Jupyter¶
Embed PQViewer in a Jupyter output cell.
Install¶
python -m pip install 'MolarVerse-PQViewer[jupyter]'
Display a file¶
Use water.xyz from Getting started,
or replace the path with your trajectory:
from pqviewer import view
viewer = view("water.xyz", height=620)
viewer
view chooses an available 127.0.0.1 port and starts PQViewer in a daemon
thread. The returned NotebookViewer exposes its url and renders as an
iframe.
Companion files use the same names as create_app:
viewer = view(
"trajectory.xyz",
forces_path="trajectory.force",
velocities_path="trajectory.vel",
topology_path="topology",
height=680,
)
viewer
Display an ASE object¶
Add the optional adapter:
python -m pip install 'MolarVerse-PQViewer[ase]'
from ase.build import molecule
from pqviewer import view
viewer = view(molecule("C60"), height=620)
viewer
Stop the server¶
viewer.close()
close is safe to call more than once. For a bounded server lifetime:
with view("water.xyz") as viewer:
print(viewer.url)
Local kernels work directly. With a remote Jupyter kernel, the browser also needs access to the selected loopback port through the notebook environment or an explicit port forward. The iframe does not set up this route automatically. For a separate desktop-browser workflow, use the CLI SSH forwarding guide.
The complete workflow is in the executable example notebook.