Interactive plots
atomli.visualize.plot creates interactive figures for notebooks and HTML pages.
from atomli.visualize import plot
figure = plot.ir(frequencies_cm_inv, intensities, broadening=15)figure.write_html("ir.html")figureHover over a trace to read values. Select a legend item to compare contributions. Zoom controls and wheel zoom are disabled by default. Each example links the Python script and the data that produced it.
Spectra
Section titled “Spectra”plot.ir, plot.raman, plot.vibration, and plot.uv_vis take frequencies or energies with intensities.
The blue curve is Gaussian broadening of the input lines, which are drawn as red sticks.
IR uses decreasing wavenumber and Raman increasing Raman shift.
See Spectra and diffraction for saved results and the vibration guide for animated modes.
Band structure
Section titled “Band structure”plot.band_structure(path, energies, n_valence=4, labels=..., label_positions=..., dos=(energies, density)) draws
bands along a k path with an optional density of states that shares the energy axis.
Energies are shifted so the valence-band maximum is zero, the band edges are marked, and the gap is shaded and labeled.
Each energy is plotted at its own k point and joined by straight lines. The function does not interpolate.
plot.band_gap(energies, n_valence) returns the same edges as numbers.
The figure shows silicon from the band and phonon example: PBE eigenvalues
at the mesh points on the Γ–X–W–K–Γ–L path.
Silicon band structure and density of states with the indirect gap shaded
Silicon example · Build · Run
Orbital DOS
Section titled “Orbital DOS”plot.dos takes energies and a density in states/eV, relative to a reference energy.
This water spectrum is PBE/def2-SVP with Gaussian width 0.3 eV, shown from the O 2s level to above the LUMO.
Energies are relative to the middle of the HOMO–LUMO gap, which is shaded.
plot.pdos adds atom or orbital projections.
Water orbital DOS with the HOMO-LUMO gap shaded
Phonons
Section titled “Phonons”plot.phonon_bands draws branches along a q path with an optional side density of states, and plot.phonon_dos draws
a density alone. Both take frequencies in cm⁻¹ and display THz. The figure shows the silicon dispersion along Γ–X–W–K–Γ–L
and its density of states on a shared frequency axis, built with plot.plotly; red diamonds are DFT frequencies at Γ, X and L.
The phonon guide covers the force constants.
Silicon phonon dispersion and density of states with PBE frequencies at Γ, X and L
Silicon example · Build · Run
Reaction and trajectory plots
Section titled “Reaction and trajectory plots”plot.reaction_profile plots relative energies along a coordinate.
This is the optimized PBE/def2-SVP ammonia inversion band from the
climbing-image NEB study, with the initial minimum at zero.
Interactive ammonia NEB barrier profile
Temperature can vary during an NVE trajectory because kinetic and potential energy exchange. The two panels show both quantities from one 32-atom argon trajectory. The total energy changes by +0.0246 meV over 500 fs with a 1 fs time step.
Argon trajectory comparison explains temperature fluctuations and energy conservation
Data and conditions · Molecular dynamics calculation
General plots
Section titled “General plots”plot.line, plot.scatter, plot.bar, plot.heatmap, and plot.surface provide the basic forms.
The line shows the total-energy change of a g-xTB water NVE run.
The heatmap and surface use PBE/def2-SVP water energies over two O–H distances at the relaxed H–O–H angle.
The remaining coordinates are held fixed.
Interactive NVE energy line
Interactive water O H energy heatmap
Interactive water O H energy surface
plot.plotly accepts a Plotly figure or a mapping with data, layout, and config.
Use it for linked panels, reference lines, and result labels.
Atomli does not require the Python Plotly package for mappings.
Select a plot from the question that the calculation must answer:
| Chemical question | Comparison | Complete study |
|---|---|---|
| Which guest has the lowest binding energy? | Binding energies on one reference scale | CO₂ in CC3 |
| Does the best pose establish a guest preference? | Best energies together with all sampled poses | Cyclodextrin |
| Which balanced reaction lowers the electronic energy? | Reactant and product energy levels | Thiolate addition |
| Does conformer orientation change the energy? | Anti and mirror gauche conformers | Ethanol |
| Where does the coordinate survey locate a minimum? | Contour map and fixed-coordinate energy sections | Water |
| How large is the semiconductor gap, and is it direct? | Bands and DOS along a k path | Silicon bands |
| How does model refinement change the crystal prediction? | Lattice minima and the sampled orbital gap | Silicon |
Updates, events, and exports
Section titled “Updates, events, and exports”figure.set(title="Water IR", broadening=12, sticks=True)figure.update(new_content)figure.relayout(**{"xaxis.range": [4000, 500]})figure.restyle({"line.width": 3}, traces=[0])figure.save("spectrum.svg")figure.write_html("spectrum.html")Image export uses the connected browser download directory.
HTML export writes to the Python filesystem.
Use as_widget() for Python event callbacks and direct PNG capture through Jupyter communications.
Install anywidget>=0.9,<1 in the notebook environment.
figure.on("click", lambda event: print(event["points"]))display(figure.as_widget())image = await figure.capture_png("spectrum.png")figure.close()capture_png needs a displayed widget and a connected notebook kernel.
It writes PNG bytes to the Python filesystem when a filename is supplied.
The API reference lists plot builders and viewer controls.
Reusable Python widgets
Section titled “Reusable Python widgets”Plot.to_json() exports the data descriptor.
Plot.write_html() exports a reusable interactive widget.
Use the same Python plot builders for notebooks, saved reports, and standalone pages.