-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSTART_FROM_CONFIG.sh
More file actions
70 lines (53 loc) · 1.86 KB
/
START_FROM_CONFIG.sh
File metadata and controls
70 lines (53 loc) · 1.86 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
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
if [ $# -ne 4 ]; then
echo "Usage: $0 <g> <old_force> <new_force> <steps>"
exit 1
fi
g_value="$1"
old_force="$2"
force="$3"
steps="$4"
cp config/friction/friction_$g_value/restart/friction_$old_force.restart friction_$old_force.restart
mv friction_$old_force.restart friction.restart
cp input/apply_force_restart.in apply_force_restart.in
sed -i '' "s@variable g equal .*@variable g equal $g_value@g" apply_force_restart.in
sed -i '' "s@# reset_timestep 0@reset_timestep 0@g" apply_force_restart.in
sed -i '' "s@variable Forcefrac equal .*@variable Forcefrac equal $force*v_F1s@g" apply_force_restart.in
sed -i '' "s@run .*@run $steps@g" apply_force_restart.in
echo "------------------------------------------------------------------------"
echo " "
echo "FRICTION simulation: g = $g_value"
echo " "
echo "Using force: F = $force F_1s from $old_force config"
echo "$steps simulation steps"
echo " "
echo "------------------------------------------------------------------------"
lmp -in apply_force_restart.in
# Declare files and their corresponding destination folders
FILES=(
"final_config.lmpdat"
"pos_vel.dat"
"sim_log.lammps"
"friction.restart"
)
# Corresponding destination folders
DESTINATIONS=(
"config/friction/friction_$g_value/"
"output/friction/friction_$g_value/"
"output/friction/friction_$g_value/logs/"
"config/friction/friction_$g_value/restart/"
)
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}_$force.${extension}"
mv "$file" "${destination}${new_name}"
else
echo "Warning: $file not found!"
fi
done
rm -f log.lammps apply_force_restart.in # start_config.lmpdat