# rosettacommons/foundry architecture

> Architecture diagram of the GitHub repository rosettacommons/foundry, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rosettacommons/foundry
- Repository: https://github.com/rosettacommons/foundry

## Overview

Foundry is a shared framework for biomolecular model training and inference, shipping four model families: RFD3 and RFD3NA for constrained all-atom design, RF3 for structure prediction, and ProteinMPNN/LigandMPNN for inverse folding. The user-facing workflow is to provide a structure or design specification, prepare model-specific inputs, run the model or sampler, and obtain designed sequences or predicted/generated structures. AtomWorks supplies structure manipulation and preprocessing across model workflows. The graph captures documented capabilities and indexed module references; several model internals and the RF3 engine were not excerpted, so those links are shown as unverified.

Main entry points: [`models/rfd3/src/rfd3/engine.py`](https://github.com/rosettacommons/foundry/blob/production/models/rfd3/src/rfd3/engine.py) (Design Engine), [`models/rfd3na/src/rfd3na/engine.py`](https://github.com/rosettacommons/foundry/blob/production/models/rfd3na/src/rfd3na/engine.py) (Design Engine), [`models/rf3/src/rf3/inference_engines/rf3.py`](https://github.com/rosettacommons/foundry/blob/production/models/rf3/src/rf3/inference_engines/rf3.py) (Inference Engine), [`models/mpnn/src/mpnn/inference_engines/mpnn.py`](https://github.com/rosettacommons/foundry/blob/production/models/mpnn/src/mpnn/inference_engines/mpnn.py) (Inference Engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shared["Foundry Core"]
  node_foundry_engine["Inference Base<br/>[base.py]"]
  node_checkpoint_registry[("Checkpoint Registry")]
  node_foundry_components["Component Utilities<br/>[components.py]"]
  node_foundry_training["Fabric Training<br/>[fabric.py]"]
end

subgraph group_rfd3["RFD3 Design"]
  node_rfd3_input["Input Preparation<br/>[inference.py]"]
  node_rfd3_pipeline["Conditioning Pipeline<br/>[pipelines.py]"]
  node_rfd3_engine["Design Engine<br/>[engine.py]"]
  node_rfd3_sampler["Diffusion Sampler"]
  node_rfd3_model["Design Model"]
  node_rfd3_result["Designed Structures<br/>[engine.py]"]
end

subgraph group_rfd3na["RFD3NA Design"]
  node_rfd3na_input["Input Preparation<br/>[inference.py]"]
  node_rfd3na_pipeline["Conditioning Pipeline<br/>[pipelines.py]"]
  node_rfd3na_engine["Design Engine<br/>[engine.py]"]
  node_rfd3na_sampler["Diffusion Sampler"]
  node_rfd3na_model["Design Model<br/>[RFD3.py]"]
  node_rfd3na_result["Designed Structures<br/>[engine.py]"]
end

subgraph group_rf3["RF3 Folding"]
  node_rf3_pipeline["Data Pipelines<br/>[pipelines.py]"]
  node_rf3_engine["Inference Engine<br/>[rf3.py]"]
  node_rf3_model["Folding Model<br/>[RF3.py]"]
  node_rf3_result["Predicted Structures<br/>[inference.py]"]
end

subgraph group_mpnn["MPNN Inverse Folding"]
  node_mpnn_input["Inference Inputs<br/>[inference.py]"]
  node_mpnn_engine["Inference Engine<br/>[mpnn.py]"]
  node_mpnn_model["Sequence Model<br/>[mpnn.py]"]
  node_mpnn_graph["Graph Embeddings"]
  node_mpnn_result["Designed Sequences<br/>[inference.py]"]
end

node_user(("Researcher"))
node_atomworks["AtomWorks"]

node_user -.->|"specifies design"| node_rfd3_engine
node_rfd3_engine -->|"prepares inputs"| node_rfd3_input
node_rfd3_engine -->|"runs sampler"| node_rfd3_sampler
node_rfd3_pipeline -->|"uses conditioning"| node_rfd3_input
node_rfd3_sampler -.->|"denoises with"| node_rfd3_model
node_rfd3_engine -.->|"writes outputs"| node_rfd3_result
node_user -.->|"specifies design"| node_rfd3na_engine
node_rfd3na_engine -->|"prepares inputs"| node_rfd3na_input
node_rfd3na_engine -->|"runs sampler"| node_rfd3na_sampler
node_rfd3na_pipeline -->|"uses conditioning"| node_rfd3na_input
node_rfd3na_sampler -.->|"denoises with"| node_rfd3na_model
node_rfd3na_engine -.->|"writes outputs"| node_rfd3na_result
node_user -.->|"requests folding"| node_rf3_engine
node_rf3_engine -.->|"loads data"| node_rf3_pipeline
node_rf3_engine -.->|"runs prediction"| node_rf3_model
node_rf3_engine -.->|"returns structures"| node_rf3_result
node_user -.->|"provides backbone"| node_mpnn_input
node_mpnn_input -->|"builds request"| node_mpnn_engine
node_mpnn_engine -.->|"runs inference"| node_mpnn_model
node_mpnn_model -->|"uses embeddings"| node_mpnn_graph
node_mpnn_engine -.->|"returns sequences"| node_mpnn_result
node_atomworks -.->|"processes structures"| node_rfd3_input
node_atomworks -.->|"processes structures"| node_rfd3na_input
node_atomworks -.->|"processes structures"| node_rf3_pipeline
node_atomworks -.->|"processes structures"| node_mpnn_input
node_foundry_engine -->|"looks up weights"| node_checkpoint_registry
node_foundry_training -->|"instantiates components"| node_foundry_components
node_rfd3_engine -->|"extends engine"| node_foundry_engine
node_rfd3na_engine -->|"extends engine"| node_foundry_engine

click node_foundry_engine "https://github.com/rosettacommons/foundry/blob/production/src/foundry/inference_engines/base.py"
click node_checkpoint_registry "https://github.com/rosettacommons/foundry/blob/production/src/foundry/inference_engines/checkpoint_registry.py"
click node_foundry_components "https://github.com/rosettacommons/foundry/blob/production/src/foundry/utils/components.py"
click node_foundry_training "https://github.com/rosettacommons/foundry/blob/production/src/foundry/trainers/fabric.py"
click node_rfd3_input "https://github.com/rosettacommons/foundry/blob/production/models/rfd3/src/rfd3/utils/inference.py"
click node_rfd3_pipeline "https://github.com/rosettacommons/foundry/blob/production/models/rfd3/src/rfd3/transforms/pipelines.py"
click node_rfd3_engine "https://github.com/rosettacommons/foundry/blob/production/models/rfd3/src/rfd3/engine.py"
click node_rfd3_sampler "https://github.com/rosettacommons/foundry/blob/production/models/rfd3/src/rfd3/model/inference_sampler.py"
click node_rfd3_result "https://github.com/rosettacommons/foundry/blob/production/models/rfd3/src/rfd3/engine.py"
click node_rfd3na_input "https://github.com/rosettacommons/foundry/blob/production/models/rfd3na/src/rfd3na/utils/inference.py"
click node_rfd3na_pipeline "https://github.com/rosettacommons/foundry/blob/production/models/rfd3na/src/rfd3na/transforms/pipelines.py"
click node_rfd3na_engine "https://github.com/rosettacommons/foundry/blob/production/models/rfd3na/src/rfd3na/engine.py"
click node_rfd3na_sampler "https://github.com/rosettacommons/foundry/blob/production/models/rfd3na/src/rfd3na/model/inference_sampler.py"
click node_rfd3na_model "https://github.com/rosettacommons/foundry/blob/production/models/rfd3na/src/rfd3na/model/RFD3.py"
click node_rfd3na_result "https://github.com/rosettacommons/foundry/blob/production/models/rfd3na/src/rfd3na/engine.py"
click node_rf3_pipeline "https://github.com/rosettacommons/foundry/blob/production/models/rf3/src/rf3/data/pipelines.py"
click node_rf3_engine "https://github.com/rosettacommons/foundry/blob/production/models/rf3/src/rf3/inference_engines/rf3.py"
click node_rf3_model "https://github.com/rosettacommons/foundry/blob/production/models/rf3/src/rf3/model/RF3.py"
click node_rf3_result "https://github.com/rosettacommons/foundry/blob/production/models/rf3/src/rf3/utils/inference.py"
click node_mpnn_input "https://github.com/rosettacommons/foundry/blob/production/models/mpnn/src/mpnn/utils/inference.py"
click node_mpnn_engine "https://github.com/rosettacommons/foundry/blob/production/models/mpnn/src/mpnn/inference_engines/mpnn.py"
click node_mpnn_model "https://github.com/rosettacommons/foundry/blob/production/models/mpnn/src/mpnn/model/mpnn.py"
click node_mpnn_graph "https://github.com/rosettacommons/foundry/blob/production/models/mpnn/src/mpnn/model/layers/graph_embeddings.py"
click node_mpnn_result "https://github.com/rosettacommons/foundry/blob/production/models/mpnn/src/mpnn/inference.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_foundry_engine,node_checkpoint_registry,node_foundry_components,node_foundry_training toneBlue
class node_rfd3_input,node_rfd3_pipeline,node_rfd3_engine,node_rfd3_sampler,node_rfd3_model,node_rfd3_result toneAmber
class node_rfd3na_input,node_rfd3na_pipeline,node_rfd3na_engine,node_rfd3na_sampler,node_rfd3na_model,node_rfd3na_result toneMint
class node_rf3_pipeline,node_rf3_engine,node_rf3_model,node_rf3_result toneRose
class node_mpnn_input,node_mpnn_engine,node_mpnn_model,node_mpnn_graph,node_mpnn_result,node_user,node_atomworks toneIndigo
```

## Components

### Foundry Core

- [Inference Base](https://github.com/rosettacommons/foundry/blob/production/src/foundry/inference_engines/base.py): `src/foundry/inference_engines/base.py`
- [Checkpoint Registry](https://github.com/rosettacommons/foundry/blob/production/src/foundry/inference_engines/checkpoint_registry.py): `src/foundry/inference_engines/checkpoint_registry.py`
- [Component Utilities](https://github.com/rosettacommons/foundry/blob/production/src/foundry/utils/components.py): `src/foundry/utils/components.py`
- [Fabric Training](https://github.com/rosettacommons/foundry/blob/production/src/foundry/trainers/fabric.py): `src/foundry/trainers/fabric.py`

### RFD3 Design

- [Input Preparation](https://github.com/rosettacommons/foundry/blob/production/models/rfd3/src/rfd3/utils/inference.py): `models/rfd3/src/rfd3/utils/inference.py`
- [Conditioning Pipeline](https://github.com/rosettacommons/foundry/blob/production/models/rfd3/src/rfd3/transforms/pipelines.py): `models/rfd3/src/rfd3/transforms/pipelines.py`
- [Design Engine](https://github.com/rosettacommons/foundry/blob/production/models/rfd3/src/rfd3/engine.py): `models/rfd3/src/rfd3/engine.py`
- [Diffusion Sampler](https://github.com/rosettacommons/foundry/blob/production/models/rfd3/src/rfd3/model/inference_sampler.py): `models/rfd3/src/rfd3/model/inference_sampler.py`
- **Design Model**
- [Designed Structures](https://github.com/rosettacommons/foundry/blob/production/models/rfd3/src/rfd3/engine.py): `models/rfd3/src/rfd3/engine.py`

### RFD3NA Design

- [Input Preparation](https://github.com/rosettacommons/foundry/blob/production/models/rfd3na/src/rfd3na/utils/inference.py): `models/rfd3na/src/rfd3na/utils/inference.py`
- [Conditioning Pipeline](https://github.com/rosettacommons/foundry/blob/production/models/rfd3na/src/rfd3na/transforms/pipelines.py): `models/rfd3na/src/rfd3na/transforms/pipelines.py`
- [Design Engine](https://github.com/rosettacommons/foundry/blob/production/models/rfd3na/src/rfd3na/engine.py): `models/rfd3na/src/rfd3na/engine.py`
- [Diffusion Sampler](https://github.com/rosettacommons/foundry/blob/production/models/rfd3na/src/rfd3na/model/inference_sampler.py): `models/rfd3na/src/rfd3na/model/inference_sampler.py`
- [Design Model](https://github.com/rosettacommons/foundry/blob/production/models/rfd3na/src/rfd3na/model/RFD3.py): `models/rfd3na/src/rfd3na/model/RFD3.py`
- [Designed Structures](https://github.com/rosettacommons/foundry/blob/production/models/rfd3na/src/rfd3na/engine.py): `models/rfd3na/src/rfd3na/engine.py`

### RF3 Folding

- [Data Pipelines](https://github.com/rosettacommons/foundry/blob/production/models/rf3/src/rf3/data/pipelines.py): `models/rf3/src/rf3/data/pipelines.py`
- [Inference Engine](https://github.com/rosettacommons/foundry/blob/production/models/rf3/src/rf3/inference_engines/rf3.py): `models/rf3/src/rf3/inference_engines/rf3.py`
- [Folding Model](https://github.com/rosettacommons/foundry/blob/production/models/rf3/src/rf3/model/RF3.py): `models/rf3/src/rf3/model/RF3.py`
- [Predicted Structures](https://github.com/rosettacommons/foundry/blob/production/models/rf3/src/rf3/utils/inference.py): `models/rf3/src/rf3/utils/inference.py`

### MPNN Inverse Folding

- [Inference Inputs](https://github.com/rosettacommons/foundry/blob/production/models/mpnn/src/mpnn/utils/inference.py): `models/mpnn/src/mpnn/utils/inference.py`
- [Inference Engine](https://github.com/rosettacommons/foundry/blob/production/models/mpnn/src/mpnn/inference_engines/mpnn.py): `models/mpnn/src/mpnn/inference_engines/mpnn.py`
- [Sequence Model](https://github.com/rosettacommons/foundry/blob/production/models/mpnn/src/mpnn/model/mpnn.py): `models/mpnn/src/mpnn/model/mpnn.py`
- [Graph Embeddings](https://github.com/rosettacommons/foundry/blob/production/models/mpnn/src/mpnn/model/layers/graph_embeddings.py): `models/mpnn/src/mpnn/model/layers/graph_embeddings.py`
- [Designed Sequences](https://github.com/rosettacommons/foundry/blob/production/models/mpnn/src/mpnn/inference.py): `models/mpnn/src/mpnn/inference.py`

### Other components

- **Researcher**
- **AtomWorks**

## Connections

- Researcher → Design Engine: specifies design
- Design Engine → Input Preparation: prepares inputs (evidence: `models/rfd3/src/rfd3/engine.py`)
- Design Engine → Diffusion Sampler: runs sampler (evidence: `models/rfd3/src/rfd3/engine.py`)
- Conditioning Pipeline → Input Preparation: uses conditioning (evidence: `models/rfd3/src/rfd3/transforms/pipelines.py`)
- Diffusion Sampler → Design Model: denoises with
- Design Engine → Designed Structures: writes outputs (evidence: `models/rfd3/src/rfd3/engine.py`)
- Researcher → Design Engine: specifies design
- Design Engine → Input Preparation: prepares inputs (evidence: `models/rfd3na/src/rfd3na/engine.py`)
- Design Engine → Diffusion Sampler: runs sampler (evidence: `models/rfd3na/src/rfd3na/engine.py`)
- Conditioning Pipeline → Input Preparation: uses conditioning (evidence: `models/rfd3na/src/rfd3na/transforms/pipelines.py`)
- Diffusion Sampler → Design Model: denoises with
- Design Engine → Designed Structures: writes outputs (evidence: `models/rfd3na/src/rfd3na/engine.py`)
- Researcher → Inference Engine: requests folding
- Inference Engine → Data Pipelines: loads data
- Inference Engine → Folding Model: runs prediction
- Inference Engine → Predicted Structures: returns structures
- Researcher → Inference Inputs: provides backbone
- Inference Inputs → Inference Engine: builds request (evidence: `models/mpnn/src/mpnn/inference.py`)
- Inference Engine → Sequence Model: runs inference (evidence: `models/mpnn/src/mpnn/inference_engines/mpnn.py`)
- Sequence Model → Graph Embeddings: uses embeddings (evidence: `models/mpnn/src/mpnn/model/mpnn.py`)
- Inference Engine → Designed Sequences: returns sequences (evidence: `models/mpnn/src/mpnn/inference.py`)
- AtomWorks → Input Preparation: processes structures
- AtomWorks → Input Preparation: processes structures
- AtomWorks → Data Pipelines: processes structures
- AtomWorks → Inference Inputs: processes structures
- Inference Base → Checkpoint Registry: looks up weights (evidence: `src/foundry/inference_engines/base.py`)
- Fabric Training → Component Utilities: instantiates components (evidence: `src/foundry/trainers/fabric.py`)
- Design Engine → Inference Base: extends engine (evidence: `models/rfd3/src/rfd3/engine.py`)
- Design Engine → Inference Base: extends engine (evidence: `models/rfd3na/src/rfd3na/engine.py`)
