MCPcopy Create free account
hub / github.com/SINGROUP/dscribe / test_transformations

Function test_transformations

tests/test_general.py:90–103  ·  view source on GitHub ↗

Test that coordinates are correctly transformed from scaled to cartesian and back again.

()

Source from the content-addressed store, hash-verified

88
89
90def test_transformations():
91 """Test that coordinates are correctly transformed from scaled to
92 cartesian and back again.
93 """
94 system = System(
95 scaled_positions=[[0.0, 0.0, 0.0], [0.5, 0.5, 0.5]],
96 symbols=["H", "H"],
97 cell=[[5, 5, 0], [0, -5, -5], [5, 0, 5]],
98 )
99
100 orig = np.array([[2, 1.45, -4.8]])
101 scal = system.to_scaled(orig)
102 cart = system.to_cartesian(scal)
103 assert np.allclose(orig, cart)
104
105
106def test_cell_wrap():

Callers

nothing calls this directly

Calls 3

to_scaledMethod · 0.95
to_cartesianMethod · 0.95
SystemClass · 0.90

Tested by

no test coverage detected