Add missing bonds#

Inferring and adding missing covalent bonds based on interatomic distances and chemical element types.

The function molsysmt.build.add_missing_bonds() adds the candidates returned by molsysmt.build.get_missing_bonds() using group templates and distance criteria. It does not certify valence or complete chemistry and does not assign bond orders. Review candidates before reconstructing connectivity in a coordinate-only input.

Peptide candidates require consecutive source group indices in one defined chain. Selecting separated groups does not create adjacency. Integer selections refer to source atom indices; both endpoints of an added pair must be selected. Existing declared edges are preserved, including edges outside these inference criteria. Use in_place=False to prepare a copy while leaving the source unchanged.

Added in version 1.0.0.

Basic usage#

Let’s show how this function works using an alanine dipeptide system:

import molsysmt as msm
molsys = msm.systems['alanine dipeptide']['alanine_dipeptide.h5msm']
molsys = msm.convert(molsys)

To demonstrate molsysmt.build.add_missing_bonds(), we first save the original list of bonded_atom_pairs and remove all existing covalent bonds from the molecular system to simulate a topology lacking bond definitions:

bonded_atom_pairs = msm.get(molsys, bonded_atom_pairs=True)
molsys.topology.remove_bonds()

Let’s verify that the system currently has zero covalent bonds:

msm.get(molsys, n_bonds=True)
0

We now call molsysmt.build.add_missing_bonds() to automatically infer covalent bonds based on interatomic distances and element types:

msm.build.add_missing_bonds(molsys)

Finally, let’s verify that the total number of bonds was restored and check if the newly inferred bonded atom pairs match the original topology:

msm.get(molsys, n_bonds=True)
21
new_bonded_atom_pairs = msm.get(molsys, bonded_atom_pairs=True)
new_bonded_atom_pairs == bonded_atom_pairs
True