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

Modified main routine to make it importable

It is now possible to import a function
'generate_and_output_as_text()' from another Python script
to process VASP data.
This commit is contained in:
Oleg E. Peil 2015-12-16 15:58:14 +01:00
parent fe88b37515
commit 3478db8a90
2 changed files with 24 additions and 11 deletions

View File

View File

@ -14,6 +14,29 @@ from inpconf import ConfigParameters
from elstruct import ElectronicStructure
from plotools import generate_plo, output_as_text
def generate_and_output_as_text(conf_filename, vasp_dir):
"""
Parse config file, process VASP data, and store as text.
"""
# Prepare input-file parameters
pars = ConfigParameters(conf_filename, verbosity=0)
pars.parse_input()
# Read VASP data
if 'efermi' in pars.general:
efermi_required = False
else:
efermi_required = True
vasp_data = vaspio.VaspData(vasp_dir, efermi_required=efermi_required)
el_struct = ElectronicStructure(vasp_data)
el_struct.debug_density_matrix()
if 'efermi' in pars.general:
el_struct.efermi = pars.general['efermi']
# Generate and store PLOs
pshells, pgroups = generate_plo(pars, el_struct)
output_as_text(pars, el_struct, pshells, pgroups)
if __name__ == '__main__':
narg = len(sys.argv)
if narg < 2:
@ -27,15 +50,5 @@ if __name__ == '__main__':
else:
vasp_dir = './'
# Prepare input-file parameters
pars = ConfigParameters(filename, verbosity=0)
pars.parse_input()
generate_and_output_as_text(conf_filename, vasp_dir)
# Read VASP data
vasp_data = vaspio.VaspData(vasp_dir)
el_struct = ElectronicStructure(vasp_data)
el_struct.debug_density_matrix()
# Generate and store PLOs
pshells, pgroups = generate_plo(pars, el_struct)
output_as_text(pars, el_struct, pshells, pgroups)