molsysmt.thirds.nglview package#

Submodules#

molsysmt.thirds.nglview.add_arrows module#

molsysmt.thirds.nglview.add_arrows.add_arrows(view, origin=None, end=None, vectors=None, color='#808080', radius='0.2 angstroms')[source]#

Adding arrows to a view.

A list of arrows can be added to an NGL view (NGLWidget).

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

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

  • arrows (Quantity (value:numpy.ndarray, dimensionality:['L']=1)) – Vectors to be added as arrows. A quantity with length dimensions is required ([‘L’]=1), the value must be a numpy ndarray with shape [n_arrows, 3] (n_arrows is the number of arrows to be added).

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

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

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 numpy as np
>>> molecular_system = msm.convert('181L', selection='molecule_type=="protein"')
>>> coordinates = msm.get(molecular_system, element='atom', selection='atom_name=="CA"', coordinates=True)
>>> vectors = puw.quantity(np.ones([coordinates.shape[0],3]), 'angstroms')
>>> view = msm.view(molecular_system)
>>> msm.thirds.add_arrows(view, origin=coordinates, vectors=arrows)
>>> view

Notes

Have a look to the `YYY`_.

molsysmt.thirds.nglview.add_contacts module#

molsysmt.thirds.nglview.add_contacts.add_contacts(view, selection=None, center_of_atoms=False, weights=None, structure_indices='all', selection_2=None, center_of_atoms_2=False, weights_2=None, structure_indices_2=None, threshold=None, pbc=False, atom_pairs=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, syntax='MolSysMT', skip_digestion=False)[source]#

molsysmt.thirds.nglview.add_cylinders module#

molsysmt.thirds.nglview.add_cylinders.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`_.

molsysmt.thirds.nglview.add_hbonds module#

molsysmt.thirds.nglview.add_hbonds.add_hbonds(view, hbonds, selection=None, selection_2=None, hbond_level='atom', color='#FFC300', radius='0.1 angstroms', syntax='MolSysMT')[source]#

molsysmt.thirds.nglview.clear module#

molsysmt.thirds.nglview.clear.clear(view, skip_digestion=False)[source]#

molsysmt.thirds.nglview.load_html_in_jupyter_notebook module#

molsysmt.thirds.nglview.load_html_in_jupyter_notebook.load_html_in_jupyter_notebook(filename)[source]#

molsysmt.thirds.nglview.patching_nglview module#

molsysmt.thirds.nglview.patching_nglview.add_molsysmt_to_nglview()[source]#

molsysmt.thirds.nglview.set_color module#

molsysmt.thirds.nglview.set_color.set_color(view, color, selection='all', syntax='MolSysMT')[source]#

molsysmt.thirds.nglview.set_color_by_value module#

molsysmt.thirds.nglview.set_color_by_value.set_color_by_value(view, values, element='group', selection='all', cmap='bwr_r', min_value=None, mid_value=None, max_value=None, representation='cartoon', syntax='MolSysMT')[source]#

Adding a new representation colored by a color scale.

A new representation can be added to an NGL view (NGLWidget) with elements colored by a list of values and a color map.

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

  • values (list, tuple or numpy.ndarray) – List of values or magnitudes corresponding to each element to be encoded as a color.

  • element (str, default='group') – Element to be colored according to its value in the input argument values.

  • selection (str, list, tuple or numpy.ndarray, default='all') – Selection over which this method applies. The selection can be given by a list, tuple or numpy array of integers (0-based), or by means of a string following any of the selection syntax parsable by MolSysMT (see: molsysmt.select()).

  • cmap (str, matplotlib.colors.LinearSegmentedColormap, default:'rwb') – The name of the matplotlib colormap or a LineraSegemendedColormap native Python object of the MatPlotLib library.

  • min_value (float, Quantity, default='None') – Minimum value of the color scale. By default (‘None’), the minimum of the input argument values is taken.

  • mid_value (float, Quantity, default='None') – Middle value of the color scale. By default (‘None’), the center between of the range [min_value, max_value] is taken.

  • max_value (float, Quantity, default='None') – Maximum value of the color scale. By default (‘None’), the maximum of the input argument values is taken.

  • representation (str, default='cartoon') – Representation type supported by NGLView: ‘cartoon’, ‘licorice’, ‘surface’, ‘ball_and_stick’…

  • syntax (str, default='MolSysMT') – Syntaxis used in the argument selection (in case it is a string). The current options supported by MolSysMt can be found in section XXX (see: molsysmt.basic.select()).

Returns:

The method modifies an nglview.NGLWidget object including the new representation.

Return type:

None

Examples

>>> import molsysmt as msm
>>> from matplotlib.pyplot import colormaps
>>> molecular_system = msm.convert('181L', selection='molecule_type=="protein"')
>>> charge_residues = msm.physchem.charge(molecular_system, element='group', definition='physical_pH7') 
>>> view = msm.view(molecular_system)
>>> view.clear()
>>> msm.thirds.nglview.color_by_value(view, charge_residues)
>>> view

Notes

Have a look to the `YYY`_.

molsysmt.thirds.nglview.show_as_balls_and_sticks module#

molsysmt.thirds.nglview.show_as_balls_and_sticks.show_as_balls_and_sticks(view, selection='all', skip_digestion=False)[source]#

molsysmt.thirds.nglview.show_as_cartoon module#

molsysmt.thirds.nglview.show_as_cartoon.show_as_cartoon(view, selection='all', color='blue', skip_digestion=False)[source]#

molsysmt.thirds.nglview.show_as_licorice module#

molsysmt.thirds.nglview.show_as_licorice.show_as_licorice(view, selection='all', skip_digestion=False)[source]#

molsysmt.thirds.nglview.show_as_surface module#

molsysmt.thirds.nglview.show_as_surface.show_as_surface(view, selection='all', opacity=0.3, color='lightblue', skip_digestion=False)[source]#

molsysmt.thirds.nglview.show_gui module#

molsysmt.thirds.nglview.show_gui.show_gui(view)[source]#

molsysmt.thirds.nglview.standardize_view module#

molsysmt.thirds.nglview.standardize_view.standardize_view(view, atom_indices='all', structure_indices='all')[source]#

molsysmt.thirds.nglview.write_html module#

molsysmt.thirds.nglview.write_html.write_html(view, output_filename)[source]#

Module contents#