Skip to content

Commit 7199c46

Browse files
committed
update cartesian coordinate getter so it doesnt round
1 parent bb207e0 commit 7199c46

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/diffpy/structure/structure.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,6 @@ def get_cartesian_coordinates(self):
211211
in the same order as `Structure.get_chemical_symbols()`.
212212
"""
213213
cartn_coords = numpy.array([a.xyz_cartn for a in self])
214-
# round coordinates to avoid negative numbers close to zero
215-
cartn_coords = numpy.round(cartn_coords, 5)
216214
return cartn_coords
217215

218216
def get_anisotropic_displacement_parameters(self):

tests/test_structure.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -643,13 +643,13 @@ def test_get_cartesian_coordinates(datafile):
643643
actual_cartesian_coords = cdse_stru.get_cartesian_coordinates()
644644
expected_cartesian_coords = numpy.array(
645645
[
646-
[1.22284, 2.1176, 0.0],
647-
[2.44495, 0.0, 3.45301],
648-
[1.22284, 2.1176, 2.60129],
649-
[2.44495, 0.0, 6.05431],
646+
[1.22284264, 2.11760202, 0.0],
647+
[2.44495161, 0.0, 3.4530135],
648+
[1.22284264, 2.11760202, 2.60129319],
649+
[2.44495161, 0.0, 6.05430669],
650650
]
651651
)
652-
assert numpy.allclose(actual_cartesian_coords, expected_cartesian_coords)
652+
assert numpy.allclose(actual_cartesian_coords, expected_cartesian_coords, atol=1e-6)
653653

654654

655655
def test_get_anisotropic_displacement_parameters(datafile):

0 commit comments

Comments
 (0)