Skip to content

Commit

Permalink
When fitting extra frequencies, don't forget the uncertainties.
Browse files Browse the repository at this point in the history
If you manipulate an ArrayQuantity.value_si array without also
changing the uncertainty array then you can end up with arrays
of different sizes, which causes a problem when you pickle them
and unpickle them (eg. write and load a restart file).

Hopefully addresses #114
  • Loading branch information
rwest committed Apr 21, 2013
1 parent f477d79 commit d8b38a0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rmgpy/data/statmech.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,11 @@ def getStatmechData(self, molecule, thermoModel):
modes = fitStatmechToHeatCapacity(Tlist, Cv, numVibrations - len(frequencies), numRotors, molecule)
for mode in modes:
if isinstance(mode, HarmonicOscillator):
uncertainties = [0 for f in frequencies] # probably shouldn't be zero
frequencies.extend(mode.frequencies.value_si)
uncertainties.extend(mode.frequencies.uncertainty)
mode.frequencies.value_si = numpy.array(frequencies, numpy.float)
mode.frequencies.uncertainty = numpy.array(uncertainties, numpy.float)
break
else:
modes.insert(0, HarmonicOscillator(frequencies=(frequencies,"cm^-1")))
Expand Down

0 comments on commit d8b38a0

Please sign in to comment.