#load force field
include "loadff.inc"
#load the IL box
loadmsf step6_equil_npt.msf
tell boxsize
type=tetr
a=$boxa
b=$boxa
c=$boxa*3
nstepmini=200
#load raw solvent box unit prepared
loadmsf file="waterbox.msf"
tell box
lunit=$boxA
#compute number of replication for each dimmension
nx=int(($a+8)/$lunit+1)
ny=int(($b+8)/$lunit+1)
nz=int(($c+8)/$lunit+1)
#do replication
echo -hs "| building box ..."
replicate nx=$nx ny=$ny nz=$nz stride=($lunit,$lunit,$lunit)
#move center to origin
atom transto pos=(0,0,0) select=all
tell center select=all
#setup crystal/pbc box
crystal type=$type a=$a b=$b c=$c
tell boxsize
echo "crystal type=$type a=$a b=$b c=$c" > pbc.inc
tell bestfft
echo "fftx=$fftx" >> pbc.inc
echo "ffty=$ffty" >> pbc.inc
echo "fftz=$fftz" >> pbc.inc
#remove residues outside the box
removeresidueoutsidebox ext=4 select="all"
#remove residues overlapped
resolveresidueoverlap cutoff=2.2 select="name OH2"
#resolveresidueoverlap cutoff=1.0 select="all"
#check bad overlap
tell contactsamong cutoff=1.5 select="name O*"
#checkmsf
checkmsf
tell msf_info
tell density
echo -hs "| "
echo -hs "| Summary of solvent box:"
echo -hs "| box type: $boxtype"
echo -hs "| size in angstrom: $a x $b x $c"
echo -hs "| number of residue: $nres"
echo -hs "| number of atoms: $natom"
echo -hs "| density: $density"
echo -hs "| dimmension of FFT suggested: $fftx x $ffty x $fftz"
#resort sequence
atom resortseq start=1 select=all
tell center select=all
tell size select=all
#image groups
imggroup method=resid sorted=true select="all"
#nonbond setup
nonbond type=pme nblcutoff=10.0 nbcutoff=8.0 swcutoff=7.0 eps=1.0 \
beta=0.34 ftx=$fftx fty=$ffty ftz=$fftz bsorder=6
#do minimization for solvent
echo -hs "| running $nstepmini steps minimization for the solvent box, please wait a moment"
minimize type=SDfuse nstep=$nstepmini nprint=10 ftol=1e-5
minimize type=SD nstep=$nstepmini nprint=10 ftol=1e-5
tell pot
echo -hs "| total potential energy: $pot kcal/mol"
#save msf and pdb
savemsf file="step7_waterbox.msf"
savepdb fmt=pdb file="step7_waterbox.pdb" |