overreact/thermo/_gas.py
def calc_elec_energy(energy=0.0, degeneracy=1, temperature=298.15):
    """Calculate electronic energy.

    This eventually adds a correction based on accessible excited states, but
    simply return the ground state energy if only information on the ground
    state is given.

    Parameters
    ----------
    energy : array-like, optional
        Energies for different states, in J/mol.
    degeneracy : array-like, optional
        Degeneracies of the states of the molecule. This is normally the same
        as spin multiplicity, but might be total angular momentum degeneracy in
        some cases (e.g., fluorine).
    temperature : array-like, optional
        Absolute temperature in Kelvin.

    Returns
    -------
    float
        Electronic energy in J/mol.

    Examples
    --------
    Normally, only the ground state is considered. In this case, only the
    energy and degeneracy of the ground state are needed. The degeneracy
    normally means spin multiplicity in this case. In fact, the energy in this
    case is independent of the ground state degeneracy and, if not given,
    non-degenerate is assumed:

    >>> calc_elec_energy(1234.0, degeneracy=4)
    1234.0
    >>> np.isclose(calc_elec_energy(1234.0, 3), calc_elec_energy(1234.0, 2))
    True
    >>> calc_elec_energy(1234.0)  # singlet by default
    1234.0

    But you can consider excited states too. Below is a calculation with
    degeneracies and excitation energies for the fluorine atom as taken from
    the NIST atomic data
    (<https://physics.nist.gov/PhysRefData/Handbook/Tables/fluorinetable5.htm>).
    Similar data can also be found in Table 5-1 of Statistical Thermodynamics,
    McQuarrie (ground energy is assumed zero to simplify things):

    >>> j = np.array([3/2, 1/2, 5/2, 3/2, 1/2, 3/2, 1/2])
    >>> degeneracy = 2 * j + 1
    >>> energy = np.array([0.000, 404.141, 102405.714, 102680.439,  # cm-1
    ...                    102840.378, 104731.048, 105056.283])
    >>> calc_elec_energy(
    ...     energy * 100 * constants.h * constants.c * constants.N_A, degeneracy
    ... )
    321.00

    """
    temperature = np.asarray(temperature)

    min_energy = np.asarray(energy).min()
    if np.isclose(temperature, 0.0):
        logger.warning("assuming ground state as electronic energy at zero temperature")
        return min_energy

    energy = energy - min_energy
    q_elec_terms = degeneracy * np.exp(-energy / (constants.R * temperature))
    q_elec = np.sum(q_elec_terms)

    electronic_energy = min_energy + np.sum(energy * q_elec_terms) / q_elec
    logger.info(f"electronic energy = {electronic_energy} J/mol")
    return electronic_energy
Calculate electronic energy.

    This eventually adds a correction based on accessible excited states, but
    simply return the ground state energy if only information on the ground
    state is given.

    Parameters
    ----------
    energy : array-like, optional
        Energies for different states, in J/mol.
    degeneracy : array-like, optional
        Degeneracies of the states of the molecule. This is normally the same
        as spin multiplicity, but might be total angular momentum degeneracy in
        some cases (e.g., fluorine).
    temperature : array-like, optional
        Absolute temperature in Kelvin.

    Returns
    -------
    float
        Electronic energy in J/mol.

    Examples
    --------
    Normally, only the ground state is considered. In this case, only the
    energy and degeneracy of the ground state are needed. The degeneracy
    normally means spin multiplicity in this case. In fact, the energy in this
    case is independent of the ground state degeneracy and, if not given,
    non-degenerate is assumed:

    >>> calc_elec_energy(1234.0, degeneracy=4)
    1234.0
    >>> np.isclose(calc_elec_energy(1234.0, 3), calc_elec_energy(1234.0, 2))
    True
    >>> calc_elec_energy(1234.0)  # singlet by default
    1234.0

    But you can consider excited states too. Below is a calculation with
    degeneracies and excitation energies for the fluorine atom as taken from
    the NIST atomic data
    (<https://physics.nist.gov/PhysRefData/Handbook/Tables/fluorinetable5.htm>).
    Similar data can also be found in Table 5-1 of Statistical Thermodynamics,
    McQuarrie (ground energy is assumed zero to simplify things):

    >>> j = np.array([3/2, 1/2, 5/2, 3/2, 1/2, 3/2, 1/2])
    >>> degeneracy = 2 * j + 1
    >>> energy = np.array([0.000, 404.141, 102405.714, 102680.439,  # cm-1
    ...                    102840.378, 104731.048, 105056.283])
    >>> calc_elec_energy(
    ...     energy * 100 * constants.h * constants.c * constants.N_A, degeneracy
    ... )
    321.00

    
Calculate electronic energy.
This eventually adds a correction based on accessible excited states, but
simply return the ground state energy if only information on the ground
state is given.

Parameters

energy : array-like, optional
Energies for different states, in J/mol.
degeneracy : array-like, optional
Degeneracies of the states of the molecule. This is normally the same
as spin multiplicity, but might be total angular momentum degeneracy in
some cases .
temperature : array-like, optional
Absolute temperature in Kelvin.

Returns

float
Electronic energy in J/mol.

Examples

Normally, only the ground state is considered. In this case, only the
energy and degeneracy of the ground state are needed. The degeneracy
normally means spin multiplicity in this case. In fact, the energy in this
case is independent of the ground state degeneracy and, if not given,
non-degenerate is assumed.



But you can consider excited states too. Below is a calculation with
degeneracies and excitation energies for the fluorine atom as taken from
the NIST atomic data
().
Similar data can also be found in Table 5-1 of Statistical Thermodynamics,
McQuarrie (ground energy is assumed zero to simplify things).


Calculate electronic energy . This eventually adds a correction based on accessible excited states but simply return the ground state energy if only information on the ground state is given . Parameters energy : array - like optional Energies for different states in J / mol . degeneracy : array - like optional Degeneracies of the states of the molecule . This is normally the same as spin multiplicity but might be total angular momentum degeneracy in some cases . temperature : array - like optional Absolute temperature in Kelvin . Returns float Electronic energy in J / mol . Examples Normally only the ground state is considered . In this case only the energy and degeneracy of the ground state are needed . The degeneracy normally means spin multiplicity in this case . In fact the energy in this case is independent of the ground state degeneracy and if not given non - degenerate is assumed . But you can consider excited states too . Below is a calculation with degeneracies and excitation energies for the fluorine atom as taken from the NIST atomic data () . Similar data can also be found in Table 5 - 1 of Statistical Thermodynamics McQuarrie ( ground energy is assumed zero to simplify things ) .
def calc_elec_energy(energy=0.0, degeneracy=1, temperature=298.15):
    temperature = np.asarray(temperature)
    min_energy = np.asarray(energy).min()
    if np.isclose(temperature, 0.0):
        logger.warning("assuming ground state as electronic energy at zero temperature")
        return min_energy
    energy = energy - min_energy
    q_elec_terms = degeneracy * np.exp(-energy / (constants.R * temperature))
    q_elec = np.sum(q_elec_terms)
    electronic_energy = min_energy + np.sum(energy * q_elec_terms) / q_elec
    logger.info(f"electronic energy = {electronic_energy} J/mol")
    return electronic_energy
def calc_elec_energy ( energy = 0.0 , degeneracy = 1 , temperature = 298.15 ) : temperature = np . asarray ( temperature ) min_energy = np . asarray ( energy ) . min ( ) if np . isclose ( temperature , 0.0 ) : logger . warning ( "assuming ground state as electronic energy at zero temperature" ) return min_energy energy = energy - min_energy q_elec_terms = degeneracy * np . exp ( - energy / ( constants . R * temperature ) ) q_elec = np . sum ( q_elec_terms ) electronic_energy = min_energy + np . sum ( energy * q_elec_terms ) / q_elec logger . info ( f"electronic energy = {electronic_energy} J/mol" ) return electronic_energy
Calculate electronic energy.
Calculate electronic energy .
"""Calculate electronic energy.

    This eventually adds a correction based on accessible excited states, but
    simply return the ground state energy if only information on the ground
    state is given.

    Parameters
    ----------
    energy : array-like, optional
        Energies for different states, in J/mol.
    degeneracy : array-like, optional
        Degeneracies of the states of the molecule. This is normally the same
        as spin multiplicity, but might be total angular momentum degeneracy in
        some cases (e.g., fluorine).
    temperature : array-like, optional
        Absolute temperature in Kelvin.

    Returns
    -------
    float
        Electronic energy in J/mol.

    Examples
    --------
    Normally, only the ground state is considered. In this case, only the
    energy and degeneracy of the ground state are needed. The degeneracy
    normally means spin multiplicity in this case. In fact, the energy in this
    case is independent of the ground state degeneracy and, if not given,
    non-degenerate is assumed:

    >>> calc_elec_energy(1234.0, degeneracy=4)
    1234.0
    >>> np.isclose(calc_elec_energy(1234.0, 3), calc_elec_energy(1234.0, 2))
    True
    >>> calc_elec_energy(1234.0)  # singlet by default
    1234.0

    But you can consider excited states too. Below is a calculation with
    degeneracies and excitation energies for the fluorine atom as taken from
    the NIST atomic data
    (<https://physics.nist.gov/PhysRefData/Handbook/Tables/fluorinetable5.htm>).
    Similar data can also be found in Table 5-1 of Statistical Thermodynamics,
    McQuarrie (ground energy is assumed zero to simplify things):

    >>> j = np.array([3/2, 1/2, 5/2, 3/2, 1/2, 3/2, 1/2])
    >>> degeneracy = 2 * j + 1
    >>> energy = np.array([0.000, 404.141, 102405.714, 102680.439,  # cm-1
    ...                    102840.378, 104731.048, 105056.283])
    >>> calc_elec_energy(
    ...     energy * 100 * constants.h * constants.c * constants.N_A, degeneracy
    ... )
    321.00

    """
energy
degeneracy
temperature