Skip to content

Commit de35c59

Browse files
author
tianhongzhen
committed
add data test for mlmd
1 parent ed651bb commit de35c59

File tree

4 files changed

+46
-0
lines changed

4 files changed

+46
-0
lines changed

tests/pwmat/mlmd_cell

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
0.1000000000E+02 0.0000000000E+00 0.0000000000E+00
2+
0.0000000000E+00 0.1000000000E+02 0.0000000000E+00
3+
0.0000000000E+00 0.0000000000E+00 0.1000000000E+02

tests/pwmat/mlmd_coord

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
0.538154340000000 0.406860800000000 0.360573010000000
2+
0.394539660000000 0.480320570000000 0.438468840000000
3+
0.552092430000000 0.565450290000000 0.442708740000000
4+
0.528185300000000 0.416414760000000 0.539182660000000
5+
0.503250590000000 0.467255160000000 0.445232340000000

tests/pwmat/mlmd_force

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
0.000000000000000 0.000000000000000 0.000000000000000
2+
0.000000000000000 0.000000000000000 0.000000000000000
3+
0.000000000000000 0.000000000000000 0.000000000000000
4+
0.000000000000000 0.000000000000000 0.000000000000000
5+
0.000000000000000 0.000000000000000 0.000000000000000

tests/test_pwmat_mlmd.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,39 @@ def test_mlmd(self) :
1515
self.assertEqual(self.LabeledSystem1['energies'], -0.2197270691E+03)
1616
self.assertEqual(self.LabeledSystem1.get_nframes(), 1)
1717
self.assertEqual(self.LabeledSystem1.get_natoms(), 5)
18+
self.assertEqual(self.LabeledSystem1.data['atom_names'], ['H', 'C'])
19+
self.assertEqual(self.LabeledSystem1.data['atom_numbs'], [4, 1])
20+
def test_cell(self) :
21+
fp = open('pwmat/mlmd_cell')
22+
cell = []
23+
for ii in fp :
24+
cell.append([float(jj) for jj in ii.split()])
25+
cell = np.array(cell)
26+
for ii in range(cell.shape[0]) :
27+
for jj in range(cell.shape[1]) :
28+
self.assertEqual(self.LabeledSystem1.data['cells'][0][ii][jj], cell[ii][jj])
29+
fp.close()
30+
31+
def test_coord(self) :
32+
fp = open('pwmat/mlmd_coord')
33+
coord = []
34+
for ii in fp :
35+
coord.append([float(jj) for jj in ii.split()])
36+
coord = np.array(coord)
37+
for ii in range(coord.shape[0]) :
38+
for jj in range(coord.shape[1]) :
39+
self.assertEqual(self.LabeledSystem1.data['coords'][0][ii][jj], coord[ii][jj]*10.0)
40+
fp.close()
41+
def test_force(self) :
42+
fp = open('pwmat/mlmd_force')
43+
force = []
44+
for ii in fp :
45+
force.append([float(jj) for jj in ii.split()])
46+
force = np.array(force)
47+
for ii in range(force.shape[0]) :
48+
for jj in range(force.shape[1]) :
49+
self.assertEqual(self.LabeledSystem1.data['forces'][0][ii][jj], force[ii][jj])
50+
fp.close()
1851

1952

2053

0 commit comments

Comments
 (0)