From 5e09fbfec73b88cd1f54f14e5397a627aa255cba Mon Sep 17 00:00:00 2001 From: Dawn Date: Tue, 1 Sep 2026 11:11:03 +0200 Subject: [PATCH] install qfit --- qfit/README.md | 61 ++++++++++++++++++++++++++++++++++++++++++ qfit/build | 33 +++++++++++++++++++++++ qfit/files/config.yaml | 20 ++++++++++++++ qfit/modulefile | 17 ++++++++++++ 4 files changed, 131 insertions(+) create mode 100644 qfit/README.md create mode 100755 qfit/build create mode 100644 qfit/files/config.yaml create mode 100644 qfit/modulefile diff --git a/qfit/README.md b/qfit/README.md new file mode 100644 index 0000000..9d08656 --- /dev/null +++ b/qfit/README.md @@ -0,0 +1,61 @@ +# qfit + +qFit 3 — automated multiconformer model building for X-ray +crystallography and cryo-EM (`qfit_protein`, `qfit_ligand`, +`qfit_covalent_ligand`, `edia`, ...). Repo is named `qfit-3.0`; module +follows the name/version rule as `qfit/`. + +- Upstream: https://github.com/ExcitedStates/qfit-3.0 +- License: MIT + +## How it is built + +uv route (careless-style) from the sha-pinned GitHub tag tarball into +`$PREFIX/venv`, Python **3.10** (upstream pins `numpy<1.22`, which has +no 3.11+ wheels). The small C extension builds with the gcc/12.3.0 +module (plain C, no gcc runtime dep). Upstream quirks the recipe +handles: + +- `use_scm_version=True` but the tarball has no `.git` → + `SETUPTOOLS_SCM_PRETEND_VERSION=` is exported for the build. +- MIQP solvers are only listed in upstream's conda `environment.yml`, + not in `install_requires` → `cvxopt` and `cplex` are pip-installed + explicitly. + +**CPLEX caveat**: the pip `cplex` wheel is the IBM Community Edition, +limited to 1000 variables/constraints. Large residues/ligands may hit +the cap; the fix is a full academic CPLEX install into the venv +(https://www.ibm.com/academic/) — documented by upstream. + +`uv` must be on the build host (default `~/.local/bin/uv`, override +with `UV=/path/to/uv`). + +## Building on Ra + +```sh +module use unstable && module load modbuild/2.1.3 +cd qfit +modbuild build \ + --tmpdir=/das/work/p21/p21515/.cache/Pmodules \ + --distdir=/das/work/p21/p21515/.cache/Pmodules \ + 3.2.2 +module use MX unstable && module load qfit/3.2.2 +``` + +## Verifying the install + +```sh +which qfit_protein # -> .../qfit/3.2.2/venv/bin/qfit_protein +qfit_protein --help # argparse usage, no traceback +"$QFIT_ENV/bin/python" -c "import qfit, cplex, cvxopt; print(qfit.__version__)" +``` + +The post-refinement scripts (`qfit_final_refine_xray.sh`) call phenix: +`module load phenix` before using them. + +## Adding a new version + +Add version + tarball sha256 in `files/config.yaml` (`sha256sum` the +downloaded `v.tar.gz`), check whether upstream unpinned +numpy/pandas (a newer pin may allow a newer venv Python), then build as +above. diff --git a/qfit/build b/qfit/build new file mode 100755 index 0000000..74616fe --- /dev/null +++ b/qfit/build @@ -0,0 +1,33 @@ +#!/usr/bin/env modbuild + +# qFit (multiconformer model building), uv route from the sha-pinned GitHub +# tarball. Three upstream traps handled here: +# - use_scm_version needs git metadata the tarball lacks -> SETUPTOOLS_SCM_PRETEND_VERSION +# - numpy pinned <1.22 -> newest CPython with wheels is 3.10 +# - MIQP solvers (cvxopt, cplex) are only in environment.yml, not +# install_requires -> pip them explicitly or qfit dies at runtime + +pbuild::configure() { + # modbuild's shell strips ~/.local/bin from PATH; override with UV=/path/to/uv if needed + UV="${UV:-$HOME/.local/bin/uv}" + export UV_CACHE_DIR="/opt/psi/MX/.uv-cache" + export UV_PYTHON_INSTALL_DIR="$PREFIX/python" + "$UV" venv --python 3.10 "$PREFIX/venv" || std::die 42 "uv venv failed - is uv at \$UV?" +} + +pbuild::compile() { + : +} + +pbuild::install() { + UV="${UV:-$HOME/.local/bin/uv}" + export UV_CACHE_DIR="/opt/psi/MX/.uv-cache" + export CC=gcc + export SETUPTOOLS_SCM_PRETEND_VERSION="${V_PKG}" + # cplex is the IBM Community Edition pip wheel (problem-size limited); + # full CPLEX needs an academic license, see README + "$UV" pip install --python "$PREFIX/venv/bin/python" \ + cvxopt cplex "$SRC_DIR" || \ + std::die 42 "qfit install failed - check build log above" + [[ -x "$PREFIX/venv/bin/qfit_protein" ]] || std::die 42 "qfit_protein missing from venv" +} diff --git a/qfit/files/config.yaml b/qfit/files/config.yaml new file mode 100644 index 0000000..8e8c212 --- /dev/null +++ b/qfit/files/config.yaml @@ -0,0 +1,20 @@ +--- +format: 1 +qfit: + defaults: + group: MX + overlay: base + relstage: unstable + urls: + # repo is named qfit-3.0 but the tool/module is qfit (name/version guardrail) + - url: https://github.com/ExcitedStates/qfit-3.0/archive/refs/tags/v${V_PKG}.tar.gz + name: qfit-${V_PKG}.tar.gz + strip_dirs: 1 + shasums: + qfit-3.2.2.tar.gz: b3c37a45598c31aabfb0a0024710b8e22ea6ffd49355ad69a17b93a7777e699d + versions: + 3.2.2: + config: + relstage: unstable + # gcc for the small C extension (_extensions.c); plain C, so no runtime dep + build_requires: [gcc/12.3.0] diff --git a/qfit/modulefile b/qfit/modulefile new file mode 100644 index 0000000..57e922a --- /dev/null +++ b/qfit/modulefile @@ -0,0 +1,17 @@ +#%Module1.0 + +module-whatis "qFit - automated multiconformer model building for X-ray and cryo-EM" +module-url "https://github.com/ExcitedStates/qfit-3.0" +module-license "MIT" +module-maintainer "MX Data " + +module-help " +qFit 3: qfit_protein, qfit_ligand, qfit_covalent_ligand, edia and +friends, in a private Python venv with cvxopt + IBM CPLEX Community +Edition as MIQP solvers. The post-refinement scripts +(qfit_final_refine_xray.sh) expect phenix on PATH - load a phenix +module for those. +" + +setenv QFIT_ENV $PREFIX/venv +prepend-path PATH $PREFIX/venv/bin