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

Uploaded CPython 3.7+Windows x86-64

cosmol_viewer-0.1.2.dev4-cp37-abi3-win32.whl (3.6 MB view details)

Uploaded CPython 3.7+Windows x86

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

File metadata

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

File hashes

Hashes for cosmol_viewer-0.1.2.dev4.tar.gz
Algorithm Hash digest
SHA256 99d4b2910d940162e1e0b3b574011974752622c950b275d281882a67d7336317
MD5 83d68faa53d3f41b7690637fd9a350b0
BLAKE2b-256 bad5e152aa4ce22044042b8193a1ff9fd8dece9b8235ae6563457490203d1a82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev4-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d12a6778ebf0009bf9f4cd6262bbf64eb9963935c98ede1c47d91620d9294c6d
MD5 c5928581a26bd23c36e53cebe734017e
BLAKE2b-256 ab653e350a48f2034e4cecb2c56b2058623e0fa4a343a841f40e1242f5b5e716

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev4-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 58d0b3890f2ec94dfed9b49c1611724aa55eb679ad68ab50e2c857016c97e4ab
MD5 f1f803fe440b93771eba1c41f51b4558
BLAKE2b-256 ba3931fa4143e52b7284ce5a5b55c32b715ca2deb0195d2b0a9aab1f88f5a9d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev4-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 af7d6e295e884203d53f1b673a33971740581326b5fe6b84426de45ddc1a6762
MD5 093ac1bfca06c608f3eb729f07a94c80
BLAKE2b-256 44f2fa8c32b2876164d3d2750d98412e7aba2c2e21c06435ba7d635e72a262a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev4-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 36f4a94c512db70027894111980da1160b75440bb9c307aad30ccb351167d92b
MD5 fc983f4e4fe3eccf0c598ea5c61575be
BLAKE2b-256 842514445826e2957a92cd057a155c4fdbc6b347e08f3ec11ce1d8dcbcdeaa5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev4-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 89dbea34443e0f385d4eadf66832694d39f4f2d74cddd8ab5b5e342f0023c572
MD5 c17682afed2983a8028b58a68b1e70d4
BLAKE2b-256 d4caba5b8c41d7b6ad883fa95bdd1392c35b56827d3f740a4033e55b89983118

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosmol_viewer-0.1.2.dev4-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 84027b9f4888051de76e9e47fb5416c5270f4adc53457f32264801132c0e9f57
MD5 4a106882a532b5bc198bb4d22814e9c7
BLAKE2b-256 f7c2c273d4211ed2ba2e8265f62ef0005b99a2f4c9745638262843fc6fe25706

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