Skip to content

Api

Performs vibrational pertubration theory calculation

Parameters:

Name Type Description Default
inp VPTInput

Input schema

required

Returns:

Type Description
VPTResult

VPT2 results schema

Source code in pyvpt2/vpt2.py
def vpt2_from_schema(inp: VPTInput) -> VPTResult:
    """
    Performs vibrational pertubration theory calculation

    Parameters
    ----------
    inp: VPInput
        Input schema

    Returns
    -------
    VPTResult
        VPT2 results schema
    """

    from qcelemental.models.molecule import Molecule

    if isinstance(inp, dict):
        inp = VPTInput(**inp)
    elif isinstance(inp, VPTInput):
        inp = inp.copy()
    else:
        raise AssertionError("Input type not recognized.")


    mol = inp.molecule
    kwargs = process_options_keywords(**inp.keywords)
    qc_specification = inp.input_specification[0]
    if len(inp.input_specification) == 1:
        qc_specification2 = inp.input_specification[0]
    else:
        qc_specification2 = inp.input_specification[1]
        kwargs.update({"MULTILEVEL": True})

    mol = mol.orient_molecule()
    mol = mol.dict()
    mol.update({"fix_com": True, "fix_orientation": True})
    mol = Molecule(**mol)
    #rotor_type = check_rotor(mol)

    plan = hessian_planner(mol, qc_specification, **kwargs)

    if kwargs.get("RETURN_PLAN", False):
        return plan
    else:
        with psi4.p4util.hold_options_state():
            plan.compute()
        harmonic_result = plan.get_results()

    plan = vpt2_from_harmonic(harmonic_result, qc_specification2, **kwargs)
    plan.compute()
    quartic_result = plan.get_results()
    result_dict = process_vpt2(quartic_result, **kwargs)

    return result_dict