Synthetic High-Speed AFM image generation with differentiable kernels
Project description
🧬 synth-afm: Differentiable HS-AFM Simulation
synth-afm is a JAX-powered toolkit for generating synthetic High-Speed Atomic Force Microscopy (HS-AFM) images and movies from atomistic protein structures.
Built with the differentiable biophysics philosophy, every step—from coordinate rotation to tip-collision height mapping—is end-to-end differentiable.
🧪 For Structural Biologists
HS-AFM provides a unique look at "proteins at work," but interpreting noisy movies is challenging. synth-afm helps you bridge the resolution gap:
- Realistic Tip Physics: Uses a spherical-tip dilation model to account for the broadening effect of the AFM probe.
- Atomic Rigor: Automatically assigns van der Waals radii based on element (Bondi, 1964) for accurate topography.
- Temporal Distortion: Models Scanning Lag, simulating how protein dynamics during a scan cause the "shear" artifacts seen in real HS-AFM movies.
- Force Maps: Go beyond height-maps with experimental support for tip-sample repulsion (deflection) modeling.
🤖 For Machine Learning Geeks
synth-afm treats the entire AFM scanning process as a differentiable operator $\mathcal{H}: \mathbb{R}^{N \times 3} \rightarrow \mathbb{R}^{H \times W}$:
- End-to-End Differentiable: Built entirely in JAX, allowing you to flow gradients from an experimental AFM image $\mathbf{I}_{exp}$ back to atomic coordinates $\mathbf{X}$.
- Flexible Fitting: Enable gradient-based optimization of molecular structures using experimental AFM data as a loss term: $\mathcal{L} = |\mathcal{H}(\mathbf{X}) - \mathbf{I}_{exp}|^2$.
- Synthetic Benchmarking: Generate large-scale, ground-truth datasets of "corrupted" AFM movies (with lag, noise, and dilation) to train denoising or state-detection models.
🚀 Key Features
- Differentiable Height Mapping: Efficient Log-Sum-Exp collision detection for sub-nanometer topography.
- Scanning Lag Simulation: Models the line-by-line temporal delay inherent in pixel-by-pixel acquisition.
- Flexible Tip Geometries: Supports spherical and parabolic tip-shape dilation.
- Integration: Reads PDB/mmCIF files via
biotiteand integrates withsynth-pdbandresonance-flow.
📦 Installation
pip install synth-afm
📖 Tutorials
Get started immediately with our interactive Jupyter notebooks:
- Quick Start: Differentiable HS-AFM Simulation: Learn how to generate height maps with tip dilation and scanning lag.
🛠 Quick Start
import jax.numpy as jnp
from synth_afm.simulator import AFMSimulator
from synth_afm.io import load_coords_and_radii
# 1. Load your structure (N, 3) and radii (N,)
coords, radii = load_coords_and_radii("molecule.pdb")
# 2. Initialize simulator (1A pixel size, 2nm tip radius)
sim = AFMSimulator(pixel_size=1.0, tip_radius=20.0)
# 3. Generate height map (Differentiable!)
height_map = sim.scan(coords, radii)
🧪 Scientific Validation
The height-mapping kernels are validated against the standard Villarrubia algorithm and verified to preserve atomic heights within 0.01 Å precision. The temporal lag simulation correctly reproduces the stroboscopic shearing effects documented in high-speed biological AFM (Ando et al., 2011).
📜 License
Distributed under the MIT License. See LICENSE for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file synth_afm-0.1.0.tar.gz.
File metadata
- Download URL: synth_afm-0.1.0.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25d34a1dcf052b990220cd8706a0807c46e5d09a3fde26b7070161e41bae9939
|
|
| MD5 |
41004b913d851ebc1ae881a89371ec62
|
|
| BLAKE2b-256 |
4920cf7195f6bf509a18060a7754eb98db28427a776c9ffa1d6ca2f668534526
|
File details
Details for the file synth_afm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: synth_afm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21e01b95d80a3da3fe2214e58aebc9a04ef94985ee77d3e508141b09f65ab543
|
|
| MD5 |
6c6fe93b4a477f991d59f366438fbcd1
|
|
| BLAKE2b-256 |
a3d69714b607169f9e6b1c2317f3d621365074704babbcbe1f4d51858ba5b216
|