Skip to content

Alphafold-3.0.0

this page briefly describes a local installation of Alphafold 3.0.0 (no docker or singularity involved).

License

The model used in AlphaFold3 has certain restrictions. Please have a look at the license and instructions to obtain model parameters. To use AlphaFold3 you have to

  • get your personal copy of the model parameters
  • keep it in a secure location and don't share it with anyone

Please also consult the Terms of Use and the Prohibited Use Policy.

Setup

AlphaFold3 separates the CPU-only and GPU-only tasks into a data pipeline and an inference tasks. The data pipeline can't make use of GPUs, while inference is tied to GPUs. Your batch-jobs should split tasks accordingly to make efficient use of resources. Have a look at the alphafold3 performance documentation.

Samples

There are two basic sample sripts for the two tasks mentioned.

data pipeline

The script can be found at sbatch-af3-pipeline.sh:

#!/bin/bash
#SBATCH --constraint=9554|75F3
#SBATCH --partition=maxcpu
#SBATCH --time=2-0
unset LD_PRELOAD
source /etc/profile.d/modules.sh

export ALPHAFOLD_DB=/software/alphafold/db
export ALPHAFOLD_PREFIX=/software/alphafold/3.0.0L
export PATH=$ALPHAFOLD_PREFIX/hmmer/bin:$ALPHAFOLD_PREFIX/bin:$PATH

python ${ALPHAFOLD_PREFIX}/alphafold/run_alphafold.py \
    --db_dir=${ALPHAFOLD_DB} \
    --json_path=$PWD/input/alphafold_input.json \
    --model_dir=$PWD/parameters \
    --output_dir=$PWD/output --norun_inference \
    --run_data_pipeline=True

inference

The script can be found at sbatch-af3-inference.sh:

#!/bin/bash
#SBATCH --constraint=A100-PCIE-80GB|A100-SXM4-80GB
#SBATCH --partition=maxgpu
#SBATCH --time=0-01:00:00
unset LD_PRELOAD
source /etc/profile.d/modules.sh

export XLA_FLAGS="--xla_gpu_enable_triton_gemm=false"
# Memory settings used for folding up to 5,120 tokens on A100 80 GB.
export XLA_PYTHON_CLIENT_PREALLOCATE=true
export XLA_CLIENT_MEM_FRACTION=0.95

export ALPHAFOLD_DB=/software/alphafold/db
export ALPHAFOLD_PREFIX=/software/alphafold/3.0.0L

export PATH=$ALPHAFOLD_PREFIX/lib/python3.11/site-packages/nvidia/cuda_nvcc/bin:$PATH
export PATH=$ALPHAFOLD_PREFIX/hmmer/bin:$ALPHAFOLD_PREFIX/bin:$PATH

python ${ALPHAFOLD_PREFIX}/alphafold/run_alphafold.py \
    --db_dir=${ALPHAFOLD_DB} \
    --json_path=$PWD/input/2pv7_data.json \
    --model_dir=$PWD/parameters \
    --output_dir=$PWD/inference --run_inference=True \
    --norun_data_pipeline

You will need to change --model_dir to point to your personal copy of the model parameters. You might also need to change partitions and constraints matching the choosen partition(s).

Installation

a rough outline of the installation procedure can be found at /software/alphafold/3.0.0L/00BUILD:

#!/bin/bash
tmpdir=/scratch/$USER
inst_dir=/software/alphafold/3.0.0L

export PATH=$inst_dir/bin:$PATH

module load maxwell mamba
. mamba-init

# virtual env
cd $inst_dir/../
python3 -m venv 3.0.0L
source 3.0.0L/bin/activate

# hmmer
cd $tmpdir
mkdir hmmer_build $inst_dir/hmmer 
wget http://eddylab.org/software/hmmer/hmmer-3.4.tar.gz --directory-prefix hmmer_build
cd hmmer_build && tar zxf hmmer-3.4.tar.gz && rm hmmer-3.4.tar.gz
cd hmmer-3.4/
./configure --prefix $inst_dir/hmmer
make -j8
make install
cd $tmpdir/hmmer_build/hmmer-3.4/easel
make install

mkdir -p $tmpdir
pushd $tmpdir  
wget https://github.com/google-deepmind/alphafold3/archive/refs/tags/v3.0.0.tar.gz -O alphafold-3.0.0.tar.gz
tar xf alphafold-3.0.0.tar.gz 
mv alphafold3-3.0.0 $inst_dir/alphafold

export PYTHONNOUSERSITE=1
python3 -m pip install pip==24.3.1
python3 -m pip install -r dev-requirements.txt
python3 -m pip install --no-deps .
# Build chemical components database (this binary was installed by pip).
build_data