Skip to content

Commit

Permalink
f! Make is_ts an attribute of the ArkaneSpecies class
Browse files Browse the repository at this point in the history
  • Loading branch information
alongd committed Feb 28, 2019
1 parent d1a3a87 commit 4c76ce5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions arkane/common.py
Expand Up @@ -70,7 +70,7 @@ def __init__(self, species=None, conformer=None, author='', level_of_theory='',
chemkin_thermo_string='', smiles=None, adjacency_list=None, inchi=None, inchi_key=None, xyz=None,
molecular_weight=None, symmetry_number=None, transport_data=None, energy_transfer_model=None,
thermo=None, thermo_data=None, label=None, datetime=None, RMG_version=None, reactants=None,
products=None, reaction_label=None):
products=None, reaction_label=None, is_ts=None):
# reactants/products/reaction_label need to be in the init() to avoid error when loading a TS YAML file,
# but we don't use them
if species is None and conformer is None:
Expand All @@ -93,8 +93,8 @@ def __init__(self, species=None, conformer=None, author='', level_of_theory='',
self.xyz = xyz
self.molecular_weight = molecular_weight
self.symmetry_number = symmetry_number
is_ts = isinstance(species, TransitionState)
if not is_ts:
self.is_ts = is_ts if is_ts is not None else isinstance(species, TransitionState)
if not self.is_ts:
self.chemkin_thermo_string = chemkin_thermo_string
self.smiles = smiles
self.adjacency_list = adjacency_list
Expand Down Expand Up @@ -220,7 +220,7 @@ def load_yaml(self, path, species, pdep=False):
try:
if species.label != data['label']:
logging.debug('Found different labels for species: {0} in input file, and {1} in the .yml file. '
'Using the label "{0}" for this species.'.format(species.label, data['label']))
'Using the label "{0}" for this species.'.format(species.label, data['label']))
except KeyError:
# Lacking label in the YAML file is strange, but accepted
logging.debug('Did not find label for species {0} in .yml file.'.format(species.label))
Expand Down Expand Up @@ -258,10 +258,11 @@ def load_yaml(self, path, species, pdep=False):
self.adjacency_list = data['adjacency_list'] if 'adjacency_list' in data else None
self.inchi = data['inchi'] if 'inchi' in data else None
self.smiles = data['smiles'] if 'smiles' in data else None
if pdep and (self.transport_data is None or self.energy_transfer_model is None):
self.is_ts = data['is_ts'] if 'is_ts' in data else False
if pdep and not self.is_ts and (self.transport_data is None or self.energy_transfer_model is None):
raise ValueError('Transport data and an energy transfer model must be given if pressure-dependent '
'calculations are requested. Check file {0}'.format(path))
if pdep and self.smiles is None and self.adjacency_list is None\
if pdep and not self.is_ts and self.smiles is None and self.adjacency_list is None\
and self.inchi is None and self.molecular_weight is None:
raise ValueError('The molecular weight was not specified, and a structure was not given so it could '
'not be calculated. Specify either the molecular weight or structure if '
Expand Down

0 comments on commit 4c76ce5

Please sign in to comment.