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.
Metadata
Release files for siroccomol 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| siroccomol-0.1.0.tar.gz | 80.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| siroccomol-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 93.4 kB
Release files / siroccomol-0.1.0.tar.gz
| Download URL | siroccomol-0.1.0.tar.gz |
|---|---|
| Size | 80.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5e8036e36e9fda519027387d77657fd59b7a6d4545780992a3efea9e3a5ce997
|
|
BLAKE2b-256 checksum How to use checksums |
f01545b779287fc48bbe33792dbb189d569108f3ea54b6c791d5c5ddc3cacc0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / siroccomol-0.1.0-py3-none-any.whl
| Download URL | siroccomol-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
144e9c78e7701ef8f1a622d57361195ec673b7e6f291387b39d51b0a6684ace3
|
|
BLAKE2b-256 checksum How to use checksums |
c44a4b673735d5c680a59c1441f3180f6d97586a76f19c4f433dad9ca7ac9720
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|