Skip to content

Commit

Permalink
Calculate Species.molecularWeight if not given
Browse files Browse the repository at this point in the history
  • Loading branch information
alongd committed Jun 13, 2018
1 parent e8f85a3 commit 39614f3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rmgpy/cantherm/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ def species(label, *args, **kwargs):
if structure:
spec.molecule = [structure]
spec.conformer = Conformer(E0=E0, modes=modes, spinMultiplicity=spinMultiplicity, opticalIsomers=opticalIsomers)
if molecularWeight is None:
if spec.conformer.number is None:
raise ValueError('No molecularWeight entered for species {0}, and it cannot be reconstructed from'
' conformer.number'.format(spec.label))
else:
molecularWeight = Quantity(sum([getElement(int(element)).mass
for element in spec.conformer.number.value_si]), 'kg/mol')
spec.molecularWeight = molecularWeight
spec.transportData = collisionModel
spec.energyTransferModel = energyTransferModel
Expand Down

0 comments on commit 39614f3

Please sign in to comment.