Skip to content

Commit 7806f61

Browse files
author
davidcorteso
committed
Set the indexes of lattice sites with zero magnetic moment to -1 in the neighbours matrix (both in micro and atomistic simulations)
1 parent 1b5532f commit 7806f61

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

fidimag/atomistic/llg.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ def set_mu_s(self, value):
153153
if self._mu_s[i] == 0.0:
154154
self._pins[i] = 1
155155

156+
# Set the neighbour index to -1 for sites with mu_s = 0
157+
self.mesh.neighbours[self.mesh.neighbours == i] = -1
158+
156159
mu_s = property(get_mu_s, set_mu_s)
157160

158161
def add(self, interaction, save_field=False):

fidimag/micro/llg.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ def set_Ms(self, value):
161161
if self._Ms[i] == 0.0:
162162
self._pins[i] = 1
163163

164+
# Set the neighbour index to -1 for sites with Ms = 0
165+
self.mesh.neighbours[self.mesh.neighbours == i] = -1
166+
164167
self.Ms_const = np.max(self._Ms)
165168

166169
Ms = property(get_Ms, set_Ms)

0 commit comments

Comments
 (0)