#!/bin/bash

cp POSCAR.init POSCAR
cp INCAR.init INCAR
rseed="RANDOM_SEED =         311137787                0                0"
echo $rseed >> INCAR

i=1
while [ $i -le 3 ] 
do
  # start vasp
  mpirun -np 2 vasp_gam

  rseed=$(grep RANDOM_SEED REPORT |tail -1)
  cp INCAR.init INCAR
  echo $rseed >> INCAR

  # use the last configuration generated in the previous
  # run as initial configuration for the next run
  cp CONTCAR POSCAR

  # backup some important files
  mkdir run$i
  cp REPORT vasprun.xml vaspout.h5 run$i

  let i=i+1
done



