radis.levels.partfunc module

Partition function calculators and tabulators.

Notes

Partition function calculators and tabulators

Calculators all derive from the same RovibPartitionFunction object, and require a list of energies

Tabulators are more specific, and require a list of precalculated partition functions at different temperature. PartFuncHAPI uses the HITRAN hapi.py [1]_ module to interpolate Q for HITRAN species

Routine Listing

Partition functions:

Which inherit from:

Which inherit from:

See also

-

class:PartFuncCO2_CDSDcalc

-

class:PartFuncCO2_CDSDtab

References

1

HAPI: The HITRAN Application Programming Interface


class PartFuncHAPI(M, I, path=None, verbose=True)[source]

Bases: radis.levels.partfunc.RovibParFuncTabulator

Return partition function using interpolation of tabulated values.

Parameters
  • M (int) – molecule id

  • I (int) – isotope identifier

  • path (str) – path to hapi.py. If None, the hapi package from PyPI is used.

Examples

from radis.levels.partfunc import PartFuncHAPI
from radis.db.classes import get_molecule_identifier

M = get_molecule_identifier('N2O')
iso=1

Q = PartFuncHAPI(M, iso)
print(Q.at(T=1500))

See online examples for more.

References

Partition function are calculated with HAPI [1]_ (Hitran Python Interface) using partitionSum(M,I,T)

1

HAPI: The HITRAN Application Programming Interface

import_from_file(path)[source]

Import hapi.py from a given file (in case user wants to specify a different HAPI version than the one embedded in RADIS)

class PartFunc_Dunham(electronic_state, vmax=None, vmax_morse=None, Jmax=None, spectroscopic_constants='default', use_cached=True, verbose=True, calc_Evib_per_mode=True, calc_Evib_harmonic_anharmonic=True, group_energy_modes_in_2T_model={'CO2': (['Evib1', 'Evib2', 'Evib3'], ['Erot'])})[source]

Bases: radis.levels.partfunc.RovibParFuncCalculator

Calculate partition functions from spectroscopic constants, if molecule data is available in RADIS. If using the default spectroscopic constants, make sure you know what reference data is being used in RADIS! Energies are calculated with the Erovib() method of Molecules

Parameters
  • electronic_state (ElectronicState) – an ElectronicState object, which is defined in RADIS molecule database and contains spectroscopic data

  • vmax (int, or None) – maximum vibrational quantum to calculate with Dunham expansion. If None, the molecule one is taken. If None still, all levels are calculated up to the molecule dissociation energy

  • vmax_morse (int, or None) – maximum vibrational quantum to calculate with Morse potential. If None, the molecule one is taken. Use 0 or -1 not to calculate with Morse potential

  • Jmax (int, or None) – maximum rotational quantum. If None, the molecule one is taken. If None, all levels are calculated up to the molecule dissociation energy

Other Parameters
  • use_cached (True, False, or 'regen', 'force') – if True, use (and generate if doesnt exist) a .h5 file. If 'regen', regenerate cache file. If 'force', raise an error if file doesnt exist. Default True

  • calc_Evib_per_mode (boolean) – if True, calculate energies of each vibration mode (so far only implemented for CO2 with Evib1, Evib2, Evib3 but shall be generalized to all molecules)

  • calc_Evib_harmonic_anharmonic (boolean) – if True, calculate and store separately harmonic and anharmonic parts of the vibrational energy. This is needed to calculate Treanor distributions ( ~ Evib_harmonic / Tvib - Evib_anharmonic / Trot )

  • group_energy_modes_in_2T_model (dict) – (experimental in neq 0.9.21) for polyatomic molecules (> 1 vibration mode), how to regroup energy modes when working with 2T models. For instance, for CO2, (Evib, Erot) could as well as defined with:

    ['Evib1', 'Evib2', 'Evib3'],['Erot']
    or
    ['Evib3'],['Evib1', 'Evib2', 'Erot']
    

    depending on which levels are supposed to interact the most

Notes

Validity:

So far, RADIS energy levels are only calculated from Dunham’s expansion. Above a certain vibrational level a Morse Potential may be used. See how the molecule is defined in molecules

build_energy_levels_class1()[source]

in the case where only Ediss is given. Deal with vmax, Jmax later.

Applies to molecules in HITRAN_CLASS1

Returns

but the Pandas DataFrame self.df is updated with parameters:

  • g : degeneracy

  • E : energy level

  • Evib : vibrational energy

  • Erot : rotational energy

  • viblvl : vibrational level name

Return type

None

build_energy_levels_class5(calc_Evib_per_mode=True, calc_Evib_harmonic_anharmonic=False, group_energy_modes_in_2T_model=(['Evib1', 'Evib2', 'Evib2'], ['Erot']))[source]

in the case where only Ediss is given. Deal with vmax, Jmax later.

HITRAN_CLASS5 = [‘CO2’] # Linear triatomic with large Fermi resonance

Parameters

calc_Evib_per_mode (boolean) – if True, calculates Evib1, Evib2, Evib3

Other Parameters
  • calc_Evib_harmonic_anharmonic (boolean) – if True, calculates Evib_h and Evib_a, harmonic and non harmonic components, to be used in Treanor distributions

  • group_energy_modes_in_2T_model (dict) – (experimental in neq 0.9.21) for polyatomic molecules (> 1 vibration mode), how to regroup energy modes when working with 2T models. For instance, for CO2, (Evib, Erot) could as well as defined with:

    ['Evib1', 'Evib2', 'Evib3'],['Erot']
    

    or:

    ['Evib3'],['Evib1', 'Evib2', 'Erot']
    

    depending on which levels are supposed to interact the most

Returns

but the Pandas DataFrame self.df is updated with parameters:

  • g : degeneracy

  • E : energy level

  • Evib : vibrational energy

  • Erot : rotational energy

  • viblvl : vibrational level name

Return type

None

gi(ElecState)[source]

Get state independant rotational degeneracy. Typically depends on the isotope.

See also

gi()

gs(ElecState)[source]

Get state specific rotational degeneracy.

Parameters

ElecState – an ElectronicState, that contains molecule id and isotope number

See also

gs()

class RovibParFuncCalculator(electronic_state)[source]

Bases: radis.levels.partfunc.RovibPartitionFunction

Parameters

electronic_state (ElectronicState) – an ElectronicState object, which is defined in RADIS molecule database and contains spectroscopic data. Energies are calculated with the Erovib() method.

at(T, update_populations=False)[source]

Get partition function at temperature T under equilibrium conditions.

Parameters

T (float) – equilibrium temperature

Other Parameters

update_populations (boolean) – if True, store calculated populations in energy level list Default False

Returns

Q – partition function calculated at temperature T

Return type

float

Examples

See online examples

See also

at_noneq(), at_noneq_3Tvib()

at_noneq(Tvib, Trot, overpopulation=None, vib_distribution='boltzmann', rot_distribution='boltzmann', returnQvibQrot=False, update_populations=False)[source]

Calculate Partition Function under non equilibrium (Tvib, Trot), with boltzmann/treanor distributions and overpopulations as specified by the user.

Parameters
  • Tvib, Trot (float) – vibrational & rotational temperatures (K)

  • overpopulation (dict, or None) – dict of overpopulated levels: {'level':over_factor}

  • vib_distribution ('boltzmann', 'treanor') – distribution of vibrational levels

  • rot_distribution ('boltzmann') – distribution of rotational levels

  • returnQvibQrot (boolean) – cf output

Other Parameters

update_populations (boolean) – if True, store calculated populations in energy level list. Default False

Returns

  • Q (float) – partition function calculated at non eq temperatures

  • Q, Qvib, dfQrot (float, float, pandas table (if returnQvibQrot)) – total partition function, vibrational partition function, and table of rotational partition functions for each vibrational state (note that all Qrot are not necessarily the same for all vibrational levels)

Examples

See online examples

See also

at(), at_noneq_3Tvib()

at_noneq_3Tvib(Tvib, Trot, overpopulation=None, vib_distribution='boltzmann', rot_distribution='boltzmann', returnQvibQrot=False, update_populations=False)[source]

Calculate Partition Function under non equilibrium ((Tvib1, Tvib2, Tvib3), Trot), with boltzmann/treanor distributions and overpopulations as specified by the user.

Dedicated function for 3 Tvib mode

Parameters
  • Tvib, Trot ((float, float, float), float) – vibrational & rotational temperatures (K)

  • overpopulation (dict, or None) – dict of overpopulated levels: {'level':over_factor}

  • vib_distribution ('boltzmann', 'treanor')

  • rot_distribution ('boltzmann')

  • returnQvibQrot (boolean) – cf output

  • update_populations (boolean) – if True, saves populations for calculated temperature in PartitionFunction dataframe. Default False

Returns

  • Q (float) – partition function calculated at non eq temperatures

  • Q, Qvib, dfQrot (float, float, pandas table (if returnQvibQrot)) – total partition function, vibrational partition function, and table of rotational partition functions for each vibrational state (note that all Qrot are not necessarily the same for all vibrational levels)

See also

at(), at_noneq()

reset_populations()[source]

Discard computed populations of all energy levels.

To call on every RovibrationalPartitionFunction object before each new spectrum calculation

class RovibParFuncTabulator(electronic_state)[source]

Bases: radis.levels.partfunc.RovibPartitionFunction

at(T, **kwargs)[source]

Get partition function at temperature T under equilibrium conditions, from tabulated data.

Parameters

T (float) – equilibrium temperature

Returns

Q – partition function interpolated at temperature T

Return type

float

Examples

See online examples

See also

PartFuncHAPI

at_noneq(*args, **kwargs)[source]
class RovibPartitionFunction(electronic_state)[source]

Bases: object

General class from which all partition function calculators derive.

Parameters

electronic_state (ElectronicState) – an ElectronicState object, which is defined in RADIS molecule database and contains spectroscopic data

Notes

Implementation:

one partition function generator (RovibPartitionFunction) is generated per specie per isotope

RovibPartitionFunction may differ in the way they build / fetch their list of states and the associated energies, but the .at(), .at_noneq() calls to calculate the partition function should be shared among all derived classes