Get-dimer-dir.sh: Difference between revisions

From Wiki
Jump to navigation Jump to search
Dkarhanek (talk | contribs)
mNo edit summary
Rgarcia (talk | contribs)
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
go back to [[Main Page]], [[Computational Resources]], [[Chemistry & More]], [[Computational Codes]], [[VASP]], [[IDM]] or [[Scripts for VASP]]
go back to [[Main Page]], [[Computational Resources]], [[Chemistry & More]], [[Computational Codes]], [[VASP]], [[IDM]] or [[Scripts for VASP]]


== DESCRIPTION ==
Warning! This version might contain obsolete features. For a newer one please reffer to [[Dimer Method]].


Use the script "<TT>get-dimer-dir.sh</TT>" (''vide infra'') to process OUTCAR from a VASP frequency job in order to obtain a DIMERDIRECTION file:
== Description ==
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 ==
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.
Use the script as simply as:
<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 ==
<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 as to setup IDM (Improved Dimer Method) calculation.
  # from an OUTCAR file in order to setup IDM (Improved Dimer Method) calculation.
  # David Karhanek, 2010-09-21 @ ICIQ Tarragona
  # 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 test -f OUTCAR ; then printf "present, OK.\n" ; else printf "NOT PRESENT! Bye-bye.\n" ; exit ; fi
  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 <nowiki>[[</nowiki> $IBRION -gt 8 || $IBRION -lt 5 <nowiki>]]</nowiki> ; then printf "  However, it is not a frequency job. Bye-Bye.\n" ; exit ; fi
  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 test "$VASPVER" -lt "5" ; then NVIBS=$(($NVIBS/2)) ; NIMAG=$(($NIMAG/2)) ; fi
  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 "  Output saved into the file 'DIMERDIRECTION'.\n"
  printf "  The POSCAR for IDM was saved into 'TS' up-dir.\n"
</nowiki>
 
== Remarks ==


== COMMON ERRORS ==
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.


If you find some bugs, report them to David.


--[[User:Dkarhanek|Dkarhanek]] 17:45, 29 September 2010 (CEST)
[[User:Dkarhanek|Dkarhanek]] 19:37, 1 June 2011 (CEST)

Latest revision as of 14:23, 18 July 2014

go back to Main Page, Computational Resources, Chemistry & More, Computational Codes, VASP, IDM or Scripts for VASP

Warning! This version might contain obsolete features. For a newer one please reffer to Dimer Method.

Description[edit]

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[edit]

 #!/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[edit]

Note that the NWRITE=3 is an important setting, as it enables mass-weighted eigenvectors to be printed in the frequency-run OUTCAR.


Dkarhanek 19:37, 1 June 2011 (CEST)