12
12
get_structure_indices ,
13
13
get_lammps_indicies_from_ase_structure ,
14
14
set_selective_dynamics ,
15
+ UnfoldingPrism ,
15
16
)
16
17
17
18
@@ -127,6 +128,22 @@ def test_get_lammps_indicies_from_ase_structure(self):
127
128
self .assertEqual (len (set (indicies )), 1 )
128
129
self .assertEqual (set (indicies ), {1 })
129
130
131
+ def test_unfolding_prism_cubic (self ):
132
+ prism = UnfoldingPrism (self .structure_cubic .cell .array )
133
+ self .assertEqual (
134
+ prism .get_lammps_prism_str (),
135
+ ('8.1000000000' , '8.1000000000' , '8.1000000000' , '0E-10' , '0E-10' , '0E-10' )
136
+ )
137
+ self .assertTrue (np .all (np .isclose (prism .pos_to_lammps (position = [[1.0 , 1.0 , 1.0 ]]), np .array ([1.0 , 1.0 , 1.0 ]))))
138
+
139
+ def test_unfolding_prism_skewed (self ):
140
+ prism = UnfoldingPrism (self .structure_skewed .cell .array )
141
+ self .assertTrue (np .all (np .isclose (
142
+ [np .abs (float (s )) for s in prism .get_lammps_prism_str ()],
143
+ [5.7275649276 , 4.9602167291 , 4.6765371804 , 2.8637824638 , 2.8637824638 , 1.6534055764 ]
144
+ )))
145
+ self .assertTrue (np .all (np .isclose (prism .pos_to_lammps (position = [[1.0 , 1.0 , 1.0 ]]), np .array ([1.41421356 , 0.81649658 , 0.57735027 ]))))
146
+
130
147
131
148
class TestConstraints (unittest .TestCase ):
132
149
@classmethod
@@ -189,4 +206,4 @@ def test_selective_dynamics_wrong_plane(self):
189
206
[2 , 1 , 0 ],
190
207
))
191
208
with self .assertRaises (ValueError ):
192
- set_selective_dynamics (structure = atoms , calc_md = False )
209
+ set_selective_dynamics (structure = atoms , calc_md = False )
0 commit comments