Skip to content
Open
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Thomas Hoffmann, EMBL Heidelberg, structures-it@embl.de, 2025/01
# - additionally search libciffpp components.cif in path definded by
# environment variable LIBCIFPP_DATA_DIR
# - allow to set default model dir and public databases dir by environment
# variables AF3_MODEL_DIR and DB_DIR, respectively.
diff -ru alphafold3-ea040346e10db1759170e723ef263316e64aa768/run_alphafold.py alphafold3-ea040346e10db1759170e723ef263316e64aa768_data_path/run_alphafold.py
--- alphafold3-ea040346e10db1759170e723ef263316e64aa768/run_alphafold.py 2025-01-09 13:59:41.000000000 +0100
+++ alphafold3-ea040346e10db1759170e723ef263316e64aa768_data_path/run_alphafold.py 2025-01-15 18:48:19.060274236 +0100
@@ -55,8 +55,14 @@


_HOME_DIR = pathlib.Path(os.environ.get('HOME'))
-_DEFAULT_MODEL_DIR = _HOME_DIR / 'models'
-_DEFAULT_DB_DIR = _HOME_DIR / 'public_databases'
+_DEFAULT_MODEL_DIR = os.environ.get('AF3_MODEL_DIR')
+if _DEFAULT_MODEL_DIR == None:
+ _DEFAULT_MODEL_DIR = _HOME_DIR / 'models'
+else: _DEFAULT_MODEL_DIR = pathlib.Path(_DEFAULT_MODEL_DIR)
+_DEFAULT_DB_DIR = os.environ.get('DB_DIR')
+if _DEFAULT_DB_DIR == None:
+ _DEFAULT_DB_DIR = _HOME_DIR / 'public_databases'
+else: _DEFAULT_DB_DIR = pathlib.Path(_DEFAULT_DB_DIR)


# Input and output paths.
diff -ru alphafold3-ea040346e10db1759170e723ef263316e64aa768/src/alphafold3/build_data.py alphafold3-ea040346e10db1759170e723ef263316e64aa768_data_path/src/alphafold3/build_data.py
--- alphafold3-ea040346e10db1759170e723ef263316e64aa768/src/alphafold3/build_data.py 2025-01-09 13:59:41.000000000 +0100
+++ alphafold3-ea040346e10db1759170e723ef263316e64aa768_data_path/src/alphafold3/build_data.py 2025-01-15 18:04:26.440308446 +0100
@@ -17,16 +17,21 @@
import alphafold3.constants.converters
from alphafold3.constants.converters import ccd_pickle_gen
from alphafold3.constants.converters import chemical_component_sets_gen
-
+from os import getenv

def build_data():
"""Builds intermediate data."""
- for site_path in site.getsitepackages():
- path = pathlib.Path(site_path) / 'share/libcifpp/components.cif'
- if path.exists():
- cif_path = path
- break
+ cif_path = None
+ if getenv('LIBCIFPP_DATA_DIR'):
+ path = getenv('LIBCIFPP_DATA_DIR') + '/components.cif'
+ cif_path = path
else:
+ for site_path in site.getsitepackages():
+ path = pathlib.Path(site_path) / 'share/libcifpp/components.cif'
+ if path.exists():
+ cif_path = path
+ break
+ if (not cif_path):
raise ValueError('Could not find components.cif')

out_root = resources.files(alphafold3.constants.converters)
diff -ru alphafold3-ea040346e10db1759170e723ef263316e64aa768/src/alphafold3/model/mkdssp_pybind.cc alphafold3-ea040346e10db1759170e723ef263316e64aa768_data_path/src/alphafold3/model/mkdssp_pybind.cc
--- alphafold3-ea040346e10db1759170e723ef263316e64aa768/src/alphafold3/model/mkdssp_pybind.cc 2025-01-09 13:59:41.000000000 +0100
+++ alphafold3-ea040346e10db1759170e723ef263316e64aa768_data_path/src/alphafold3/model/mkdssp_pybind.cc 2025-01-15 14:34:35.267983665 +0100
@@ -27,20 +27,23 @@
void RegisterModuleMkdssp(pybind11::module m) {
py::module site = py::module::import("site");
py::list paths = py::cast<py::list>(site.attr("getsitepackages")());
+ const char* libcifpp_data_dir_p = std::getenv("LIBCIFPP_DATA_DIR");
+ if (!libcifpp_data_dir_p) {
// Find the first path that contains the libcifpp components.cif file.
- bool found = false;
- for (const auto& py_path : paths) {
- auto path_str =
- std::filesystem::path(py::cast<absl::string_view>(py_path)) /
- "share/libcifpp/components.cif";
- if (std::filesystem::exists(path_str)) {
- setenv("LIBCIFPP_DATA_DIR", path_str.parent_path().c_str(), 0);
- found = true;
- break;
+ bool found = false;
+ for (const auto& py_path : paths) {
+ auto path_str =
+ std::filesystem::path(py::cast<absl::string_view>(py_path)) /
+ "share/libcifpp/components.cif";
+ if (std::filesystem::exists(path_str)) {
+ setenv("LIBCIFPP_DATA_DIR", path_str.parent_path().c_str(), 0);
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ throw py::type_error("Could not find the libcifpp components.cif file.");
}
- }
- if (!found) {
- throw py::type_error("Could not find the libcifpp components.cif file.");
}
m.def(
"get_dssp",
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Thomas Hoffmann, EMBL Heidelberg, structures-it@embl.de, 2025/01
# disable FetchContent for pybind11, abseil-cpp, pybind11_abseil, cifpp and dssp
# use find_package instead.
diff -ru alphafold3-3.0.0/CMakeLists.txt alphafold3-3.0.0_disable_fetch/CMakeLists.txt
--- alphafold3-3.0.0/CMakeLists.txt 2024-11-11 11:42:47.000000000 +0100
+++ alphafold3-3.0.0_disable_fetch/CMakeLists.txt 2025-01-14 17:14:41.925312870 +0100
@@ -54,8 +54,11 @@
GIT_TAG 57560472b4260dc41f457706bc45fc6ef0bc0f10 # v4.4.7
EXCLUDE_FROM_ALL)

-FetchContent_MakeAvailable(pybind11 abseil-cpp pybind11_abseil cifpp dssp)
-
+#FetchContent_MakeAvailable(pybind11 abseil-cpp pybind11_abseil cifpp dssp)
+find_package(pybind11 CONFIG REQUIRED)
+find_package(absl CONFIG REQUIRED)
+find_package(pybind11_abseil CONFIG REQUIRED)
+find_package(dssp CONFIG REQUIRED)
find_package(
Python3
COMPONENTS Interpreter Development NumPy
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Author: Thomas Hoffmann, EMBL Heidelberg, structures-it@embl.de, 2025/02
# Update: Pavel Tomanek (Inuits)
easyblock = 'PythonBundle'

name = 'AlphaFold3'
version = '3.0.1-20250908'
versionsuffix = '-CUDA-%(cudaver)s'
local_commit = 'a8ecdb2'

homepage = 'https://deepmind.google/technologies/alphafold'
description = """This package provides an implementation of the inference pipeline of AlphaFold3.
See below for how to access the model parameters. You may only use AlphaFold3
model parameters if received directly from Google. Use is subject to these
terms of use:
https://github.com/google-deepmind/alphafold3/blob/main/WEIGHTS_TERMS_OF_USE.md"""

toolchain = {'name': 'foss', 'version': '2024a'}

github_account = 'google-deepmind'

builddependencies = [
('scikit-build', '0.17.6'),
('poetry', '1.8.3'),
('Python-bundle-PyPI', '2024.06'),
('scikit-build-core', '0.10.6'),
('pybind11', '2.12.0'),
('pybind11_abseil', '202402.0'),
]

dependencies = [
('Python', '3.12.3'),
('CUDA', '12.6.0', '', SYSTEM),
('jax', '0.6.2', versionsuffix),
('jax-triton', '0.3.0', versionsuffix),
('jaxtyping', '0.2.38', versionsuffix),
('dm-haiku', '0.0.14', versionsuffix),
('dm-tree', '0.1.9'),
('RDKit', '2025.03.3'),
('tqdm', '4.66.5'),
('dssp', '4.4.10'),
('Abseil', '20240722.0'),
('HMMER', '3.4'),
]

exts_list = [
('zstandard', '0.23.0', {
'checksums': ['b2d8c62d08e7255f68f7a740bae85b3c9b8e5466baa9cbf7f57f1cde0ac6bc09'],
}),
('typeguard', '2.13.3', {
'checksums': ['00edaa8da3a133674796cf5ea87d9f4b4c367d77476e185e80251cc13dfbb8c4'],
}),
(name, version, {
# unpin dependencies versions
'preinstallopts': """sed -i 's/==.*/",/g' %(start_dir)s/pyproject.toml && """,
'patches': [
'%(name)s-3.0.0_disable_fetch.patch',
'%(name)s-3.0.0.20250109_data_path.patch',
],
'postinstallcmds': [
'cp run_alphafold.py %(installdir)s/bin',
'cp run_alphafold_data_test.py %(installdir)s/bin',
'cp run_alphafold_test.py %(installdir)s/bin',
'cp fetch_databases.sh %(installdir)s',
'chmod +x %(installdir)s/bin/run_alphafold.py',
'%(installdir)s/bin/build_data',
],
'source_urls': ['https://github.com/%(github_account)s/%(namelower)s/archive'],
'sources': [{'download_filename': 'a8ecdb2.tar.gz', 'filename': '%(name)s-%(version)s-a8ecdb2.tar.gz'}],
'checksums': [
{'AlphaFold3-3.0.1-20250908-a8ecdb2.tar.gz':
'77cc1ee5e9d111bafd4cd6af01d43eee01059cb3f7fd2d19fd6c38d81082246d'},
{'AlphaFold3-3.0.0_disable_fetch.patch':
'041a35a09f783405f40e3ba47566ad6d063a10cfd98f0efd2e2a04c78e2c155e'},
{'AlphaFold3-3.0.0.20250109_data_path.patch':
'a06a971460df5e4cbe7a59042100512d2f96755d6dcdef01d4bc4e8c55122287'},
],
}),
]

fix_python_shebang_for = ['bin/run_alphafold.py']

sanity_check_paths = {
'files': ['bin/run_alphafold.py'],
'dirs': ['lib'],
}
sanity_check_commands = [
('run_alphafold.py --help|grep "AlphaFold 3 structure prediction script"')
]

modextravars = {
# Compilation Time Workaround with XLA Flags
'XLA_FLAGS': '--xla_gpu_enable_triton_gemm=false ',
# Unified memory:
'XLA_PYTHON_CLIENT_PREALLOCATE': 'false',
'TF_FORCE_UNIFIED_MEMORY': 'true',
'XLA_CLIENT_MEM_FRACTION': '3.2',
}

modextrapaths = {'PYTHONPATH': 'bin'} # to be able 'import run_alphafold'

modloadmsg = """
To let AF3 works properly you need to have Google models parameters (weights), then set:
export AF3_MODEL_DIR="/path/to/the/dir/with/models"
Also you should have databases dowloaded - use fetch_databases.sh to download them and set:
export DB_DIR="/path/to/fetched/databases"
You can test your installation by:
1) python bin/run_alphafold_data_test.py (works without models)
2) python bin/run_alphafold_test.py --model_dir="$AF3_MODEL_DIR" (only with models)
"""

moduleclass = 'bio'
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# update 0.0.12: Thomas Hoffmann (EMBL)
easyblock = 'PythonBundle'

name = 'dm-haiku'
version = '0.0.14'
versionsuffix = '-CUDA-%(cudaver)s'

homepage = 'https://github.com/deepmind/dm-haiku'
description = """Haiku is a simple neural network library for JAX developed by some of the authors of Sonnet, a neural
network library for TensorFlow."""

toolchain = {'name': 'foss', 'version': '2024a'}

builddependencies = [('poetry', '1.8.3')]

dependencies = [
('CUDA', '12.6.0', '', SYSTEM),
('Python', '3.12.3'),
('SciPy-bundle', '2024.05'),
('jax', '0.6.2', versionsuffix),
('Flax', '0.10.2', versionsuffix),
('absl-py', '2.1.0'),
]

exts_list = [
('jmp', '0.0.4', {
'checksums': ['5dfeb0fd7c7a9f72a70fff0aab9d0cbfae32a809c02f4037ff3485ceb33e1730'],
}),
('dm_haiku', version, {
'modulename': 'haiku',
'checksums': ['0c1d56ef20e1e04d8551f788ff8964167092c5d8051b7c17ed3f9ce60c0b0a59'],
}),
]

moduleclass = 'lib'
42 changes: 42 additions & 0 deletions easybuild/easyconfigs/f/Flax/Flax-0.10.2-gfbf-2024a-CUDA-12.6.0.eb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
easyblock = 'PythonBundle'

name = 'Flax'
version = '0.10.2'
versionsuffix = '-CUDA-%(cudaver)s'

homepage = 'https://flax.readthedocs.io'
description = """Flax is a high-performance neural network library and ecosystem for JAX that is
designed for flexibility: Try new forms of training by forking an example and
by modifying the training loop, not by adding features to a framework."""

toolchain = {'name': 'gfbf', 'version': '2024a'}

builddependencies = [('hatchling', '1.24.2')]
dependencies = [
('CUDA', '12.6.0', '', SYSTEM),
('Python', '3.12.3'),
('SciPy-bundle', '2024.05'),
('jax', '0.6.2', versionsuffix),
('Optax', '0.2.4', versionsuffix),
('protobuf-python', '5.28.0'),
('PyYAML', '6.0.2'),
('tensorstore', '0.1.72'),
]

exts_list = [
('nest_asyncio', '1.6.0', {
'checksums': ['6f172d5449aca15afd6c646851f4e31e02c598d553a667e38cafa997cfec55fe'],
}),
('humanize', '4.11.0', {
'checksums': ['e66f36020a2d5a974c504bd2555cf770621dbdbb6d82f94a6857c0b1ea2608be'],
}),
('orbax_checkpoint', version, {
'modulename': 'orbax.checkpoint',
'checksums': ['e575ebe1f94e5cb6353ab8c9df81de0ca7cddc118645c3bfc17b8344f19d42f1'],
}),
('%(namelower)s', version, {
'checksums': ['6f831350026ad48182ba6588bb4dd72dc1084985d9aca923254cb3e4c78d75f3'],
}),
]

moduleclass = 'ai'
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Thomas Hoffmann, EMBL Heidelberg, structures-it@embl.de, 2024/12

easyblock = 'PythonBundle'

name = 'jax-triton'
version = '0.3.0'
versionsuffix = '-CUDA-%(cudaver)s'

homepage = 'https://pypi.org/project/jax-triton'
description = """The jax-triton repository contains integrations between JAX and Triton."""

toolchain = {'name': 'foss', 'version': '2024a'}

dependencies = [
('Python', '3.12.3'),
('CUDA', '12.6.0', '', SYSTEM),
('jax', '0.6.2', versionsuffix),
('Triton', '3.3.1', versionsuffix),
]

exts_list = [
('jax_triton', version, {
'checksums': ['da7b9cd8f784de50b26d104a3f4c417c0afcdd894f98442bc815a822900033e6'],
}),
]

sanity_check_paths = {
'files': [],
'dirs': ['lib'],
}

moduleclass = 'ai'
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Thomas Hoffmann, EMBL Heidelberg, structures-it@embl.de, 2024/12

easyblock = 'PythonBundle'

name = 'jaxtyping'
version = '0.2.38'
versionsuffix = '-CUDA-%(cudaver)s'

homepage = 'https://github.com/patrick-kidger/jaxtyping'
description = """Type annotations and runtime type-checking for:
1. shape and dtype of JAX arrays;
(Now also supports PyTorch, NumPy, and TensorFlow!)
2. PyTrees. """
toolchain = {'name': 'foss', 'version': '2024a'}

builddependencies = [
('poetry', '1.8.3')
]
dependencies = [
('Python', '3.12.3'),
('CUDA', '12.6.0', '', SYSTEM),
('jax', '0.6.2', versionsuffix),
]

exts_list = [
('wadler_lindig', '0.1.3', {
'checksums': ['476fb7015135f714cef8f8eac7c44b164c8b993345e651a9b6f25b7b112440c9'],
}),
(name, version, {
'checksums': ['84d509341437189e82d7dbb59a2970435724851ca79fd8550e886cd37c048333'],
}),
]

sanity_check_paths = {
'files': [],
'dirs': ['lib'],
}

moduleclass = 'ai'
Loading