Get-dimer-dir.sh: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
| Line 3: | Line 3: | ||
== DESCRIPTION == | == DESCRIPTION == | ||
Use the script "<TT>get-dimer-dir.sh</TT>" (''vide infra'') to process OUTCAR from a VASP frequency job in order to | Use the script "<TT>get-dimer-dir.sh</TT>" (''vide infra'') to process OUTCAR from a VASP frequency job in order to extract the eigenvetors of the hardest imaginary vibrational mode to utilize them in a subsequent IDM run. | ||
get-dimer-dir.sh | Use the script as simply as: | ||
No arguments needed, it reads | <nowiki> | ||
get-dimer-dir.sh</nowiki> | |||
No arguments needed, it reads the OUTCAR (in the current directory!) and creates a '''"TS" up-directory''' with the IDM-ready POSCAR file therein. | |||
== CODE == | == CODE == | ||
<nowiki> | |||
#!/bin/bash | #!/bin/bash | ||
# Script for extracting the displacement vector of the (lowest) imaginary frequency | # Script for extracting the displacement vector of the (lowest) imaginary frequency | ||
# from an OUTCAR file | # from an OUTCAR file in order to setup IDM (Improved Dimer Method) calculation. | ||
# David Karhanek, | # David Karhanek, 2011-03-10 @ ICIQ Tarragona | ||
# Get basic data from OUTCAR | # Get basic data from OUTCAR | ||
printf " Checking for OUTCAR file... " | printf " Checking for OUTCAR file... " | ||
if | if [[ -f OUTCAR ]] ; then printf "present, OK.\n" ; else printf "NOT PRESENT! Bye-bye.\n" ; exit ; fi | ||
IBRION=`grep IBRION OUTCAR | awk '{print $3}'` | IBRION=`grep IBRION OUTCAR | awk '{print $3}'` | ||
if | if [[ $IBRION -gt "8" || $IBRION -lt "5" ]] ; then printf " However, it is not a frequency job. Bye-Bye.\n" ; exit ; fi | ||
VASPVER=`head -1 OUTCAR | cut -c 7` | VASPVER=`head -1 OUTCAR | cut -c 7` # VASP version check | ||
NIONS=`grep NIONS OUTCAR | awk '{print $12}'` | NIONS=`grep NIONS OUTCAR | awk '{print $12}'` # Number of atoms | ||
grep -A $(($NIONS+1)) 'cm-1' OUTCAR > temp.tmp | grep -A $(($NIONS+1)) 'cm-1' OUTCAR > temp.tmp # Snip eigenvectors parts of OUTCAR only | ||
NVIBS=`grep 'cm-1' temp.tmp | wc -l` | NVIBS=`grep 'cm-1' temp.tmp | wc -l` # Total nr. of printed frequencies | ||
NIMAG=`grep 'f/i' temp.tmp | wc -l` | NIMAG=`grep 'f/i' temp.tmp | wc -l` # ... of which so many are imaginary | ||
if | if [[ $VASPVER -lt "5" ]] || [[ $VASPVER -ge "5" && $NWRITE -lt "3" ]] ; then NVIBS=$(($NVIBS/2)) ; NIMAG=$(($NIMAG/2)) ; fi | ||
NWRITE=`grep NWRITE OUTCAR | awk '{print $3}'` # Verbosity check - v 5.* needs NWRITE=3 | |||
printf " VASP version %1g.*. Total of %3g atoms, %3g vibration modes, %3g imaginary mode(s).\n" $VASPVER $NIONS $NVIBS $NIMAG | printf " VASP version %1g.*. Total of %3g atoms, %3g vibration modes, %3g imaginary mode(s).\n" $VASPVER $NIONS $NVIBS $NIMAG | ||
if [[ $VASPVER -gt "4" && $NWRITE -lt "3" ]] ; then printf " Restart your calculation with NWRITE=3 tag in INCAR! Bye-Bye.\n" ; rm temp.tmp ; exit ; fi | |||
# Parse the lowest imaginary mode displacement vector | # Parse the lowest imaginary mode displacement vector | ||
tail -$NIONS temp.tmp | awk '{printf " %12.6f%12.6f%12.6f\n",$4,$5,$6}' > DIMERDIRECTION | if [[ ! -d ../TS ]] ; then mkdir ../TS ; fi | ||
tail -$NIONS temp.tmp | awk '{printf " %12.6f%12.6f%12.6f\n",$4,$5,$6}' > ../TS/DIMERDIRECTION | |||
# The file DIMERDIRECTION may be needed for some obsolete implementations of the IDM. | |||
cp POSCAR ../TS/ ; echo >> ../TS/POSCAR ; cat ../TS/DIMERDIRECTION >> ../TS/POSCAR | |||
rm temp.tmp | rm temp.tmp | ||
printf " | printf " The POSCAR for IDM was saved into 'TS' up-dir.\n" | ||
</nowiki> | |||
== REMARKS == | |||
Note that the <TT>NWRITE=3</TT> is an important setting, as it enables mass-weighted eigenvectors to be printed in the frequency-run OUTCAR. | |||
== COMMON ERRORS == | == COMMON ERRORS == | ||
| Line 37: | Line 50: | ||
If you find some bugs, report them to David. | If you find some bugs, report them to David. | ||
[[User:Dkarhanek|Dkarhanek]] 19:37, 1 June 2011 (CEST) | |||
Revision as of 18:37, 1 June 2011
go back to Main Page, Computational Resources, Chemistry & More, Computational Codes, VASP, IDM or Scripts for VASP
DESCRIPTION
Use the script "get-dimer-dir.sh" (vide infra) to process OUTCAR from a VASP frequency job in order to extract the eigenvetors of the hardest imaginary vibrational mode to utilize them in a subsequent IDM run. Use the script as simply as:
get-dimer-dir.sh
No arguments needed, it reads the OUTCAR (in the current directory!) and creates a "TS" up-directory with the IDM-ready POSCAR file therein.
CODE
#!/bin/bash
# Script for extracting the displacement vector of the (lowest) imaginary frequency
# from an OUTCAR file in order to setup IDM (Improved Dimer Method) calculation.
# David Karhanek, 2011-03-10 @ ICIQ Tarragona
# Get basic data from OUTCAR
printf " Checking for OUTCAR file... "
if [[ -f OUTCAR ]] ; then printf "present, OK.\n" ; else printf "NOT PRESENT! Bye-bye.\n" ; exit ; fi
IBRION=`grep IBRION OUTCAR | awk '{print $3}'`
if [[ $IBRION -gt "8" || $IBRION -lt "5" ]] ; then printf " However, it is not a frequency job. Bye-Bye.\n" ; exit ; fi
VASPVER=`head -1 OUTCAR | cut -c 7` # VASP version check
NIONS=`grep NIONS OUTCAR | awk '{print $12}'` # Number of atoms
grep -A $(($NIONS+1)) 'cm-1' OUTCAR > temp.tmp # Snip eigenvectors parts of OUTCAR only
NVIBS=`grep 'cm-1' temp.tmp | wc -l` # Total nr. of printed frequencies
NIMAG=`grep 'f/i' temp.tmp | wc -l` # ... of which so many are imaginary
if [[ $VASPVER -lt "5" ]] || [[ $VASPVER -ge "5" && $NWRITE -lt "3" ]] ; then NVIBS=$(($NVIBS/2)) ; NIMAG=$(($NIMAG/2)) ; fi
NWRITE=`grep NWRITE OUTCAR | awk '{print $3}'` # Verbosity check - v 5.* needs NWRITE=3
printf " VASP version %1g.*. Total of %3g atoms, %3g vibration modes, %3g imaginary mode(s).\n" $VASPVER $NIONS $NVIBS $NIMAG
if [[ $VASPVER -gt "4" && $NWRITE -lt "3" ]] ; then printf " Restart your calculation with NWRITE=3 tag in INCAR! Bye-Bye.\n" ; rm temp.tmp ; exit ; fi
# Parse the lowest imaginary mode displacement vector
if [[ ! -d ../TS ]] ; then mkdir ../TS ; fi
tail -$NIONS temp.tmp | awk '{printf " %12.6f%12.6f%12.6f\n",$4,$5,$6}' > ../TS/DIMERDIRECTION
# The file DIMERDIRECTION may be needed for some obsolete implementations of the IDM.
cp POSCAR ../TS/ ; echo >> ../TS/POSCAR ; cat ../TS/DIMERDIRECTION >> ../TS/POSCAR
rm temp.tmp
printf " The POSCAR for IDM was saved into 'TS' up-dir.\n"
REMARKS
Note that the NWRITE=3 is an important setting, as it enables mass-weighted eigenvectors to be printed in the frequency-run OUTCAR.
COMMON ERRORS
If you find some bugs, report them to David.
Dkarhanek 19:37, 1 June 2011 (CEST)