-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSA_run.sh
More file actions
57 lines (40 loc) · 1.21 KB
/
SA_run.sh
File metadata and controls
57 lines (40 loc) · 1.21 KB
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
#!/bin/bash
# Usage:
if [[ -z "$1" ]]; then
echo "Usage: $0 <g>"
exit 1
fi
g_value="$1"
cp input/colloid.lmpdat colloid.lmpdat
cp input/simulated_annealing.in simulated_annealing.in
sed -i '' "s@variable g equal .*@variable g equal $g_value@g" simulated_annealing.in
echo "------------------------------------------------------------------------"
echo " "
echo "Simulated Annealing: g = $g_value"
echo " "
echo "------------------------------------------------------------------------"
lmp -in simulated_annealing.in
# Declare files and their corresponding destination folders
FILES=(
"SA_config.lmpdat"
"SA_log.lammps"
)
# Corresponding destination folders
DESTINATIONS=(
"config/sim_ann/"
"output/sim_ann/"
)
for i in "${!FILES[@]}"; do
file="${FILES[$i]}"
destination="${DESTINATIONS[$i]}"
mkdir -p "$destination"
if [[ -f "$file" ]]; then
filename="${file%.*}" # Extract filename
extension="${file##*.}" # Extract extension
new_name="${filename}_$g_value.${extension}" # Rename with g value
mv "$file" "${destination}${new_name}"
else
echo "Warning: $file not found!"
fi
done
rm -f colloid.lmpdat simulated_annealing.in log.lammps