xnn.common.models.vibrations#

Second derivatives of a model’s energy with respect to the positions, and harmonic vibrational analysis.

hessian_vector_product() differentiates the energy gradient once more along a direction (one more backward pass); hessian() forms the full matrix of every structure of a batch from 3 n such products. With create_graph=True both stay differentiable, so a loss on curvatures (mode curvatures, frequencies) can be trained. harmonic_analysis() turns a Hessian into harmonic frequencies, normal modes and the zero-point energy.

Units are those of the models: energies in eV, positions in Angstrom, masses in u.

Models whose energies come from a self-consistent density tell these functions how to get exact second derivatives: a position_response attribute is switched on during the evaluation (see exact_curvature()), or an energy_gradient(data, create_graph) method returns the positions and a gradient whose derivatives are exact (create_graph tells it the Hessian will be differentiated once more). differentiable_hessian = False marks Hessians that cannot be differentiated once more, and exact_second_derivatives = False a model whose plain autograd Hessian is approximate (a warning).

Module Attributes

WAVENUMBER

Wavenumber (cm^-1) of a mass-weighted Hessian eigenvalue of 1 eV / (Angstrom^2 u).

HC

the energy of a vibrational quantum of 1 cm^-1.

Functions

exact_curvature(model)

Switch on, within the block, what a model's exact second derivatives need.

harmonic_analysis(hessian, positions[, ...])

Harmonic frequencies, normal modes and zero-point energy of one structure.

hessian(model, data[, create_graph])

The Hessian of the energy with respect to the positions of every structure of a batch.

hessian_vector_product(model, data, v[, ...])

The Hessian of the energy times a direction, H v, for every structure of a batch.