Skip to main content

Molecular visualization tools

Project description

COSMol-viewer

A high-performance molecular visualization library built with Rust and WebGPU, designed for seamless integration into Python workflows.

  • ⚡ Fast: Native-speed rendering powered by Rust and GPU acceleration

  • 🧬 Flexible: Load molecules from .sdf, .pdb, and dynamically update 3D structures

  • 📓 Notebook-friendly: Fully supports Jupyter and Google Colab — ideal for education, research, and live demos

  • 🔁 Real-time updates: Update molecular coordinates on-the-fly for simulations or animations

  • 🎨 Customizable: Control styles, camera, and rendering settings programmatically

Installation

pip install cosmol-viewer

Usage

from cosmol_viewer import Scene, Viewer, parse_sdf, Molecules

# === Step 1: Load and render a molecule ===
with open("molecule.sdf", "r") as f:
    sdf = f.read()
    mol = Molecules(parse_sdf(sdf)).centered()

scene = Scene()
scene.scale(0.1)
scene.add_shape(mol, "mol")

viewer = Viewer.render(scene)  # Launch the viewer

# === Step 2: Update the same molecule dynamically ===
import time

for i in range(1, 10):  # Simulate multiple frames
    with open(f"frames/frame_{i}.sdf", "r") as f:
        sdf = f.read()
        updated_mol = Molecules(parse_sdf(sdf)).centered()

    scene.update_shape("mol", updated_mol)
    viewer.update(scene)

    time.sleep(0.033)  # ~30 FPS

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

cosmol_viewer-0.1.2.dev2.tar.gz (46.2 kB view details)

Uploaded Source

Built Distributions

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

cosmol_viewer-0.1.2.dev2-cp37-abi3-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.7+Windows x86-64

cosmol_viewer-0.1.2.dev2-cp37-abi3-win32.whl (3.5 MB view details)

Uploaded CPython 3.7+Windows x86

cosmol_viewer-0.1.2.dev2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.7 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ x86-64

cosmol_viewer-0.1.2.dev2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.6 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ARM64

cosmol_viewer-0.1.2.dev2-cp37-abi3-macosx_11_0_arm64.whl (3.8 MB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

cosmol_viewer-0.1.2.dev2-cp37-abi3-macosx_10_12_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.7+macOS 10.12+ x86-64

File details

Details for the file cosmol_viewer-0.1.2.dev2.tar.gz.

File metadata

  • Download URL: cosmol_viewer-0.1.2.dev2.tar.gz
  • Upload date:
  • Size: 46.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.1

File hashes

Hashes for cosmol_viewer-0.1.2.dev2.tar.gz
Algorithm Hash digest
SHA256 c13bfc64941a9604f3e0c9f53ab77189efcc366866d50b6dd5a5d514753fda7e
MD5 276de1247e82fe8d26e4fe552464419f
BLAKE2b-256 eb8c0ded674e615de3cba9d698e3a5ae9beb2a48d3fa55b0e667bc453e4475a2

See more details on using hashes here.

File details

Details for the file cosmol_viewer-0.1.2.dev2-cp37-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev2-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 be9710c9cca27e08ff54347788b64e0b3df406858e98df889daf483b57856ab6
MD5 74adafb1636030a39c348af8b1d86dd6
BLAKE2b-256 e16176155e6532e7b138e9fea53ddcff6d6153b668185d8a846b5216822d910f

See more details on using hashes here.

File details

Details for the file cosmol_viewer-0.1.2.dev2-cp37-abi3-win32.whl.

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev2-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 e2a3c1cde021187b2d40d0f5b9ea58830c935f1bb77b3ba53c6ff6650d88574f
MD5 13c378867a15fc77ccfe3d5f9b5b295d
BLAKE2b-256 7bdd7bed100a2587eadbf4d589e8c236b2812934e753546dd946c0c5b5df2cf7

See more details on using hashes here.

File details

Details for the file cosmol_viewer-0.1.2.dev2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 59fb2f61b762e6bc154482c2c7d315053099420f69580aa8b8872b1b75cb863f
MD5 5ae143e5393639ef015c662da05010ff
BLAKE2b-256 5589e65bf8e10b7e079cbe6aee0a4dd7a7e0c8d41ae67e8203eb668d49a4ffdb

See more details on using hashes here.

File details

Details for the file cosmol_viewer-0.1.2.dev2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7104fdc494a499cba2a477667c81c17fb9bc69d86c926ad6cd2ae12b0947f827
MD5 6585ce9e1838a69831d2db90b6e58aa1
BLAKE2b-256 6a0ca5aa656fa65e3ed5627a5837209d8ba036cf043c8c1a5219c267372bb9cc

See more details on using hashes here.

File details

Details for the file cosmol_viewer-0.1.2.dev2-cp37-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev2-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4f5c6533e6d475046c03438c2af137299d0157e5ab6e04205c58a490fcfbb0f7
MD5 90c6c647a1148ba169c1e2ddc232c07d
BLAKE2b-256 7481d21aef779b716d8338c8a2e805bb63c61eb1aa10c220f73d80d345422b8c

See more details on using hashes here.

File details

Details for the file cosmol_viewer-0.1.2.dev2-cp37-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev2-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 87a4811d97fc4e638d5f156731d589116c895eda0785f3ba22a43eb47f066cf8
MD5 88bf0ff170680f716b2960447e59c575
BLAKE2b-256 9a271136faf6188da3ca356a565b161ebbd40bca9109b824c1869d74802ecb7c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page