diff --git a/tests/abacus.spin/STRU.spin b/tests/abacus.spin/STRU.spin new file mode 100644 index 00000000..340430c9 --- /dev/null +++ b/tests/abacus.spin/STRU.spin @@ -0,0 +1,24 @@ +ATOMIC_SPECIES +Fe 55.845 Fe.upf + +NUMERICAL_ORBITAL +Fe_gga_10au_200.0Ry_4s2p2d1f.orb + +LATTICE_CONSTANT +1.880277359 +LATTICE_VECTORS + 2.8274254848 0.0000000000 0.0000000000 #latvec1 + 0.0000000000 2.8274254848 0.0000000000 #latvec2 + 0.0000000000 0.0000000000 2.8274254848 #latvec3 + +ATOMIC_POSITIONS +Direct + +Fe #label +1 #magnetism +4 #number of atoms + 0.0000000000 0.000000000 0.000000000 mag 0 0 2 + 0.1000000000 0.1000000000 0.1000000000 mag 3 + 0.2000000000 0.2000000000 0.2000000000 mag 3 angle1 90 + 0.3000000000 0.3000000000 0.3000000000 mag 3 4 0 angle1 90 angle2 90 + diff --git a/tests/test_abacus_spin.py b/tests/test_abacus_spin.py index a786eb7b..65761d77 100644 --- a/tests/test_abacus_spin.py +++ b/tests/test_abacus_spin.py @@ -157,8 +157,21 @@ def test_md(self): ) def test_read_stru_spin(self): - mysys = dpdata.System("abacus.spin/STRU", fmt="abacus/stru") + mysys = dpdata.System("abacus.spin/STRU.spin", fmt="abacus/stru") self.assertTrue("spins" in mysys.data) - np.testing.assert_almost_equal(mysys.data["spins"],[[[0,0,2.4],[0,0,2.4]]],decimal=8) + print(mysys.data["spins"]) + + """ + 0.0000000000 0.000000000 0.000000000 mag 0 0 2 + 0.1000000000 0.1000000000 0.1000000000 mag 3 + 0.2000000000 0.2000000000 0.2000000000 mag 3 angle1 90 + 0.3000000000 0.3000000000 0.3000000000 mag 3 4 0 angle1 90 angle2 90 + """ + np.testing.assert_almost_equal(mysys.data["spins"][0][0],[0,0,2],decimal=8) + np.testing.assert_almost_equal(mysys.data["spins"][0][1],[0,0,3],decimal=8) + np.testing.assert_almost_equal(mysys.data["spins"][0][2],[3,0,0],decimal=8) + np.testing.assert_almost_equal(mysys.data["spins"][0][3],[0,5,0],decimal=8) + +