mirror of
https://github.com/triqs/dft_tools
synced 2024-12-21 20:03:41 +01:00
Added output of the header of a PLO-group file
The basic header for PLO-group file (now called '<basename>.pg<Ng>') is implemented. Also, fixed the wrong imported function name in 'main.py'.
This commit is contained in:
parent
207c637be2
commit
2472341cd0
@ -3,7 +3,7 @@ import sys
|
||||
import vaspio
|
||||
from inpconf import ConfigParameters
|
||||
from elstruct import ElectronicStructure
|
||||
from plotools import generate_ortho_plos, plo_output
|
||||
from plotools import generate_ortho_plos, output_as_text
|
||||
|
||||
if __name__ == '__main__':
|
||||
narg = len(sys.argv)
|
||||
@ -24,4 +24,5 @@ if __name__ == '__main__':
|
||||
vasp_data = vaspio.VaspData(vasp_dir)
|
||||
el_struct = ElectronicStructure(vasp_data)
|
||||
pshells, pgroups = generate_ortho_plos(pars, el_struct)
|
||||
output_to_ascii(pars, el_struct, pshells, pgroups)
|
||||
output_as_text(pars, el_struct, pshells, pgroups)
|
||||
|
||||
|
@ -258,6 +258,12 @@ class ProjectorShell:
|
||||
self.lm1 = self.lorb**2
|
||||
self.lm2 = (self.lorb+1)**2
|
||||
|
||||
if self.tmatrix is None:
|
||||
self.ndim = self.lm2 - self.lm1 + 1
|
||||
else:
|
||||
# TODO: generalize this to a tmatrix for every ion
|
||||
self.ndim = self.tmatrix.shape[0]
|
||||
|
||||
# Pre-select a subset of projectors (this should be an array view => no memory is wasted)
|
||||
# !!! This sucks but I have to change the order of 'ib' and 'ilm' indices here
|
||||
# This should perhaps be done right after the projector array is read from PLOCAR
|
||||
@ -444,7 +450,34 @@ def plo_output(conf_pars, el_struct, pshells, pgroups):
|
||||
...
|
||||
|
||||
"""
|
||||
pass
|
||||
for ig, pgroup in enumerate(pgroups):
|
||||
plo_fname = conf_pars.general['basename'] + '.pg%i'%(ig + 1)
|
||||
print " Storing PLO-group file '%s'..."%(plo_fname)
|
||||
head_dict = {}
|
||||
|
||||
head_dict['ewindow'] = (pgroup.emin, pgroup.emax)
|
||||
head_dict['nb_max'] = pgroup.nb_max
|
||||
|
||||
head_shells = []
|
||||
for shell in pgroup.shells:
|
||||
sh_dict = {}
|
||||
sh_dict['lorb'] = shell.lorb
|
||||
sh_dict['ndim'] = shell.ndim
|
||||
# Convert ion indices from the internal representation (starting from 0)
|
||||
# to conventional VASP representation (starting from 1)
|
||||
ion_output = [io + 1 for io in shell.ion_list]
|
||||
sh_dict['ion_list'] = ion_output
|
||||
# TODO: add the output of transformation matrices
|
||||
|
||||
head_shells.append(sh_dict)
|
||||
|
||||
head_dict['shells'] = head_shells
|
||||
|
||||
header = json.dumps(head_dict, indent=4, separators=(',', ': '))
|
||||
|
||||
with open(plo_fname, 'wt') as f:
|
||||
f.write(header + "\n")
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
@ -455,6 +488,6 @@ def output_as_text(pars, el_struct, pshells, pgroups):
|
||||
"""
|
||||
Output all information necessary for the converter as text files.
|
||||
"""
|
||||
ctrl_output(conf_pars, el_struct, len(pgroups))
|
||||
plo_output(conf_pars, el_struct, pshells, pgroups):
|
||||
ctrl_output(pars, el_struct, len(pgroups))
|
||||
plo_output(pars, el_struct, pshells, pgroups)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user