#!/bin/bash # This bash scrpit is for the interface between ATAT and Quantum-ESPRESSO v5.0 # The final result will be in eV unit # Produced by GAO Zhe, Mater. Sci & Eng, Seoul Nat'l Univ., S. Korea # email to gaozhe1983(a)snu.ac.kr # Set the k-points density in reciprocal space KPPRA=1000 # Set the command to run pw.x, for example, # if you wanna run it with 4 cores/cpus, set it # as "$MPI_PATH/mpirun -n 4 $QE_PATH/pw.x" PWCOMMAND="pw.x" # Set some calculation parameters here, which contents: # cut-off energy for wave-functions and charge density; # gaussian broadening parameter for smearing; # especially, the directory where restore your pseudo-potential files. # Definitely, you can directly set these and some other parameters # in the input file-creating part. ######################################################################## # Recommand from the official manual of Quantum-ESPRESSO: # # for Norm-Conserving pseudo-potential, the cut-off for charge density # # does not need to be setted (or, 4 times of ecutwfc). # # But for ultrasoft pseudo-potential, set the cut-off for charge # # density to 8~10 times of cut-off for wavefunctions. # ######################################################################## PseudoDIR=/usr/local/pseudo CUT_WFC= CUT_CHG= DEGAUSS= # Try to find the parameter setting file, which contents the # information for species of elements # If this file does not exist, the script will stop ParamFile=qe.param if [ ! -e $ParamFile ]; then ParamFile="../qe.param" if [ ! -e $ParamFile ]; then ParamFile="../../qe.param" if [ ! -e $ParamFile ]; then echo " Cannot find the param file qe.param, stop the code!" exit 1 fi fi fi # Create the fist part of input file for QE v5.0 cat > pwscf.in <> pwscf.in echo " ntyp = $NTYPE , " >> pwscf.in # Create the temp input file, which corresponds to # the second big part. After creating, it will be # attached follow the former one and deleted. cat > pwscf.tmp <> pwscf.in rm -f pwscf.tmp # Find and write the lattice vector information cat str.out | cellcvrt -c -sig=9 | tail -n +4 | head -3 >> pwscf.in # Find and write the information for element type, mass # and pseudo-potential files' name echo "ATOMIC_SPECIES" >> pwscf.in INT=1 while [ "$INT" -le "$NTYPE" ]; do KIND=pp`cellcvrt -f < str.out | tail -n +7 | awk '{print $4}' | sort -u | head -${INT} | tail -1` grep "$KIND" $ParamFile | awk '{print " " $2, $3, $4}' >> pwscf.in let "$((INT++))" done # Find and write the atoms' position to input file echo "ATOMIC_POSITIONS angstrom" >> pwscf.in cat str.out | cellcvrt -c -sig=9 | tail -n +7 | awk '{print " " $4, $1, $2, $3 }' >> pwscf.in # Find the k-points mesh, the mesh will be created # by Monkhorst-Pack method echo "K_POINTS automatic" >> pwscf.in nbat=`cellcvrt -pn < str.out` echo " " `( echo $KPPRA $nbat | awk '{print $1/$2}' ; cat str.out | cellcvrt -f | head -3 ) | kmesh -q -r` 0 0 0 >> pwscf.in # Run pw.x for calculation $PWCOMMAND < pwscf.in > pwscf.out # Abstract the final total energy to "energy" file # in the unit of eV FERy=`grep '!' pwscf.out | tail -1 | cut -c 35-50` FEeV=`echo "scale=15; $FERy*13.605698066" | bc -l` echo "$FEeV" > energy