-
Notifications
You must be signed in to change notification settings - Fork 0
/
runset2.sh
81 lines (61 loc) · 1.65 KB
/
runset2.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
#!/bin/bash
CHARMMEXEC=/net/orinoco/pga043/CHARMM_47a2/charmm_47a2/build_opls/charmm
DIR=`pwd`
name=`cat name`
nnodes=`cat nnodes`
nreps=`cat nreps`
ini=1 # phase 2 starts with this #
iri=1
ifi=20 # phase 2 ends with this #
for i in `seq $ini $ifi`
do
im1=$(( $i - 1 ))
ip1=$(( $i + 1 ))
im5=`awk 'BEGIN {if (('$i'-4)<'$iri') {print '$iri'} else {print '$i'-4}}'`
N=$(( $i - $im5 + 1 ))
ir=$(( $RANDOM % ( $ip1 - $iri ) + $iri ))
RUNDIR=$DIR/run$i
PANADIR=$DIR/analysis$im1
ANADIR=$DIR/analysis$i
while [ ! -f $ANADIR/b_sum.dat ]
do
if [ -d ${RUNDIR}_failed ]; then
rm -r ${RUNDIR}_failed
fi
if [ -d $RUNDIR ]; then
cp -r $RUNDIR ${RUNDIR}_failed
rm -r $RUNDIR
echo "run$i failed"
sleep 30
fi
### Run the simulation
mkdir $RUNDIR
mkdir $RUNDIR/res $RUNDIR/dcd
cp -r variables$i.inp prep $RUNDIR/
cd $RUNDIR
### timeout -s SIGINT 8h
echo "run$i started"
mpirun -np $nreps -x OMP_NUM_THREADS=$nnodes --map-by node $CHARMMEXEC iflat=$i esteps=15000 nsteps=50000 seed=$RANDOM -i ../msld_flat.inp > output 2> error
sed -i '/run setvariable domdecheuristic off/,$d' output
rm -rf prep
cd $DIR
# Run the analysis
echo "analysis$i started"
if [ ! -d $ANADIR ]; then
mkdir $ANADIR
fi
mkdir $ANADIR/
cp $PANADIR/b_sum.dat $ANADIR/b_prev.dat
cp $PANADIR/c_sum.dat $ANADIR/c_prev.dat
cp $PANADIR/x_sum.dat $ANADIR/x_prev.dat
cp $PANADIR/s_sum.dat $ANADIR/s_prev.dat
cd $ANADIR
../ALF/GetLambdas.py $i
../ALF/GetEnergy.py $im5 $i
../ALF/RunWham.sh $(( $N * $nreps )) `cat ../ntersiteflat`
../ALF/GetFreeEnergy5.py 0 1 `cat ../ntersiteflat`
../ALF/SetVars.py $ip1
echo "set restartfile = \"run$ir/res/${name}_flat.res\"" >> $DIR/variables$ip1.inp
cd $DIR
done
done