Пример #1
0
def core_phasespace(geo1, geo2, sym_factor, stoich,
                    pot_prefactor=10.0, pot_exp=6.0, tstlvl='e'):
    """ Writes the string that defines the `Core` section for a
        phase space theory model of a transition state for a MESS input file by
        formatting input information into strings a filling Mako template.

        :param geo1: geometry of the dissociation species 1
        :type geo1: list
        :param geo2: geometry of the dissociation species 2
        :type geo2: list
        :param sym_factor: symmetry factor of transition state
        :type sym_factor: float
        :param stoich: combined stoichiometry of dissociation species 1 and 2
        :type stoich: str
        :param pot_prefator: factor C0 in potential expression V = -C0/R^n (au)
        :type pot_prefactor: float
        :param pot_exp: power n in potential expression V = -C0/R^n (au)
        :type pot_exp: float
        :param tstlvl: level to resolve the rate constant
        :type tstlvl: str
        :rtype: str
    """

    assert tstlvl in ('e', 'ej', 't')

    # Format the geometry section of each fragment
    natom1, geo1 = messformat.geometry_format(geo1)
    natom2, geo2 = messformat.geometry_format(geo2)

    # Indent the geometry strings
    geo1 = indent(geo1, 2)
    geo2 = indent(geo2, 2)

    # Format the tstlvl string
    assert tstlvl in ('e', 'ej', 't')
    tstlvl = tstlvl.upper()

    # Create dictionary to fill template
    core_keys = {
        'sym_factor': sym_factor,
        'natom1': natom1,
        'geo1': geo1,
        'natom2': natom2,
        'geo2': geo2,
        'stoich': stoich,
        'pot_prefactor': pot_prefactor,
        'pot_exp': pot_exp,
        'tstlvl': tstlvl
    }

    return build_mako_str(
        template_file_name='core_phasespace.mako',
        template_src_path=SPEC_INFO_PATH,
        template_keys=core_keys)
Пример #2
0
def core_rigidrotor(geo, sym_factor, interp_emax=None):
    """ Writes the string that defines the 'Core' section for a
        rigid-rotor model of a species for a MESS input file by
        formatting input information into strings a filling Mako template.

        :param geo: geometry of species
        :type geo: list
        :param sym_factor: symmetry factor of species
        :type sym_factor: float
        :param interp_emax: max energy to calculate num. of states (kcal.mol-1)
        :type interp_emax: float
        :rtype: str
    """

    # Format the geometry section
    natom, geo = messformat.geometry_format(geo)

    # Create dictionary to fill template
    core_keys = {
        'sym_factor': sym_factor,
        'natom': natom,
        'geo': geo,
        'interp_emax': interp_emax
    }

    return build_mako_str(
        template_file_name='core_rigidrotor.mako',
        template_src_path=SPEC_INFO_PATH,
        template_keys=core_keys)
Пример #3
0
def umbrella_mode(group, plane, ref_atom, potential,
                  geo=None):
    """ Writes the string that defines the `Umbrella` section for a
        single umbrella mode of a species for a MESS input file by
        formatting input information into strings a filling Mako template.

        :param group: idxs for the atoms of ?
        :type group: list(int)
        :param axis: idxs for the atoms that ?
        :type axis: list(int)
        :param geo: geometry of the species the umbrella mode exists for
        :type geo: list
        :rtype: str
    """

    # Format the sections
    umbr_group = messformat.format_rotor_key_defs(group)
    umbr_plane = messformat.format_rotor_key_defs(plane)
    umbr_npotential, _, umbr_potential = messformat.format_rotor_potential(
        potential)
    ref_atom += 1

    # Format the geom
    if geo is not None:
        natom, geo = messformat.geometry_format(geo)
        geo = indent(geo, 4)
    else:
        natom = None

    # Create dictionary to fill template
    umbr_keys = {
        'group': umbr_group,
        'axis': umbr_plane,
        'ref_atom': ref_atom,
        'npotential': umbr_npotential,
        'potential': umbr_potential,
        'natom': natom,
        'geo': geo,
    }

    return build_mako_str(
        template_file_name='umbrella_mode.mako',
        template_src_path=SPEC_INFO_PATH,
        template_keys=umbr_keys)
Пример #4
0
def core_multirotor(geo, sym_factor, pot_surf_file, int_rot_str,
                    interp_emax=100, quant_lvl_emax=9):
    """ Writes the string that defines the `Core` section for a
        multidimensional rotor model of a species for a MESS input file by
        formatting input information into strings a filling Mako template.

        :param geo: geometry of species
        :type geo: list
        :param sym_factor: symmetry factor of species
        :type sym_factor: float
        :param pot_surf_file: name of file with PES along rotor (kcal.mol-1)
        :type pot_sur_file: str
        :param int_rot_str: MESS-format strings that define internal rotors
        :type int_rot_str: str
        :param interp_emax: max energy to calculate density/number of states
        :type interp_emax: float
        :param quant_lvl_emax: max energy to calculate quantum energy levels
        :type quant_lvl_emax: float
        :rtype: str
    """

    # Format the geometry section
    natom, geo = messformat.geometry_format(geo)

    # Indent the internal rotor string
    int_rot_str = indent(int_rot_str, 2)

    # Create dictionary to fill template
    core_keys = {
        'sym_factor': sym_factor,
        'natom': natom,
        'geo': geo,
        'pot_surf_file': pot_surf_file,
        'int_rot': int_rot_str,
        'interp_emax': interp_emax,
        'quant_lvl_emax': quant_lvl_emax
    }

    return build_mako_str(
        template_file_name='core_multirotor.mako',
        template_src_path=SPEC_INFO_PATH,
        template_keys=core_keys)
Пример #5
0
def rotor_internal(group, axis, symmetry, grid_size, mass_exp_size,
                   pot_exp_size=5, hmin=13, hmax=101,
                   geo=None, rotor_id=''):
    """ Writes the string that defines the `Rotor` section for a
        single internal rotor of a species for a MESS input file by
        formatting input information into strings a filling Mako template.

        :param group: idxs for the atoms of one of the rotational groups
        :type group: list(int)
        :param axis: idxs for the atoms that make up the rotational axis
        :type axis: list(int)
        :param symmetry: overall symmetry of the torsional motion (potential)
        :type symmetry: int
        :param grid_size: grid_size for statistical weight calculation
        :type grid_size: int
        :param mass_exp_size: num. mass expansion Fourier harmonics
        :type mass_exp_size: int
        :param pot_exp_size: num. potential expansion Fourier harmonics
        :type pot_exp_size: int
        :param hmin: minimum value for quantum phase space dimension
        :type hmin: int
        :param hmax: maximum value for quantum phase space dimension
        :type hmax: int
        :param geo: geometry of the species the rotor exists for
        :type geo: list
        :param rotor_id: name associated with the rotor
        :type rotor_id: str
        :rtype: str
    """

    assert mass_exp_size > 0 and mass_exp_size % 2 == 1, (
        f'Mass exponent size: {mass_exp_size} is not an odd number'
    )
    assert pot_exp_size > 0 and pot_exp_size % 2 == 1, (
        f'Potential exponent size: {pot_exp_size} is not an odd number'
    )

    # Format the sections
    rotor_group = messformat.format_rotor_key_defs(group)
    rotor_axis = messformat.format_rotor_key_defs(axis)

    # Format the geom
    if geo is not None:
        natom, geo = messformat.geometry_format(geo)
        geo = indent(geo, 4)
    else:
        natom = None

    # Create dictionary to fill template
    rotor_keys = {
        'group': rotor_group,
        'axis': rotor_axis,
        'symmetry': symmetry,
        'mass_exp_size': mass_exp_size,
        'pot_exp_size': pot_exp_size,
        'hmin': hmin,
        'hmax': hmax,
        'grid_size': grid_size,
        'natom': natom,
        'geo': geo,
        'rotor_id': rotor_id
    }

    return build_mako_str(
        template_file_name='rotor_internal.mako',
        template_src_path=SPEC_INFO_PATH,
        template_keys=rotor_keys)
Пример #6
0
def rotor_hindered(group, axis, symmetry, potential,
                   hmin=None, hmax=None,
                   lvl_ene_max=None,
                   therm_pow_max=None,
                   geo=None,
                   rotor_id='',
                   potential_form='spline'):
    """ Writes the string that defines the `Rotor` section for a
        single hindered rotor of a species for a MESS input file by
        formatting input information into strings a filling Mako template.

        :param group: idxs for the atoms of one of the rotational groups
        :type group: list(int)
        :param axis: idxs for the atoms that make up the rotational axis
        :type axis: list(int)
        :param symmetry: overall symmetry of the torsional motion (potential)
        :type symmetry: int
        :param hmin: minimum value for quantum phase space dimension
        :type hmin: int
        :param hmax: maximum value for quantum phase space dimension
        :type hmax: int
        :param potential: value of the potential along torsion (kcal.mol-1)
        :type potential: list(float)
        :param therm_pow_max: max exp't power in Boltzmann weight
        :type therm_pow_max: int
        :param geo: geometry of the species the rotor exists for
        :type geo: list
        :param rotor_id: name associated with the rotor
        :type rotor_id: str
        :param potential_form: expression the potential should be fit to
        :type potential_form: str
        :rtype: str
    """

    # Format the rotor sections
    fmtd_group = messformat.format_rotor_key_defs(group)
    fmtd_axis = messformat.format_rotor_key_defs(axis)
    npot, fmtd_coords, fmtd_enes = messformat.format_rotor_potential(
        potential)

    # Format the geom
    natom = 1
    if geo is not None:
        natom, geo = messformat.geometry_format(geo)
        geo = indent(geo, 4)

    # Create dictionary to fill template
    rotor_keys = {
        'group': fmtd_group,
        'axis': fmtd_axis,
        'symmetry': symmetry,
        'npotential': npot,
        'pot_coords': fmtd_coords,
        'pot_enes': fmtd_enes,
        'potential_form': potential_form,
        'hmin': hmin,
        'hmax': hmax,
        'lvl_ene_max': lvl_ene_max,
        'therm_pow_max': therm_pow_max,
        'natom': natom,
        'geo': geo,
        'rotor_id': rotor_id
    }

    return build_mako_str(
        template_file_name='rotor_hindered.mako',
        template_src_path=SPEC_INFO_PATH,
        template_keys=rotor_keys)