SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2306.01794 · NeurIPS · 2023

DiffPack: A Torsional Diffusion Model for Autoregressive Protein Side-Chain Packing

Jian Tang, Zuobai Zhang, Yangtian Zhang, Bozitao Zhong, Sanchit Misra

arXiv · PDF · Open in the Atlas

Code that ran

11 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 8 have no contract verdict; 3 failures of our instrument; 0 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2306.01794.json · badge: /api/ran/2306.01794.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
DeepGraphLearning/DiffPack canonical (classifier label)
classifier basis: census
11 ran · 0 no recorded run
FunctionStatusWhere it lives
detect_variables Ran
ran; our contract draft was wrong, not the code
DeepGraphLearning/DiffPack/util.py
pointer only (licence: MIT); the stored copy get_code serves, from ahart34/protein, is pointer only (licence: NONE) · get_code("eab8b6a6ced6d93e")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from ahart34/protein, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_chi_mask Ran
ran on a synthesized input
DeepGraphLearning/DiffPack/diffpack/rotamer.py
code served (permissive licence) · get_code("507fc705ebe0f858")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Create a minimal Protein class that satisfies the function's requirements
class MockProtein:
    def __init__(self):
        self.device = torch.device('cpu')
        self.num_residue = 2
        
        # Create minimal node_position: (num_atoms, 3)
        # Let's say we have 8 atoms total
        self.node_position = torch.randn(8, 3, dtype=torch.float32)
        
        # atom2residue: which residue each atom belongs to
        # 8 atoms distributed across 2 residues
        self.atom2residue = torch.tensor([0, 0, 0, 0, 1, 1, 1, 1], dtype=torch.long)
        
        # atom_name: which of the 37 atom slots each atom occupies
        # Use indices 0-3 for first residue, 0-3 for second residue
        self.atom_name = torch.tensor([0, 1, 2, 3, 0, 1, 2, 3], dtype=torch.long)
        
        # residue_type: which residue type (0-19) each residue is
        # Residue 0 is GLY (index 0), Residue 1 is ALA (index 1)
        self.residue_type = torch.tensor([0, 1], dtype=torch.long)

# Create the protein object
protein = MockProtein()

# Build chi_atom37_index_map with valid indices for testing
# This map tells us which atom37 indices to use for each chi angle
residue_list = ['GLY', 'ALA', 'SER', 'PRO', 'VAL', 'THR', 'CYS', 'ILE', 'LEU', 'ASN', 'ASP', 'GLN', 'LYS', 'GLU', 'MET', 'HIS', 'PHE', 'ARG', 'TYR', 'TRP']

# Initialize the global maps
chi_atom37_index_map = -torch.ones((len(residue_list), 4, 4), dtype=torch.long)
chi_atom14_index_map = -torch.ones((len(residue_list), 4, 4), dtype=torch.long)

# Set some valid indices for GLY (index 0) and ALA (index 1)
# GLY has no chi angles, so keep it all -1
# ALA has 1 chi angle with 4 atoms involved
chi_atom37_index_map[1, 0, :] = torch.tensor([0, 1, 2, 3], dtype=torch.long)  # ALA chi1
chi_atom14_index_map[1, 0, :] = torch.tensor([0, 1, 2, 3], dtype=torch.long)

# Make these available globally for the function
import sys
current_module = sys.modules[__name__]
setattr(current_module, 'chi_atom37_index_map', chi_atom37_index_map)
setattr(current_module, 'chi_atom14_index_map', chi_atom14_index_map)

ARGS = {
    'protein': protein,
    'chi_id': None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float — no output shape is stated: observe_signature.py could not observe it (fixture:KeyError)
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_chis Ran
ran on a synthesized input
DeepGraphLearning/DiffPack/diffpack/rotamer.py
code served (permissive licence) · get_code("452679e8812f1da1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

class MockProtein:
    """Minimal protein object with required attributes for get_chis."""
    def __init__(self):
        self.device = torch.device('cpu')
        # 2 residues, 5 atoms per residue
        self.num_residue = 2
        self.num_atom = 10
        
        # Node positions: (num_atom, 3)
        self.node_position = torch.randn(10, 3)
        
        # Residue types: map atoms to residue indices
        # atom 0-4 belong to residue 0, atom 5-9 belong to residue 1
        self.atom2residue = torch.tensor([0, 0, 0, 0, 0, 1, 1, 1, 1, 1])
        
        # Atom names: indices 0-36 for 37 standard atoms per residue
        # For simplicity, map atoms to different atom name indices
        self.atom_name = torch.tensor([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
        
        # Residue types: which standard residue (0-19 for the 20 residues)
        # Use residue type 0 (GLY) and 1 (ALA)
        self.residue_type = torch.tensor([0, 1])
        
        # Chi mask: (num_residue, 4) - which chi angles are valid for each residue
        # GLY has no chi angles, ALA has 1 chi angle
        self.chi_mask = torch.tensor([
            [False, False, False, False],
            [True, False, False, False]
        ])

# Create mock protein
protein = MockProtein()

# Optional: provide custom node_position
node_position = None

ARGS = {
    'protein': protein,
    'node_position': node_position
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_dihedral Ran
ran on a synthesized input
DeepGraphLearning/DiffPack/diffpack/rotamer.py
code served (permissive licence) · get_code("846c9f3728edafd3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 1, dtype family float, shape (2,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function expects 4 points in 3D space
# p0, p1, p2, p3 should be tensors with shape [..., 3]
# where ... can be any number of leading dimensions

# Create simple 3D points as tensors
# Using batch size 2 for variety
p0 = torch.tensor([[0.0, 0.0, 0.0], [1.0, 1.0, 1.0]])
p1 = torch.tensor([[1.0, 0.0, 0.0], [2.0, 1.0, 1.0]])
p2 = torch.tensor([[1.0, 1.0, 0.0], [2.0, 2.0, 1.0]])
p3 = torch.tensor([[0.0, 1.0, 0.0], [1.0, 2.0, 1.0]])

ARGS = {
    'p0': p0,
    'p1': p1,
    'p2': p2,
    'p3': p3,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family float, shape (2,) — shape (2,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_root_logger Ran
ran; our contract draft was wrong, not the code
DeepGraphLearning/DiffPack/util.py
pointer only (licence: MIT); the stored copy get_code serves, from ahart34/protein, is pointer only (licence: NONE) · get_code("70a68fd646c6e4a7")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from ahart34/protein, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_root_logger Ran
ran; our contract draft was wrong, not the code
DeepGraphLearning/DiffPack/diffpack/util.py
code served (permissive licence) · get_code("779851964961dfac")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned RootLogger. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import logging
import tempfile
import os

# Create a temporary directory for the log file
temp_dir = tempfile.mkdtemp()
log_path = os.path.join(temp_dir, 'log.txt')

# Change to temp directory so log.txt gets created there
original_cwd = os.getcwd()
os.chdir(temp_dir)

ARGS = {
    'file': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type RootLogger — a RootLogger output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a RootLogger output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_timestep_embedding Ran
ran on a synthesized input
DeepGraphLearning/DiffPack/diffpack/layer.py
code served (permissive licence) · get_code("593e40089c2c2510")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned SinusoidalEmbedding. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import math
import numpy as np

torch.manual_seed(0)

ARGS = {
    'embedding_type': 'sinusoidal',
    'embedding_dim': 8,
    'embedding_scale': 10000
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SinusoidalEmbedding — a SinusoidalEmbedding output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SinusoidalEmbedding output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
grad Ran
ran on a synthesized input
DeepGraphLearning/DiffPack/diffpack/schedule.py
code served (permissive licence) · get_code("35d120ffc51b9534")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float64, ndim 0, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# The function grad computes a gradient using:
# - x: a numeric value (scalar or array)
# - sigma: a numeric value (standard deviation)
# - N: integer (default 10)
# - PI: numeric constant (default np.pi)

# Setting up small, valid arguments
x = 0.5  # scalar float value
sigma = 1.0  # scalar float value for standard deviation
N = 3  # smaller N for faster execution
PI = np.pi  # using numpy's pi constant

ARGS = {
    "x": x,
    "sigma": sigma,
    "N": N,
    "PI": PI
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_config Ran
ran on a synthesized input
DeepGraphLearning/DiffPack/diffpack/util.py
code served (permissive licence) · get_code("d6210a4a40bfd88d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned EasyDict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
import yaml
import easydict
import os

# Create a temporary YAML config file
temp_dir = tempfile.mkdtemp()
cfg_file = os.path.join(temp_dir, "test_config.yaml")

# Write a sample YAML config
sample_config = {
    "model": "resnet50",
    "learning_rate": 0.001,
    "batch_size": 32,
    "epochs": 100,
    "nested": {
        "param1": "value1",
        "param2": 42
    }
}

with open(cfg_file, 'w') as f:
    yaml.dump(sample_config, f)

ARGS = {
    "cfg_file": cfg_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
easydict, yaml — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EasyDict — a EasyDict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a EasyDict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
p Ran
ran on a synthesized input
DeepGraphLearning/DiffPack/diffpack/schedule.py
code served (permissive licence) · get_code("48fa7b4051a1867a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float64, ndim 0, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import tqdm

# Construct arguments for the function p(x, sigma, N=10, PI=np.pi)
# x: a numeric value or array
# sigma: a positive numeric value (standard deviation)
# N: integer parameter (defaults to 10)
# PI: numeric value for pi (defaults to np.pi)

x = 2.5
sigma = 1.0
N = 5
PI = np.pi

ARGS = {
    'x': x,
    'sigma': sigma,
    'N': N,
    'PI': PI
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sample Ran
ran on a synthesized input
DeepGraphLearning/DiffPack/diffpack/schedule.py
code served (permissive licence) · get_code("17e317fb95547359")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 2, dtype family float, shape (4, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# The function sigma * np.random.randn(*sigma.shape) requires sigma to be
# a numpy array (it uses .shape attribute and multiplication/modulo operations)
sigma = np.random.randn(4, 3)

# PI is already provided a default value of np.pi, but we can override it
PI = np.pi

ARGS = {
    "sigma": sigma,
    "PI": PI,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (4, 3) — shape (4, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 2 later) and 8 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
get_root_logger 8 other papers
5 dated earlier, 3 later
2106.06935 (2021-06)
Neural Bellman-Ford Networks: A General Graph Neural Network Framework for Link Prediction
2205.10128 (2022-05)
Neural-Symbolic Models for Logical Queries on Knowledge Graphs
2206.04798 (2022-06)
A*Net: A Scalable Path-based Reasoning Approach for Knowledge Graphs
and 5 more not named here
detect_variables 7 other papers
4 dated earlier, 3 later
2106.06935 (2021-06)
Neural Bellman-Ford Networks: A General Graph Neural Network Framework for Link Prediction
2205.10128 (2022-05)
Neural-Symbolic Models for Logical Queries on Knowledge Graphs
2302.02209 (2023-02)
A Theory of Link Prediction via Relational Weisfeiler-Leman on Knowledge Graphs
and 4 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Proteins play a critical role in carrying out biological functions, and their 3D structures are essential in determining their functions. Accurately predicting the conformation of protein side-chains given their backbones is important for applications in protein structure prediction, design and protein-protein interactions. Traditional methods are computationally intensive and have limited accuracy, while existing machine learning methods treat the problem as a regression task and overlook the restrictions imposed by the constant covalent bond lengths and angles. In this work, we present DiffPack, a torsional diffusion model that learns the joint distribution of side-chain torsional angles, the only degrees of freedom in side-chain packing, by diffusing and denoising on the torsional space. To avoid issues arising from simultaneous perturbation of all four torsional angles, we propose autoregressively generating the four torsional angles from χ 1 to χ 4 and training diffusion models for each torsional angle. We evaluate the method on several benchmarks for protein side-chain packing and show that our method achieves improvements of 11.9% and 13.5% in angle accuracy on CASP13 and CASP14, respectively, with a significantly smaller model size (60× fewer parameters). Additionally, we show the effectiveness of our method in enhancing side-chain predictions in the AlphaFold2 model. Code is available at https://github.com/DeepGraphLearning/DiffPack. 37th Conference on Neural Information Processing Systems (NeurIPS 2023).

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2306.01794")
get_code_for_paper("2306.01794")
have("2306.01794")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2306.01794.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2306.01794.svg)](https://syntology.ai/paper/2306.01794)

Connect an agent — have() is free.