install qfit

This commit is contained in:
2026-09-01 11:11:03 +02:00
parent a9c84530f8
commit 5e09fbfec7
4 changed files with 131 additions and 0 deletions
+61
View File
@@ -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/<version>`.
- 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=<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<ver>.tar.gz`), check whether upstream unpinned
numpy/pandas (a newer pin may allow a newer venv Python), then build as
above.
Executable
+33
View File
@@ -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"
}
+20
View File
@@ -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]
+17
View File
@@ -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 <jiaxin.duan@psi.ch>"
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