VASP Computing Bulk Modulus of Au: Difference between revisions

From Micro and Nano Mechanics Group
Jump to navigation Jump to search
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 3: Line 3:
VASP: Computing Bulk Modulus of Au</STRONG></font></P>
VASP: Computing Bulk Modulus of Au</STRONG></font></P>
<DIV>
<DIV>
<P ALIGN="CENTER"><STRONG> </STRONG></P>
<P ALIGN="CENTER"><STRONG>Modified by Yanming Wang (Sep, 2015) </STRONG></P>
</DIV>
</DIV>


Line 14: Line 14:


<pre>
<pre>

ENCUT = 400
ISMEAR = 1
PREC = High

ISTART = 0
ICHARG = 2
ISMEAR = 1
SIGMA = 0.1
SIGMA = 0.1

EDIFF = 1E-09
NELM = 40
ENMAX = 500
ENCUT = 500

ISIF = 2
NSW = 100
IBRION = 2
</pre>
</pre>


Line 33: Line 46:
<pre>
<pre>
POSCAR for FCC Au (created manually)
POSCAR for FCC Au (created manually)
4.068
4.068
0 0.5 0.5
1.0 0 0
0.5 0 0.5
0 1.0 0
0.5 0.5 0
0 0 1.0
4
1
selective dynamics
Cartesian (real coordinates r)
direct (real coordinates r)
0 0 0
0 0 0 T T T
0.5000 0.5000 0 T T T
0 0.5000 0.5000 T T T
0.5000 0 0.5000 T T T
</pre>
</pre>


'''POTCAR'''
To do this calculation, you also need to put the LDA pseudopotential file as <tt>POTCAR</tt> in this directory.
A POTCAR file that specifies the pseudopotential is required to be in the same directory. In this example, we will present the results from two calculations with US-LDA PP and PAW-LDA PP.


===Run VASP===
===Run VASP===


We can write one .pbs script to submit the VASP simulation request to the cluster.
Now we are ready to run


Using MC2 cluster as an example, we provide the following <tt>vasp.pbs</tt> for the calculation of equilibrium lattice constant, cohesive energy and bulk modulus of Au. The goal of this script is to run <tt>vasp</tt> in iterations with different lattice constants.
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>
<pre>
#!/bin/bash
#!/bin/bash
#PBS -N vasp.Au
rm WAVECAR
#PBS -j oe
for a in 4.056 4.058 4.060 4.062 4.064 4.066 4.068
#PBS -l nodes=1:ppn=8,walltime=48:00:00
#PBS -V

### ---------------------------------------
### BEGINNING OF EXECUTION
### ---------------------------------------

echo The master node of this job is `hostname`
echo The working directory is `echo $PBS_O_WORKDIR`
echo This job runs on the following nodes:
echo `cat $PBS_NODEFILE`

ncpu=`cat $PBS_NODEFILE | wc -w`
echo "Number of processors = $ncpu "

### end of information preamble

cd $PBS_O_WORKDIR

echo $PWD

cd $PBS_O_WORKDIR

module load vasp

rm WAVECAR
for a in 4.064 4.065 4.066 4.067 4.068 4.069 4.070 4.071 4.072
do
do
cat > POSCAR << FIN
cat > POSCAR << FIN
POSCAR for FCC Au (created manually)
POSCAR for FCC Au (created manually)
$a
$a
0 0.5 0.5
1.0 0 0
0.5 0 0.5
0 1.0 0
0.5 0.5 0
0 0 1.0
1
4
selective dynamics
Cartesian (real coordinates r)
direct (real coordinates r)
0 0 0
0 0 0 T T T
0.5 0.5 0 T T T
0 0.5 0.5 T T T
0.5 0 0.5 T T T
FIN
FIN


echo "a=$a"
echo "a=$a ncpu=$ncpu"

./vasp
cmd="mpiexec -np $ncpu vasp"
$cmd >& vasp.log


E=`tail -1 OSZICAR`
E=`tail -1 OSZICAR`
Line 80: Line 129:
</pre>
</pre>


To submit the job, make sure '''POTCAR''', '''INCAR''' and '''KPOINTS''' are placed in the same folder of your '''PBS''' script, and then type the following command.
qsub vasp.pbs


===Analyze data===
===Analyze data===


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>.
After the simulation is finished, it will create data files <tt>Elatt.B.dat</tt> and <tt>platt.B.dat</tt>.


For simulation with US-LDA PP, the result files should be similar to
Launch <tt>octave</tt> and run the following functions [[media:fit_a0EB.m.txt | fit_a0EB.m]] and [[media:fit_a0B.m.txt | fit_a0B.m]],
<tt>Elatt.B.dat</tt>
<pre>
4.064 1 -.17546329E+02 -.17546306E+02 -.175463E+02
4.065 1 -.17546473E+02 -.17546449E+02 -.175465E+02
4.066 1 -.17546574E+02 -.17546550E+02 -.175466E+02
4.067 1 -.17546633E+02 -.17546607E+02 -.175466E+02
4.068 1 -.17546649E+02 -.17546622E+02 -.175466E+02
4.069 1 -.17546622E+02 -.17546594E+02 -.175466E+02
4.070 1 -.17546553E+02 -.17546524E+02 -.175466E+02
4.071 1 -.17546441E+02 -.17546412E+02 -.175464E+02
4.072 1 -.17546288E+02 -.17546257E+02 -.175463E+02
</pre>


fit_a0EB('Elatt.B.dat');
<tt>platt.B.dat</tt>
<pre>
fit_a0B ('platt.B.dat');
4.064 5.34 5.34 5.34
4.065 3.95 3.95 3.95
4.066 2.56 2.56 2.56
4.067 1.18 1.18 1.18
4.068 -0.20 -0.20 -0.20
4.069 -1.57 -1.57 -1.57
4.070 -2.93 -2.93 -2.93
4.071 -4.29 -4.29 -4.29
4.072 -5.63 -5.64 -5.64
</pre>


Launch <tt>Matlab</tt> and run the following functions [[media:fit_a0EB.m.txt | fit_a0EB.m]] and [[media:fit_a0B.m.txt | fit_a0B.m]],
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.06 angstrom, Ecoh = -4.39 eV, B = 190 GPa.

===Parallel computation===

To run <tt>vasp</tt> in parallel, you need to submit [[media:vasp.pbs.txt | vasp.pbs]] as

qsub vasp.pbs


[a0, Ecoh, B] = fit_a0EB('Elatt.B.dat',4,4);
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. For simulation with US-LDA PP, the result is a0 = 4.068 <math>\AA</math>, Ecoh = -4.39 eV, B = 186 GPa.
You will need the following two files to do this calculation in parallel on SU-AHPCRC:
[[media:auto.B.par.Au.txt | auto.B.par]] and
[[media:B.pbs.Au.txt | B.pbs]].

Latest revision as of 09:15, 4 September 2015

VASP: Computing Bulk Modulus of Au

Modified by Yanming Wang (Sep, 2015)


Input files

Here we give an example of how to use VASP to compute the bulk modulus of LDA-Au. We performed this calculation on MC-CC in serial model in the ~/Codes/VASP/runs/Au/LDA/perfect.21x21x21 directory. This directory contains the following files.

INCAR


PREC = High

ISTART = 0 
ICHARG = 2  
ISMEAR = 1
SIGMA = 0.1

EDIFF  = 1E-09  
NELM = 40      
ENMAX = 500     
ENCUT = 500    

ISIF = 2 
NSW = 100  
IBRION = 2  

KPOINTS

21x21x21
0        0 = automatic generation of k-points
Monkhorst
21 21 21
0 0 0

POSCAR

POSCAR for FCC Au (created manually)
4.068 
1.0  0    0
0    1.0  0
0    0    1.0
4
selective dynamics
direct  (real coordinates r)
0       0       0       T T T
0.5000  0.5000  0       T T T
0       0.5000  0.5000  T T T
0.5000  0       0.5000  T T T

POTCAR A POTCAR file that specifies the pseudopotential is required to be in the same directory. In this example, we will present the results from two calculations with US-LDA PP and PAW-LDA PP.

Run VASP

We can write one .pbs script to submit the VASP simulation request to the cluster.

Using MC2 cluster as an example, we provide the following vasp.pbs for the calculation of equilibrium lattice constant, cohesive energy and bulk modulus of Au. The goal of this script is to run vasp in iterations with different lattice constants.

#!/bin/bash
#PBS -N vasp.Au
#PBS -j oe
#PBS -l nodes=1:ppn=8,walltime=48:00:00
#PBS -V

### ---------------------------------------
### BEGINNING OF EXECUTION
### ---------------------------------------

echo The master node of this job is `hostname`
echo The working directory is `echo $PBS_O_WORKDIR`
echo This job runs on the following nodes:
echo `cat $PBS_NODEFILE`

ncpu=`cat $PBS_NODEFILE | wc -w`
echo "Number of processors = $ncpu "

### end of information preamble

cd $PBS_O_WORKDIR

echo $PWD

cd $PBS_O_WORKDIR

module load vasp

rm WAVECAR
for a in 4.064 4.065 4.066 4.067 4.068 4.069 4.070 4.071 4.072
do
cat > POSCAR << FIN
POSCAR for FCC Au (created manually)
   $a 
   1.0  0    0
   0    1.0  0
   0    0    1.0
   4
selective dynamics 
direct  (real coordinates r)
   0    0    0    T T T
   0.5  0.5  0    T T T
   0    0.5  0.5  T T T
   0.5  0    0.5  T T T
FIN

echo "a=$a  ncpu=$ncpu"

cmd="mpiexec -np $ncpu vasp"
$cmd >& vasp.log

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

To submit the job, make sure POTCAR, INCAR and KPOINTS are placed in the same folder of your PBS script, and then type the following command.

qsub vasp.pbs

Analyze data

After the simulation is finished, it will create data files Elatt.B.dat and platt.B.dat.

For simulation with US-LDA PP, the result files should be similar to Elatt.B.dat

4.064 1  -.17546329E+02  -.17546306E+02 -.175463E+02
4.065 1  -.17546473E+02  -.17546449E+02 -.175465E+02
4.066 1  -.17546574E+02  -.17546550E+02 -.175466E+02
4.067 1  -.17546633E+02  -.17546607E+02 -.175466E+02
4.068 1  -.17546649E+02  -.17546622E+02 -.175466E+02
4.069 1  -.17546622E+02  -.17546594E+02 -.175466E+02
4.070 1  -.17546553E+02  -.17546524E+02 -.175466E+02
4.071 1  -.17546441E+02  -.17546412E+02 -.175464E+02
4.072 1  -.17546288E+02  -.17546257E+02 -.175463E+02

platt.B.dat

4.064 5.34 5.34 5.34
4.065 3.95 3.95 3.95
4.066 2.56 2.56 2.56
4.067 1.18 1.18 1.18
4.068 -0.20 -0.20 -0.20
4.069 -1.57 -1.57 -1.57
4.070 -2.93 -2.93 -2.93
4.071 -4.29 -4.29 -4.29
4.072 -5.63 -5.64 -5.64

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

[a0, Ecoh, B] = fit_a0EB('Elatt.B.dat',4,4);
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. For simulation with US-LDA PP, the result is a0 = 4.068 , Ecoh = -4.39 eV, B = 186 GPa.