Skip to content

Commit

Permalink
Avoid using fmod for detecting equivalent atoms
Browse files Browse the repository at this point in the history
  • Loading branch information
ttadano committed May 9, 2022
1 parent b09631c commit a4d0e07
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions python/alm/fcsxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def get_atoms_in_primitive(self):
if self._map_p2s is None:
self._setup_symmetry()

return self._map_p2s[:][0]
return self._map_p2s[:, 0]

def _add_header_xml(self, root_in):

Expand Down Expand Up @@ -542,8 +542,10 @@ def _setup_symmetry(self):
xnew = self._xf[index_s, :] + translations[isym][:]

for iat in np.where(mapping_to_primitive == unique_set[index_p])[0]:
xdiff = np.fmod(xnew - self._xf[iat], 1.0)
if np.dot(xdiff, xdiff) < 1.0e-8:
xdiff = xnew - self._xf[iat]
xdiff -= np.array(np.rint(xdiff), dtype="float")

if np.dot(xdiff, xdiff) < 1.0e-5:
self._map_p2s[index_p][itran] = iat
break

Expand Down

0 comments on commit a4d0e07

Please sign in to comment.