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.dev1.tar.gz (47.5 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.dev1-cp37-abi3-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.7+Windows x86-64

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

Uploaded CPython 3.7+Windows x86

cosmol_viewer-0.1.2.dev1-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.dev1-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.dev1-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.dev1-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.dev1.tar.gz.

File metadata

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

File hashes

Hashes for cosmol_viewer-0.1.2.dev1.tar.gz
Algorithm Hash digest
SHA256 6038d5481eb900d9b5a60a9f0d2ce578c41717f5c6d1645e9286dad1d666882f
MD5 9d6829eb1e663ac7454aecef605acee9
BLAKE2b-256 86155fc49e7752fdfdca8a172f94adb3d08ed27b1390cd608cd79c7132ac6385

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev1-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 3c3413eea4c8d79b2cb9250cf7ca8545cd9e9038985b6812d922c4b4cddc8be8
MD5 cfe93337fd41b4585e3084fc17c5aa10
BLAKE2b-256 f1784da422b3a6b981920063fc2e06a1b3ced163a142b7bec0ce4c32e98bbe9d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev1-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 54ea46d92644116b24fb77cb728bc4d47946848a25d6294a3019d8e5103d3639
MD5 33a3e220393d17b6eaef53d589f7852c
BLAKE2b-256 32c0d47a751daf44024dfe97a21603b4a69b0c52d87002ad8f61b827eacd8569

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 25a4e1af128f9c2be1cc466e642ec0af675d9c9331aa3de17ce564713488d82d
MD5 9866a2c4bfaf206e9a679a43ffb201b1
BLAKE2b-256 01e26e893119ad0a9f71dbe545405989762ddaa9e20c2cd6b646b194ecb8b549

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1a63ef6ce5f047d66670b76a1abf368d728ac22e17351a1bf0b8cb04420f3e6a
MD5 5ec0224ac67a90c239d95990937b1954
BLAKE2b-256 e935c4988ecff2e698250749b63b268d33c1837d704f8720221da8ddca443866

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev1-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 15cd9f270f294db44466fab79e628a8bb211dc7eb02aaa57b93a89260db4acb5
MD5 e178d6e38480dd699ac4829ef9ca392f
BLAKE2b-256 5f0edec7d2f51c3d769a9eec53fa02beced0d9148a4b2dac79ee3083a3e6cd7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev1-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 aa79d46127c90c3ff23a8f1a466c54cbb57a6eb2d7607f9458424514e1bea2c1
MD5 5ce2854fe7c544c604f206055931eb68
BLAKE2b-256 e78ee1fdc02b79c6c2fd1468c50b6c2eaf6ecdc194c575a7369024de76c8ae8f

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