#!/bin/csh -f

set lambda = 0.5

set DO_PARALLEL = "mpi 4 ~/amber9/exe/sander.MPI"

cat > mdin <<EOF
    2000 fs simulation
     &cntrl
      imin=0,
      ntx=1,irest=0,
      ntpr=1,ntwr=1,ntwx=1,
      ntc=2,ntf=2,ntb=1,cut=10,
      igb=0,
      ntr=0,
      nstlim=2000,dt=0.001,nscm=5000,nrespa=1,
      ntt=3,gamma_ln=1,tempi=300,temp0=300,ig=233,
      ntp=0,taup=2.0,pres0=1,
      icfe=1,klambda=6,clambda=$lambda
     /
EOF

cat > groups <<EOF
-O -i mdin -p ../ggcc.prmtop     -c ../ggcc.inpcrd -o out.$lambda.p1 -r rst_$lambda.p1
-O -i mdin -p ../igigicic.prmtop -c ../ggcc.inpcrd -o out.$lambda.p2 -r rst_$lambda.p2
EOF

$DO_PARALLEL -ng 2 -groupfile groups < /dev/null || goto error

/bin/rm mdin

exit(0)
echo "  ${0}:  Program error"
exit(1)
