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) – Molecular system in any supported MolSysMT format.

  • nodes_name (str, default='atom_index') – Atom attribute used to label graph nodes.

  • selection (str, list, tuple, or numpy.ndarray, default='all') – Selection string or boolean/integer array specifying elements.

  • syntax (str, default='MolSysMT') – Selection syntax used to evaluate selection (e.g., ‘MolSysMT’, ‘MDTraj’).

  • to_form (str, default='networkx.Graph') – Graph form to return; only ‘networkx.Graph’ is currently implemented.

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
>>> from molsysmt.topology.get_bondgraph import get_bondgraph
>>> G = get_bondgraph(systems['pentalanine']['pentalanine.prmtop'])
>>> G.number_of_nodes() > 0
True

Added in version 1.0.0.