In this tutorial we perform a simulation of bulk liquid water using the quantum chemistry code CP2K. This system is well-studied and often used as a benchmark for ab initio MD (AIMD) simulations. For example, you should take a look at the reference J. Phys. Chem. B 2009, 113, 35, 11959–11964. The syntax for the CP2K input file from this tutorial can be used as a starting point for other ab initio MD simulations in CP2K with modifications as needed.
In quantum mechanics both the electrons and nuclei are described using the time-dependent Schrödinger equation
\[\begin{equation}\label{EQ:SE} i \hbar \frac{\partial \Psi(r_i, R_I,t)}{\partial t} = H \Psi(r_i,R_I,t) \end{equation}\]with
\[\begin{equation}\label{EQ:Htotal} H = -\sum_I \frac{\hbar^2}{2M_I}\nabla_I^2 + H_e \end{equation}\] \[\begin{equation}\label{EQ:He} H_e = -\sum_i \frac{\hbar^2}{2m_e}\nabla_i^2 + \frac{1}{4\pi \epsilon_0}\sum_{i<j} \frac{e^2}{|\textbf{r}_i-\textbf{r}_j|} - \frac{1}{4\pi \epsilon_0}\sum_{I,i} \frac{e^2 Z_I}{|\textbf{R}_I-\textbf{r}_i|} + \frac{1}{4\pi \epsilon_0}\sum_{I<J} \frac{e^2Z_IZ_J}{|\textbf{R}_I-\textbf{R}_J|} \end{equation}\]where \(\textbf{R}_I\) is the atomic position, \(Z_I\) is the atomic charge, \(M_I\) is the atomic mass, \(\textbf{r}_i\) is the electron position and \(m_e\) is the electron mass.
In Born-Oppenheimer MD (BOMD) only the ground state wave function is included and the wave function is assumed to be always at the minimum. The BOMD equations of motion are thus:
\[\begin{equation}\label{EQ:BOMD} M_I \frac{d^2\textbf{R}_I(t)}{dt^2} = -\nabla_I \min_{\Psi_0}\left< \Psi_0 | H_e | \Psi_0\right> \end{equation}\] \[\begin{equation}\label{EQ:BOMD2} E_0 \Psi_0 = H_e \Psi_0 \end{equation}\]where we note that \(H_e\) depends on the atomic positions. The next step is to solve the electronic Schrödinger equation using some level of approximation like Hartree-Fock (HF) or Density Functional Theory (DFT). AIMD simulations are very computationally expensive as compared to classical molecular dynamics (MD) but have the great advantage of allowing for chemical bonds to break and form. Furthermore, with a suitable choice of basis set and pseudopotentials, the numerical approximations are small and these methods can be quite accurate.
DFT in CP2K is performed using the Quickstep code that uses a Gaussian and plane waves (GPW) method.
In this section we will perform Born-Oppenheimer MD of bulk liquid water containing 64 water molecules (192 atoms) in a 12.42 Å\(^3\) box. The starting configuration water.xyz is in xyz format and available here. The other file we need is a CP2K input file water.inp. A CP2K input file is divided into sections. The section &GLOBAL contains general information regarding the kind of simulations to perform and any global parameters. In our file we have specified the run-type to be MD (molecular dynamics) and set the output verbosity to low.
Next, we define the parameters needed to calculate the energy and forces with the &FORCE_EVAL section. In BOMD the forces come from the solution of the electronic Schrödinger equation. First we specify the method we are using to compute the forces as QUICKSTEP
The we need to specify the parameters need by the LCAO DFT program. In the tutorial we will use the DZVP-GTH-BLYP basis set found in the file BASIS_SET located in cp2k/data and we will use the pseudopotential of Goedecker, Teter, and Hutter (GTH) located in the POTENTIAL file in cp2k/data. We set the planewave cutoff to 340 Ry
Next, we specify the parameters to uses in the QUIKSTEP framework with the &QS section. We set the electronic structure method as GPW (Gaussian and plane waves method) and the ASPC stable predictor corrector for MD stability.
For systems with periodic boundary conditions (condensed phases) we specify the directions in which PBC applies for the electrostatics with the &POISSON section:
Now we set the parameters needed to perform the SCF run with the %SCF section. Our initial guess is the atomic wavefunction, and we set the target accuracy for SCF convergence and maximum number of SCF iterations. The subsection &OT sets the various options for the orbital transformation (OT) method. The OT method is a direct minimization scheme that allows for efficient wave function optimization for large systems.
Next for performing the DFT calculation we need to specify the exchange correlation potential. We specify the parameters for the exchange correlation potential in the section &XC. In this tutorial we will use the BLYP functional
Lastly we specify the print options for the DFT part of the code with the &PRINT section and then end the &DFT section
After specifying the DFT section, we specify the subsystem coordinates, topology, and cell size with the &SUBSYS section. We specify the unit cell dimensions (in Angstroms) with the &CELL section. Next we specify the atomic coordinates in XYZ format. Finally, we specify the basis set and pseudopotential to use for each atom type and the end the &FORCE_EVAL section
In the section &MOTION we define the molecular dynamics parameters for propagating the atomic coordinates (nuclei). We are performing molecular dynamics in the NVT ensemble. We set the time step for the equation of motion to 0.5 fs. The temperature will be controlled by the velocity rescaling thermostat.
Finally, before we end the &MOTION section we will specify what properties of the MD run to print and how often.
Once you understand the input file water.inp, you are now ready to run the simulation
The trajectory file WATER-pos-1.xyz is in xyz format and can be viewed using programs like Molden or VMD. See if you can create a representation that shows the dynamic hydrogen bond network. The python script calc_gofr.py will compute the radial distribution function between atoms given a trajectory in xyz format. To run the script type:
The above script will calculate the radial distribution function between pairs of oxygen atoms. The peak in the O-O radial distribution function occurs at roughly 2.8 Å which is the well known average hydrogen bond length in water.
A plot of the radial distribution function \(g_{OO}(r)\) is shown below:
The other output file is the .ener file WATER-1.ener that contains information about the energy and temperature during the simulation. Using gnuplot compare columns 4,5 and 6 which are the temperature, potential energy, and conserved quantity.
The structure file hydronium.xyz contains a single hydronium ion in a system with 5 other water molecules. We can run the simulation as before, except that now the total charge of the system is +1. Modify the water.inp file such that
We have also made the system smaller to speed up the calculation, so we need to update the box size accordingly and make sure the input coordinate file is specified to hydronium.xyz:
Now, run the simulation as before:
When the simulation finishes, see if you can visualize the Grotthuss mechanism