Add hydrogen bonds#

Adding hydrogen bond representations to NGLView interactive visualization widgets.

The function molsysmt.third_party.nglview.add_hbonds() calculates hydrogen bonds in the molecular system and renders them as dashed lines or cylinders in the viewer.

Added in version 1.0.0.

Basic usage#

Let’s demonstrate how to use this function on an interactive NGLView view:

import molsysmt as msm
import numpy as np

molsys = msm.convert(msm.systems['T4 lysozyme L99A']['181l.h5msm'], to_form='molsysmt.MolSys')
view = msm.convert(molsys, to_form='nglview.NGLWidget')
hbonds = np.array([[0, 10, 20], [1, 15, 25]])
msm.third_party.nglview.add_hbonds(view, hbonds=hbonds, color='#F39C12')

Evaluating the view object displays the interactive visualization:

view