Example: BSSE correction

Download BSSE.run

#!/bin/bash

# This example shows how to calculate the basis set superposition error for the
# interaction of CO with H2. In this shell script we loop over progressively
# better basis sets.

for bas in DZ TZ2P QZ4P
do

core=Large

$ADFBIN/ams <<eor
Task SinglePoint
System
  Atoms [Bohr] 
    C 0 0 0
    O 2.13 0 0
    H 0 0 6
    H 1.5 0 6
  End
End

Engine Band
  Basis
    Type $bas
    Core $core
  End
EndEngine
eor

ECOH2=`$ADFBIN/adfreport  ams.results/band.rkf -r 'Bond energies%final bond energy'`
rm -r ams.results

$ADFBIN/ams <<eor 
Task SinglePoint
System
  Atoms [Bohr]
    H 0 0 6
    H 1.5 0 6
  End
End

Engine Band
  Basis
    Type $bas
    Core $core
  End
EndEngine

eor

EH2=`$ADFBIN/adfreport  ams.results/band.rkf -r 'Bond energies%final bond energy'`
rm -r ams.results


$ADFBIN/ams <<eor 
Task SinglePoint
System
  Atoms [Bohr]
    Gh.C 0 0 0
    Gh.O 2.13 0 0
    H 0 0 6
    H 1.5 0 6
  End
End

Engine Band
  Basis
    Type $bas
    Core $core
  End
EndEngine

eor

EH2_GHOST_CO=`$ADFBIN/adfreport  ams.results/band.rkf -r 'Bond energies%final bond energy'`
rm -r ams.results


$ADFBIN/ams <<eor
Task SinglePoint
System
  Atoms [Bohr]
    C 0 0 0
    O 2.13 0 0
  End
End

Engine Band
  Basis
    Type $bas
    Core $core
  End
EndEngine

eor

ECO=`$ADFBIN/adfreport  ams.results/band.rkf -r 'Bond energies%final bond energy'`
rm -r ams.results


$ADFBIN/ams <<eor
Task SinglePoint
System
  Atoms [Bohr]
    C 0 0 0
    O 2.13 0 0
    Gh.H 0 0 6
    Gh.H 1.5 0 6
  End
End

Engine Band
  Basis
    Type $bas
    Core $core
  End
EndEngine

eor

ECO_GHOST_H2=`$ADFBIN/adfreport  ams.results/band.rkf -r 'Bond energies%final bond energy'`
rm -r ams.results


EV=27.212
echo "Start report"
echo "basis set: $bas"
echo "H2 + CO : $ECOH2"
echo "H2 : $EH2"
echo "H2 (with ghost CO) : $EH2_GHOST_CO"
echo "CO : $ECO"
echo "CO (with ghost H2) : $ECO_GHOST_H2"
BSSEEV=`$ADFBIN/startpython -c "print (( $EH2 - $EH2_GHOST_CO + $ECO - $ECO_GHOST_H2 ) *$EV)"`
echo "BSSE correction: $BSSEEV (eV)"
BOND1EV=`$ADFBIN/startpython -c "print (( $ECOH2 - $EH2 - $ECO ) *$EV)"`
BOND2EV=`$ADFBIN/startpython -c "print ($BOND1EV + $BSSEEV)"`
echo "Bond energy: $BOND1EV (eV)"
echo "Bond energy + BSSE: $BOND2EV (eV)"
echo "End report"

done