Skip to content

Commit 3ecb9cf

Browse files
Fixed memory leak in FS nebm
1 parent 497152b commit 3ecb9cf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fidimag/common/nebm_FS.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def compute_effective_field_and_energy(self, y):
245245
# Do not update the extreme images
246246
for i in range(1, len(y) - 1):
247247

248-
self.sim.set_m(y[i])
248+
self.sim.spin[:] = y[i]
249249
# elif self.coordinates == 'Cartesian':
250250
# self.sim.set_m(self.band[i])
251251

@@ -331,7 +331,8 @@ def compute_action(self):
331331
# Gnorms2 = np.sum(self.G**2, axis=1) / self.n_spins
332332

333333
# Compute the root mean square per image
334-
self.gradientENorm[:] = np.sqrt(Gnorms2)
334+
# self.gradientENorm[:] = np.sqrt(Gnorms2)
335+
self.gradientENorm[:] = np.linalg.norm(self.gradientE, axis=1) / self.n_spins
335336
self.gradientE.shape = (-1)
336337
# self.G.shape = (-1)
337338

0 commit comments

Comments
 (0)