# rmgpy.data.statmechfit¶

## Fitting functions¶

rmgpy.data.statmechfit.fitStatmechToHeatCapacity(Tlist, Cvlist, Nvib, Nrot, molecule=None)

For a given set of dimensionless heat capacity data Cvlist corresponding to temperature list Tlist in K, fit Nvib harmonic oscillator and Nrot hindered internal rotor modes. External and other previously-known modes should have already been removed from Cvlist prior to calling this function. You must provide at least 7 values for Cvlist.

This function returns a list containing the fitted vibrational frequencies in a HarmonicOscillator object and the fitted 1D hindered rotors in HinderedRotor objects.

rmgpy.data.statmechfit.fitStatmechDirect(Tlist, Cvlist, Nvib, Nrot, molecule=None)

Fit Nvib harmonic oscillator and Nrot hindered internal rotor modes to the provided dimensionless heat capacities Cvlist at temperatures Tlist in K. This method assumes that there are enough heat capacity points provided that the vibrational frequencies and hindered rotation frequency- barrier pairs can be fit directly.

rmgpy.data.statmechfit.fitStatmechPseudoRotors(Tlist, Cvlist, Nvib, Nrot, molecule=None)

Fit Nvib harmonic oscillator and Nrot hindered internal rotor modes to the provided dimensionless heat capacities Cvlist at temperatures Tlist in K. This method assumes that there are enough heat capacity points provided that the vibrational frequencies can be fit directly, but the hindered rotors must be combined into a single “pseudo-rotor”.

rmgpy.data.statmechfit.fitStatmechPseudo(Tlist, Cvlist, Nvib, Nrot, molecule=None)

Fit Nvib harmonic oscillator and Nrot hindered internal rotor modes to the provided dimensionless heat capacities Cvlist at temperatures Tlist in K. This method assumes that there are relatively few heat capacity points provided, so the vibrations must be combined into one real vibration and two “pseudo-vibrations” and the hindered rotors must be combined into a single “pseudo-rotor”.

## Helper functions¶

rmgpy.data.statmechfit.harmonicOscillator_heatCapacity(T, freq)

Return the heat capacity in J/mol*K at the given set of temperatures Tlist in K for the harmonic oscillator with a frequency freq in cm^-1.

rmgpy.data.statmechfit.harmonicOscillator_d_heatCapacity_d_freq(T, freq)

Return the first derivative of the heat capacity with respect to the harmonic oscillator frequency in J/mol*K/cm^-1 at the given set of temperatures Tlist in K, evaluated at the frequency freq in cm^-1.

rmgpy.data.statmechfit.hinderedRotor_heatCapacity(T, freq, barr)

Return the heat capacity in J/mol*K at the given set of temperatures Tlist in K for the 1D hindered rotor with a frequency freq in cm^-1 and a barrier height barr in cm^-1.

rmgpy.data.statmechfit.hinderedRotor_d_heatCapacity_d_freq(T, freq, barr)

Return the first derivative of the heat capacity with respect to the hindered rotor frequency in J/mol*K/cm^-1 at the given set of temperatures Tlist in K, evaluated at the frequency freq in cm^-1 and a barrier height barr in cm^-1.

rmgpy.data.statmechfit.hinderedRotor_d_heatCapacity_d_barr(T, freq, barr)

Return the first derivative of the heat capacity with respect to the hindered rotor frequency in J/mol*K/cm^-1 at the given set of temperatures Tlist in K, evaluated at the frequency freq in cm^-1 and a barrier height barr in cm^-1.

## Helper classes¶

class rmgpy.data.statmechfit.DirectFit(Tdata, Cvdata, Nvib, Nrot)

Class for fitting vibrational frequencies and hindered rotor frequency-barrier pairs for the case when there are few enough oscillators and rotors that their values can be fit directly.

initialize()

Initialize the DQED solver. The required parameters are:

• Neq - The number of algebraic equations.
• Nvars - The number of unknown variables.
• Ncons - The number of constraint equations.

The optional parameters are:

• bounds - A list of 2-tuples giving the lower and upper bound for each unknown variable. Use None if there is no bound in one or either direction. If provided, you must give bounds for every unknown variable.
• tolf - The tolerance used for stopping when the norm of the residual has absolute length less than tolf, i.e. $$\| \vec{f} \| \le \epsilon_f.$$
• told - The tolerance used for stopping when changes to the unknown variables has absolute length less than told, i.e. $$\| \Delta \vec{x} \| \le \epsilon_d.$$
• tolx - The tolerance used for stopping when changes to the unknown variables has relative length less than tolx, i.e. $$\| \Delta \vec{x} \| \le \epsilon_x \cdot \| \vec{x} \|.$$
• maxIter - The maximum number of iterations to use
• verbose - True to have DQED print extra information about the solve, False to only see printed output when the solver has an error.
solve()

Using the initial guess x0, return the least-squares solution to the set of nonlinear algebraic equations defined by the evaluate() method of the derived class. This is the method that actually conducts the call to DQED. Returns the solution vector and a flag indicating the status of the solve. The possible output values of the flag are:

Value Meaning
2 The norm of the residual is zero; the solution vector is a root of the system
3 The bounds on the trust region are being encountered on each step; the solution vector may or may not be a local minimum
4 The solution vector is a local minimum
5 A significant amount of noise or uncertainty has been observed in the residual; the solution may or may not be a local minimum
6 The solution vector is only changing by small absolute amounts; the solution may or may not be a local minimum
7 The solution vector is only changing by small relative amounts; the solution may or may not be a local minimum
8 The maximum number of iterations has been reached; the solution is the best found, but may or may not be a local minimum
9-18 An error occurred during the solve operation; the solution is not a local minimum
class rmgpy.data.statmechfit.PseudoRotorFit(Tdata, Cvdata, Nvib, Nrot)

Class for fitting vibrational frequencies and hindered rotor frequency-barrier pairs for the case when there are too many oscillators and rotors for their values can be fit directly, and where collapsing the rotors into a single pseudo-rotor allows for fitting the vibrational frequencies directly.

initialize()

Initialize the DQED solver. The required parameters are:

• Neq - The number of algebraic equations.
• Nvars - The number of unknown variables.
• Ncons - The number of constraint equations.

The optional parameters are:

• bounds - A list of 2-tuples giving the lower and upper bound for each unknown variable. Use None if there is no bound in one or either direction. If provided, you must give bounds for every unknown variable.
• tolf - The tolerance used for stopping when the norm of the residual has absolute length less than tolf, i.e. $$\| \vec{f} \| \le \epsilon_f.$$
• told - The tolerance used for stopping when changes to the unknown variables has absolute length less than told, i.e. $$\| \Delta \vec{x} \| \le \epsilon_d.$$
• tolx - The tolerance used for stopping when changes to the unknown variables has relative length less than tolx, i.e. $$\| \Delta \vec{x} \| \le \epsilon_x \cdot \| \vec{x} \|.$$
• maxIter - The maximum number of iterations to use
• verbose - True to have DQED print extra information about the solve, False to only see printed output when the solver has an error.
solve()

Using the initial guess x0, return the least-squares solution to the set of nonlinear algebraic equations defined by the evaluate() method of the derived class. This is the method that actually conducts the call to DQED. Returns the solution vector and a flag indicating the status of the solve. The possible output values of the flag are:

Value Meaning
2 The norm of the residual is zero; the solution vector is a root of the system
3 The bounds on the trust region are being encountered on each step; the solution vector may or may not be a local minimum
4 The solution vector is a local minimum
5 A significant amount of noise or uncertainty has been observed in the residual; the solution may or may not be a local minimum
6 The solution vector is only changing by small absolute amounts; the solution may or may not be a local minimum
7 The solution vector is only changing by small relative amounts; the solution may or may not be a local minimum
8 The maximum number of iterations has been reached; the solution is the best found, but may or may not be a local minimum
9-18 An error occurred during the solve operation; the solution is not a local minimum
class rmgpy.data.statmechfit.PseudoFit(Tdata, Cvdata, Nvib, Nrot)

Class for fitting vibrational frequencies and hindered rotor frequency-barrier pairs for the case when there are too many oscillators and rotors for their values can be fit directly, and where we must collapse both the vibrations and hindered rotations into “pseudo-oscillators” and “pseudo-rotors”.

initialize()

Initialize the DQED solver. The required parameters are:

• Neq - The number of algebraic equations.
• Nvars - The number of unknown variables.
• Ncons - The number of constraint equations.

The optional parameters are:

• bounds - A list of 2-tuples giving the lower and upper bound for each unknown variable. Use None if there is no bound in one or either direction. If provided, you must give bounds for every unknown variable.
• tolf - The tolerance used for stopping when the norm of the residual has absolute length less than tolf, i.e. $$\| \vec{f} \| \le \epsilon_f.$$
• told - The tolerance used for stopping when changes to the unknown variables has absolute length less than told, i.e. $$\| \Delta \vec{x} \| \le \epsilon_d.$$
• tolx - The tolerance used for stopping when changes to the unknown variables has relative length less than tolx, i.e. $$\| \Delta \vec{x} \| \le \epsilon_x \cdot \| \vec{x} \|.$$
• maxIter - The maximum number of iterations to use
• verbose - True to have DQED print extra information about the solve, False to only see printed output when the solver has an error.
solve()

Using the initial guess x0, return the least-squares solution to the set of nonlinear algebraic equations defined by the evaluate() method of the derived class. This is the method that actually conducts the call to DQED. Returns the solution vector and a flag indicating the status of the solve. The possible output values of the flag are:

Value Meaning
2 The norm of the residual is zero; the solution vector is a root of the system
3 The bounds on the trust region are being encountered on each step; the solution vector may or may not be a local minimum
4 The solution vector is a local minimum
5 A significant amount of noise or uncertainty has been observed in the residual; the solution may or may not be a local minimum
6 The solution vector is only changing by small absolute amounts; the solution may or may not be a local minimum
7 The solution vector is only changing by small relative amounts; the solution may or may not be a local minimum
8 The maximum number of iterations has been reached; the solution is the best found, but may or may not be a local minimum
9-18 An error occurred during the solve operation; the solution is not a local minimum