molsysmt.thirds.nglview.add_cylinders#

molsysmt.thirds.nglview.add_cylinders(view, bottom=None, top=None, vectors=None, color='#808080', color_2=None, radius='0.1 angstroms', color_values=None, min_color_value=None, mid_color_value=None, max_color_value=None, color_values_scale='linear', colormap='bwr', color_values_2=None, min_color_value_2=None, mid_color_value_2=None, max_color_value_2=None, color_values_scale_2=None, colormap_2=None, skip_digestion=False)[source]#

Adding cylinders to a view.

Cylinders can be added to an NGL view (NGLWidget).

Parameters:
  • view (nglview.NGLWidget) – A view of the molecular system as an nglview.NGLWidget native object.

  • start (Quantity (value:numpy.ndarray, dimensionality:['L']=1)) – Positions of the origin points for the set of cylinders. A quantity with length dimensions is required ([‘L’]=1), the value must be a numpy ndarray with shape [n_cylinders, 3] (n_cylinders is the number of arrows to be added).

  • end (Quantity (value:numpy.ndarray, dimensionality:['L']=1)) – Positions of the end points for the set of cylinders. A quantity with length dimensions is required ([‘L’]=1), the value must be a numpy ndarray with shape [n_cylinders, 3] (n_cylinders is the number of arrows to be added).

  • color (list, tuple, string default='#808080') – HEX or RGB color code of the first half of the cylinder.

  • color2 (list, tuple, string default='#808080') – HEX or RGB color code of the first half of the cylinder.

  • radius (Quantity (value:float, dimensionality:['L']=1), default='0.2 angstroms') – Radius of the cylinder.

Returns:

The method modifies an nglview.NGLWidget object to add a list of arrows.

Return type:

None

Examples

>>> import molsysmt as msm
>>> from molsysmt import pyunitwizard as puw
>>> import nglview as nv
>>> view = nv.NGLWidget()
>>> start = puw.quantity([[0,0,0], [0,5,0]], 'angstroms')
>>> end = puw.quantity([[10,0,0], [0,10,0]], 'angstroms')
>>> msm.thirds.nglview.add_cylinders(view, start, end, color='#ff0000', color_2='#0000ff', radius='0.2 angstroms')
>>> view

Notes

Have a look to the `YYY`_.