#creates input files and executes NWChem, writing energy values for separation n
#version 1.0 by MV 

Rhh=0.0
Re=1.4

for n in {0.85,0.9,0.95,1.0,1.1,1.2,1.5,2.0,4.0,8.0,16.0}; do

Rhh_str="${n} * ${Re}"
Rhh="$(echo "$Rhh_str" | bc -l)"

echo -e "Memory 500 mb

charge 0
Geometry units bohr
  H     0.0    0.0    0.0
  H     0.0    0.0    $Rhh
End

Basis \"ao basis\" spherical
  H  library  STO-3G
End

Title \"H2 STO-3G\" 

scf
  Singlet
  RHF
  Direct
end

task scf energy" >input$n.nw
mpirun.mpich -np 1 nwchem input$n.nw >& output$n.out

s=`grep -in "Total SCF energy" output$n.out`

echo -e "$s , $n " >>data.csv
done