Get-dimer-dir.sh

From Wiki
Revision as of 18:37, 1 June 2011 by Dkarhanek (talk | contribs)
Jump to navigation Jump to search

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)