Example #1
0
def lennard_jones_params(n_heavy, bath_model, tgt_model):
    """ Returns in angstrom and cm-1.

        :param n_heavy: Number of heavy atoms for a species
        :type n_heavy: int
        :param bath_model: InChI string for bath gas species
        :type bath_model: str
        :param target_model: string denoting some class of target species
        :type target_model: str
    """
    def _lj(param, n_heavy, expt):
        """ calculate an effective Lennard-Jones parameter
        """
        return param * n_heavy**(expt)

    # print('target in etrans', tgt_model)
    # sigma, eps = dict_.values_in_multilevel_dct(
    #     LJ_DCT, bath_model, tgt_model[0])
    sig, eps = None, None

    if sig is None and eps is None:
        # Read the proper coefficients from the moldriver dct
        coeffs = dict_.values_in_multilevel_dct(LJ_EST_DCT, bath_model,
                                                tgt_model)

        # Calculate the effective sigma and epsilon values
        sig = _lj(coeffs[0], n_heavy, coeffs[1])
        eps = _lj(coeffs[2], n_heavy, coeffs[3])

    # Put in a check for zeros
    if sig == 0 or eps == 0:
        sig, eps = None, None

    return sig, eps
Example #2
0
def test__read():
    """ test dict_.values_by_unordered_tuple
        test dict_.values_in_multilevel
    """

    # Unordered unordered tuple reads
    val1 = dict_.values_by_unordered_tuple(DCT4, ('C', 'H'))
    val2 = dict_.values_by_unordered_tuple(DCT4, ('H', 'C'))
    assert numpy.isclose(1.54, val1, val2)

    val3 = dict_.values_by_unordered_tuple(DCT4, ('C', 'H'), fill_val=1.15)
    val4 = dict_.values_by_unordered_tuple(DCT4, ('C', 'N'), fill_val=1.15)
    assert numpy.isclose(1.54, val3)
    assert numpy.isclose(1.15, val4)

    # Multilevel dct reads
    val1 = dict_.values_in_multilevel_dct(GDCT3,
                                          'key1',
                                          'subkey2',
                                          fill_val='fill')
    val2 = dict_.values_in_multilevel_dct(GDCT3,
                                          'key2',
                                          'subkey1',
                                          fill_val='fill')
    val3 = dict_.values_in_multilevel_dct(GDCT3,
                                          'key1',
                                          'subkey3',
                                          fill_val='fill')
    val4 = dict_.values_in_multilevel_dct(GDCT3,
                                          'key3',
                                          'subkey1',
                                          fill_val='fill')

    assert val1 == 'subval1-2'
    assert val2 == 'subval2-1'
    assert val3 == 'fill'
    assert val4 == 'fill'
Example #3
0
def _calculate_z_alpha_terms(n_eff, bath_model, tgt_model):
    """ Calculate the [Z*alpha](N_eff)
    """
    def _z_alpha(coeff, n_eff):
        """ calculate an effective Z*alpha parameter
        """
        return ((coeff[0] * n_eff**(3) + coeff[1] * n_eff**(2) +
                 coeff[2] * n_eff**(1) + coeff[3]) / 1.0e9)

    # Read the proper coefficients from the moldriver dct
    coeff_dct = dict_.values_in_multilevel_dct(Z_ALPHA_EST_DCT, bath_model,
                                               tgt_model)

    # Calculate the three alpha terms
    z_alpha_dct = {}
    for temp, coeffs in coeff_dct.items():
        z_alpha_dct[temp] = _z_alpha(coeffs, n_eff)

    return z_alpha_dct