Skip to content

Commit

Permalink
Fix to use np.float64
Browse files Browse the repository at this point in the history
  • Loading branch information
lan496 committed Oct 30, 2024
1 parent d56d17d commit 32c1a88
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/spinspg/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def get_primitive_spin_symmetry(
W = solve_procrustes(new_magmoms, perm_magmoms)
if spin_only_group.contain(W):
# Chose W as identify if W belongs to the spin only group
W = np.eye(3, dtype=np.float_)
W = np.eye(3, dtype=np.float64)

new_magmoms = new_magmoms @ W.T
if np.max(np.linalg.norm(new_magmoms - perm_magmoms, axis=1)) < mag_symprec:
Expand Down Expand Up @@ -276,7 +276,7 @@ def get_primitive_spin_symmetry(
W = solve_procrustes(new_magmoms, perm_magmoms)
if spin_only_group.contain(W):
# Chose W as identify if W belongs to the spin only group
W = np.eye(3, dtype=np.float_)
W = np.eye(3, dtype=np.float64)

new_magmoms = new_magmoms @ W.T
if np.max(np.linalg.norm(new_magmoms - perm_magmoms, axis=1)) < mag_symprec:
Expand Down
2 changes: 1 addition & 1 deletion src/spinspg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing_extensions import TypeAlias # for Python<3.10

NDArrayInt: TypeAlias = NDArray[np.int_]
NDArrayFloat: TypeAlias = NDArray[np.float_]
NDArrayFloat: TypeAlias = NDArray[np.float64]


def ndarray2d_to_integer_tuple(array: NDArrayFloat) -> tuple[tuple[Any]]:
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def fcc():
[1, 0, 0],
[1, 0, 0],
],
dtype=np.float_,
dtype=np.float64,
)
return lattice, positions, numbers, magmoms

Expand Down
2 changes: 1 addition & 1 deletion tests/test_pointgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def test_get_integer_point_group_3m():
[0, 0, 1],
],
],
dtype=np.float_,
dtype=np.float64,
)
P, rotations = get_integer_point_group(cart_rotations)

Expand Down
8 changes: 4 additions & 4 deletions tests/test_spin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def nonmagnetic():
[0, 0, 0],
[0, 0, 0],
],
dtype=np.float_,
dtype=np.float64,
)
return magmoms_nonmagnetic

Expand All @@ -23,7 +23,7 @@ def collinear():
[0, 0, 1],
[0, 0, -2],
],
dtype=np.float_,
dtype=np.float64,
)
return magmoms_collinear

Expand All @@ -35,7 +35,7 @@ def coplanar():
[0, 0, 1],
[0, 1, 0],
],
dtype=np.float_,
dtype=np.float64,
)
return magmoms_coplanar

Expand All @@ -48,7 +48,7 @@ def noncoplanar():
[0, 1, 0],
[0, 0, 1],
],
dtype=np.float_,
dtype=np.float64,
)
return magmoms_noncoplanar

Expand Down

0 comments on commit 32c1a88

Please sign in to comment.