@@ -206,20 +206,34 @@ def test_dump_move_from_vasp(self):
206206"""
207207 self .assertTrue (stru_ref in c )
208208
209-
210209 def test_dump_chaotic_atomic_species (self ):
211210 import copy
211+
212212 import numpy as np
213- from dpdata . abacus . stru import split_stru_block
213+
214214 temp_system = copy .deepcopy (self .system_ch4 )
215- temp_system .data ["atom_types" ] = np .array ([1 ,0 ,1 ,1 ,1 ])
216- temp_system .data ["coords" ] = np .array ([[[1 ,1 ,1 ],[0 ,0 ,0 ],[2 ,2 ,2 ],[3 ,3 ,3 ],[4 ,4 ,4 ]]])
217- temp_system .data ["move" ] = np .array ([[[1 ,0 ,0 ],[0 ,1 ,1 ],[1 ,1 ,1 ],[1 ,1 ,1 ],[1 ,1 ,1 ]]])
218- velocity = np .array ([[1 ,1 ,1 ],[2 ,2 ,2 ],[3 ,3 ,3 ],[4 ,4 ,4 ],[5 ,5 ,5 ]])
219- mag = np .array ([[11 ,11 ,11 ],[22 ,22 ,22 ],[33 ,33 ,33 ],[44 ,44 ,44 ],[55 ,55 ,55 ]])
215+ temp_system .data ["atom_types" ] = np .array ([1 , 0 , 1 , 1 , 1 ])
216+ temp_system .data ["coords" ] = np .array (
217+ [[[1 , 1 , 1 ], [0 , 0 , 0 ], [2 , 2 , 2 ], [3 , 3 , 3 ], [4 , 4 , 4 ]]]
218+ )
219+ temp_system .data ["move" ] = np .array (
220+ [[[1 , 0 , 0 ], [0 , 1 , 1 ], [1 , 1 , 1 ], [1 , 1 , 1 ], [1 , 1 , 1 ]]]
221+ )
222+ velocity = np .array ([[1 , 1 , 1 ], [2 , 2 , 2 ], [3 , 3 , 3 ], [4 , 4 , 4 ], [5 , 5 , 5 ]])
223+ mag = np .array (
224+ [[11 , 11 , 11 ], [22 , 22 , 22 ], [33 , 33 , 33 ], [44 , 44 , 44 ], [55 , 55 , 55 ]]
225+ )
220226 constrain = np .array ([1 , 0 , 1 , 0 , 1 ])
221- sc = np .array ([[0 ,1 ,1 ],[0 ,0 ,1 ],[1 ,1 ,1 ],[1 ,1 ,1 ],[1 ,1 ,1 ]])
222- lambda_ = np .array ([[0.1 , 0.2 , 0.3 ], [0.4 , 0.5 , 0.6 ], [0.7 , 0.8 , 0.9 ], [1.0 , 1.1 , 1.2 ], [1.3 , 1.4 , 1.5 ]])
227+ sc = np .array ([[0 , 1 , 1 ], [0 , 0 , 1 ], [1 , 1 , 1 ], [1 , 1 , 1 ], [1 , 1 , 1 ]])
228+ lambda_ = np .array (
229+ [
230+ [0.1 , 0.2 , 0.3 ],
231+ [0.4 , 0.5 , 0.6 ],
232+ [0.7 , 0.8 , 0.9 ],
233+ [1.0 , 1.1 , 1.2 ],
234+ [1.3 , 1.4 , 1.5 ],
235+ ]
236+ )
223237 temp_system .to (
224238 "stru" ,
225239 "STRU_tmp" ,
@@ -229,9 +243,10 @@ def test_dump_chaotic_atomic_species(self):
229243 sc = sc ,
230244 lambda_ = lambda_ ,
231245 )
232-
246+
233247 assert os .path .isfile ("STRU_tmp" )
234- with open ("STRU_tmp" ) as f : lines = f .read ()
248+ with open ("STRU_tmp" ) as f :
249+ lines = f .read ()
235250 ref_c = """C
2362510.0
2372521
@@ -243,9 +258,10 @@ def test_dump_chaotic_atomic_species(self):
2432582.000000000000 2.000000000000 2.000000000000 1 1 1 v 3.000000000000 3.000000000000 3.000000000000 mag 33.000000000000 33.000000000000 33.000000000000 sc 1 1 1 lambda 0.700000000000 0.800000000000 0.900000000000
2442593.000000000000 3.000000000000 3.000000000000 1 1 1 v 4.000000000000 4.000000000000 4.000000000000 mag 44.000000000000 44.000000000000 44.000000000000 sc 1 1 1 lambda 1.000000000000 1.100000000000 1.200000000000
2452604.000000000000 4.000000000000 4.000000000000 1 1 1 v 5.000000000000 5.000000000000 5.000000000000 mag 55.000000000000 55.000000000000 55.000000000000 sc 1 1 1 lambda 1.300000000000 1.400000000000 1.500000000000"""
246-
261+
247262 self .assertTrue (ref_c in lines )
248263
264+
249265class TestABACUSParseStru (unittest .TestCase ):
250266 def test_parse_pos_oneline (self ):
251267 pos , move , velocity , magmom , angle1 , angle2 , constrain , lambda1 = (
0 commit comments