Skip to content

Commit

Permalink
Moving to the new commandline argument handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulsaxe committed Dec 5, 2020
1 parent 99666a6 commit 0dd33e8
Showing 1 changed file with 6 additions and 44 deletions.
50 changes: 6 additions & 44 deletions supercell_step/supercell.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""Non-graphical part of the Supercell step in a SEAMM flowchart
"""

import configargparse
import logging
import seamm
from seamm import data # noqa: F401
Expand Down Expand Up @@ -31,9 +30,6 @@ class Supercell(seamm.Node):
Attributes
----------
parser : configargparse.ArgParser
The parser object.
options : tuple
It contains a two item tuple containing the populated namespace and the
list of remaining argument strings.
Expand Down Expand Up @@ -66,45 +62,11 @@ def __init__(self, flowchart=None, title='Supercell', extension=None):
extension: None
Not yet implemented
"""
logger.debug('Creating Supercell {}'.format(self))

# Argument/config parsing
self.parser = configargparse.ArgParser(
auto_env_var_prefix='',
default_config_files=[
'/etc/seamm/supercell_step.ini',
'/etc/seamm/seamm.ini',
'~/.seamm/supercell_step.ini',
'~/.seamm/seamm.ini',
]
)

self.parser.add_argument(
'--seamm-configfile',
is_config_file=True,
default=None,
help='a configuration file to override others'
)

# Options for this plugin
self.parser.add_argument(
"--supercell-step-log-level",
default=configargparse.SUPPRESS,
choices=[
'CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG', 'NOTSET'
],
type=str.upper,
help="the logging level for the Supercell step"
)

self.options, self.unknown = self.parser.parse_known_args()

# Set the logging level for this module if requested
if 'supercell_step_log_level' in self.options:
logger.setLevel(self.options.supercell_step_log_level)

super().__init__(
flowchart=flowchart, title='Supercell', extension=extension
flowchart=flowchart,
title='Supercell',
extension=extension,
logger=logger
)

self.parameters = supercell_step.SupercellParameters()
Expand Down Expand Up @@ -165,8 +127,8 @@ def run(self):

# Get the current system
if data.structure is None:
logger.error('Solvate: there is no system!')
raise RuntimeError('Solvate: there is no system to solvate!')
self.logger.error('Supercell: there is no system!')
raise RuntimeError('Supercell: there is no system to solvate!')

system = data.structure
atoms = system['atoms']
Expand Down

0 comments on commit 0dd33e8

Please sign in to comment.