Harmonic Vibrational Analysis and Visualization of Normal Modes — frequency() and hessian()

For further discussion of vibrational and thermochemical analysis, see Sec. Vibrational and Thermochemical Analysis.

frequency() is the only command most users will ever need to access directly to perform frequency calculations. Behind the scenes, frequency() is a light wrapper over hessian() that computes the Hessian then adds a thermochemical analysis.

psi4.frequency(name[, molecule, return_wfn, func, mode, dertype, irrep])[source]

Function to compute harmonic vibrational frequencies.

Aliases:

frequencies(), freq()

Returns:

float – Total electronic energy in Hartrees.

Returns:

(float, Wavefunction) – energy and wavefunction when return_wfn specified.

Parameters:
  • name (str) –

    'scf' || 'mp2' || 'ci5' || etc.

    First argument, usually unlabeled. Indicates the computational method to be applied to the system.

  • molecule (molecule) –

    h2o || etc.

    The target molecule, if not the last molecule defined.

  • return_wfn (boolean) –

    'on' || \(\Rightarrow\) 'off' \(\Leftarrow\)

    Indicate to additionally return the Wavefunction calculation result as the second element (after float energy) of a tuple. Arrays of frequencies and the Hessian can be accessed through the wavefunction.

  • func (function) –

    \(\Rightarrow\) gradient \(\Leftarrow\) || energy || cbs

    Indicates the type of calculation to be performed on the molecule. The default dertype accesses 'gradient' or 'energy', while 'cbs' performs a multistage finite difference calculation. If a nested series of python functions is intended (see Function Intercalls), use keyword freq_func instead of func.

  • dertype (dertype) –

    \(\Rightarrow\) 'hessian' \(\Leftarrow\) || 'gradient' || 'energy'

    Indicates whether analytic (if available- they’re not), finite difference of gradients (if available) or finite difference of energies is to be performed.

  • irrep (int or str) –

    \(\Rightarrow\) -1 \(\Leftarrow\) || 1 || 'b2' || 'App' || etc.

    Indicates which symmetry block (Cotton ordering) of vibrational frequencies to be computed. 1, '1', or 'a1' represents \(a_1\), requesting only the totally symmetric modes. -1 indicates a full frequency calculation.

Note

Analytic hessians are only available for RHF and UHF. For all other methods, Frequencies will proceed through finite differences according to availability of gradients or energies.

name

calls method

scf

Hartree–Fock (HF) or LSDA density functional theory (DFT) [manual] [details]

Examples:

>>> # [1] Frequency calculation for all modes through highest available derivatives
>>> frequency('ccsd')
>>> # [2] Frequency calculation for b2 modes through finite difference of gradients
>>> #     printing lowest mode frequency to screen and Hessian to output
>>> E, wfn = frequencies('scf', dertype=1, irrep=4, return_wfn=True)
>>> print wfn.frequencies().get(0, 0)
>>> wfn.hessian().print_out()
>>> # [3] Frequency calculation at default conditions and Hessian reuse at STP
>>> E, wfn = freq('mp2', return_wfn=True)
>>> set t 273.15
>>> set p 100000
>>> thermo(wfn, wfn.frequencies())
>>> # [4] Opt+Freq, skipping the gradient recalc at the start of the Hessian
>>> e, wfn = optimize('hf', return_wfn=True)
>>> frequencies('hf', ref_gradient=wfn.gradient())
psi4.hessian(name[, molecule, return_wfn, func, dertype, irrep])[source]

Function complementary to frequency(). Computes force constants, deciding analytic, finite difference of gradients, or finite difference of energies.

Returns:

Matrix – Total non-mass-weighted electronic Hessian in Hartrees/Bohr/Bohr.

Returns:

(Matrix, Wavefunction) – Hessian and wavefunction when return_wfn specified.

Examples:

>>> # [1] Frequency calculation without thermochemical analysis
>>> hessian('mp3')
>>> # [2] Frequency calc w/o thermo analysis getting the Hessian
>>> #     in file, core.Matrix, and np.array forms
>>> set hessian_write on
>>> H, wfn = hessian('ccsd', return_wfn=True)
>>> wfn.hessian().print_out()
>>> np.array(H)

It’s handy to collect the wavefunction after a frequency calculation through e, wfn = psi4.frequency(..., return_wfn=True) as the frequencies can be accessed through psi4.core.Wavefunction.frequencies(), the Hessian through psi4.core.Wavefunction.hessian(), and much other computation info through psi4.core.Wavefunction.frequency_analysis (note no parentheses). Examples of using this data structure can be found fd-freq-gradient and psi4/tests/pytests/test_vibanalysis.py. Formatted printing of vibrational results is available through psi4.driver.qcdb.vib.print_vibs().

Results accessible through psi4.core.Wavefunction.frequency_analysis

key

description (lbl & comment)

units

data (real/imaginary modes)

omega

frequency

cm^-1

ndarray(ndof) complex (real/imag)

q

normal mode, normalized mass-weighted

a0 u^1/2

ndarray(ndof, ndof) float

w

normal mode, un-mass-weighted

a0

ndarray(ndof, ndof) float

x

normal mode, normalized un-mass-weighted

a0

ndarray(ndof, ndof) float

degeneracy

degree of degeneracy

ndarray(ndof) int

TRV

translation/rotation/vibration

ndarray(ndof) str ‘TR’ or ‘V’ or ‘-’ for partial

gamma

irreducible representation

ndarray(ndof) str irrep or None if unclassifiable

mu

reduced mass

u

ndarray(ndof) float (+/+)

k

force constant

mDyne/A

ndarray(ndof) float (+/-)

DQ0

RMS deviation v=0

a0 u^1/2

ndarray(ndof) float (+/0)

Qtp0

Turning point v=0

a0 u^1/2

ndarray(ndof) float (+/0)

Xtp0

Turning point v=0

a0

ndarray(ndof) float (+/0)

theta_vib

char temp

K

ndarray(ndof) float (+/0)

Visualization of Normal Modes

PSI4 has the ability to export a Molden file that stores information about the harmonic frequencies and normal modes computed via frequency(). This feature can be enabled by setting the option NORMAL_MODES_WRITE to true. The filename of the Molden file ends in .molden_normal_modes, and the prefix is determined by WRITER_FILE_LABEL (if set), or else by the name of the output file plus the name of the current molecule. The normal coordinates saved in the Molden file are normalized and are not mass weighted.

Molden Interface Keywords

NORMAL_MODES_WRITE

Do write a file containing the normal modes in Molden format? If so, the filename will end in .molden_normal_modes, and the prefix is determined by WRITER_FILE_LABEL (if set), or else by the name of the output file plus the name of the current molecule.

WRITER_FILE_LABEL

Base filename for text files written by PSI, such as the MOLDEN output file, the Hessian file, the internal coordinate file, etc. Use the add_str_i function to make this string case sensitive.

  • Type: string

  • Default: No Default

psi4.driver.qcdb.vib Module

Functions

compare_vibinfos(expected, computed, tol, label)

Returns True if two dictionaries of vibration Datum objects are equivalent within a tolerance.

filter_nonvib(vibinfo[, remove])

From a dictionary of vibration Datum, remove normal coordinates.

filter_omega_to_real(omega)

Returns ndarray (float) of omega (complex) where imaginary entries are converted to negative reals.

harmonic_analysis(hess, geom, mass, ...[, ...])

Extract frequencies, normal modes and other properties from electronic Hessian.

hessian_symmetrize(hess, mol)

Apply Abelian symmetry of mol to Hessian hess.

print_molden_vibs(vibinfo, atom_symbol, geom)

Format vibrational analysis for Molden.

print_vibs(vibinfo[, atom_lbl, normco, ...])

Pretty printer for vibrational analysis.

thermo(vibinfo, T, P, multiplicity, ...[, ...])

Perform thermochemical analysis from vibrational output.

API

pydantic model psi4.driver.driver_findif.FiniteDifferenceComputer[source]

Show JSON schema
{
   "title": "FiniteDifferenceComputer",
   "description": "Base class for \"computers\" that plan, run, and process QC tasks.",
   "type": "object",
   "properties": {
      "molecule": {
         "title": "Molecule"
      },
      "driver": {
         "$ref": "#/definitions/DriverEnum"
      },
      "metameta": {
         "title": "Metameta",
         "default": {},
         "type": "object"
      },
      "task_list": {
         "title": "Task List",
         "default": {},
         "type": "object",
         "additionalProperties": {
            "$ref": "#/definitions/BaseComputer"
         }
      },
      "findifrec": {
         "title": "Findifrec",
         "default": {},
         "type": "object"
      },
      "method": {
         "title": "Method",
         "type": "string"
      }
   },
   "required": [
      "driver",
      "method"
   ],
   "definitions": {
      "DriverEnum": {
         "title": "DriverEnum",
         "description": "Allowed computation driver values.",
         "enum": [
            "energy",
            "gradient",
            "hessian",
            "properties"
         ],
         "type": "string"
      },
      "BaseComputer": {
         "title": "BaseComputer",
         "description": "Base class for \"computers\" that plan, run, and process QC tasks.",
         "type": "object",
         "properties": {}
      }
   }
}

Fields:
Validators:
field driver: DriverEnum [Required]
Validated by:
field findifrec: Dict[str, Any] = {}
field metameta: Dict[str, Any] = {}
field method: str [Required]
field molecule: Any = None
Validated by:
field task_list: Dict[str, BaseComputer] = {}
computer

alias of AtomicComputer

build_tasks(obj, **kwargs)[source]
compute(client=None)[source]

Run each job in task list.

Parameters:

client (Optional[FractalClient]) –

get_psi_results(return_wfn=False)[source]

Called by driver to assemble results into FiniteDifference-flavored QCSchema, then reshape and return them in the customary Psi4 driver interface: (e/g/h, wfn).

Parameters:

return_wfn (bool) –

Whether to additionally return the dummy Wavefunction calculation result as the second element of a tuple. Contents are:

  • undisplaced molecule

  • compute basis if simple, else dummy basis def2-svp

  • e/g/h member data

  • QCVariables

  • module

Return type:

Union[float, Matrix, Tuple[Union[float, Matrix], Wavefunction]]

Returns:

  • ret – Gradient or Hessian according to self.driver.

  • wfn – Wavefunction described above when return_wfn specified.

get_results(client=None)[source]

Return results as FiniteDifference-flavored QCSchema.

Return type:

AtomicResult

Parameters:

client (Optional[FractalClient]) –

plan()[source]
validator set_driver  »  driver[source]
validator set_molecule  »  molecule[source]