-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloop_md_production_run.sh
42 lines (34 loc) · 2.17 KB
/
loop_md_production_run.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
#!/bin/bash
# Define the systems to process
systems=("system01" "system02" "system03" "system04" "system05" "system06")
# Load the gmx command
source /home/usr_name/GMX2020.3/bin/GMXRC
# ANSI escape code for yellow
YELLOW='\033[1;33m'
NOCOLOR='\033[0m'
# Loop over each system
for sys in "${systems[@]}"; do
echo -e "${YELLOW}Processing system: $sys${NOCOLOR}" | boxes -d info
cd "$sys" || { echo -e "${YELLOW}Failed to enter directory $sys${NOCOLOR}" | boxes -d WARNING -p a2v1; exit 1; }
# Step 1: Check if md production job was previously run
if [ -f "md_0_100.cpt" ]; then
echo -e "${YELLOW}Step 1: md_0_100.cpt exists. Resuming the mdrun job...${NOCOLOR}" | boxes -d info -p a2v1
gmx mdrun -ntmpi 12 -ntomp 6 -pin on -v -nb gpu -pme cpu -tunepme yes -pmefft cpu -bonded gpu -update cpu -deffnm md_0_100 -cpi md_0_100.cpt -s md_0_100.tpr -append
else
# Step 2: Check for the existence of md_0_100.tpr file
if [ -f "md_0_100.tpr" ]; then
echo -e "${YELLOW}Step 2: md_0_100.tpr exists. Starting the mdrun job...${NOCOLOR}" | boxes -d info -p a2v1
gmx mdrun -ntmpi 12 -ntomp 6 -pin on -v -nb gpu -pme cpu -tunepme yes -pmefft cpu -bonded gpu -update cpu -deffnm md_0_100
else
# Step 3: Generate the md_0_100.tpr file since it does not exist
echo -e "${YELLOW}Step 3: md_0_100.tpr does not exist. Generating it now...${NOCOLOR}" | boxes -d info -p a2v1
gmx grompp -v -f md.mdp -c npt.gro -t npt.cpt -p topol.top -n index.ndx -po mdout.mdp -pp processed.top -o md_0_100.tpr
# Step 4: Run the md production job after generating the tpr file
echo -e "${YELLOW}Step 4: Running the mdrun job after generating md_0_100.tpr...${NOCOLOR}" | boxes -d info -p a2v1
gmx mdrun -ntmpi 12 -ntomp 6 -pin on -v -nb gpu -pme cpu -tunepme yes -pmefft cpu -bonded gpu -update cpu -deffnm md_0_100
fi
fi
# Return to the parent directory
cd .. || { echo -e "${YELLOW}Failed to return to the parent directory${NOCOLOR}" | boxes -d WARNING -p a2v1; exit 1; }
done
echo -e "${YELLOW}All systems processed successfully!${NOCOLOR}" | boxes -d info