Phonon Calculations

The Phonon class allows to compute the normal modes and vibration energies of a system using a machine learning trained model.

class mlcalcdriver.workflows.phonon.Phonon(posinp, calculator, relax=True, finite_difference=False, translation_amplitudes=None)[source]

Bases: object

This class allows to run all the calculations enabling the computation of the phonon energies of a given system, using machine learning models.

To get the phonon energies of the system, one needs to find the eigenvalues of the dynamical matrix, that is closely related to the Hessian matrix. To build these matrices, one must find the derivatives of the forces when each coordinate of each atom is translated by a small amount around the equilibrium positions.

The initial position fo the atoms are taken from the init_state Posinp instance. If they are not part of a relaxed geometry, the relax parameter should stay at True.

WARNING: Relaxed geometries are dependent on the model chosen to define the calculator. In doubt, relax parameter should be ignored.

The distance of the displacement in each direction is controlled by translation_amplitudes.

Phonon energies and normal modes are calculated using the run()`method. This method creates the additional structures needed, passes them to a `Job instance, then post-processes the obtained forces to obtain them.

Parameters
  • posinp (mlcaldriver.Posinp) – Initial positions of the system under consideration.

  • calculator (Calculator) – mlcalcdriver.Calculator instance that will be used in the created Jobs to evaluate properties.

  • relax (bool) – Wether the initial positions need to be relaxed or not. Default is True.

  • finite_difference (bool) – If True, the hessian matrix is calculated using finite displacements of atoms. Default is False. Mostly there for legacy reasons.

  • translation_amplitudes (list of length 3) – Amplitudes of the translations to be applied to each atom along each of the three space coordinates (in angstroms). Only relevant if finite_difference is True.

property posinp
Returns

posinp – Initial positions of the system for which phonon properties will be calculated.

Return type

Posinp

property calculator
Returns

The Calculator object to use for the Jobs necessary to perform the phonons calculations.

Return type

Calculator

property translation_amplitudes
Returns

translation_amplitudes – Displacements of atoms in all three dimensions to calculate the phonon properties. Default is 0.03 Angstroms.

Return type

float

property relax
Returns

relax – If True, which is default, the initial positions are relaxed before the phonon properties are calculated. Recommended, especially if more than one model is used.

Return type

bool

property finite_difference
Returns

finite_difference – If True, the hessian matrix is calculated using small finite movements on the atoms. Default is False.

Return type

bool

property energies
Returns

Phonon energies of the system (units: cm^-1).

Return type

numpy.array or None

property dyn_mat
Returns

Dynamical matrix deduced from the calculations.

Return type

numpy.array or None

property normal_modes
Returns

Normal modes of the system found as eigenvectors of the dynamical matrix.

Return type

numpy.array or None

run(batch_size=128, **kwargs)[source]
Parameters
  • batch_size (int) – Batch size used when passing the structures to the model

  • **kwargs – Optional arguments for the geometry optimization. Only useful if the relaxation is unstable.