-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenerate_simulation.sh
executable file
·84 lines (71 loc) · 2.73 KB
/
generate_simulation.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
#!/bin/bash
if [[ -z "$SHERLOCK" ]]; then
echo "Error: You're on $(hostname), not sherlock"
exit 1
fi
if [[ "$#" -ne 2 ]]; then
echo "Usage: $0 <prmtop> <directory>"
exit 1
fi
prmtop=$1
dir=$(readlink -e $2)
if [[ ! -f "$1" ]]; then
echo "No prmtop: $1"
exit 1
fi
psf=$(readlink -e ${1/prmtop/psf})
sampler="$2/sampler.cfg"
if [[ ! -f "$psf" ]]; then
echo "No psf: $psf"
exit 1
fi
if [[ ! -f "$sampler" ]]; then
echo "No configuration file: $sampler"
exit 1
fi
# Extract relevant variables from sampler config file
jobname="$(grep "jobname" "$sampler" | awk -F '=' '{print $2}' | tr -d '[:space:]')"
nanoseconds="$(grep "runlength" "$sampler" | awk -F '=' '{print $2}' | tr -d '[:space:]')"
nreps="$(grep "samplers" "$sampler" | awk -F '=' '{print $2}' | tr -d '[:space:]')"
queue="$(grep "queue" "$sampler" | awk -F '=' '{print $2}' | tr -d '[:space:]')"
pressure="$(grep "pressure" "$sampler" | awk -F '=' '{print $2}' | tr -d '[:space:]')"
# HMR is a boolean, default to true
hmr="$(grep "hmr" "$sampler" | awk -F '=' '{print $2}' | tr -d '[:space:]')"
if [[ "$hmr" != "False" ]]; then
hmrflag="--hmr"
fi
# Print some helpful infos
echo
echo "Using config file: $sampler"
echo "Job name prefix: $jobname"
echo "Running in queue: $queue"
echo "Starting prmtop: $prmtop"
echo "Pressure control: $pressure"
echo "HMR increased dt: $hmr"
echo "Total desired time: $nanoseconds"
echo "Number of samplers: $nreps"
echo
mkdir -p "$dir/systems/1"
# Ensure relative symlinks, helps with visualization over sshfs
relpsf="$(realpath --relative-to="$dir/systems/1" "$psf")"
for ((i=1; i<=$nreps; i++)); do
echo " Submitting sampler: $i"
ln -s "$relpsf" "$dir/systems/1/$i.psf" # Create psf symlink since all psfs are same
ln -s "${relpsf%.psf}.prmtop" "$dir/systems/1/$i.prmtop"
ln -s "${relpsf%.psf}.pdb" "$dir/systems/1/$i.pdb"
ln -s "${relpsf%.psf}.inpcrd" "$dir/systems/1/$i.inpcrd"
$PI_HOME/software/submit_new/submit_new -r 1 \
--msm $i \
-j "${jobname}-G1-r$i" \
-d "$dir" \
-q "$queue" \
-s 100 \
-t $nanoseconds \
-p "$prmtop" \
-q "$queue" \
--gpus 1 \
"--$pressure" \
$hmrflag
done
# Add this simulation sampler file to the active file
echo "$sampler" >> "$PI_SCRATCH/rbetz/adaptivesampling/ACTIVE"