Ev curve
From EVOCD
Purpose
- Generates a POSCAR file for each lattice parameter in a specified range, or, for Quantum Espresso, edits the lattice parameter in one you provide
- Executes VASP or Quantum Espresso
- 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
Usage
ev_curve fcc 3.63
The INCAR, KPOINTS, and POTCAR files must be in the same directory.
For VASP, the script should be edited with the path to your vasp executable, as well as your version of the evfit program and cleanvaspfiles script. For Quantum Espresso, you will need to provide an input script names *.ev.in, where * is the name of your structure in all lowercase.
Source
If you are using VASP:
#!/bin/bash # Remove old files rm EvsA EvsV evfit.4 grace SUMMARY sT="$(date +%s)" # Set the range and number of points generated low=`echo 0.8\*$2 | bc` # Sets the lower bound to 80% of guess high=`echo 1.2\*$2 | bc` # Sets the upper bound to 120% of guess step=`echo "($high-$low)/20" | bc -l` # Sets stepsize such that 20 points are created for a in `seq -w $low $step $high` do echo "a= $a" # Lattice vectors with fewest atoms if [ "$1" == fcc ] then natom=1 cat >POSCAR <<! Atom positions $a 0.0 0.5 0.5 0.5 0.0 0.5 0.5 0.5 0.0 1 Cartesian 0.0 0.0 0.0 ! elif [ "$1" == bcc ] then natom=1 cat >POSCAR <<! Atom positions $a -0.5 0.5 0.5 0.5 -0.5 0.5 0.5 0.5 -0.5 1 Cartesian 0.0 0.0 0.0 ! elif [ "$1" == hcp ] then natom=2 cat >POSCAR <<! Atom positions $a 1.0 0.0 0.0 -0.5 0.866 0.0 0.0 0.0 1.633 2 Cartesian 0.0 0.0 0.0 0.0 0.57735 0.8165 ! fi # Run VASP with the new POSCAR file # Must provide path to executable mpirun -np 4 vasp # 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/1}'` E=`echo "$E/$natom" | bc -l` 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 with equation of state 4 cat <<! | ./evfit $1 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" totT="$(($(date +%s)-sT))" tail +5 evfit.4|awk '{print $1,"\t", $2,"\t", $3}' > grace echo "Data for $1" >> 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
If you are using Quantum Espresso:
#!/bin/bash # usage: ev_curve <structure> <alat_guess> # ev_curve fcc 3.61 # # The script also requires input scripts for each structure named as follows: # fcc.ev.in # bcc.ev.in # hcp.ev.in # These scripts will define the pseudopotential, structure, and calculation parameters # Remove old files rm EvsA EvsV evfit.4 SUMMARY sT="$(date +%s)" # Set the range and number of points generated low=`echo 0.8\*$2 | bc` # Sets the lower bound to 80% of guess high=`echo 1.2\*$2 | bc` # Sets the upper bound to 120% of guess step=`echo "($high-$low)/20" | bc -l` # Sets stepsize such that 20 points are created for a in `seq -w $low $step $high` do #a=2.9 echo "a= $a" a_au=`echo "$a/0.529" | bc -l` # Lattice vectors with fewest atoms if [ "$1" == fcc ] || [ "$1" == bcc ] then natom=1 elif [ "$1" == hcp ] then natom=2 fi input=$1.ev.in # sed the lattice parameter curr=`grep "celldm(1)" $input | awk '{print $4}'` sed -i "s/celldm(1) $curr/celldm(1) =$a_au,/g" $input # Run Quantum Espresso with the correct input deck # Must provide path to executable pw.x < $input > pw_ev.out # Gather energy and volume data from the output file # Store the data in "EvsA" and "EvsV" text files V=`grep volume pw_ev.out | awk '{print $4}'` E=`grep "! *[ ] total energy" pw_ev.out | awk '{print $5}'` # Convert volume to Ang^3 and energy to eV V=`echo "$V*0.1481847" | bc -l` E=`echo "$E/$natom*13.605685" | bc -l` echo $a $E >> EvsA echo $V $E >> EvsV # Restart done # Once VASP has been run for each lattice parameter in the range # Run evfit routine with equation of state 4 cat <<! | ./evfit $1 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" totT="$(($(date +%s)-sT))" echo "Data for $1" >> 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