Yesterday, I installed a new version of the Atomic Simulation Environment on Triolith. ASE allows you to script your ab initio calculations using Python. Here comes a tutorial on how you can run VASP calculations with ASE on Triolith. It is a little bit more elaborate than the official documentation of VASP module which can be found on the ASE web site.
First, we need to load the Python and ASE modules. I recommend the python/2.7.4-snic-1
module.
module load python/2.7.4-snic-1 ase/3.7.1
Next, we need to tell ASE’s VASP module where to find the VASP binaries and the POTCARs files.
export VASP_COMMAND="mpprun /software/apps/vasp/5.3.3-18Dec12/default/vasp"
export VASP_PP_PATH=/software/apps/vasp/POTCARs
Note that ASE requires that there are directories called potpaw
, potpaw_GGA
and potpaw_PBE
below the VASP_PP_PATH
, so you may have to create symlinks with these names if you don’t have them in your own database.
Now, we need to create the actual ASE Python script that sets up the calculation. The idea in this little example is to calculate the equilibrium volume and bulk modulus of hcp Mg.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
The script works like this: first, we create cells for 10 different volumes and at the same time attach VASP settings to them, then we call get_potential_energy()
for each of these cells and collect the energies and volumes, and finally, we use ASE’s built-in equation of state subroutine to calculate the equilibrium volume and bulk modulus.
To run this script on a Triolith compute node, we need to create a job script. In the job script, we just launch the Python script, which will start ASE and then launch VASP for us.
#!/bin/bash
#SBATCH -J mg
#SBATCH -N 1
#SBATCH --exclusive
#SBATCH -t 0:10:00
python mg-hcp.py
Submit by sbatch
as usual.
sbatch mg.sh
When the job has completed (it should not take more than a few minutes), look in the slurm.out file for the output from ASE.
[pla@triolith1 asetest]$ cat slurm-693921.out
Calculation output
------------------
Volumes: [30.469003876435877, 32.782153276649034, 35.209509626875203, 37.753824901813466, 40.417851076162975, 43.204340124622782, 46.116044021892051, 49.155714742669836, 52.326104261655324, 55.629964553547552]
Energies: [-1.86460718, -2.2747034, -2.5757448, -2.78654685, -2.92182549, -2.99416931, -3.01374966, -2.99022215, -2.93151648, -2.84418079]
Equation of state parameters
----------------------------
E0: -3.013844 eV
V0: 45.9 A^3
B: 36.5 GPa
The experimental bulk modulus of Mg is ca 45 GPa, so the result seems reasonable.