Using with nglview

The nglview package provides a dynamic widget in a Jupyter notebook for visualising molecular systems.

Narupatools provides handy utilities for using nglview with various constructs.

How do I…

… visualise a dynamics object?

A dynamics object can be shown using the show_dynamics function. This generates an nglview widget that updates its contents as the dynamics object is changed.

from narupatools.nglview import show_dynamics

show_dynamics(dynamics)

… use shorthand Jupyter magick to use nglview

The narupatools package provides IPython magick to allow you to quickly render a system. Firstly, this must be setup:

# Load the narupatools IPython extension
%load_ext narupatools

Then, instead of having to import the correct show_ function, the %ngl magick will automatically call the correct version:

# Render dynamics using nglview
%ngl dynamics