Skip to content

Commit 6b3583a

Browse files
author
davidcorteso
committed
Simplified norm calculation in Rodrigues formulae. Minor grammar corrections in examples
1 parent c3176d6 commit 6b3583a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

examples/neb_micromagnetic/elongated_particle/elongated_particle_along_z.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
66
Test of the NEBM on an elongated particle of cylindrical shape, based on [1],
77
where a series of simple magnetic systems are tested using the NEBM in
8-
Spherical coordinates with an Euclidean distance. For the alongated particle
8+
Spherical coordinates with an Euclidean distance. For the elongated particle
99
test, the system is a 70 nm long and 12 nm wide (originally it is 13 nm)
10-
nanocylinder, with an uniaxial anisotropy in the direction of the long axis.The
10+
nanocylinder, with a uniaxial anisotropy in the direction of the long axis.The
1111
test goal is to find the minimum energy path (MEP) between two degenerate
1212
ferromagnetic states (saturated states along the anisotropy axis), which are
1313
the ground states of this system. The MEP is given by a transverse domain wall

fidimag/common/nebm_tools.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def linear_interpolation_spherical(y_initial, y_final, n, pins=None):
120120
# Just use half the length of y_initial
121121
pins = np.zeros(len(y_initial[::2]))
122122

123-
# Since we have a pin index per every PAIR of coordinates, we copy very
123+
# Since we have a pin index per every PAIR of coordinates, we copy every
124124
# entry. For example: [1 0] --> [1 1 0 0]
125125
# and we change only unpinned spins (0)
126126
_filter = np.repeat(pins, 2) == 0
@@ -177,7 +177,7 @@ def interpolation_Rodrigues_rotation(y_initial, y_final, n, pins=None):
177177
# Only use 1/3 of the length of y_initial (1 pin per mesh/lattice site)
178178
pins = np.zeros(len(y_initial[::3]))
179179

180-
# Since we have a pin index per every TRIAD of coordinates, we copy very
180+
# Since we have a pin index per every TRIAD of coordinates, we copy every
181181
# entry. For example: [1 0] --> [1 1 1 0 0 0]
182182
# and we change only unpinned spins (0)
183183
_filter = np.repeat(pins, 3) == 0
@@ -191,8 +191,8 @@ def interpolation_Rodrigues_rotation(y_initial, y_final, n, pins=None):
191191
# The cross products of corresponding spins in the initial and final images
192192
yi_cross_yf = np.cross(y_initial, y_final)
193193
# This should only be an array of ones:
194-
yi_cross_yf_norm = np.apply_along_axis(lambda x: np.sqrt(np.sum(x ** 2)),
195-
1, yi_cross_yf)
194+
yi_cross_yf_norm = np.linalg.norm(yi_cross_yf, axis=1)
195+
196196
# The rotation axis is just the normalised cross product defined before
197197
rot_axis = yi_cross_yf / yi_cross_yf_norm[:, np.newaxis]
198198
rot_axis = np.cross(rot_axis, y_initial)

0 commit comments

Comments
 (0)