-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sh
executable file
·129 lines (119 loc) · 3.85 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
BASE_DIR=`pwd`;
BUILD_DIR="build"
CPU=4
NREP=5
#system info
SOLVENT="octanol.pdb"
TOT_SOLUTE=(pfmethanol.pdb pfethanol.pdb pfpropanol.pdb pfbutanol.pdb pfpentanol.pdb pfhexanol.pdb pfheptanol.pdb pfoctanol.pdb)
TOT_SOLUTE_RESNAME=(F3O F5O F7O F9O F11O F13O F15O F17O)
#packing info
N_SOLVENT=200
BOX_SIZE=37.6
#simulation info
T=298
P=1.01325
RCUT=14
RCUTLOW=0.00
FE_MC=100000000 #steps for free energy simulation
EQ_MC=5000000 #steps for eq simulation
NPT_MC=30000000 #steps for NPT simulation
FE_FREQ=5000 #free energy calc frequency
STATES=(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22)
VDW=(0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.60 0.70 0.80 0.90 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00)
COUL=(0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.20 0.40 0.60 0.70 0.80 0.90 1.00)
if [ ${#COUL[@]} != ${#VDW[@]} ]; then
echo "Warning: Number of Lambda states for VDW and COUL does not match!"
exit 1
elif [ ${#STATES[@]} != ${#VDW[@]} ]; then
echo "Warning: Number of states does not match with VDW lambda!"
exit 1
fi
if [ ${#SOLUTE[@]} != ${#SOLUTE_RESNAME[@]} ]; then
echo "Warning: Number of solute and residue name are not same!"
exit 1
fi
for s in "${!TOT_SOLUTE[@]}"
do
SOLUTE=${TOT_SOLUTE[s]}
SOLUTE_RESNAME=${TOT_SOLUTE_RESNAME[s]}
echo "Working on ${SOLUTE_RESNAME}"
WD=${BASE_DIR}/${SOLUTE_RESNAME}
mkdir $WD
cp -rf ${BASE_DIR}/${BUILD_DIR} $WD/.
cd $WD
echo "Packing the system for ${SOLUTE_RESNAME}"
cd ${BUILD_DIR}/pack/.
PACK_SIZE=$( echo "${BOX_SIZE} - 1.5" | bc )
sed -i 's#SOLVENT#'${SOLVENT}'#g' Pack.inp;
sed -i 's#SOLV_NUM#'${N_SOLVENT}'#g' Pack.inp;
sed -i 's#SOLUTE#'${SOLUTE}'#g' Pack.inp;
sed -i 's#BOXSIZE#'${PACK_SIZE}'#g' Pack.inp;
./packmol < Pack.inp >& PACK.log
vmd -dispdev text < build.tcl >& PACK.log
if [ ! -f "PACKED.pdb" ]; then
echo "Packing failed! Look at the ${WD}/${BUILD_DIR}/pack/PACK.log file."
fi
vmd -dispdev text < build.tcl >& PACK.log
if [ ! -f "START.psf" ]; then
echo "PSF generator failed! Look at the ${WD}/${BUILD_DIR}/pack/PACK.log file."
fi
#set the common variable in config file
cd ${WD}/${BUILD_DIR}/input/.
sed -i 's#NCPU#'${CPU}'#g' *.sh
sed -i 's#TTT#'${T}'#g' *.conf
sed -i 's#PPPP#'${P}'#g' *.conf
sed -i 's#BOXSIZE#'${BOX_SIZE}'#g' *.conf
sed -i 's#RCUT#'${RCUT}'#g' *.conf
sed -i 's#RLOW#'${RCUTLOW}'#g' *.conf
sed -i 's#SOLUTE#'${SOLUTE_RESNAME}'#g' *.conf
sed -i s/"STATES"/"${STATES[*]}"/g *.conf
sed -i s/"LAMBDA_VDW"/"${VDW[*]}"/g *.conf
sed -i s/"LAMBDA_COULOMB"/"${COUL[*]}"/g *.conf
cd $WD
mkdir EQ
echo "Working on Equilibration files"
EQD=${WD}/EQ
cd ${EQD}
IND=${WD}/${BUILD_DIR}/input/
mkdir NVT NPT
EQ_JOB=${SOLUTE_RESNAME}"_eq.sh"
cp ${IND}/eq.sh ${EQ_JOB}
cp ${IND}/NVT.conf ./NVT/.
cp ${IND}/NPT.conf ./NPT/.
cp ${IND}/GOMC_CPU_NVT ./NVT/.
cp ${IND}/GOMC_CPU_NPT ./NPT/.
sed -i 's#RUN_DIR#'`pwd`'#g' ${EQ_JOB}
sed -i 's#MCSTEPS#'${EQ_MC}'#g' NVT/*.conf
sed -i 's#MCSTEPS#'${NPT_MC}'#g' NPT/*.conf
cd $WD
for r in $( seq 1 ${NREP} )
do
cd $WD
RD="TI_"$r
mkdir $RD
echo "Working on Free Energy files: ${RD}"
TID=${WD}/${RD}
cd ${TID}
N=$((${#VDW[@]}-1))
for d in $( seq 0 $N );
do
DN="state_"$d
#echo " Building ${DN}"
PR_JOB=${SOLUTE_RESNAME}"_"$d".sh"
mkdir $DN
cd $DN
cp ${IND}/job.sh ${PR_JOB}
cp ${IND}/GOMC_CPU_NVT .
cp ${IND}/eq.conf .
cp ${IND}/prod.conf .
sed -i 's#MCSTEPS#'${EQ_MC}'#g' eq.conf
sed -i 's#MCSTEPS#'${FE_MC}'#g' prod.conf
sed -i 's#FREE_EN_FREQ#'${FE_FREQ}'#g' prod.conf
sed -i 's#RUN_DIR#'`pwd`'#g' ${PR_JOB}
sed -i 's#STATENUM#'${d}'#g' *.conf;
sed -i 's#INIT_STATE#'${d}'#g' *.conf
cd ${TID}
done
done
done