Skip to content

Commit

Permalink
Drift in Outcar (#858)
Browse files Browse the repository at this point in the history
* test for drift parsing

* parse drift in OUTCAR
  • Loading branch information
shyamd authored and shyuep committed Oct 4, 2017
1 parent 16a0320 commit 37b6db4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pymatgen/io/vasp/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1491,6 +1491,11 @@ def __init__(self, filename):
self.final_energy = total_energy
self.data = {}

# Read the drift:
self.read_pattern({"drift":"total drift:\s+(\S+)\s+(\S+)\s+(\S+)"},
terminate_on_match=False,
postprocess=float)

# Check if calculation is spin polarized
self.spin = False
self.read_pattern({'spin': 'ISPIN = 2'})
Expand Down
11 changes: 11 additions & 0 deletions pymatgen/io/vasp/tests/test_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,17 @@ def test_read_fermi_contact_shift(self):
self.assertAlmostEqual(outcar.data["fermi_contact_shift"][u'th'][0][0], -0.052)
self.assertAlmostEqual(outcar.data["fermi_contact_shift"][u'dh'][0][0], 0.0)

def test_drift(self):
outcar = Outcar(os.path.join(test_dir, "OUTCAR"))
self.assertEqual(len(outcar.data['drift']),5)
self.assertAlmostEqual(np.sum(outcar.data['drift']),0)

outcar = Outcar(os.path.join(test_dir, "OUTCAR.CL"))
self.assertEqual(len(outcar.data['drift']), 79)
self.assertAlmostEqual(np.sum(outcar.data['drift']), 0.448010)




class BSVasprunTest(unittest.TestCase):

Expand Down

0 comments on commit 37b6db4

Please sign in to comment.