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

Examples

See examples in Google Colab.

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.dev5.tar.gz (54.6 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.dev5-cp37-abi3-win_amd64.whl (5.9 MB view details)

Uploaded CPython 3.7+Windows x86-64

cosmol_viewer-0.1.2.dev5-cp37-abi3-win32.whl (5.8 MB view details)

Uploaded CPython 3.7+Windows x86

cosmol_viewer-0.1.2.dev5-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.1 MB view details)

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

cosmol_viewer-0.1.2.dev5-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.9 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ARM64

cosmol_viewer-0.1.2.dev5-cp37-abi3-macosx_11_0_arm64.whl (5.8 MB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

cosmol_viewer-0.1.2.dev5-cp37-abi3-macosx_10_12_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.7+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for cosmol_viewer-0.1.2.dev5.tar.gz
Algorithm Hash digest
SHA256 e07fefed863540723382ea9d2590741edbb89451b15419495475d309a7a8ec46
MD5 4ad3aaf5eb35c1e1e26434d6e3f7580f
BLAKE2b-256 852a7987cc2062a0b40419e3aac77b8b666e7fe081773a8cc0c5a3af0a560841

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev5-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 2d8778a6053b6d242b2e07f8894c2f9253c7411b05c1207697eab59ed3d0b66d
MD5 24c925ba59df0656c83df72536923cc3
BLAKE2b-256 582003d4c0bcfd51cf6321bc1c82cb246f74b442c980e74f54ae6f71fae5d7e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev5-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 dcbf53565d502b402ed2e22f68075b0f7c4dbac4d23b3a75251a6e45af3542df
MD5 6ed60e8d94fdeb64c8ecdabba92a8281
BLAKE2b-256 143684b63836da36cdaa2400da88fcdaf806352b534cf164a668e6d0393ec4c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev5-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f1c126a7b0fa3bfd7a7dc62f9758940757519085e7329ccd5f6bc304eee5c9a3
MD5 557992f2250123a7ce101892386c662a
BLAKE2b-256 3648e7527a1e835a196a445af57ccbb928226a8aca491e354b32dc776edab7e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev5-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 247b8c167b9429caa3ce1afc519891216716fb987fc64984b7d855badd700869
MD5 84e551c33dc7ea75d7785ea0b430cb91
BLAKE2b-256 510f5b0604b9b4672311efdb2c97552d5293536403a1a0472cd1cffc7fda7cf5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev5-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eef1ce737cd6721382cbd06d3e24013e81bdac0c23539bda569502b11b2f143c
MD5 3f32c64f7e9699dcdbd55c75e322aff6
BLAKE2b-256 df64386bfd77c3e5b034c5b3b41f18ce488a5d18e0aae35a20c8185bdc0d964c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev5-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d5759a448a96eeccb8d7d7eeb11b57ccd5a46af1453facf8ded6ce74acd62b62
MD5 101c663958b72802a2e536746b4d43cd
BLAKE2b-256 20a07bdfbe74172e1f7232a97b60d7063534bf470c59cf1d3afe5e50a6149a55

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