3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-21 20:03:41 +01:00

Modified LOCPROJ parser to conform to new format

The format of LOCPROJ has been modified again (in VASP 5.4.2
build from Dec 02, 2015).
Now, there is an additional line before each projector block
providing the spin, k-, and band indices, as well as
eigenvalues and Fermi weights.
This commit is contained in:
Oleg E. Peil 2015-12-04 12:08:33 +01:00
parent 1bfacd3883
commit 34bc2b6225

View File

@ -195,6 +195,7 @@ class Plocar:
# Read the first line of LOCPROJ to get the dimensions
with open(locproj_filename, 'rt') as f:
line = f.readline()
line = line.split("#")[0]
nspin, nk, nband, nproj = map(int, line.split())
plo = np.zeros((nproj, nspin, nk, nband), dtype=np.complex128)
@ -224,15 +225,18 @@ class Plocar:
assert ip == nproj, "Number of projectors in the header is wrong in LOCPROJ"
# TODO: one can read eigenvalues and Fermi weights from lines starting with "orbital"
# at the moment we ignore them
patt = re.compile("^orbital")
for ispin in xrange(nspin):
for ik in xrange(nk):
for ib in xrange(nband):
for ip in xrange(nproj):
line = ""
while not line:
while not line or not re.match(patt, line) is None:
line = f.readline().strip()
sline = line.split()
ctmp = complex(float(sline[4]), float(sline[5]))
ctmp = complex(float(sline[1]), float(sline[2]))
plo[ip, ispin, ik, ib] = ctmp
print "Read parameters:"