3
0
mirror of https://github.com/triqs/dft_tools synced 2024-06-20 04:02:20 +02:00

Added a possibility to read EFERMI from LOCPROJ

Noramlly, the Fermi energy is read from DOSCAR. However, this does
not work in case of a self-consistent calculation in which DOSCAR
is not written between iterations. One of the options is
to modify slightly the output to LOCPROJ and add EFERMI to the
first line.
This commit is contained in:
Oleg E. Peil 2015-12-18 17:45:12 +01:00
parent 3478db8a90
commit e8dff08fcf
3 changed files with 21 additions and 6 deletions

View File

@ -22,7 +22,8 @@
from wien2k_converter import Wien2kConverter
from hk_converter import HkConverter
from vasp_converter import VaspConverter
__all__ =['Wien2kConverter','HkConverter']
__all__ =['Wien2kConverter','HkConverter','VaspConverter']

View File

@ -47,7 +47,10 @@ class ElectronicStructure:
# Note that one should not subtract this Fermi level from eigenvalues
# here because the true Fermi level might be provided by conf-file
# (for instance, for spaghetti calculations)
self.efermi = vasp_data.doscar.efermi
try:
self.efermi = vasp_data.doscar.efermi
except AttributeError:
pass
# Note that the number of spin-components of projectors might be different from those
# of bands in case of non-collinear calculations
@ -74,6 +77,7 @@ class ElectronicStructure:
print "eigvals from LOCPROJ"
self.eigvals = vasp_data.plocar.eigs
self.ferw = vasp_data.plocar.ferw.transpose((2, 0, 1))
self.efermi = vasp_data.plocar.efermi
# For later use it is more convenient to use a different order of indices
# [see ProjectorGroup.orthogonalization()]

View File

@ -40,7 +40,7 @@ class VaspData:
"""
Container class for all VASP data.
"""
def __init__(self, vasp_dir, read_all=True):
def __init__(self, vasp_dir, read_all=True, efermi_required=True):
self.vasp_dir = vasp_dir
self.plocar = Plocar()
@ -59,8 +59,16 @@ class VaspData:
self.eigenval.eigs = None
self.eigenval.ferw = None
print "!!! WARNING !!!: Error reading from EIGENVAL, trying LOCPROJ"
pass
self.doscar.from_file(vasp_dir)
try:
self.doscar.from_file(vasp_dir)
except (IOError, StopIteration):
if efermi_required:
# raise Exception("Efermi cannot be read from DOSCAR")
pass
else:
# TODO: This a hack. Find out a way to determine ncdij without DOSCAR
print "!!! WARNING !!!: Error reading from DOSCAR, taking Efermi from config"
self.doscar.ncdij = self.plocar.nspin
################################################################################
################################################################################
@ -202,7 +210,9 @@ class Plocar:
with open(locproj_filename, 'rt') as f:
line = f.readline()
line = line.split("#")[0]
self.nspin, nk, self.nband, nproj = map(int, line.split())
sline = line.split()
self.nspin, nk, self.nband, nproj = map(int, sline[:4])
self.efermi = float(sline[4])
plo = np.zeros((nproj, self.nspin, nk, self.nband), dtype=np.complex128)
proj_params = [{} for i in xrange(nproj)]