-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjob
More file actions
executable file
·82 lines (66 loc) · 2.34 KB
/
job
File metadata and controls
executable file
·82 lines (66 loc) · 2.34 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
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/bash
# ================= CONFIGURATION =================
# Define your ORCA paths
orca_5_path="/home/vport/software/orca_5_0_4/orca"
orca_6_path="/home/vport/software/orca_6_1_1/orca"
# Define your OpenMPI Base Directories (UPDATE THESE PATHS)
# Example: /usr/lib64/openmpi or /home/vport/opt/openmpi-4.1.1
MPI_411_HOME="/opt/openmpi-4.1.1"
MPI_418_HOME="/opt/openmpi-4.1.8"
# =================================================
# Helper function to remove a specific path from a variable
# Usage: remove_path "variable_name" "path_to_remove"
remove_path() {
local var_name=$1
local path_to_remove=$2
local current_val=${!var_name}
# Use colon as delimiter for replacement
# 1. Remove path from middle (:path:)
# 2. Remove path from start (path:)
# 3. Remove path from end (:path)
# 4. Remove if it's the only path
current_val=${current_val//:$path_to_remove:/:}
current_val=${current_val/#$path_to_remove:/" "}
current_val=${current_val/%:$path_to_remove/""}
current_val=${current_val/#$path_to_remove/""}
# Export the modified variable back
export $var_name="$current_val"
}
# Default setup (ORCA 5 matches your default system environment)
orca_executable="$orca_5_path"
# Parse flags
while getopts ":v:" opt; do
case $opt in
v)
if [[ $OPTARG == "6" ]]; then
# --- SWITCH TO ORCA 6 ENVIRONMENT ---
orca_executable="$orca_6_path"
# 1. Remove default OpenMPI 4.1.1 from environment
remove_path "PATH" "$MPI_411_HOME/bin"
remove_path "LD_LIBRARY_PATH" "$MPI_411_HOME/lib"
# 2. Add OpenMPI 4.1.8 to environment (Prepend to ensure priority)
export PATH="$MPI_418_HOME/bin:$PATH"
export LD_LIBRARY_PATH="$MPI_418_HOME/lib:$LD_LIBRARY_PATH"
elif [[ $OPTARG != "5" ]]; then
echo "Unsupported ORCA version. Use 6 or 5 (default)."
exit 1
fi
;;
\?)
echo "Invalid option: -$OPTARG"
exit 1
;;
esac
done
# Shift arguments to get the input file
shift $((OPTIND - 1))
if [ -z "$1" ]; then
echo "Usage: $0 [-v 5|6] <input_file>"
exit 1
fi
infile=$1
outfile="${infile%.*}.out"
# Debug: Uncomment the next line to check paths before running
echo -e "PATH: $PATH\nLD: $LD_LIBRARY_PATH\nEXE: $orca_executable"
# Run ORCA
$orca_executable "$infile" --use-hwthread-cpus > "$outfile"