Skip to content

Commit

Permalink
Add test for orbital moments
Browse files Browse the repository at this point in the history
  • Loading branch information
oashour committed Nov 9, 2023
1 parent 6a5dac2 commit b8a3f66
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/io/vasp/test_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,9 +837,32 @@ def test_soc(self):
"tot": Magmom([0.0, 0.0, 0.0]),
},
)
expected_orbmom = (
{
"p": Magmom([0.0, 0.0, 0.0]),
"d": Magmom([0.109, 0.109, 0.109]),
"tot": Magmom([0.108, 0.108, 0.108]),
},
{
"p": Magmom([0.0, 0.0, 0.0]),
"d": Magmom([-0.109, -0.109, -0.109]),
"tot": Magmom([-0.108, -0.108, -0.108]),
},
{
"p": Magmom([0.0, 0.0, 0.0]),
"d": Magmom([0.0, 0.0, 0.0]),
"tot": Magmom([0.0, 0.0, 0.0]),
},
{
"p": Magmom([0.0, 0.0, 0.0]),
"d": Magmom([0.0, 0.0, 0.0]),
"tot": Magmom([0.0, 0.0, 0.0]),
},
)
# test note: Magmom class uses np.allclose() when testing for equality
# so fine to use == operator here
assert outcar.magnetization == expected_mag, "Wrong vector magnetization read from Outcar for SOC calculation"
assert outcar.orbital_moment == expected_orbmom, "Wrong orbital moments read from Outcar for SOC calculation"

def test_polarization(self):
filepath = f"{TEST_FILES_DIR}/OUTCAR.BaTiO3.polar"
Expand Down

0 comments on commit b8a3f66

Please sign in to comment.