molsysmt.topology.get_bondgraph#

molsysmt.topology.get_bondgraph(molecular_system, nodes_name='atom_index', selection='all', syntax='MolSysMT', to_form='networkx.Graph')[source]#

Building a bond graph from a molecular system.

Parameters:
  • molecular_system (molecular system) – Input system in any supported form.

  • nodes_name ({'atom_index'}, default 'atom_index') – Label to use for nodes; currently only atom indices are supported.

  • selection (str, list, tuple or numpy.ndarray, default 'all') – Atom selection (MolSysMT syntax or indices) used to build the graph.

  • syntax (str, default 'MolSysMT') – Selection syntax when selection is a string.

  • to_form ({'networkx.Graph'}, default 'networkx.Graph') – Output graph type.

Returns:

Graph where nodes represent atoms and edges represent bonds.

Return type:

networkx.Graph

Raises:

NotImplementedError – If nodes_name or to_form is not supported.

Notes

  • Bonds are taken from inner_bonded_atom_pairs at the atom level.

Examples

>>> import molsysmt as msm
>>> from molsysmt import systems
>>> G = msm.topology.get_bondgraph(systems['pentalanine']['pentalanine.prmtop'])
>>> G.number_of_nodes() > 0
True

Added in version 1.0.0.