-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathworkflow.sh
99 lines (79 loc) · 3.68 KB
/
workflow.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
#!/bin/bash
# ===================================================
# Shell-based wrapper for polymer simulation workflow
# ===================================================
# parameter definitions
# ===================================================
root_dir='workflow_test'
clear_existing=true
struct_src='polymer_structures'
pdb_src="$struct_src/pdb"
mono_src="$struct_src/monomers"
mol_names=(
'paam_modified'
# 'peg_modified'
# 'pnipam_modified'
)
# charging methods
N=150
rct_charge_method='Espaloma-AM1-BCC'
# rct_charge_method='AM1-BCC-ELF10'
charge_methods=(
# 'AM1-BCC-ELF10'
# 'Espaloma-AM1-BCC'
'RCT'
)
# periodic box size
box_x=6.0
box_y=6.0
box_z=6.0
box_unit='nanometer'
# simulation parameter sets
num_confs=1
forcefield='openff-2.0.0'
param_dir='sim_param_sets'
anneal_param_path=$param_dir/anneal_params.json
equil_param_path=$param_dir/equilibration_params.json
prod_param_path=$param_dir/production_lite_params.json
# solvation
solvent='water_TIP3P'
density_gcm3=0.997
exclusion=1.0
exclusion_unit='nanometer'
# RDF radii
rmin=0.0
rmax=2.0
rad_unit='nanometer'
# setting up directories and files
# ===================================================
if [ -e $root_dir ] && [ $clear_existing == true ]; then
rm -r $root_dir
echo "Removed existing directory $root_dir"
fi
mkdir -p $root_dir # make root directory (exists ok)
echo "Touched directory $root_dir"
# actual code
# ===================================================
for mol_name in "${mol_names[@]}"; do # iterate over list of names
mol_dir=$root_dir/$mol_name
root_log_dir="$mol_dir/Logs"
sdf_path=$(python -m components.assign_chem -wdir $mol_dir -ldir $root_log_dir -pdb $pdb_src/$mol_name.pdb -mono $mono_src/$mol_name.json -n $mol_name)
rct_paths=$(python -m components.rct_protocol -wdir $mol_dir -ldir $root_log_dir -mono $mono_src/$mol_name.json -n $mol_name -cmet $rct_charge_method -N $N)
rct_paths=($rct_paths) # convert to array so each of multiple components can be read off one-by-one
lib_chg_path=${rct_paths[0]} # path to cached library charges
redux_path=${rct_paths[1]} # path to reduced-size molecule used to generate library charges
redux_RCT_path=$(python -m components.charge_mol -wdir $mol_dir -ldir $root_log_dir -sdf $redux_path -cmet 'RCT' -lc $lib_chg_path) # also charge reduction w/ RCT charges for validation; output catching unused, simply done to avoid terminal output clutter
for charge_method in "${charge_methods[@]}"; do
charge_dir=$mol_dir/$charge_method
charge_log_dir="$charge_dir/Logs"
charge_path=$(python -m components.charge_mol -wdir $charge_dir -ldir $charge_log_dir -sdf $sdf_path -cmet $charge_method -lc $lib_chg_path)
for ((i=1; i<=$num_confs; i++)); do # can't use {1..$num_confs} (variable upper bound returns curly braces as literal)
conf_name="conformer_$i"
conf_dir=$charge_dir/$conf_name
conf_log_dir="$conf_dir/Logs"
conf_path=$(python -m components.anneal -wdir $conf_dir -ldir $conf_log_dir -sdf $charge_path -a $conf_name -bd $box_x $box_y $box_z -bdu $box_unit -sp $anneal_param_path -ff $forcefield)
solv_path=$(python -m components.solvate -wdir $conf_dir -ldir $conf_log_dir -sdf $conf_path -a $conf_name -solv $solvent -rho $density_gcm3 -bd $box_x $box_y $box_z -bdu $box_unit -exc $exclusion -excu $exclusion_unit)
python -m components.simulate -wdir $conf_dir -ldir $conf_log_dir -sdf $solv_path -a $conf_name -bd $box_x $box_y $box_z -bdu $box_unit -sp "equilibration=$equil_param_path" "production=$prod_param_path" -ff $forcefield -az 'production' -rmin $rmin -rmax $rmax -ru $rad_unit
done
done
done