Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dpdata/abacus/scf.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def make_unlabeled_stru(data, frame_idx, pp_file=None, numerical_orbital=None, n
for iele in range(len(data['atom_names'])):
out += data['atom_names'][iele] + " "
if mass is not None:
out += "%d "%mass[iele]
out += "%.3f "%mass[iele]
else:
out += "1 "
if pp_file is not None:
Expand Down
4 changes: 2 additions & 2 deletions tests/abacus.scf/stru_test
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ATOMIC_SPECIES
C 12 C.upf
H 1 H.upf
C 12.000 C.upf
H 1.000 H.upf

NUMERICAL_ORBITAL
C.orb
Expand Down
22 changes: 21 additions & 1 deletion tests/test_abacus_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,32 @@ def test_energy(self) :
np.testing.assert_almost_equal(self.system_water.data['energies'], ref_energy)
np.testing.assert_almost_equal(self.system_Si.data['energies'], ref_energy2)

def test_to_system(self):
pp_file=["H.upf","O.upf"]
numerical_orbital=["H.upf","O.upf"]
numerical_descriptor="jle.orb"
mass=[1.008,15.994]
self.system_water.to(file_name="abacus.md/water_stru",fmt='abacus/stru',pp_file=pp_file,\
numerical_orbital=numerical_orbital,numerical_descriptor=numerical_descriptor,\
mass=mass)
self.assertTrue(os.path.isfile('abacus.md/water_stru'))
if os.path.isfile('abacus.md/water_stru'):
with open('abacus.md/water_stru') as f:
iline=0
for iline,l in enumerate(f):
iline += 1
self.assertEqual(iline,30)


class TestABACUSMDLabeledOutput(unittest.TestCase, TestABACUSMD):

def setUp(self):
self.system_water = dpdata.LabeledSystem('abacus.md',fmt='abacus/md') # system with stress
self.system_Si = dpdata.LabeledSystem('abacus.md.nostress',fmt='abacus/md') # system without stress

def tearDown(self):
if os.path.isfile('abacus.md/water_stru'):
os.remove('abacus.md/water_stru')

if __name__ == '__main__':
unittest.main()
unittest.main()