Skip to content

Commit 72f176b

Browse files
author
rytheranderson
committed
added option for wrapping fractional coordinates to [0,1]
1 parent 1af8f72 commit 72f176b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

write_cifs.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,9 @@ def write_cif(placed_all, fixed_bonds, scaled_params, sc_unit_cell, cifname, cha
423423

424424
vec = list(map(float, l[1:4]))
425425
cvec = np.dot(np.linalg.inv(sc_unit_cell), vec)
426-
cvec = np.mod(cvec, 1)
426+
427+
if wrap_coords:
428+
cvec = np.mod(cvec, 1) # makes sure that all fractional coordinates are in [0,1]
427429

428430
if charges:
429431
out.write('{:7} {:>4} {:>15} {:>15} {:>15} {:>15}'.format(l[0], re.sub('[0-9]','',l[0]), "%.10f" % np.round(cvec[0],10), "%.10f" % np.round(cvec[1],10), "%.10f" % np.round(cvec[2],10), l[4]))

0 commit comments

Comments
 (0)