11#! /usr/bin/env bash
22set -euo pipefail
33
4+ # -------------------------------------------------------------------------
5+ # INSTALLATION OF ARC, RMG, and other external dependencies
6+ # Options:
7+ # --no-clean: Skip the aggressive cleanup of conda/micromamba caches and build directories.
8+ # --no-ext: Skip the installation of external dependencies (autotst, kinbot, etc.)
9+ # --rmg-*: Options for RMG installation
10+ # --arc-*: Options for ARC installation
11+ # -------------------------------------------------------------------------
12+
13+ # ── locate this script and the repo root ──────────────────────────────────
14+ SCRIPT_DIR=" $( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd) "
15+ DEVTOOLS_DIR=" $SCRIPT_DIR " # you are already in devtools
16+ REPO_ROOT=" $( cd " $SCRIPT_DIR /.." && pwd) " # one level up
17+
18+ # helper so every sub-call works no matter where we launched from
19+ run_devtool () { bash " $DEVTOOLS_DIR /$1 " " ${@: 2} " ; }
20+
421# ##################################################################################
5- # Flag for cleaning
22+ # Flag for cleaning up disk space and caches, and for installing external dependencies
23+ # and their arguments.
624# ################################################################################
7- SKIP_CLEAN=false
8- [[ " ${1:- } " == --no-clean ]] && SKIP_CLEAN=true
9-
10-
11- # -----------------------------------------------------------------------------
12- # Helper: aggressively clean conda/micromamba caches & remove any known build
13- # directories in our workspace. Ignores any permission errors.
14- # -----------------------------------------------------------------------------
15- cleanup_disk () {
16- echo " >>> Cleaning package manager caches and temporary build dirs…"
17-
18- # Clean conda / micromamba
19- if command -v micromamba & > /dev/null; then
20- micromamba clean --all --yes || true
21- elif command -v mamba & > /dev/null; then
22- mamba clean --all --yes || true
23- elif command -v conda & > /dev/null; then
24- conda clean -afy || true
25- fi
26-
27- # Remove pip cache
28- rm -rf " $HOME /.cache/pip" || true
2925
30- # Remove any "build/" or "dist/" dirs left behind in our repo clones
31- find . -type d \( -name build -o -name dist \) -prune -exec rm -rf {} + 2> /dev/null || true
26+ SKIP_CLEAN=false
27+ SKIP_EXT=false
28+ SKIP_ARC=false
29+ RMG_ARGS=()
30+ ARC_ARGS=()
31+ EXT_ARGS=()
32+ GENERIC_ARGS=()
33+
34+ while [[ $# -gt 0 ]]; do
35+ case " $1 " in
36+ --no-clean) SKIP_CLEAN=true ;;
37+ --no-ext) SKIP_EXT=true ;;
38+ --no-arc) SKIP_ARC=true ;;
39+ --rmg-* ) RMG_ARGS+=(" ${1# --rmg-} " ) ;;
40+ --arc-* ) ARC_ARGS+=(" ${1# --arc-} " ) ;;
41+ --ext-* ) EXT_ARGS+=(" ${1# --ext-} " ) ;;
42+ --help|-h)
43+ cat << EOF
44+ Usage: $0 [global-flags] [--rmg-xxx] [--arc-yyy] [--ext-zzz]
45+ --no-clean Skip micromamba/conda cache cleanup
46+ --no-ext Skip external tools (AutoTST, KinBot, …)
47+ --rmg-path Forward '--path' to RMG installer
48+ --rmg-pip Forward '--pip' to RMG installer
49+ ...
50+ EOF
51+ exit 0 ;;
52+ * ) GENERIC_ARGS+=(" $1 " ) ;;
53+ esac
54+ shift
55+ done
3256
33- # Remove any __pycache__
34- find . -type d -name " __pycache__" -prune -exec rm -rf {} + 2> /dev/null || true
57+ echo " >>> Beginning full ARC external repo installation…"
58+ echo " RMG sub-flags : ${RMG_ARGS[*]:- (none)} "
59+ echo " ARC sub-flags : ${ARC_ARGS[*]:- (none)} "
60+ echo " EXT sub-flags : ${EXT_ARGS[*]:- (none)} "
3561
36- # Prune any other big caches under home that we own
37- rm -rf " $HOME /.cache" /git* " $HOME /.cache" /julia* || true
3862
39- df -h . | sed ' 1!p;d' # show after-clean free space
40- }
4163
4264# -----------------------------------------------------------------------------
4365# Main install sequence
@@ -47,57 +69,54 @@ pushd . >/dev/null
4769
4870# 1) RMG
4971echo " === Installing RMG ==="
50- bash devtools/ install_rmg.sh
51- ! $SKIP_CLEAN && cleanup_disk
72+ run_devtool install_rmg.sh " ${RMG_ARGS[@]} "
73+
5274
5375# # 2) PyRDL
5476# echo "=== Installing PyRDL ==="
5577# bash devtools/install_pyrdl.sh
5678# ! $SKIP_CLEAN && cleanup_disk
5779
58- # # 3) ARC itself (skip env creation in CI)
59- # if [[ -z "${CI:-}" ]]; then
60- # echo "=== Installing ARC ==="
61- # bash devtools/install_arc.sh
62- # ! $SKIP_CLEAN && cleanup_disk
63- # else
64- # echo "ℹ️ CI detected, skipping arc_env creation."
65- # fi
66-
67- # 4) GCN (CPU)
68- echo " === Installing GCN CPU ==="
69- bash devtools/install_gcn_cpu.sh
70- ! $SKIP_CLEAN && cleanup_disk
71-
72- # 5) AutoTST
73- echo " === Installing AutoTST ==="
74- bash devtools/install_autotst.sh
75- ! $SKIP_CLEAN && cleanup_disk
76-
77- # 6) KinBot
78- echo " === Installing KinBot ==="
79- bash devtools/install_kinbot.sh
80- ! $SKIP_CLEAN && cleanup_disk
81-
82- # 7) Open Babel
83- echo " === Installing OpenBabel ==="
84- bash devtools/install_ob.sh
85- ! $SKIP_CLEAN && cleanup_disk
86-
87- # 8) xtb
88- echo " === Installing xtb ==="
89- bash devtools/install_xtb.sh
90- ! $SKIP_CLEAN && cleanup_disk
91-
92- # 9) Sella
93- echo " === Installing Sella ==="
94- bash devtools/install_sella.sh
95- ! $SKIP_CLEAN && cleanup_disk
96-
97- # 10) TorchANI
98- echo " === Installing TorchANI ==="
99- bash devtools/install_torchani.sh
100- ! $SKIP_CLEAN && cleanup_disk
80+ # 3) ARC itself (skip env creation in CI or if user requests it)
81+ if [[ -z " ${CI:- } " ]] && [[ -z " ${SKIP_ARC:- } " ]]; then
82+ echo " === Installing ARC ==="
83+ run_devtool install_arc.sh " ${ARC_ARGS[@]} "
84+
85+ if [[ $SKIP_CLEAN == false ]]; then
86+ echo " === Cleaning up ARC build artifacts ==="
87+ # Cleanup disk space after ARC installation
88+ run_devtool clean.sh --python-builds --pip
89+ echo " ℹ️ Disk cleanup complete."
90+ else
91+ echo " ℹ️ Skipping ARC cleanup as per --no-clean flag."
92+ fi
93+ else
94+ echo " ℹ️ CI detected or --no-arc flag set. Skipping ARC installation."
95+ fi
96+
97+ if [[ $SKIP_EXT == false ]]; then
98+ # map of friendly names → installer scripts
99+ declare -A EXT_INSTALLERS=(
100+ [GCN\ CPU]=install_gcn_cpu.sh
101+ [AutoTST]=install_autotst.sh
102+ [KinBot]=install_kinbot.sh
103+ [OpenBabel]=install_ob.sh
104+ [xtb]=install_xtb.sh
105+ [Sella]=install_sella.sh
106+ [TorchANI]=install_torchani.sh
107+ )
108+
109+ for name in " ${! EXT_INSTALLERS[@]} " ; do
110+ echo " === Installing $name ==="
111+ run_devtool " ${EXT_INSTALLERS[$name]} "
112+
113+ done
114+ else
115+ echo " ℹ️ --no-ext flag set. Skipping external-dependency installs."
116+ fi
117+
118+ # 4) Clean up disk space
119+ run_devtool clean.sh --conda
101120
102121popd > /dev/null
103122
0 commit comments