Preparing to run Alphafold

The ALPHAFOLD2 source an implementation of the inference pipeline of AlphaFold v2.0. using a completely new model that was entered in CASP14. This is not a production application per se, but a reference that is capable of producing structures from a single amino acid sequence.

From the developers' original publication: "The provided inference script is optimized for predicting the structure of a single protein, and it will compile the neural network to be specialized to exactly the size of the sequence, MSA, and templates. For large proteins, the compile time is a negligible fraction of the runtime, but it may become more significant for small proteins or if the multi-sequence alignments are already precomputed. In the bulk inference case, it may make sense to use our make_fixed_size function to pad the inputs to a uniform size, thereby reducing the number of compilations required."

The SBGrid installation of Alphafold2 does not require Docker to run, but does require a relatively recent NVidia GPU and updated driver.

CUDA SDK is required

The alphafold2 pipeline requires that the CUDA Toolkit SDK be installed. We use version 11.1 and have had success with latest versions. The executables provided in this package are not redistributable so we do not include them with our CUDA libraries.

Required Databases and Parameters AlphaFold requires a set of (large) genetic databases that must be downloaded separately. See for more information.

These databases can be downloaded with the included download script and the aria2c program, both of which are available in the SBGrid collection. Note that these databases are large in size (> 2Tb) and may require a significant amount of time to download.

/programs/x86_64-linux/alphafold/2.1.1/alphafold/scripts/ <destination path>

The database directory shouuld look like this :

├── bfd     
│   ├── bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt_a3m.ffdata
│   ├── bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt_a3m.ffindex
│   ├── bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt_cs219.ffdata
│   ├── bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt_cs219.ffindex
│   ├── bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt_hhm.ffdata                                                                                                 
│   └── bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt_hhm.ffindex
├── mgnify
│   ├── mgy_clusters_2018_12.fa
├── params
│   ├── LICENSE
│   ├── params_model_1_multimer.npz
│   ├── params_model_1.npz
│   ├── params_model_1_ptm.npz
│   ├── params_model_2_multimer.npz
│   ├── params_model_2.npz
│   ├── params_model_2_ptm.npz
│   ├── params_model_3_multimer.npz
│   ├── params_model_3.npz
│   ├── params_model_3_ptm.npz
│   ├── params_model_4_multimer.npz
│   ├── params_model_4.npz
│   ├── params_model_4_ptm.npz
│   ├── params_model_5_multimer.npz
│   ├── params_model_5.npz
│   └── params_model_5_ptm.npz
├── pdb70
│   ├── md5sum
│   ├── pdb70_a3m.ffdata
│   ├── pdb70_a3m.ffindex
│   ├── pdb70_clu.tsv
│   ├── pdb70_cs219.ffdata
│   ├── pdb70_cs219.ffindex
│   ├── pdb70_hhm.ffdata
│   ├── pdb70_hhm.ffindex
│   └── pdb_filter.dat
├── pdb_mmcif
│   ├── mmcif_files
│   └── obsolete.dat
├── pdb_seqres
│   └── pdb_seqres.txt
├── small_bfd
│   └── bfd-first_non_consensus_sequences.fasta
├── uniclust30
│   └── uniclust30_2018_08
├── uniprot
│   └── uniprot.fasta

Running the python script

The script requires all parameters to be set explicitly. Pass --helpshort or --helpfull to see help on flags. See examples below.

GPU Memory

Memory is going to be an issue with larger protein sizes. The original publication suggests some things to try:

"Inferencing large proteins can easily exceed the memory of a single GPU. For a V100 with 16 GB of memory, we can predict the structure of proteins up to ~1,300 residues without ensembling and the 256- and 384-residue inference times are using a single GPU’s memory. "

"The memory usage is approximately quadratic in the number of residues, so a 2,500 residue protein involves using unified memory so that we can greatly exceed the memory of a single V100. In our cloud setup, a single V100 is used for computation on a 2,500 residue protein but we requested four GPUs to have sufficient memory."

The following environment variable settings may help with larger polypeptide calculations (> 1,200 aa).

Thanks Ci Ji Lim at Wisconsin for suggesting and testing these.

Web portal

It is possible to run alphafold through a web portal. See .

Changes in AlphaFold 2.1.1 multimer

On 4 Nov 2021 we added vesion 2.1.0 to the installation. This version allows prediction of multimers from fasta files containing multiple sequences. This version is not currently the default, but will be after further testing.

To use it, set the ALPHAFOLD_X variable to 2.1.0 in the shell or in the ~/.sbgrid.conf file. This is the standard SBGrid version override method.


  • Databases must be redownloaded for 2.1.1, specifically UniProt and PDB seqres databases.
    • Run scripts/ <DOWNLOAD_DIR>.
    • Remove/rename <DOWNLOAD_DIR>/pdb_mmcif. It is needed to have PDB SeqRes and PDB from exactly the same date. Failure to do this step will result in potential errors when searching for templates when running AlphaFold-Multimer.
    • Run scripts/ <DOWNLOAD_DIR>.
    • Run scripts/ <DOWNLOAD_DIR>.
  • Update the model parameters.
    • Remove/rename the old model parameters in <DOWNLOAD_DIR>/params.
    • Download new model parameters using scripts/ <DOWNLOAD_DIR>.

Some command line flags have changed since version 2.0.0. We recommend running the command directly and are not providing a wrapper script ( as we did for 2.0.0) at the present time.


Standard prediction example :

/programs/x86_64-linux/alphafold/2.1.1/bin.capsules/ \
--data_dir=/programs/local/alphafold/ \
--output_dir=/scratch/data/sbgrid/alphafold/test_monomer \
--fasta_paths=test_monomer.fasta \
--max_template_date=2020-05-14 \
--db_preset=full_dbs \
--bfd_database_path=/programs/local/alphafold/bfd/bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt \
--uniclust30_database_path=/programs/local/alphafold/uniclust30/uniclust30_2018_08/uniclust30_2018_08 \
--uniref90_database_path=/programs/local/alphafold/uniref90/uniref90.fasta \
--mgnify_database_path=/programs/local/alphafold/mgnify/mgy_clusters_2018_12.fa \
--template_mmcif_dir=/programs/local/alphafold/pdb_mmcif/mmcif_files \
--pdb70_database_path=/programs/local/alphafold/pdb70/pdb70 \

where test_monomer.fasta is


Multimer example :

/programs/x86_64-linux/alphafold/2.1.1/bin.capsules/ \
--data_dir=/programs/local/alphafold \
--output_dir=/scratch/data/sbgrid/alphafold/test_multimer \
--fasta_paths=test_multimer.fasta \
--max_template_date=2020-05-14 \
--db_preset=full_dbs \
--bfd_database_path=/programs/local/alphafold/bfd/bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt \
--uniclust30_database_path=/programs/local/alphafold/uniclust30/uniclust30_2018_08/uniclust30_2018_08  \
--uniref90_database_path=/programs/local/alphafold/uniref90/uniref90.fasta \
--mgnify_database_path=/programs/local/alphafold/mgnify/mgy_clusters_2018_12.fa \
--template_mmcif_dir=/programs/local/alphafold/pdb_mmcif/mmcif_files --model_preset=multimer \
--uniprot_database_path=/programs/local/alphafold/uniprot/uniprot.fasta \
--pdb_seqres_database_path=/programs/local/alphafold/pdb_seqres/pdb_seqres.txt \

where test_multimer.fasta is


Known issues

  • Unified memory across GPUs does not appear to work in the current version.
  • The ptxas executable is required to be in PATH in some cases, but not all. We can not redistribute this binary since it is part of the NVIDIA SDK. It must be installed separetely and added to the environment PATH variable, typically in /usr/local/cuda/bin. Version 11.0.3 works well in our hands, but other versions should work. You can download the SDK here :
  • Clashes bewtween monomers have been reported in some cases in multimer mode