Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def nglview(self): # pragma: no cover
"""Visualize structure with nglview inside a jupyter notebook."""
try:
import nglview as nv
except ImportError:
cprint("nglview is not installed. See https://github.com/arose/nglview")
raise
view = nv.show_pymatgen(self)
view.add_unitcell()
return view