Get-dimer-dir.sh

From Wiki
Revision as of 16:45, 29 September 2010 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 obtain a DIMERDIRECTION file:

get-dimer-dir.sh

No arguments needed, it reads an OUTCAR (in the current directory!) and creates a DIMERDIRECTION file at the same place.

CODE

#!/bin/bash

# Script for extracting the displacement vector of the (lowest) imaginary frequency
# from an OUTCAR file as to setup IDM (Improved Dimer Method) calculation.
# David Karhanek, 2010-09-21 @ ICIQ Tarragona

# Get basic data from OUTCAR
printf "  Checking for OUTCAR file... "
if test -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`
NIONS=`grep NIONS OUTCAR | awk '{print $12}'`
grep -A $(($NIONS+1)) 'cm-1' OUTCAR > temp.tmp
NVIBS=`grep 'cm-1' temp.tmp | wc -l`
NIMAG=`grep 'f/i' temp.tmp | wc -l`
if test "$VASPVER" -lt "5" ; then NVIBS=$(($NVIBS/2)) ; NIMAG=$(($NIMAG/2)) ; fi
printf "  VASP version %1g.*. Total of %3g atoms, %3g vibration modes, %3g imaginary mode(s).\n" $VASPVER $NIONS $NVIBS $NIMAG

# Parse the lowest imaginary mode displacement vector
tail -$NIONS temp.tmp | awk '{printf " %12.6f%12.6f%12.6f\n",$4,$5,$6}' > DIMERDIRECTION
rm temp.tmp
printf "  Output saved into the file 'DIMERDIRECTION'.\n"

COMMON ERRORS

If you find some bugs, report them to David.

--Dkarhanek 17:45, 29 September 2010 (CEST)