Skip to content

Commit 09cc8d8

Browse files
committed
Fixed an error on a test in the lock mode,
however this thing is to be overlooked
1 parent 8f0952d commit 09cc8d8

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

Modules/Utilities.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,20 +377,22 @@ def CFG_ProjectOnModes(self, dyn_grad, struct_grad):
377377

378378
# Go back in cartesian coordinates
379379
projected_grad_cart = self.pols[:,:, iq].dot(projected_grad.dot(np.conj(self.pols[:,:,iq]).T))
380-
381-
# Put the masses again and overwrite the gradient
382-
new_dyngrad = projected_grad_cart * np.sqrt( np.outer(_m_, _m_))
380+
383381

384382
# Check if the grad increased
385383
if self.testing:
386-
norm_old = np.sum(np.abs(dyn_grad[iq, :, :])**2)
387-
norm_new = np.sum(np.abs(new_dyngrad)**2)
384+
norm_old = np.linalg.norm(grad_nomass)
385+
norm_new = np.linalg.norm(projected_grad_cart)
388386

389387
if norm_new > norm_old:
390388
print("Error on q = {}".format(iq))
391389
print("Old norm: {} | New norm: {}".format(norm_old, norm_new))
392390

393391
assert norm_new < norm_old
392+
393+
# Put the masses again and overwrite the gradient
394+
new_dyngrad = projected_grad_cart * np.sqrt( np.outer(_m_, _m_))
395+
394396

395397
dyn_grad[iq, :, :] = new_dyngrad
396398

0 commit comments

Comments
 (0)