No t4 step1 inputgen.bash

From Rizzo_Lab
Jump to: navigation, search
#!/bin/bash
wd=`pwd`
pre0='bnz'
pre1='bnz'
mask0=
mask1=':BNZ@H6'

for X in 1 2 3 4 5 6 7 8 9

do

cat << EOF > group_min_l${X}
-O -i mdin_min_v0_l${X} -o ${pre0}_min_v0_l${X}.out -p ../${pre0}.prm -c ../${pre0}.rst -r ${pre0}_min_v0_l${X}.rst
-O -i mdin_min_v1_l${X} -o ${pre1}_min_v1_l${X}.out -p ../${pre1}.prm -c ../${pre1}.rst -r ${pre1}_min_v1_l${X}.rst
EOF
cat << EOF > group_equi_l${X}
-O -i mdin_equi_v0_l${X} -o ${pre0}_equi_v0_l${X}.out -p ../${pre0}.prm -c ${pre0}_min_v0_l${X}.rst -r ${pre0}_equi_v0_l${X}.rst
-O -i mdin_equi_v1_l${X} -o ${pre1}_equi_v1_l${X}.out -p ../${pre1}.prm -c ${pre1}_min_v1_l${X}.rst -r ${pre1}_equi_v1_l${X}.rst
EOF
cat << EOF > group_prod_l${X}
-O -i mdin_prod_v0_l${X} -o ${pre0}_prod_v0_l${X}.out -p ../${pre0}.prm -c ${pre0}_equi_v0_l${X}.rst -r ${pre0}_prod_v0_l${X}.rst -x ${pre0}_prod_v0_l${X}.crd
-O -i mdin_prod_v1_l${X} -o ${pre1}_prod_v1_l${X}.out -p ../${pre1}.prm -c ${pre1}_equi_v1_l${X}.rst -r ${pre1}_prod_v1_l${X}.rst -x ${pre1}_prod_v1_l${X}.crd
EOF

cat << EOF > mdin_min_v0_l${X}
density minlibration
 &cntrl
  imin = 1,	ntx = 1,
  maxcyc=500,
  ntpr = 100,
  ntf = 2,      ntc = 2,
  ntb = 1,	cut = 9.0,
  icfe=1,	clambda = 0.${X},
EOF

cp mdin_min_v0_l${X} mdin_min_v1_l${X}

cat << EOF >> mdin_min_v0_l${X}
  ifsc=0,
  crgmask='${mask0}',
 &end
EOF
cat << EOF >> mdin_min_v1_l${X}
  ifsc=0,
  crgmask='${mask1}',
 &end
EOF

cat << EOF > mdin_equi_v0_l${X}
density equilibration
 &cntrl
  imin = 0,	ntx = 1,	irest = 0,
  ntpr = 2500,	ntwr = 10000,	ntwx = 0,
  ntf = 2,      ntc = 2,
  ntb = 2,	cut = 9.0,
  nstlim = 25000,	dt = 0.002,
  temp0 = 300.0,	ntt = 3,	gamma_ln = 5,
  ntp = 1,	pres0 = 1.0,	taup = 0.2,
  icfe=1,	clambda = 0.${X},
EOF

cp mdin_equi_v0_l${X} mdin_equi_v1_l${X}

cat << EOF >> mdin_equi_v0_l${X}
  ifsc=0,
  crgmask='${mask0}',
 &end
EOF
cat << EOF >> mdin_equi_v1_l${X}
  ifsc=0,
  crgmask='${mask1}',
 &end
EOF

cat << EOF > mdin_prod_v0_l${X}
NPT production
 &cntrl
  imin = 0,	ntx = 5,	irest = 1,
  ntpr = 10000,	ntwr = 100000,	ntwx = 10000,
  ntf = 2,	ntc = 2,
  ntb = 2,	cut = 9.0,
  nstlim = 100000,	dt = 0.002,
  temp0 = 300.0,	ntt = 3,	gamma_ln = 2,
  ntp = 1,	pres0 = 1.0,	taup = 2.0,
  icfe=1,       clambda = 0.${X},
EOF

cp mdin_prod_v0_l${X} mdin_prod_v1_l${X}

cat << EOF >> mdin_prod_v0_l${X}
  ifsc=0,
  crgmask='${mask0}',
 &end
EOF
cat << EOF >> mdin_prod_v1_l${X}
  ifsc=0,
  crgmask='${mask1}',
 &end
EOF

sander="${AMBERHOME}/exe/sander.MPI"
cd $wd
rm -rf zzz.qsub.out.${X} zzz.qsub.err.${X} run.pbs.${X}

cat << EOF > run.pbs.${X}
#!/bin/bash
#PBS -l nodes=2:ppn=2
#PBS -l walltime=72:00:00
#PBS -o zzz.qsub.out.${X}
#PBS -e zzz.qsub.err.${X}

cd $wd
cat \$PBS_NODEFILE | sort | uniq > mpd.nodes.${X}

mpdboot --totalnum=-1 --ncpus=2 -f mpd.nodes.${X}
mpirun -n 4 $sander -O -ng 2 -groupfile group_min_l${X}
mpirun -n 4 $sander -O -ng 2 -groupfile group_equi_l${X}
mpirun -n 4 $sander -O -ng 2 -groupfile group_prod_l${X}

mpdallexit
EOF

chmod +x run.pbs.${X}
qsub run.pbs.${X}

done