Skip to content

Commit

Permalink
Updated the main executable
Browse files Browse the repository at this point in the history
  • Loading branch information
Espen Flage-Larsen committed Feb 21, 2019
1 parent 2f7bdf0 commit 71ef7f8
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions scripts/t4me
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
"""Contains the main running script of T4ME."""
#!/usr/bin/env python
"""Contains the main running script of T4ME."""

# pylint: disable=too-many-branches, too-many-statements, useless-import-alias, unused-import, unused-variable, no-member, no-name-in-module, invalid-name

# python specifics
import sys
import logging

# locals
import t4me.utils as utils #pylint disable=useless-import-alias
import t4me.constants as constants #pylint disable=useless-import-alias
import t4me.utils as utils


def main(): #pylint disable=too-many-branches, too-many-statements
def main(): # noqa: MC0001
"""
Main routine.
Expand All @@ -36,7 +37,7 @@ def main(): #pylint disable=too-many-branches, too-many-statements

# configure logger
utils.config_logger()
logger = logging.getLogger(sys._getframe().f_code.co_name)
logger = logging.getLogger(sys._getframe().f_code.co_name) # pylint: disable=protected-access

# these modules are loaded after we configure the logger
# in case there are problems with third party libraries etc.
Expand Down Expand Up @@ -99,16 +100,8 @@ def main(): #pylint disable=too-many-branches, too-many-statements
# read param file
param = inputoutput.Param(inputoutput.readparam())

# check if mpi4py is available (parallel could be
# False or True at this point)
try:
import mpi4py
except ImportError:
# certainly do not run in parallel mode if
# mpi4py cannot be loaded, regardless of what
# the user wants
inputoutput.mpi4py_message()
param.parallel = False
# no parallelization at this point
param.parallel = False

# generate lattice from param and input file
lat = lattice.Lattice(param)
Expand All @@ -131,7 +124,9 @@ def main(): #pylint disable=too-many-branches, too-many-statements
# check if the velocities exists, if not print a message and
# continue
if bs.gen_velocities:
logger.info("Data for the band velocities does not exist. " "Skipping writing the band velocities to file " "and continuing.")
logger.info("Data for the band velocities does not exist. "
"Skipping writing the band velocities to file "
"and continuing.")
else:
inputoutput.dump_bandstruct_line(
bs,
Expand All @@ -152,7 +147,8 @@ def main(): #pylint disable=too-many-branches, too-many-statements
if lat.regular or param.dispersion_interpolate_method == "skw":
# for a regular grid it is okey for us to extract velocities
# on the fly
logger.info("Interpolating the energies and extracting the " "velocities by interpolation.")
logger.info("Interpolating the energies and extracting the "
"velocities by interpolation.")
bs.interpolate(store_inter=True, ivelocities=True)
else:
# only interpolate the eigenvalues
Expand Down Expand Up @@ -209,14 +205,15 @@ def main(): #pylint disable=too-many-branches, too-many-statements
# calculate effective mass
bs.calc_effective_mass()
# write effective mass
logger.error("Writeout of the effective mass tensor " "have not yet been included.")
logger.error("Writeout of the effective mass tensor "
"have not yet been included.")
sys.exit(1)
inputoutput.dump_effmass(bs, filename="effmass")

# calculation of the density of states?
if param.dos_calc:
# calculate
bs.calc_density_of_states(spin_degen=True)
bs.calc_density_of_states()
# write dos
inputoutput.dump_density_of_states(bs, filename="dos")

Expand Down

0 comments on commit 71ef7f8

Please sign in to comment.