Cavitas
Cavitas is a viewer and geometry toolkit for periodic materials and their molecular-dynamics runs. It opens crystal structures and trajectories, plays runs of up to a million atoms, puts structures side by side on one playhead with linked cameras, and finds the empty cavities of porous frameworks such as metal–organic frameworks.
The same viewer comes in three forms, built from one source:
| Form | For | Start with |
|---|---|---|
| A desktop app (macOS, Windows) | Opening files from Finder or Explorer, in tabs and splits, with no Python | The app |
| A Python package | Notebooks, scripts and clusters: view, compare, export pictures and offline pages, find cavities | The Python package |
| A web component | Embedding the viewer in your own page or React app | The web component |
What a structure looks like, how a run plays and what a setting means is the same in all three, because the app and the Python package both draw with the web component.
What it opens
CIF (with symmetry), mmCIF, POSCAR/CONTCAR, XDATCAR, XYZ and extended XYZ, PDB, LAMMPS data and dump, XTC and DCD with their topology, and anything else pymatgen or ASE reads from Python.
The app
The app is the viewer's Workspace in a window: files open in tabs, tabs drag into columns and rows, and one playhead and one camera can be shared across them, each link switchable. Rust reads the files and builds their scenes; no Python, notebook kernel or local server is involved.
Build it from a checkout, with Node, pnpm, stable Rust and the platform's Tauri prerequisites:
cd web
pnpm install --frozen-lockfile
pnpm desktop:build --bundles app
- How to use it: docs/desktop.md.
- What it must do: spec/desktop/app.md, spec/desktop/workspace.md, spec/desktop/readers.md.
The Python package
pip install "cavitas[viewer,widget]"
Python 3.11 or 3.12. From a checkout: pip install -e ".[viewer,widget]".
import cavitas
view = cavitas.View("framework.cif") # a structure, with its cavities
run = cavitas.View(cavitas.Trajectory.read("run.extxyz"), fps=12) # an MD run, read as it plays
cavitas.Split(view, run) # side by side, one playhead, linked cameras
In a notebook the last line draws the viewer inline: classic Jupyter, JupyterLab, VS Code and Colab. There is no notebook extension to install, because the viewer is one self-contained page shipped inside the package. From a script, view.show() opens a browser, or serves the page when there is no display; from a cluster, cavitas show framework.cif prints the SSH tunnel to type on your own machine.
The package also exports what it shows:
| Export | Call |
|---|---|
| Pictures, at a size in pixels or millimetres | cavitas.save_frames(frames, "stills/", size="85mm", dpi=600), or the panel's Export tab; see docs/figures.md |
| A movie of a run | cavitas.save_movie(run, "run.gif", fps=8) |
| An offline page or folder that opens with no Python and no network | view.export("scene.html"); see docs/static-export.md |
| The structure back into Python | view.to_pymatgen() |
And it holds the cavity engine on its own:
from ase.io import read
from cavitas import cavity
space = cavity.from_ase(read("host.extxyz"))
found = space.cavities(probe=1.26)
found.table # one row per cavity: label, class, volume, widest point
- Start here: docs/quickstart.md, then the topic guides in docs/; cavities in docs/cavities.md and docs/cavity-component.md.
- Every keyword of
cavitas.View: docs/python-keywords.md. - What it must do: spec/library/components.md, spec/reach/notebook-transport.md, spec/library/static-export.md, spec/rendering/cavities.md.
The web component
The viewer is published as three packages:
| Package | What it is |
|---|---|
@cavitas/core |
Scene documents and resource stores; runs in Node |
@cavitas/studio |
mount() and the <cavitas-studio> element |
@cavitas/react |
A React wrapper, with React 18 or 19 as a peer |
import { defineCavitasStudio } from '@cavitas/studio';
defineCavitasStudio();
const viewer = document.createElement('cavitas-studio');
viewer.style.cssText = 'display:block;width:480px;height:360px';
viewer.scene = scene; // the scene document Python writes, or one you build with @cavitas/core
document.body.append(viewer);
Each element has its own settings, camera and playhead; a page shares one WebGL context across them. The packages are not on npm yet; pnpm build:packages in web/ builds them, and examples/npm/ has a working page for the element, React 18, React 19 and Node.
- How to use it: docs/library.md.
- What it must do: spec/library/packages.md, spec/library/element.md, spec/library/mount.md, spec/library/react.md, spec/library/source.md.
For AI agents
An agent in a shell can read what a person has open, in the app, a notebook or a served page, set the view, select atoms for them, hear the atoms they click and take exact pictures, with the cavitas command:
cavitas viewing # every open view: title, frame, camera, selection
cavitas set --frame 0 --option stick_radius=0.2
cavitas shot --size 800x600 -o view.png
An agent starts at AGENTS.md and skill/llms.txt; the commands are in docs/agent.md and the protocol in spec/agent/channel.md.
How it is built
| Component | What it owns |
|---|---|
| cavity | The map of a structure's empty space, its cavities and the windows between them, and guest insertion |
| studio | The viewer: one pane, splits, and the Workspace the app shows |
| agent | The commands an agent uses, their carriers and the sign-off record |
| settings | Every setting declared once, with its scope, default and Python keyword |
They stand on one core of readers, bonds, radii and atom identity, written in Python and in Rust (rust/). The viewer is TypeScript and WebGL/WebGPU (web/).
Specifications
Every behaviour is written down as the user asked for it, one topic a file, in spec/: the demand in the user's words, what a person sees, the designs that were rejected, and the tests that hold it. Code follows the spec. The main sets:
| Folder | Covers |
|---|---|
| spec/split/ | Splits, the linked camera, the one playhead, synchronized windows |
| spec/rendering/ | Scale, which atoms may be left undrawn, playback and streamed runs, cavities, WebGPU |
| spec/figure/ | Pictures: axes, light, labels, arrows, legends, polyhedra |
| spec/panel/ | The panel's tabs: Properties, Selection, the frame card, shortcuts |
| spec/desktop/ | The app, its Workspace, readers and cloud link |
| spec/library/ | Components, the web packages, static export |
| spec/agent/, spec/settings/, spec/rust/, spec/reach/ | The agent channel, settings, the Rust workspace, notebook transport |
Metadata
Release files for cavitas 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cavitas-0.3.1.tar.gz | 2.7 MB | With provenance | Details for cavitas-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cavitas-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for cavitas-0.3.1-py3-none-any.whl |
Total release size: 5.2 MB
Release files / cavitas-0.3.1.tar.gz
| Download URL | cavitas-0.3.1.tar.gz |
|---|---|
| Size | 2.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58976e9a9ee6506afe0008a38cd38257b97b82bce49707b85f503a3b954d4188
|
|
BLAKE2b-256 checksum How to use checksums |
5bf24c52845e0599b94c4e5cc9bfb3326c4c7d507c3706a99d2462ec86abeba0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / cavitas-0.3.1-py3-none-any.whl
| Download URL | cavitas-0.3.1-py3-none-any.whl |
|---|---|
| Size | 2.5 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7a342e613000b46e17f44bd65724a5f1f1b727a5bc9ca989f7ad908eb9781ab7
|
|
BLAKE2b-256 checksum How to use checksums |
20ca0118414def50eb3eeff59a73d298094d35846f215610a28397a60bdf15ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logSecurity for cavitas 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cavitas-0.3.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.