FCC Runscript

From EVOCD
Jump to: navigation, search

< Back to Energy Volume Curves

Purpose

  • Generates a POSCAR file for each lattice parameter in a specified range
  • Executes VASP
  • Extracts energy, volume and cpu time for calculations
  • Prepares data files to plot E-V curves.
  • Fits the E-V data to Murnaghan's equation of state and extracts equilibrium volume/lattice parameter, bulk modulus and equilibrium energy to a SUMMARY file.

Implementation

  • This script cycles over a range of values for the lattice parameter. This range is controlled by the following line:
     for a in `seq -w 3.5 0.5 4.5`
    This particular loop structure starts 'a' at 3.5 and increments by 0.5 until a value of 4.5 is reached.
  • To change the range, modify either the bounds or the increment value.
  • Replace the following with the absolute path and name of the executable from the location of the directory this script is saved to (should be the same directory as the VASP executable):
     PATH_TO_EXECUTABLE 
  • Copy the source code to a text editor and save it to a VASP working directory without a file extension.

Source Code

#!/bin/sh

# Remove old files 
rm EvsA EvsV evfit.4 grace SUMMARY

sT="$(date +%s)"

# For each lattice parameter in the specified length
# Generate a FCC structure POSCAR file 
for a in `seq -w 3 0.1 3.5`
do
echo "a= $a" 

cat >POSCAR <<!
Al FCC
1.0
$a  0.00  0.00                 
0.00   $a 0.00
0.00   0.00  $a
4
Direct
0.00000000 0.00000000 0.0000000
0.50000000 0.00000000 0.5000000
0.50000000 0.50000000 0.0000000
0.00000000 0.50000000 0.5000000
!

# Run VASP with the new POSCAR file
# Must provide path to executable
mpirun -np 4 PATH_TO_EXECUTABLE

# Gather energy and volume data from the VASP outputs
# Store the data in "EvsA" and "EvsV" text files
V=`grep volume/ion OUTCAR|awk '{print $5}'`
E=`tail -n1 OSZICAR | awk '{ print $5/4}'`
totT="$(($(date +%s)-sT))"
echo $a $E >> EvsA
echo $V $E >> EvsV

# Clean up VASP files
./cleanvaspfiles

# Restart
done


# Once VASP has been run for each lattice parameter in the range
# Run evfit routine
cat <<! | evfit
FCC
4
EvsA
evfit.4
!

# Gather data from evfit output
Emin=`grep Emin evfit.4|awk '{print $2}'`
A0=`grep A0 evfit.4|awk '{print $2}'`
K0=`grep A0 evfit.4|awk '{print $4}'`

# Put that data in an output file called "SUMMARY"
tail +5 evfit.4|awk '{print $1,"\t", $2,"\t", $3}' > grace

echo "Data for Al in FCC" >> SUMMARY
echo "=================================================" >> SUMMARY
echo "Equilibrium Energy per Atom    = $Emin">>SUMMARY
echo "Equilibrium lattice constant   = $A0">>SUMMARY
echo "Bulk Modulus                   = $K0">>SUMMARY
echo "Total RUN time (sec)"          = $totT>>SUMMARY

Personal tools
Namespaces

Variants
Actions
home
Materials
Material Models
Design
Resources
Projects
Education
Toolbox