# Ab initio Molecular Dynamics with FHI-aims and i-PI

Prepared by Karen Fidanyan, Eszter Sarolta Pós and Mariana Rossi (based on previous years tutorials with contributions from: Yair Litman, Marcin Krynski, Nathaniel Raimbault, Luca Ghiringhelli)

We aim to introduce techniques that solve the classical equations of motion for a system of interacting particles. The strategy we adopt is molecular dynamics (MD). In the MD framework, a system of particles is propagated in time, given initial positions and momenta, by numerical integration of Newton's equations of motion. This technique samples the potential energy surface of a system at constant energy (microcanonical ensemble) and at constant temperature (canonical ensemble). As long as the ergodic hypothesis is valid, we will be able to relate the time-averaged parameters (or properties) to the thermodynamic averages over the corresponding statistical ensemble.

We will use the Born-Oppenheimer MD, that is, the degrees of freedom of the nuclei are decoupled from the degrees of freedom of the electrons (Born-Oppenheimer approximation). Additionally, the nuclei are treated as classical particles. Therefore, the forces between the particles are evaluated by performing DFT calculations for each time step.

## Location of the tutorial material

All files related to the tutorial, including solutions, can be found at https://gitlab.com/FHI-aims-club/tutorials/molecular-dynamics-with-i-pi.

## The Objective

In this tutorial, the electronic structure problem is solved via Density Functional Theory (DFT) using the FHI-aims code and the nuclei problem is managed by the i-PI code. i-PI works through a client-server paradigm, where the ab initio code, in this case FHI-aims, is the client that provides the calculation of interatomic forces, and i-PI is the server that provides the evolution of the equations of motion that sample the desired ensemble. You will learn the basics of driving FHI-aims with i-PI.

All the necessary theoretical background about statistical mechanics and ab initio molecular dynamics needed for a good understanding of this tutorial can be found in the 2019's lecture of Luca Ghiringhelli: Ab initio statistical mechanics and molecular dynamics. This year's lecture by Mariana Rossi is available following the link: Ab initio statistical mechanics and molecular dynamics.

## Prerequisites

• A sufficient understanding about the basics of running FHI-aims is required. Please review our tutorial Basics of Running FHI-aims if you have not yet done so and/or if you are unfamiliar with the code.

• A sufficiently powerful computer. For this tutorial a laptop with at least four (physical cores) should be sufficient. Moreover, timing informations available at the front of each exercise denote approximate runtimes of each task on a 4-core laptop. These include time spent on setting up input files and following instructions step by step, too.

• The FHI-aims and i-PI code distribution must be present on this computer.

• A Python installation, version >=3.6, and Numpy.

## Summary of the tutorial

The tutorial consists of five exercises. All of them are based on a paradigmatic system, namely, the gas-phase (isolated) H$$_5$$O$$_2$$$$^+$$, the Zundel cation.

Part 1 is a quick, introductory exercise that presents the machinery we will use through the tutorial. In particular, you will learn how to setup the i-PI and FHI-aims inputs.

Part 2 and Part 3 pose the problem of choosing the right settings for obtaining a stable and reliable molecular dynamics trajectory. In particular we will investigate the effect of the self-consistent cycle and force convergence thresholds as well as the influence of the size of the time step.

Part 4 deals with the choice of a thermostat for simulating the canonical ensemble, i.e., the contact between your system of interest and a thermal reservoir. In this tutorial we will focus on the so-called stochastic thermostats. Other implementations, for example based on extended Lagrangians exist as well, and will be briefly explained in the exercise. Also, we will introduce the concept of statistical uncertainty and learn how to estimate it.

Part 5 shows how to perform vibrational analysis in harmonic approximation with i-PI.

In Part 6, we focus on the free energy calculation. We look at the difference between harmonic approximation, obtained from lattice dynamics approach, and an anharmonic free energy, calculated using thermodynamic integration.

Part 7 introduces how to set up constant pressure dynamics runs using the barostat functionality of i-PI combined with FHI-aims. The example showcases dynamics on a periodic system of copper-chloride.