{"id":51310277,"url":"https://github.com/elkins-lab/synth-afm","last_synced_at":"2026-07-01T03:02:35.295Z","repository":{"id":360828314,"uuid":"1251887553","full_name":"elkins-lab/synth-afm","owner":"elkins-lab","description":"Differentiable High-Speed AFM (HS-AFM) simulation for protein structures. JAX-powered toolkit for generating synthetic movies with realistic tip-dilation and scanning lag.","archived":false,"fork":false,"pushed_at":"2026-06-12T20:27:33.000Z","size":740,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-12T21:16:36.314Z","etag":null,"topics":["afm-analysis","biophysics","computational-biology","computational-biophysics","differentiable-physics","high-speed-afm","hs-afm","jax","protein-dynamics","simulation","structural-biology"],"latest_commit_sha":null,"homepage":"https://elkins.github.io/synth-afm/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elkins-lab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-28T02:05:20.000Z","updated_at":"2026-06-12T20:24:52.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/elkins-lab/synth-afm","commit_stats":null,"previous_names":["elkins/synth-afm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/elkins-lab/synth-afm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elkins-lab%2Fsynth-afm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elkins-lab%2Fsynth-afm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elkins-lab%2Fsynth-afm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elkins-lab%2Fsynth-afm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elkins-lab","download_url":"https://codeload.github.com/elkins-lab/synth-afm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elkins-lab%2Fsynth-afm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34990845,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-01T02:00:05.325Z","response_time":130,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["afm-analysis","biophysics","computational-biology","computational-biophysics","differentiable-physics","high-speed-afm","hs-afm","jax","protein-dynamics","simulation","structural-biology"],"created_at":"2026-07-01T03:02:34.645Z","updated_at":"2026-07-01T03:02:35.291Z","avatar_url":"https://github.com/elkins-lab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧬 synth-afm: Differentiable HS-AFM Simulation\n\n[![PyPI version](https://img.shields.io/pypi/v/synth-afm)](https://pypi.org/project/synth-afm/)\n[![Python versions](https://img.shields.io/pypi/pyversions/synth-afm)](https://pypi.org/project/synth-afm/)\n[![Tests](https://github.com/elkins/synth-afm/actions/workflows/test.yml/badge.svg)](https://github.com/elkins/synth-afm/actions/workflows/test.yml)\n[![codecov](https://codecov.io/gh/elkins/synth-afm/branch/master/graph/badge.svg)](https://codecov.io/gh/elkins/synth-afm)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![JAX](https://img.shields.io/badge/Accelerated_by-JAX-blue.svg)](https://github.com/google/jax)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n`synth-afm` is a JAX-powered toolkit for generating synthetic High-Speed Atomic Force Microscopy (HS-AFM) images and movies from atomistic protein structures.\n\nBuilt with the **differentiable biophysics** philosophy, every step—from coordinate rotation to tip-collision height mapping—is end-to-end differentiable.\n\n---\n\n### 🧪 For Structural Biologists\nHS-AFM provides a unique look at \"proteins at work,\" but interpreting noisy movies is challenging. `synth-afm` helps you bridge the resolution gap:\n*   **Realistic Tip Physics:** Uses a spherical-tip dilation model to account for the broadening effect of the AFM probe.\n*   **Atomic Rigor:** Automatically assigns van der Waals radii based on element (Bondi, 1964) for accurate topography.\n*   **Temporal Distortion:** Models **Scanning Lag**, simulating how protein dynamics during a scan cause the \"shear\" artifacts seen in real HS-AFM movies.\n*   **Force Maps:** Go beyond height-maps with experimental support for tip-sample repulsion (deflection) modeling.\n\n### 🤖 For Machine Learning Geeks\n`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}$:\n*   **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}$.\n*   **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$.\n*   **Synthetic Benchmarking:** Generate large-scale, ground-truth datasets of \"corrupted\" AFM movies (with lag, noise, and dilation) to train denoising or state-detection models.\n\n---\n\n## 🚀 Key Features\n\n*   **Differentiable Height Mapping:** Efficient Log-Sum-Exp collision detection for sub-nanometer topography.\n*   **Physical Realism:** Simulate cantilever noise and substrate tilt (linear gradients) to match experimental conditions.\n*   **Scanning Lag Simulation:** Models the line-by-line temporal delay inherent in pixel-by-pixel acquisition.\n*   **Memory Efficiency:** Uses `jax.lax.scan` for constant-memory simulation of long trajectories.\n*   **Flexible Tip Geometries:** Supports spherical tip-shape dilation.\n*   **Integration:** Reads PDB/mmCIF files via `biotite` and integrates with `synth-pdb` and `synth-dynamics`.\n\n## 📦 Installation\n\n```bash\npip install synth-afm\n```\n\n## 📖 Tutorials\n\nGet started immediately with our interactive Jupyter notebooks:\n\n*   **[Quick Start: Differentiable HS-AFM Simulation](examples/quickstart_afm.ipynb)**: Learn how to generate height maps with tip dilation and scanning lag.\n    [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/elkins/synth-afm/blob/master/examples/quickstart_afm.ipynb)\n\n## 🛠 Quick Start\n\n```python\nimport jax.numpy as jnp\nfrom synth_afm.simulator import AFMSimulator\nfrom synth_afm.io import load_coords_and_radii\n\n# 1. Load your structure (N, 3) and radii (N,)\ncoords, radii = load_coords_and_radii(\"molecule.pdb\")\n\n# 2. Initialize simulator (1A pixel size, 2nm tip radius, 0.5A noise, slight tilt)\nsim = AFMSimulator(\n    pixel_size=1.0,\n    tip_radius=20.0,\n    noise_level=0.5,\n    substrate_tilt=(0.01, 0.0)\n)\n\n# 3. Generate height map (Differentiable!)\nheight_map = sim.scan(coords, radii)\n```\n\n## 🧪 Scientific Validation\n\nThe 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).\n\n## 🔗 Related Projects\n\n`synth-afm` is part of a broader ecosystem for synthetic biophysics data generation:\n\n| Project | Purpose |\n|---|---|\n| [synth-pdb](https://github.com/elkins/synth-pdb) | Foundation: Realistic protein structure generation and PDB/mmCIF handling |\n| [synth-nmr](https://github.com/elkins/synth-nmr) | NMR observables (NOE, RDC, chemical shifts, J-couplings, relaxation) |\n| [synth-saxs](https://github.com/elkins/synth-saxs) | SAXS profile simulation via Debye formula |\n| [synth-cryo-em](https://github.com/elkins/synth-cryo-em) | Cryo-EM density map generation with CTF/noise modeling |\n| [synth-dynamics](https://github.com/georgeelkins/synth-dynamics) | ANM/Langevin dynamics for conformational ensembles |\n| [diff-biophys](https://github.com/elkins/diff-biophys) | Differentiable JAX implementations of all biophysics kernels |\n\n## 📜 License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n\n## ✍️ Citation\n\nIf you use `synth-afm` in your research, please cite:\n\n```bibtex\n@software{synth_afm,\n  author = {Elkins, George},\n  title = {synth-afm: Differentiable HS-AFM Simulation},\n  year = {2026},\n  url = {https://github.com/elkins/synth-afm}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felkins-lab%2Fsynth-afm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felkins-lab%2Fsynth-afm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felkins-lab%2Fsynth-afm/lists"}