Difference between revisions of "Tutorial2 script"
From DoSPT
Miguel Caro (talk | contribs) |
Miguel Caro (talk | contribs) |
||
| Line 1: | Line 1: | ||
| − | for i in "pure_methanol" "pure_water" "mixture_1" "mixture_2" "mixture_3" "mixture_4" "mixture_5" "mixture_6" "mixture_7" "mixture_8" "mixture_9" "mixture_10"; do | + | for i in "pure_methanol" "pure_water" "mixture_1" "mixture_2" "mixture_3" "mixture_4" "mixture_5" "mixture_6" "mixture_7" "mixture_8" "mixture_9" "mixture_10"; do |
| − | + | ||
| − | if [ $i == "pure_methanol" ]; then | + | if [ $i == "pure_methanol" ]; then |
| − | sol=0; met=400 | + | sol=0; met=400 |
| − | tc_grps="MOL" | + | tc_grps="MOL" |
| − | energygrps="MOL" | + | energygrps="MOL" |
| − | tau_t=0.1; ref_t=298. | + | tau_t=0.1; ref_t=298. |
| − | elif [ $i == "pure_water" ]; then | + | elif [ $i == "pure_water" ]; then |
| − | sol=800; met=0 | + | sol=800; met=0 |
| − | tc_grps="SOL" | + | tc_grps="SOL" |
| − | energygrps="SOL" | + | energygrps="SOL" |
| − | tau_t=0.1; ref_t=298. | + | tau_t=0.1; ref_t=298. |
| − | elif [ $i == "mixture"* ]; then | + | elif [ $i == "mixture"* ]; then |
| − | sol=400; met=200 | + | sol=400; met=200 |
| − | tc_grps="MOL SOL" | + | tc_grps="MOL SOL" |
| − | energygrps="MOL SOL" | + | energygrps="MOL SOL" |
| − | tau_t="0.1 0.1"; ref_t="298. 298" | + | tau_t="0.1 0.1"; ref_t="298. 298" |
| − | fi | + | fi |
| − | + | ||
| − | cat>topol.top<<eof | + | cat>topol.top<<eof |
| − | #include "oplsaa.ff/forcefield.itp" | + | #include "oplsaa.ff/forcefield.itp" |
| − | #include "oplsaa.ff/spce.itp" | + | #include "oplsaa.ff/spce.itp" |
| − | #include "methanol.itp" | + | #include "methanol.itp" |
| − | + | ||
| − | [ system ] | + | [ system ] |
| − | Water+methanol | + | Water+methanol |
| − | + | ||
| − | [ molecules ] | + | [ molecules ] |
| − | ; name number | + | ; name number |
| − | SOL $sol | + | SOL $sol |
| − | MET $met | + | MET $met |
| − | eof | + | eof |
| − | + | ||
| − | + | ||
| − | awk -v tc_grps=$tc_grps -v energygrps=$energygrps -v tau_t=$tau_t -v ref_t=$ref_t \ | + | awk -v tc_grps=$tc_grps -v energygrps=$energygrps -v tau_t=$tau_t -v ref_t=$ref_t \ |
| − | '{if($1 == "Tcoupl"){print "Tcoupl = v-rescale"} | + | '{if($1 == "Tcoupl"){print "Tcoupl = v-rescale"} |
| − | + | else if($1 == "Pcoupl"){print "Pcoupl = Berendsen"} | |
| − | + | else if($1 == "Pcoupl"){print"gen_vel = yes"} | |
| − | + | else if($1 == "nsteps"){print "nsteps = 250000"} | |
| − | + | else if($1 == "nstxout"){print "nstxout = 1000"} | |
| − | + | else if($1 == "nstvout"){print "nstvout = 1000"} | |
| − | + | else if($1 == "tc-grps"){print "tc-grps =", tc_grps} | |
| − | + | else if($1 == "energygrps"){print "energygrps =", energygrps} | |
| − | + | else if($1 == "tau_t"){print "tau_t =", tau_t} | |
| − | + | else if($1 == "ref_t"){print "ref_t =", ref_t} | |
| + | else {print $0}}' md.mdp > temp; cp temp md.mdp | ||
| + | |||
| + | gmx grompp -f em.mdp -c ${i}.gro -p topol.top -o em.tpr | ||
| + | gmx mdrun -v -deffnm em | ||
| + | |||
| + | gmx grompp -f md.mdp -c em.gro -p topol.top -o md.tpr | ||
| + | gmx mdrun -v -deffnm md | ||
| + | |||
| + | echo "Box-X" | gmx energy -f md.edr -o density.xvg; grep -v "\@" density.xvg | grep -v "\#" > box | ||
| + | l=`echo 'set fit quiet; fit[250:*] a "box" via a; print a' | gnuplot` | ||
| + | |||
| + | awk -v l=$l '{if(NR==2403){printf " %.5f %.5f %.5f", l, l, l} else {print $0}}' md.gro > temp; mv temp md.gro | ||
| + | |||
| + | awk '{if($1 == "Tcoupl"){print "Tcoupl = nose-hoover"} | ||
| + | else if($1 == "Pcoupl"){print "Pcoupl = no"} | ||
| + | else if($1 == "Pcoupl"){print"gen_vel = no"} | ||
else {print $0}}' md.mdp > temp; cp temp md.mdp | else {print $0}}' md.mdp > temp; cp temp md.mdp | ||
| − | + | ||
| − | + | cp md.gro NPT_${i}.gro | |
| − | + | gmx grompp -f md.mdp -c NPT_${i}.gro -p topol.top -o md.tpr | |
| − | + | gmx mdrun -v -deffnm md | |
| − | + | ||
| − | + | cp md.gro NVT_${i}.gro | |
| − | + | ||
| − | + | awk '{if($1 == "nsteps"){print "nsteps = 10000"} | |
| − | + | else if($1 == "nstxout"){print "nstxout = 2"} | |
| − | + | else if($1 == "nstvout"){print "nstvout = 2"} | |
| − | + | else {print $0}}' md.mdp > temp; cp temp md.mdp | |
| − | + | ||
| − | + | gmx grompp -f md.mdp -c NVT_${i}.gro -p topol.top -o md.tpr | |
| − | + | gmx mdrun -v -deffnm md | |
| − | + | ||
| − | + | echo "0" | gmx trjconv -f md.trr -s md.tpr -o traj_${i}.gro -dt 0.004 -ndec 5 -vel | |
| − | + | ||
| − | cp md.gro NPT_${i}.gro | + | done |
| − | gmx grompp -f md.mdp -c NPT_${i}.gro -p topol.top -o md.tpr | ||
| − | gmx mdrun -v -deffnm md | ||
| − | |||
| − | cp md.gro NVT_${i}.gro | ||
| − | |||
| − | awk '{if($1 == "nsteps"){print "nsteps = 10000"} | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | gmx grompp -f md.mdp -c NVT_${i}.gro -p topol.top -o md.tpr | ||
| − | gmx mdrun -v -deffnm md | ||
| − | |||
| − | echo "0" | gmx trjconv -f md.trr -s md.tpr -o traj_${i}.gro -dt 0.004 -ndec 5 -vel | ||
| − | |||
| − | done | ||
Revision as of 12:18, 21 April 2017
for i in "pure_methanol" "pure_water" "mixture_1" "mixture_2" "mixture_3" "mixture_4" "mixture_5" "mixture_6" "mixture_7" "mixture_8" "mixture_9" "mixture_10"; do
if [ $i == "pure_methanol" ]; then
sol=0; met=400
tc_grps="MOL"
energygrps="MOL"
tau_t=0.1; ref_t=298.
elif [ $i == "pure_water" ]; then
sol=800; met=0
tc_grps="SOL"
energygrps="SOL"
tau_t=0.1; ref_t=298.
elif [ $i == "mixture"* ]; then
sol=400; met=200
tc_grps="MOL SOL"
energygrps="MOL SOL"
tau_t="0.1 0.1"; ref_t="298. 298"
fi
cat>topol.top<<eof
#include "oplsaa.ff/forcefield.itp"
#include "oplsaa.ff/spce.itp"
#include "methanol.itp"
[ system ]
Water+methanol
[ molecules ]
; name number
SOL $sol
MET $met
eof
awk -v tc_grps=$tc_grps -v energygrps=$energygrps -v tau_t=$tau_t -v ref_t=$ref_t \
'{if($1 == "Tcoupl"){print "Tcoupl = v-rescale"}
else if($1 == "Pcoupl"){print "Pcoupl = Berendsen"}
else if($1 == "Pcoupl"){print"gen_vel = yes"}
else if($1 == "nsteps"){print "nsteps = 250000"}
else if($1 == "nstxout"){print "nstxout = 1000"}
else if($1 == "nstvout"){print "nstvout = 1000"}
else if($1 == "tc-grps"){print "tc-grps =", tc_grps}
else if($1 == "energygrps"){print "energygrps =", energygrps}
else if($1 == "tau_t"){print "tau_t =", tau_t}
else if($1 == "ref_t"){print "ref_t =", ref_t}
else {print $0}}' md.mdp > temp; cp temp md.mdp
gmx grompp -f em.mdp -c ${i}.gro -p topol.top -o em.tpr
gmx mdrun -v -deffnm em
gmx grompp -f md.mdp -c em.gro -p topol.top -o md.tpr
gmx mdrun -v -deffnm md
echo "Box-X" | gmx energy -f md.edr -o density.xvg; grep -v "\@" density.xvg | grep -v "\#" > box
l=`echo 'set fit quiet; fit[250:*] a "box" via a; print a' | gnuplot`
awk -v l=$l '{if(NR==2403){printf " %.5f %.5f %.5f", l, l, l} else {print $0}}' md.gro > temp; mv temp md.gro
awk '{if($1 == "Tcoupl"){print "Tcoupl = nose-hoover"}
else if($1 == "Pcoupl"){print "Pcoupl = no"}
else if($1 == "Pcoupl"){print"gen_vel = no"}
else {print $0}}' md.mdp > temp; cp temp md.mdp
cp md.gro NPT_${i}.gro
gmx grompp -f md.mdp -c NPT_${i}.gro -p topol.top -o md.tpr
gmx mdrun -v -deffnm md
cp md.gro NVT_${i}.gro
awk '{if($1 == "nsteps"){print "nsteps = 10000"}
else if($1 == "nstxout"){print "nstxout = 2"}
else if($1 == "nstvout"){print "nstvout = 2"}
else {print $0}}' md.mdp > temp; cp temp md.mdp
gmx grompp -f md.mdp -c NVT_${i}.gro -p topol.top -o md.tpr
gmx mdrun -v -deffnm md
echo "0" | gmx trjconv -f md.trr -s md.tpr -o traj_${i}.gro -dt 0.004 -ndec 5 -vel
done