# 5. Molecular dynamics

This tutorial will use MLatom@XACS program. See its manual and tutorials for more details.

In this workshop tutorial, we mentioned several times that you can use different models and methods implemented in MLatom ranging from your own ML models to pure QM methods for different kinds of simulations, e.g., to make new predictions, geometry optimizations, frequency calculations, dynamics, spectra simulations, etc.

Here we show how to run molecular dynamics with MLatom.

Note

MLatom also supports machine learning methods for quantum dissipative dynamics via the interface to Arif Ullah’s MLQD package.

Here we will use the KREG model of ethanol already pre-trained for you and run molecular dynamics with it. This model was trained with the KREG model, which employs kernel ridge regression (KRR) with relative-to-equilibrium (RE) descriptor and Gaussian kernel. Input file looks like this:

```
MD # molecular dynamic
initXYZ=ethanol.xyz # initial geometry; Unit: Angstrom
initVXYZ=ethanol.vxyz # initial velocity; Unit: Angstrom/fs
dt=0.3 # time step; Unit: fs
trun=30 # total time; Unit: fs
MLprog=MLatomF # KREG model is implemented in the Fortran part of MLatom (MLatomF)
MLmodelIn=ethanol.unf # file that saves the model
thermostat=nose-hoover # NVT ensemble (Nosé-Hoover thermostat)
temp=300 # temperature for NVT; Unit: K
```

The KREG model is implemented in the Fortran part of MLatom (`MLatomF`

), so we use `MLprog=MLatomF`

here. The input files such as the `initial geometry`

, `initial velocity`

and `ML model`

can be downloaded here. See this paper on implementation details of the KREG model as well as this tutorial on how to train your own KREG model.

After the simulations finish, you can find in the trajectory files in different formats:

H5MD in the file with the extension

`.h5`

XYZ file with trajectory snapshots in

`traj.xyz`

fileXYZ velocities in

`traj.vxyz`

kinetic, potential and total energies in

`traj.ekin`

,`traj.epot`

, and`traj.etot`

files.

Note

We have also developed a radically new way of running dynamics by learning molecules directly in the 4D spacetime, i.e., by creating AI models which can predict nuclear coordinates as a function of time. See our preprint.