#!/bin/bash
#
# Code by  venkentom@gmail.com
#
# Licenced by the GPL General Public License
# Have a look at:
# http://www.gnu.org/copyleft/gpl.html
# For more information about the GPL License
#
# I am not responsible for what this code does to your hw/sw/mind
# Use at your own risk
# 

#Put gromacs commands after this line

DIR=`pwd`

source /Home/ii/venken/.bashrc

for i in {11..100}
do

mkdir $i
cp system.top $i
cp *.itp $i
cp minimization.mdp $i
cp assemble.mdp $i #has been set to 50 ns
cp submit* $i #has been set to 50 ns

genconf -f TM19_pol_CG.pdb -rot -o $i/genconf_${i}.gro

j=$[ RANDOM % 9 ]
k=$[ RANDOM % 9 ]
l=$[ RANDOM % 9 ]

cd $i
editconf -f genconf_${i}.gro -o editconf.gro -box 9 9 9 -translate $j $k $l -noc
genbox -cp editconf.gro -ci ../popc_single.gro -nmol 128 -try 500 -o genbox.gro

grompp -f minimization.mdp -c genbox.gro -p ../system_noW.top -maxwarn 10 -o min-init.tpr
mdrun -deffnm min-init -v 

genbox -cp min-init.gro -cs ../polarize-water.gro -o waterbox.gro -maxsol 1500 -vdwd 0.21

grompp -f minimization.mdp -c waterbox.gro -p system.top -maxwarn 10 -o min-solvent.tpr 
mdrun -deffnm min-solvent -v 

#grompp -f assemble.mdp -c min-solvent.gro -p system.top -maxwarn 10 -o assemble.tpr 
#mdrun -deffnm assemble -v

rm \#*

cd ..

done




