A fast and precise DFT wavelet code

Molecular Dynamics using BigDFT

A fast and precise DFT wavelet code
Jump to: navigation, search

Run a microcanonical ensemble run of water molecule in vacuo

MD keywords are to be defined in the input section under md:

 md:
     mdsteps: 3000
     timestep: 20.0
     temperature: 300.0
     print_frequency: 10
     wavefunction_extrapolation: 2

mdsteps keyword specifies the no. of MD integration steps, and timestep defines the time step in a.u. Note that 1 a.u. of time is 0.024 fs. For water, we use 0.5 fs as the integration time step. The initial temperature of the simulation is specified by the keyword temperature (in K).

The frequency of printing of MD information in the energy.dat and Trajectory.xyz files can be controlled by the keyword print_frequency. Temperature, kinetic energy, potential energy and total energy are printed in the output file which can be parsed by "(MD):" The same information is also printed in the energy.dat file. Positions and velocities of nuclei are printed in Trajectory.xyz file.

For Born-Oppenheimer MD, the initial guess of the wavefunction for the SCF of every MD step can be extrapolated from the previous MD steps using the keyword wavefunction_extrapolation. Activation of this keyword also requires that inputpsiid: 1 is set. By default, wavefunction_extrapolation is 0, and the converged wavefunction of the previous MD step is used as the initial guess. By using wavefunction_extrapolation to 1, a linear extrapolation is used, and for a value of 2, a quadratic extrapolation is performed. Higher order extrapolations were found to be inefficient and thus these options are not activated.

One begins the MD simulation by defining the coordinates using the file posinp.xyz.

The full input is in input.yaml

 dft:
   hgrids: [0.4, 0.4, 0.4]
   rmult: [6.0, 8.00]
   ixc: PBE
   qcharge: 0
   nspin: 1
   mpol: 0
   gnrm_cv: 5.e-2
   nrepmax: 2
   itermax: 40
   ncong: 1
   idsx: 10
   disablesym: No
   inputpsiid: 1
   calculate_strten: No
 perf:
   projrad: 8.000
   unblock_comms: DEN
   psp_onfly: No
   verbosity: 0
 md:
   mdsteps: 3000
   timestep: 25.0
   temperature: 300.0
   print_frequency: 10
   wavefunction_extrapolation: 2

On running, two main output files are written by BigDFT. First is the energy.dat file. This contains data in the order: {md step number}, {instantaneous temperature in K}, {nuclear kinetic energy in Ha}, {potential energy in Ha}, and {total energy in Ha}.

Plotting energy.dat 1:4 and 1:5 together shows that total energy is well conserved <<make this figure>>. Plotting 1:3, 1:4, and 1:5 indicates that energy as potential energy decreases kinetic energy increases and vice versa, thus the total energy is a constant.

One may load Trajectory.xyz in v_sim or in vmd to visualize the trajectory as a movie. The trajectory file is in .xyz file format. The fifth, sixth and the seventh columns of this file contains atomic velocities in a.u. Velocities may be further post-processed to compute various properties.

After every MD steps, md.restart file is written in the data directory of the runs. These files can be used to restart the MD run (i.e. restarting both position and velocities) by adding the following keywords in the md: section.

    restart_pos: Yes
    restart_vel: Yes


Run a canonical ensemble run of water molecule in vacuo

Let us now run a canonical ensemble MD for the same system.

We can restart the microcanonical run we carried out in the previous simulation. For that, let us run the new simulation in a folder nvt_run made in the folder where we ran microcanonical MD. To prepare the files for the restart, do the following:

mkdir nvt_run
cd nvt_run
cp -rp ../data .                  #this copies the retart file <tt>md.restart</tt>
cp ../input.yaml ../posinp.xyz .  #the input and the <tt>posinp.xyz</tt> files are copied. 

Note that posinp.xyz is only a dummy file for this run, as we will use md.restart file to restart the coordinates.

For obtaining a canonical distribution, we need to activate Nose-Hoover Chain thermostat. This can be achieved by adding the following keyword in the input.yaml which we used for the above runs. Run a microcanonical ensemble run of water molecule in vacuo

MD keywords are to be defined in the input section under md:

 md:
     mdsteps: 3000
     timestep: 20.0
     temperature: 300.0
     print_frequency: 10
     wavefunction_extrapolation: 2

mdsteps keyword specifies the number of MD integration steps, and timestep defines the time step in a.u. Note that 1 a.u. of time is 0.024 fs. For water, we use 0.5 fs as the integration time step. The initial temperature of the simulation is specified by the keyword temperature (in K).

The frequency of printing of MD information in the energy.dat and Trajectory.xyz files can be controlled by the keyword print_frequency. Temperature, kinetic energy, potential energy and total energy are printed in the output file which can be parsed by "(MD):" The same information is also printed in the energy.dat file. Positions and velocities of nuclei are printed in Trajectory.xyz file.

For Born-Oppenheimer MD, the initial guess of the wavefunction for the SCF of every MD step can be extrapolated from the previous MD steps using the keyword wavefunction_extrapolation. Activation of this keyword also requires that inputpsiid: 1 is set. By default, wavefunction_extrapolation is 0, and the converged wavefunction of the previous MD step is used as the initial guess. By using wavefunction_extrapolation to 1, a linear extrapolation is used, and for a value of 2, a quadratic extrapolation is performed. Higher order extrapolations were found to be inefficient and thus these options are not activated.

One begins the MD simulation by defining the coordinates using the file posinp.xyz.

The full input is in input.yaml

 dft:
   hgrids: [0.4, 0.4, 0.4]
   rmult: [6.0, 8.00]
   ixc: PBE
   qcharge: 0
   nspin: 1
   mpol: 0
   gnrm_cv: 5.e-2
   nrepmax: 2
   itermax: 40
   ncong: 1
idsx: 10
   disablesym: No
   inputpsiid: 1
   calculate_strten: No
 perf:
   projrad: 8.000
   unblock_comms: DEN
   psp_onfly: No
   verbosity: 0
 md:
   mdsteps: 3000
   timestep: 25.0
   temperature: 300.0
   print_frequency: 10
   wavefunction_extrapolation: 2

On running, two main output files are written by BigDFT. First is the energy.dat file. This contains data in the order: {md step number}, {instantaneous temperature in K}, {nuclear kinetic energy in Ha}, {potential energy in Ha}, and {total energy in Ha}.

Plotting energy.dat 1:4 and 1:5 together shows that total energy is well conserved. Plotting 1:3, 1:4, and 1:5 indicates that energy as potential energy decreases kinetic energy increases and vice versa, thus the total energy is a constant.

One may load Trajectory.xyz in v_sim or in vmd to visualize the trajectory as a movie. The trajectory file is in .xyz file format. The fifth, sixth and the seventh columns of this file contains atomic velocities in a.u. Velocities may be further post-processed to compute various properties.

After every MD steps, md.restart file is written in the data directory of the runs. These files can be used to restart the MD run (i.e. restarting both position and velocities) by adding the following keywords in the md: section.

    restart_pos: Yes
    restart_vel: Yes


Run a canonical ensemble run of water molecule in vacuo

Let us now run a canonical ensemble MD for the same system.

We can restart the microcanonical run we carried out in the previous simulation. For that, let us run the new simulation in a folder nvt_run made in the folder where we ran microcanonical MD. To prepare the files for the restart, do the following:

mkdir nvt_run
cd nvt_run
cp -rp ../data .                  #this copies the retart file <tt>md.restart</tt>
cp ../input.yaml ../posinp.xyz .  #the input and the <tt>posinp.xyz</tt> files are copied. 

Note that posinp.xyz is only a dummy file for this run, as we will use md.restart file to restart the coordinates.

For obtaining a canonical distribution, we need to activate Nose-Hoover Chain thermostat. This can be achieved by adding the following keyword in the input.yaml which we used for the above runs.

Also, we need to add:

    restart_pos: Yes
    restart_vel: Yes

to restart positions and velocities from the previous run.

In MD runs using thermostats, temperature: keyword defines the temperature to which the system has to be equilibrated.

Run the simulation with the above changes in the input. Plot the temperature (1:2) from the energy.dat file together with the same in the energy.dat from the microkinetic ensemble runs. You may notice the difference in the temperature fluctuation.

Similarly, you may also plot potential energy (1:4), and total energy (1:5) and check the energy conservation. Note that the total energy here is not the sum of kinetic energy and potential energy. It is the conserved Hamiltonian of the Nose-Hoover Chain thermostat.

It is important to note that for restarting a canonical MD run from a previous canonical MD simulation, Nose-Hoover chain thermostat variables have to be restarted as well together with the positions and velocities of atoms. The restart options are thus specified as

    restart_nose: Yes
    restart_pos: Yes
    restart_vel: Yes
Personal tools