How to compile VASP: Difference between revisions

From Micro and Nano Mechanics Group
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 5: Line 5:
First, go to vasp.4.lib/ directory, copy the [[media:vasp.4.lib_makefile.su-ahpcrc.txt‎ | vasp.4.lib/makefile.su-ahpcrc]] file to <tt>makefile</tt> and then type
First, go to vasp.4.lib/ directory, copy the [[media:vasp.4.lib_makefile.su-ahpcrc.txt‎ | vasp.4.lib/makefile.su-ahpcrc]] file to <tt>makefile</tt> and then type


rm -f *.o *.a
make
make

This will create <tt>libdmy.a</tt> in this directory.


Next, go to vasp.4.6/ directory, copy the [[media:vasp.4.6_makefile.su-ahpcrc.txt‎ | vasp.4.6/makefile.su-ahpcrc]] file to <tt>makefile</tt> and then type
Next, go to vasp.4.6/ directory, copy the [[media:vasp.4.6_makefile.su-ahpcrc.txt‎ | vasp.4.6/makefile.su-ahpcrc]] file to <tt>makefile</tt> and then type


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


This will create executable <tt>vasp</tt> in this directory.
Notice that in both cases, we use the <tt>mpif90</tt> compiler.

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


Finally, you need to add the following lines in your <tt>~/.bash_profile</tt> file. The most important part is the last section on the <tt>mpi</tt> libraries.
Finally, you need to add the following lines in your <tt>~/.bash_profile</tt> file. The most important part is the last section on the <tt>mpi</tt> libraries.
Line 17: Line 24:
<pre>
<pre>
LD_LIBRARY_PATH=/opt/intel/mkl/10.0.1.014/lib/em64t:/opt/intel/itac/7.1/itac/slib_impi3:
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/fce/10.1.011/lib:/opt/intel/cce/10.1.011/lib:/usr/mpi/intel/mvapich-0.9.9/lib/shared
/opt/intel/cce/10.1.011/lib:
/usr/mpi/intel/mvapich-0.9.9/lib/shared


export LD_LIBRARY_PATH
export LD_LIBRARY_PATH
</pre>
</pre>

Unfortunately, the executable <tt>vasp</tt> does not work for the case provided in the <tt>example</tt> 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 <tt>runs/Au/LDA/perfect.21x21x21</tt> directory. This directory contains the following files.

INCAR

<pre>
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
</pre>

POSCAR

<pre>
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
</pre>

To do this calculation, you also need to put the LDA pseudopotential file as <tt>POTCAR</tt> 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 <tt>auto.B.serial</tt> to run <tt>vasp</tt> repeated with different lattice constants.

<pre>
#!/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
</pre>

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

Launch <tt>octave</tt> and run the following functions [[media:fit_a0EB.m]] and [[media: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.

Revision as of 22:35, 19 September 2008

In this document, we describe how to compile VASP program on su-ahpcrc.stanford.edu (Linux 64-bit parallel cluster).

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.su-ahpcrc file to 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 media:fit_a0EB.m and media: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.