示例#1
0
def test_herzberg_coefficients_CO2_json(verbose=True, *args, **kwargs):
    ''' Check that default coefficients are found correctly
    '''
    # @dev: update this test if we ever are to change the default Herzberg
    # coeffs in CO2/molecules_data.json

    assert set(get_herzberg_coefficients('CO2', 1, 'X1SIGu+')) == set(
        ['we1', 'we2', 'we3', 'wexe1', 'wexe2', 'wexe3', 'Be', 'De', 'He'])

    if verbose:
        print(('Herzberg coefficients defined for CO2(X)(iso=1):',
               get_herzberg_coefficients('CO2', 1, 'X1SIGu+')))
示例#2
0
def test_herzberg_coefficients_CO2_json(verbose=True, *args, **kwargs):
    """Check that default coefficients are found correctly"""
    # @dev: update this test if we ever are to change the default Herzberg
    # coeffs in CO2/molecules_data.json

    assert set(get_herzberg_coefficients("CO2", 1, "X1SIGu+")) == set(
        ["we1", "we2", "we3", "wexe1", "wexe2", "wexe3", "Be", "De", "He"])

    if verbose:
        print((
            "Herzberg coefficients defined for CO2(X)(iso=1):",
            get_herzberg_coefficients("CO2", 1, "X1SIGu+"),
        ))
示例#3
0
def _test(*args, **kwargs):
    #    E_CO2X = E_CO2_626_X1SIGg
    from radis.db.utils import get_herzberg_coefficients
    coeffs = get_herzberg_coefficients('CO2', 1, 'X1SIGu+')
    E_CO2X = lambda v1, v2, l2, v3, J: EvJ_uncoupled_vibrating_rotor(
        v1, v2, l2, v3, J, coeff_dict=coeffs, gv1=1, gv2=2, gv3=1)
    print('CO2((0,0,0,0),J=0) -> CO2((0,0,0,1),J=0) energy: ',
          E_CO2X(0, 0, 0, 1, 0) - E_CO2X(0, 0, 0, 0, 0), 'cm-1')
示例#4
0
    def _parse_rovib_constants(self, spectroscopic_constants,
                               spectroscopic_constants_type):
        r"""Parse spectroscopic constants

        Stores :py:attr:`~radis.db.classes.ElectronicState.Te` and
        :py:attr:`~radis.db.classes.ElectronicState.re` as electronic state
        attributes, and the rest under :py:attr:`~radis.db.classes.ElectronicState.rovib_constants`

        Parameters
        ----------

        spectroscopic_constants: str, or ``'default'``
            filename of spectroscopic constants under Herzberg or Dunham format.

            Expected in the file:

                Yij: cm-1
                    rovibrational coefficients in Dunham convention

            or

                wexe, Be, etc. : cm-1
                    rovibrational coefficients in Herzberg convention

            or

                Te: cm-1
                    electronic energy. Default ``None`` if not given

            If ``default``, the constants defined in
            :ref:`spectroscopic constants <label_db_spectroscopic_constants>` are used.


        spectroscopic_constants_type: ``'herzberg'``, ``'dunham'``
            convention for spectroscopic constants. Default ``'herzberg'``

        Returns
        -------

        None:
            but constants are stored under :py:attr:`~radis.db.classes.ElectronicState.rovib_constants`,
            and store json file in :py:attr:`~radis.db.classes.ElectronicState.jsonfile`

        """

        # Get file name
        if spectroscopic_constants == "default":
            jsonfile = get_default_jsonfile(self.name)
        elif exists(spectroscopic_constants):  # absolute path
            jsonfile = spectroscopic_constants
        else:  # assume a json file stored in the default folder
            jsonfile = join(dirname(get_default_jsonfile(self.name)),
                            spectroscopic_constants)

        # Parse file
        if spectroscopic_constants_type == "dunham":
            rovib_constants = get_dunham_coefficients(self.name,
                                                      self.iso,
                                                      self.get_statename_utf(),
                                                      jsonfile=jsonfile)
        elif spectroscopic_constants_type == "herzberg":
            rovib_constants = get_herzberg_coefficients(
                self.name,
                self.iso,
                self.get_statename_utf(),
                jsonfile=jsonfile)
        else:
            raise ValueError(
                "Unexpected spectroscopic constant type: {0}".format(
                    spectroscopic_constants_type))

        # Clean keys
        # In particular, remove trailing '_cm-1' if given in dict or database
        import re

        rovib_constants = {
            re.sub("_cm-1$", "", k): v
            for (k, v) in rovib_constants.items()
        }

        # Get specific keys
        self.Te = rovib_constants.pop("Te", None)  # default None
        self.re = rovib_constants.pop("re", None)

        # Store
        self.rovib_constants = rovib_constants
        self.jsonfile = jsonfile
示例#5
0
#        '''
#        return EvJah_uncoupled_vibrating_rotor(v1, v2, l2, v3, J, coeff_dict=coeff_dict,
#                                             remove_ZPE=remove_ZPE)
#    return ElectronicState('CO2', isotope=1, state='X', term_symbol='1Σu+',
##                            spectroscopic_constants=get_herzberg_coefficients('CO2', 1, 'X1SIGu+'),
#                            Erovib=Erovib_CO2,
#                            Ehaj=Ehaj_CO2,  # for Treanor
#                            Ediss=44600,
#                            )

CO2_X_626 = ElectronicState(
    'CO2',
    isotope=1,
    state='X',
    term_symbol='1Σu+',
    spectroscopic_constants=get_herzberg_coefficients('CO2', 1, 'X1SIGu+'),
    #                            Erovib=EvJah_uncoupled_vibrating_rotor,
    #                            Ehaj=Ehaj_CO2,  # for Treanor
    Ediss=44600,
)
CO2_X_636 = ElectronicState(
    'CO2',
    isotope=2,
    state='X',
    term_symbol='1Σu+',
    spectroscopic_constants=get_herzberg_coefficients('CO2', 2, 'X1SIGu+'),
    #                            Erovib=EvJah_uncoupled_vibrating_rotor,
    #                            Ehaj=Ehaj_CO2,  # for Treanor
    Ediss=44600,
)
CO2_X_628 = ElectronicState(