Skip to content

Commit b5f73fe

Browse files
committed
Use the rounded new_R values in change_unit_cell.
Previously, the `new_R` values were checked to be close to an integer, but then the conversion to `int` happened directly via `astype(int)` instead of using the rounded values. This could lead to incorrect results - but it is not expected to have been common, because the new unit cell in reduced coordinates is an integer matrix.
1 parent 24c3d2b commit b5f73fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tbmodels/_tb_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,7 @@ def change_unit_cell( # pylint: disable=too-many-branches
16351635
for R, hop_mat in self.hop.items():
16361636
new_R = la.solve(uc_reduced.T, R)
16371637
assert np.allclose(np.round(new_R), new_R)
1638-
new_R = tuple(new_R.astype(int))
1638+
new_R = tuple(np.round(new_R).astype(int))
16391639
new_hop[new_R] = hop_mat
16401640

16411641
return Model(

0 commit comments

Comments
 (0)