Micro and Nano Mechanics Group
Revision as of 00:08, 24 September 2008 by Caiwei (Talk)

In this document, we describe how to compile VASP program on several computer clusters in the Mechanical Engineering Department of Stanford University. These include mc-cc, wcr, and su-ahpcrc, all of which are linux clusters. We then give an example of how to use VASP to compute the bulk modulus of Au.

Compile VASP on MC-CC

In general we follow the instructions given in http://cms.mpi.univie.ac.at/vasp/vasp/node16.html

First, go to vasp.4.lib/ directory, copy the vasp.4.lib/makefile.mc-cc file to Makefile and then type

make clean
make

This will create libdmy.a in this directory.

Next, go to vasp.4.6/ directory, copy the vasp.4.6/makefile.mc-cc file to Makefile and then type

make clean
make

This will create executable vasp in this directory.

Notice that in both makefiles, we use the /opt/mpich/intel/bin/mpif90 compiler. Different clusters have different mpi compilers and they have different speeds. Intel compilers usually perform better than generic compilers on intel linux clusters. Make sure in your directories, you do not have another file named makefile, which takes precedence over Makefile.

The binary (executable) file vasp can run in both serial mode (e.g. ./vasp) and parallel mode (e.g. mpiexec -np 4 vasp in a PBS script). In the benchmark case of one Au atom (more detail below), the serial run of this executable takes 68 seconds to finish (see OUTCAR file). In comparison, the executable on /share/apps/vasp.4.6/bin/vasp takes 116<tt> seconds to finish.

We running on 2 CPUs, our executable takes <tt>50<tt> seconds to finish. In comparison, the executable on <tt>/share/apps/vasp.4.6/bin/vasp takes ???<tt> seconds to finish.

MISC

First, go to vasp.4.lib/ directory, copy the vasp.4.lib/makefile.su-ahpcrc file to <tt>makefile and then type

rm -f *.o *.a
make

This will create libdmy.a in this directory.

Next, go to vasp.4.6/ directory, copy the vasp.4.6/makefile.su-ahpcrc file to makefile and then type

rm -f *.o vasp
cp base.f base.F
make

This will create executable vasp in this directory.

Notice that in both cases, we use the mpif90 compiler. Do not use make clean. It may delete some important files and you may regret it.

Finally, you need to add the following lines in your ~/.bash_profile file. The most important part is the last section on the mpi libraries.

LD_LIBRARY_PATH=/opt/intel/mkl/10.0.1.014/lib/em64t:/opt/intel/itac/7.1/itac/slib_impi3:
/opt/intel/fce/10.1.011/lib:/opt/intel/cce/10.1.011/lib:/usr/mpi/intel/mvapich-0.9.9/lib/shared

export LD_LIBRARY_PATH

Unfortunately, the executable vasp does not work for the case provided in the example directory.

In the following, we give an example of how to use VASP to compute the bulk modulus of LDA-Au. We performed this calculation in the runs/Au/LDA/perfect.21x21x21 directory. This directory contains the following files.

INCAR
ENCUT  =  400
ISMEAR  = 1
SIGMA = 0.1
<pre>

 KPOINTS

<pre>
21x21x21
0        0 = automatic generation of k-points
Monkhorst
21 21 21
0 0 0
POSCAR
POSCAR for FCC Au (created manually)
   4.068 
   0    0.5  0.5
   0.5  0    0.5
   0.5  0.5  0
   1 
Cartesian  (real coordinates r)
   0    0    0

To do this calculation, you also need to put the LDA pseudopotential file as POTCAR in this directory.

Now we are ready to run

vasp

To compute the equilibrium lattice constant, cohesive energy and bulk modulus, we use the following script auto.B.serial to run vasp repeated with different lattice constants.

#!/bin/bash
rm WAVECAR 
for a in 4.056 4.058 4.060 4.062 4.064 4.066 4.068
do
cat > POSCAR << FIN
POSCAR for FCC Au (created manually)
   $a 
   0    0.5  0.5
   0.5  0    0.5
   0.5  0.5  0
   1 
Cartesian  (real coordinates r)
   0    0    0
FIN

echo "a=$a"
./vasp

E=`tail -1 OSZICAR`
echo $a $E | sed -s 's/F=//; s/E0=//; s/d E =//;' >> Elatt.B.dat

p=`grep pressure OUTCAR | cut -b 25-34`
echo $a $p >> platt.B.dat

done

After running it as ./auto.B.serial, it will create data files Elatt.B.dat and platt.B.dat.

Launch octave and run the following functions fit_a0EB.m and fit_a0B.m,

fit_a0EB('Elatt.B.dat');
fit_a0B ('platt.B.dat');

The first line fits the energy data to a quadratic curve and computes the equilibrium lattice constant, cohesive energy and bulk modulus. The second line fits the pressure data to a linear curve and computes the equilibrium lattice constant and bulk modulus. In this example, the result is a0 = 4.60 angstrom, Ecoh = -4.39 eV, B = 190 GPa.

To run vasp in parallel, you need to submit vasp.pbs as

qsub vasp.pbs