Skip to main content

siroccomol

Render proteins as space-filling molecular surfaces in two styles.

  • matte: flat diffuse shading with soft cast shadows and dark silhouette and crevice contours (Goodsell-inspired).
  • cel: saturated, posterized anime cel shading with crisp flat cast shadows, cool shadow tones, a warm highlight and a rim light (similar to a well known illustration style optional sky-gradient backdrop via sky).

A protein's atoms sit at bond distances, so the renderer builds a smooth isosurface over them, ray-marches it on the GPU, shades it, and inks the contours. It runs headless through EGL.

The name is a nod to the sirocco, the hot Mediterranean wind.

Gallery

GroEL/GroES chaperonin · 1AON, video

20S proteasome · 1PMA, video

SARS-CoV-2 spike · 6VXX, video

Immunoglobulin · 1IGT, video

Haemoglobin · 4HHB, video

Green fluorescent protein · 1GFL, video

Install

uv pip install siroccomol

Needs a GPU with a headless GL/EGL driver (NVIDIA with libEGL, or Mesa), and ffmpeg for the spin videos.

Use

A PDB id is fetched from RCSB automatically.

siroccomol 4HHB --style cel -o hemoglobin.png
siroccomol 4HHB --compare -o compare.png
siroccomol 4HHB --spin --compare -o compare.mp4
siroccomol 4HHB --spin -o spin.mp4 --frames 120 --px 1080 --ss 3   # high-quality video
siroccomol my_structure.pdb --color-by element --px 1600
import siroccomol

siroccomol.render_protein("4HHB", style="cel", out="hemoglobin.png")
siroccomol.compare("4HHB", out="compare.png")
siroccomol.compare_spin("4HHB", out="compare.mp4")
siroccomol.spin("4HHB", out="spin.mp4", frames=120, px=1080, ss=3)
img = siroccomol.render_protein("1UBQ", style="matte")

Options

option meaning
style cel or matte
color_by chain (one colour per subunit) or element (CPK)
iso isosurface level. higher gives tighter, smaller spheres; lower inflates the atoms
sfrac kernel width as a fraction of atom spacing. bigger is smoother (only with --no-vdw)
vdw atom radii match Bondi van der Waals values (default; exact at iso=0.1). --no-vdw / vdw=False gives the uniform sfrac kernel
sky illustration-style sky-gradient backdrop for cel (off by default)
grid voxel resolution of the density field. default auto-scales with assembly size (~0.5 Å/voxel, clamped to 192–336)
px output size
frames, fps frames per turn and video frame rate, for spin and compare_spin
ss supersampling factor for spin and compare_spin

spin and compare_spin encode a high-quality H.264 video (.mp4/.mov/.mkv), which needs ffmpeg on PATH. Good quality settings are frames=120, fps=30, px=1080, ss=3, crf=17 (Python only).

How it works

  1. Voxelize the atoms into a density field plus a smooth per-voxel colour, in a grid aligned to the structure's principal axes. Exposed atoms get a saturation boost first, so terminal side-chain bumps pop (Goodsell-style).
  2. Ray-march the density = iso isosurface on the GPU.
  3. Shade from the surface normal (the density gradient), and cast a shadow ray through the volume toward the light. Matte is diffuse with a soft shadow; cel is a saturated 4-tone with a crisp flat shadow and rim light.
  4. A contour pass inks the silhouette, the occluding depth edges and the colour boundaries, with the line width scaled to the structure's feature size.

For animation the volume is built once and the camera orbits per frame.

Thanks

The shader I used is based on ghibli-style-shader by the brilliant craftzdog.

MIT licensed. The official illustrations in gallery/goodsell/ are by David S. Goodsell and the RCSB PDB, from PDB-101 Molecule of the Month, used under CC-BY-4.0.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

siroccomol-0.1.0.tar.gz (80.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

siroccomol-0.1.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file siroccomol-0.1.0.tar.gz.

File metadata

  • Download URL: siroccomol-0.1.0.tar.gz
  • Upload date:
  • Size: 80.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for siroccomol-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5e8036e36e9fda519027387d77657fd59b7a6d4545780992a3efea9e3a5ce997
MD5 ef7ba0a4a9e741b4e29e74acd550dead
BLAKE2b-256 f01545b779287fc48bbe33792dbb189d569108f3ea54b6c791d5c5ddc3cacc0a

See more details on using hashes here.

File details

Details for the file siroccomol-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: siroccomol-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for siroccomol-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 144e9c78e7701ef8f1a622d57361195ec673b7e6f291387b39d51b0a6684ace3
MD5 e1376dd226c95b5fc33b8d47ac5b3fca
BLAKE2b-256 c44a4b673735d5c680a59c1441f3180f6d97586a76f19c4f433dad9ca7ac9720

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page