Skip to content

Commit fd7bdd0

Browse files
author
davidcorteso
committed
Refined specification of exchange tensor in atomistic exchange
1 parent cb5dc5f commit fd7bdd0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fidimag/atomistic/exchange.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,11 @@ def setup(self, mesh, spin, mu_s, mu_s_inv):
104104
n = self.mesh.n
105105
for i in range(n):
106106
value = self.J(self.coordinates[i])
107-
if len(value) == 6:
108-
self._J[i, :] = value[:]
107+
if isinstance(value, (float, int)):
108+
self._J[i, :] = float(value)
109+
elif isinstance(value, (list, np.ndarray, tuple)):
110+
if len(value) == 6:
111+
self._J[i, :] = value[:]
109112
else:
110113
raise Exception('The given spatial function for J is not acceptable!')
111114
pass

0 commit comments

Comments
 (0)