mirror of
https://github.com/triqs/dft_tools
synced 2024-11-06 22:23:52 +01:00
Added DOSMESH option to section [General]
If option DOSMESH is specified a projected DOS for each shell will be output. Energy mesh parameters are given in DOSMESH as DOSMESH = [EMIN EMAX] N_POINTS The parameters in the brackets [] are optional. If only the number of points is specified the energy range is taken to be the same as the projection energy window.
This commit is contained in:
parent
bf34d968cc
commit
0eb574b5c8
@ -70,7 +70,8 @@ class ConfigParameters:
|
|||||||
|
|
||||||
self.gen_optional = {
|
self.gen_optional = {
|
||||||
'basename' : ('basename', str, 'vasp'),
|
'basename' : ('basename', str, 'vasp'),
|
||||||
'efermi' : ('efermi', float)}
|
'efermi' : ('efermi', float),
|
||||||
|
'dosmesh': ('dosmesh', self.parse_string_dosmesh)}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Special parsers
|
# Special parsers
|
||||||
@ -97,6 +98,7 @@ class ConfigParameters:
|
|||||||
i1, i2 = tuple(map(int, match.groups()[:2]))
|
i1, i2 = tuple(map(int, match.groups()[:2]))
|
||||||
mess = "First index of the range must be smaller or equal to the second"
|
mess = "First index of the range must be smaller or equal to the second"
|
||||||
assert i1 <= i2, mess
|
assert i1 <= i2, mess
|
||||||
|
# Note that we need to subtract 1 from VASP indices
|
||||||
ion_list = np.array(range(i1 - 1, i2))
|
ion_list = np.array(range(i1 - 1, i2))
|
||||||
else:
|
else:
|
||||||
# Check if a set of indices is given
|
# Check if a set of indices is given
|
||||||
@ -165,6 +167,46 @@ class ConfigParameters:
|
|||||||
|
|
||||||
return mat
|
return mat
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
#
|
||||||
|
# parse_string_ion_list()
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
def parse_string_dosmesh(self, par_str):
|
||||||
|
"""
|
||||||
|
Two formats are accepted:
|
||||||
|
|
||||||
|
# Two floats (energy range) and an integer (number of energy points).
|
||||||
|
|
||||||
|
# One integer (number of energy points). In this case the energy
|
||||||
|
range is taken to be equal to EMIN, EMAX of a shell.
|
||||||
|
|
||||||
|
The parser returns a dictionary:
|
||||||
|
{'n_points': int,
|
||||||
|
'emin': float,
|
||||||
|
'emax': float}
|
||||||
|
|
||||||
|
If the second option is used, 'emin' and 'emax' are undefined
|
||||||
|
and set to 'nan'.
|
||||||
|
"""
|
||||||
|
stmp = par_str.split()
|
||||||
|
if len(stmp) == 3:
|
||||||
|
emin, emax = float(stmp[0]), float(stmp[1])
|
||||||
|
n_points = int(stmp[2])
|
||||||
|
elif len(stmp) == 1:
|
||||||
|
n_points = int(stmp[0])
|
||||||
|
emin = emax = float('nan')
|
||||||
|
else:
|
||||||
|
err_mess = "DOSMESH must be either 'EMIN EMAX NPOINTS' or 'NPOINTS'"
|
||||||
|
raise ValueError(err_mess)
|
||||||
|
|
||||||
|
dos_pars = {
|
||||||
|
'n_points': n_points,
|
||||||
|
'emin': emin,
|
||||||
|
'emax': emax}
|
||||||
|
|
||||||
|
return dos_pars
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# parse_parameter_set()
|
# parse_parameter_set()
|
||||||
|
@ -520,14 +520,26 @@ def generate_plo(conf_pars, el_struct):
|
|||||||
print
|
print
|
||||||
print "Overlap:"
|
print "Overlap:"
|
||||||
print ov
|
print ov
|
||||||
|
if 'dosmesh' in conf_pars.general:
|
||||||
print
|
print
|
||||||
print "Evaluating DOS..."
|
print "Evaluating DOS..."
|
||||||
emesh = np.linspace(-3.0, 7.0, 4001)
|
mesh_pars = conf_pars.general['dosmesh']
|
||||||
|
if np.isnan(mesh_pars['emin']):
|
||||||
|
dos_emin = pgroup.emin
|
||||||
|
dos_emax = pgroup.emax
|
||||||
|
else:
|
||||||
|
dos_emin = mesh_pars['emin']
|
||||||
|
dos_emax = mesh_pars['emax']
|
||||||
|
n_points = mesh_pars['n_points']
|
||||||
|
|
||||||
|
emesh = np.linspace(dos_emin, dos_emax, n_points)
|
||||||
dos = pshells[pgroup.ishells[0]].density_of_states(el_struct, emesh)
|
dos = pshells[pgroup.ishells[0]].density_of_states(el_struct, emesh)
|
||||||
de = emesh[1] - emesh[0]
|
de = emesh[1] - emesh[0]
|
||||||
ntot = (dos[1:,...] + dos[:-1,...]).sum(0) / 2 * de
|
ntot = (dos[1:,...] + dos[:-1,...]).sum(0) / 2 * de
|
||||||
print " Total number of states:", ntot
|
print " Total number of states:", ntot
|
||||||
np.savetxt('pdos.dat', np.vstack((emesh.T, dos[:, 0, 0, :].T)).T)
|
for io in xrange(dos.shape[2]):
|
||||||
|
np.savetxt('pdos_%i.dat'%(io), np.vstack((emesh.T, dos[:, 0, io, :].T)).T)
|
||||||
|
|
||||||
pgroups.append(pgroup)
|
pgroups.append(pgroup)
|
||||||
|
|
||||||
return pshells, pgroups
|
return pshells, pgroups
|
||||||
|
Loading…
Reference in New Issue
Block a user