3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-06 22:23:52 +01:00

Added a format check for EIGENVAL to vaspio.py

Added a check to 'vaspio.py' testing that the number of columns
implies that the Fermi weights are present in EIGENVAL. This check ensures
that the new format (starting from VASP 5.4) of the file is used.

Corresponding test is added to the suite.
This commit is contained in:
Oleg E. Peil 2015-10-16 11:59:02 +02:00
parent dda331b986
commit 87b00f61b1
3 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,50 @@
1 1 1 1
0.1333597E+02 0.2587511E-09 0.2587511E-09 0.2587511E-09 0.5000000E-15
1.000000000000000E-004
CAR
V
11 4 9
0.0000000E+00 0.0000000E+00 0.0000000E+00 0.3703704E-01
1 -31.099965
2 -31.099965
3 -31.099965
4 -0.813470
5 5.974027
6 5.974027
7 5.974027
8 7.986328
9 7.986328
0.3333333E+00 0.0000000E+00 0.0000000E+00 0.4444444E+00
1 -31.819277
2 -31.322999
3 -31.105684
4 2.193081
5 4.784864
6 5.839340
7 7.833446
8 8.202781
9 8.589551
0.3333333E+00 0.3333333E+00 0.0000000E+00 0.2962963E+00
1 -31.750021
2 -31.750021
3 -31.217560
4 3.978315
5 4.708263
6 4.708263
7 8.262522
8 8.262522
9 14.771374
-0.3333333E+00 0.3333333E+00 0.3333333E+00 0.2222222E+00
1 -31.719893
2 -31.577292
3 -31.577292
4 3.383714
5 3.756320
6 7.355029
7 7.355029
8 8.411511
9 11.054129

View File

@ -22,6 +22,7 @@ class TestEigenval(mytest.MyTestCase):
Scenarios:
- correct EIGENVAL file
- wrong EIGENVAL file from old versions of VASP
"""
# Scenario 1
@ -48,3 +49,12 @@ class TestEigenval(mytest.MyTestCase):
expected = _rpath + 'EIGENVAL.example.out'
self.assertFileEqual(testout, expected)
# Scenario 2
def test_bad_example(self):
filename = 'EIGENVAL.wrong'
eigenval = Eigenval()
err_mess = "EIGENVAL file is incorrect"
with self.assertRaisesRegexp(AssertionError, err_mess):
eigenval.from_file(vasp_dir=_rpath, eig_filename=filename)

View File

@ -445,6 +445,7 @@ class Eigenval:
for ib in xrange(self.nband):
sline = f.next().split()
tmp = map(float, sline)
assert len(tmp) == 2 * self.ispin + 1, "EIGENVAL file is incorrect (probably from old versions of VASP)"
self.eigs[ik, ib, :] = tmp[1:self.ispin+1]
self.ferw[ik, ib, :] = tmp[self.ispin+1:]