Skip to main content

plotlyMol

plotlyMol Logo

Tests Lint License: MIT

Interactive molecular visualizations with Plotly. Supports SMILES, XYZ, MOL/PDB, and cube orbitals.

Features

  • 3D ball-and-stick, stick, and VDW representations
  • SMILES-to-3D embedding via RDKit
  • XYZ, MOL/SDF (single), and PDB input support
  • Cube file orbital isosurfaces
  • Vibrational mode visualization (Gaussian, ORCA, Molden formats)
    • Static displacement arrows
    • Animated vibrations with interactive controls
    • Heatmap coloring by displacement magnitude
  • Dash GUI for interactive exploration

Installation

pip install plotlymol

From source (for development)

git clone https://github.com/The-Schultz-Lab/plotlyMol.git
cd plotlyMol

# Create and activate the conda environment (includes all dependencies)
conda env create -f environment.yml
conda activate plotlymol

# Install the package in editable mode
pip install -e .

Note: Conda is required. If you don't have it, install Miniforge (recommended) or Miniconda. All packages are installed from the conda-forge channel.

Updating the environment

If environment.yml changes after pulling new commits:

conda env update -f environment.yml --prune

Quick start

from plotlymol3d import draw_3D_rep

# Draw a molecule from SMILES
fig = draw_3D_rep(smiles="CCNCOCSC", mode="ball+stick", ambient=0.1)
fig.show()

# Draw from XYZ file
fig = draw_3D_rep(xyzfile="path/to/file.xyz", mode="ball+stick", ambient=0.1)
fig.show()

Orbitals from cube files

from plotlymol3d import draw_3D_rep

fig = draw_3D_rep(
    cubefile="path/to/file.cube",
    molfile="path/to/file.mol",
    mode="ball+stick",
    ambient=0.1,
    cubedraw="orbitals",
    orbital_opacity=0.25,
    orbital_colors=["darkorange", "darkblue"],
)
fig.show()

Vibrational mode visualization

Visualize molecular vibrations from quantum chemistry calculations. Supports Gaussian .log, ORCA .out, and Molden .molden files.

Static displacement arrows:

from plotlymol3d import draw_3D_rep

fig = draw_3D_rep(
    smiles="O",  # Water molecule
    vibration_file="water_freq.log",
    vibration_mode=1,  # First vibrational mode
    vibration_display="arrows",
    vibration_amplitude=1.5,
)
fig.show()

Animated vibration:

from plotlymol3d import parse_vibrations, create_vibration_animation
from rdkit.Chem import MolFromSmiles, AddHs
from rdkit.Chem.AllChem import EmbedMolecule

# Parse vibration data
vib_data = parse_vibrations("water_freq.log")

# Create molecule
mol = MolFromSmiles("O")
mol = AddHs(mol)
EmbedMolecule(mol)

# Generate animation
fig = create_vibration_animation(
    vib_data=vib_data,
    mode_number=1,
    mol=mol,
    amplitude=0.5,
    n_frames=20,  # Smoother with more frames
    mode="ball+stick"
)
fig.show()

Heatmap coloring by displacement:

from plotlymol3d import draw_3D_rep, parse_vibrations, add_vibrations_to_figure

# Create molecular figure
fig = draw_3D_rep(smiles="O", mode="ball+stick")

# Parse vibrations and add heatmap
vib_data = parse_vibrations("water_freq.log")
fig = add_vibrations_to_figure(
    fig=fig,
    vib_data=vib_data,
    mode_number=1,
    display_type="heatmap",
    heatmap_colorscale="Reds"
)
fig.show()

Available parsers:

from plotlymol3d import (
    parse_gaussian_vibrations,  # Gaussian .log files
    parse_orca_vibrations,       # ORCA .out files
    parse_molden_vibrations,     # Molden .molden files
    parse_vibrations,            # Auto-detect format
)

# Auto-detect format from file extension
vib_data = parse_vibrations("calculation.log")

# Access mode data
for mode in vib_data.modes:
    print(f"Mode {mode.mode_number}: {mode.frequency:.1f} cm⁻¹")
    if mode.ir_intensity:
        print(f"  IR Intensity: {mode.ir_intensity:.1f} km/mol")

GUI

Launch the Dash app for interactive controls:

python examples/gui_app.py

Examples

Demo Scripts

  • Demo script: python examples/demo_visualizations.py
  • Package data includes sample XYZ/MOL/CUBE files under src/plotlymol3d/

Jupyter Notebooks

Vibration Visualization:

Performance Testing:

Launch notebooks:

jupyter notebook examples/

Performance Testing

Quantitatively measure and optimize rendering performance:

Standalone script:

python tests/test_performance.py

Interactive notebook:

jupyter notebook examples/performance_benchmarking.ipynb

Full guide: docs/PERFORMANCE_TESTING_GUIDE.md (coming soon)

Key metrics tracked:

  • Rendering time vs molecule size
  • Resolution impact (8-64)
  • Memory usage profiling
  • Vibration parsing speed
  • Animation generation performance

Use these tools to identify bottlenecks and optimize GUI responsiveness.

Repository layout

plotlyMol/
├─ src/
│  └─ plotlymol3d/        # Library package code + sample data files
├─ examples/              # Demo scripts and GUI app
├─ tests/                 # Pytest suite
├─ docs/                  # Roadmap and documentation assets
├─ pyproject.toml          # Packaging and tooling configuration
├─ requirements.txt        # Consolidated dependencies
└─ README.md

Roadmap

See GitHub Issues for planned features and upcoming work.

Metadata

Release files for plotlymol 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for plotlymol 0.2.1
File Size Uploaded Provenance Actions
plotlymol-0.2.1.tar.gz 1.3 MB With provenance Details for plotlymol-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for plotlymol 0.2.1
File Interpreter ABI Platform Actions
plotlymol-0.2.1-py3-none-any.whl Python 3 none any Details for plotlymol-0.2.1-py3-none-any.whl

Total release size: 2.6 MB

Release files / plotlymol-0.2.1.tar.gz

Download URL plotlymol-0.2.1.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
d0410cbcbd7395d74a3c9a1e0a0d77523f6b6485ad5934ec1a5f3e592b085cc1
BLAKE2b-256 checksum
How to use checksums
8f8f7b06fb1de0dfb1495ac3a33ef7e0ef1222141f99d77e710fa19729bcc06d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 18, 2026.

Transparency log

Release files / plotlymol-0.2.1-py3-none-any.whl

Download URL plotlymol-0.2.1-py3-none-any.whl
Size 1.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
f4c226c63366f9042bedfe23b133fcfcb00793661d7d52740d2e8b4e5497215b
BLAKE2b-256 checksum
How to use checksums
a161170b484235df593624c0afdda9f6c9c8a256845df90f8a88035432039cbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 18, 2026.

Transparency log

Security for plotlymol 0.2.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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for plotlymol-0.2.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 Apr 18, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page