biotite.structure.connect_via_distances(atoms, distance_range=None, atom_mask=None, inter_residue=True, default_bond_type=BondType.ANY, periodic=False)[source]

Create a BondList for a given atom array, based on pairwise atom distances.

A BondType.ANY, bond is created for two atoms within the same residue, if the distance between them is within the expected bond distance range. Bonds between two adjacent residues are created for the atoms expected to connect these residues, i.e. 'C' and 'N' for peptides and "O3'" and 'P' for nucleotides.


The structure to create the BondList for.

distance_rangedict of tuple(str, str) -> tuple(float, float), optional

Custom minimum and maximum bond distances. The dictionary keys are tuples of chemical elements representing the atoms to be potentially bonded. The order of elements within each tuple does not matter. The dictionary values are the minimum and maximum bond distance, respectively, for the given combination of elements. This parameter updates the default dictionary. Hence, the default bond distances for missing element pairs are still taken from the default dictionary. The default bond distances are taken from [1].

atom_maskndarray, dtype=bool, shape=(n,), optional

DEPRECATED: This option has no effect.

inter_residuebool, optional

If true, connections between consecutive amino acids and nucleotides are also added.

default_bond_typeBondType or int, optional

By default, all created bonds have BondType.ANY. An alternative BondType can be given in this parameter.

periodicbool, optional

If set to true, bonds can also be detected in periodic boundary conditions. The box attribute of atoms is required in this case.


The created bond list.


This method might miss bonds, if the bond distance is unexpectedly high or low, or it might create false bonds, if two atoms within a residue are accidentally in the right distance. A more accurate method for determining bonds is connect_via_residue_names().