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 viasky).
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
SARS-CoV-2 spike · 6VXX, 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
- 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).
- Ray-march the
density = isoisosurface on the GPU. - 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.
- 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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e8036e36e9fda519027387d77657fd59b7a6d4545780992a3efea9e3a5ce997
|
|
| MD5 |
ef7ba0a4a9e741b4e29e74acd550dead
|
|
| BLAKE2b-256 |
f01545b779287fc48bbe33792dbb189d569108f3ea54b6c791d5c5ddc3cacc0a
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
144e9c78e7701ef8f1a622d57361195ec673b7e6f291387b39d51b0a6684ace3
|
|
| MD5 |
e1376dd226c95b5fc33b8d47ac5b3fca
|
|
| BLAKE2b-256 |
c44a4b673735d5c680a59c1441f3180f6d97586a76f19c4f433dad9ca7ac9720
|