3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-07 06:33:48 +01:00

Added output of a basic header into a ctrl-file

Added function 'ctrl_ouput()' which stores data common for all correlated
shells into a file '<basename>.ctrl'.
At the moment, only a very basic header is output.
The signature of 'plo_output()' is also modified to include an instance
of class 'ElectronicStructre' containing important information on
the lattice structure, Efermi, and k-points.
This commit is contained in:
Oleg E. Peil 2015-08-12 17:09:30 +02:00 committed by Michel Ferrero
parent 4c18c6e09c
commit d794bfa0f5
2 changed files with 28 additions and 6 deletions

View File

@ -3,7 +3,7 @@ import sys
import vaspio
from inpconf import ConfigParameters
from elstruct import ElectronicStructure
from plotools import generate_ortho_plos
from plotools import generate_ortho_plos, plo_output
if __name__ == '__main__':
narg = len(sys.argv)
@ -24,4 +24,4 @@ if __name__ == '__main__':
vasp_data = vaspio.VaspData(vasp_dir)
el_struct = ElectronicStructure(vasp_data)
pshells, pgroups = generate_ortho_plos(pars, el_struct)
plo_output(pars, pshells, pgroups)
plo_output(pars, el_struct, pshells, pgroups)

View File

@ -366,13 +366,37 @@ def generate_ortho_plos(conf_pars, el_struct):
return pshells, pgroups
################################################################################
#
# ctrl_output
#
################################################################################
def ctrl_output(conf_pars, el_struct, ng):
"""
Outputs a ctrl-file.
"""
ctrl_fname = conf_pars.general['basename'] + '.ctrl'
head_dict = {}
# Construct the header dictionary
head_dict['ngroups'] = ng
head_dict['nk'] = el_struct.kmesh['nktot']
head_dict['ns'] = el_struct.nspin
head_dict['nc_flag'] = 1 if el_struct.nc_flag else 0
# head_dict['efermi'] = conf_pars.general['efermi'] # We probably don't need Efermi
header = json.dumps(head_dict, indent=4, separators=(',', ': '))
with open(ctrl_fname, 'wt') as f:
f.write(header)
################################################################################
#
# plo_output
#
################################################################################
# TODO: k-points with weights should be stored once and for all
def plo_output(conf_pars, pshells, pgroups):
def plo_output(conf_pars, el_struct, pshells, pgroups):
"""
Outputs PLO groups into text files.
@ -408,7 +432,5 @@ def plo_output(conf_pars, pshells, pgroups):
...
"""
# TODO: add BASENAME option to config parameters.
basename = 'vasp'
ctrl_output(conf_pars, el_struct, len(pgroups))