Phononschnet

class mybigdft.ml_workflows.Phononschnet(init_state, relax=True, translation_amplitudes=None, order=3)[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 obtained with the SchnetPack package.

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. 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 used in the run() method. In doubt, relax parameter should be ignored.

The distance of the displacement in each direction is controlled by translation_amplitudes (one amplitude per space coordinate must be given). The order of the numerical differenciation is determined by the order parameter.

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

Parameters
  • init_state (mybigdft.Posinp) – Initial positions of the system under consideration.

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

  • 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).

  • order (int) – Order of the numerical differentiation used to compute the dynamical matrix. Can be either 1, 2 or 3.

property init_state
Returns

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

Return type

mybigdft.Posinp

property ground_state
Returns

ground_state – Relaxed positions of the system for which phonon properties will be calculated. If relax`is `False, will be the same as init_state.

Return type

mybigdft.Posinp

property translation_amplitudes
Returns

translation_amplitudes – Displacements of atoms in all three dimensions to calculate the phonon properties

Return type

list of 3 floats

property order
Returns

order – Order of the numerical differentiation used to compute the dynamical matrix. If second order (resp. first), then six (resp. three) calculations per atom are to be performed.

Return type

int

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 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(model_dir, device='cpu', batch_size=128, **kwargs)[source]
Parameters
  • model_dir (str) – Path to the model used for calculations relative to $MODELDIR (absolute path if not defined).

  • device (str) – Either “cpu” or “cuda” to run on cpu or gpu.

  • 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.