Basic Visualization
Simple Usage
Available Styles
| Style | Description |
|---|---|
cartoon |
Cartoon style with black bonds (default) |
default |
Standard CPK coloring |
neon |
Glowing neon effect |
glossy |
Shiny reflective surface |
metallic |
Metallic appearance |
rowan |
Rowan-inspired style |
bubble |
Bubble-like appearance |
grey |
Greyscale rendering |
Neon Style Example
Partial Charge Visualization
Visualize partial charges using colorBy="Charge". Colors: red (negative) → white (neutral) → blue (positive).
import numpy as np
from ase.io import read
from aseview import MolecularViewer
atoms = read("molecule.xyz")
atoms.arrays['charges'] = np.array([...]) # partial charges
viewer = MolecularViewer(atoms, colorBy="Charge")
viewer.show()
Charge Options
| Option | Description |
|---|---|
colorBy="Charge" |
Enable charge coloring |
normalizeCharge=True |
Scale colors to full range |
showChargeLabels=True |
Display charge values on atoms |
Customization
viewer = MolecularViewer(
atoms,
style="metallic",
atomSize=0.5, # Atom radius scale
bondThickness=0.15, # Bond radius
bondThreshold=1.2, # Bond detection threshold
backgroundColor="#1a1a2e"
)
viewer.show()
Saving to HTML
Creates a standalone HTML file viewable in any browser without Python.