Skip to content

Bonding

get_molecule_ids(bonds, n_atoms)

Deterministic molecule IDs based on covalent bonding. IDs are assigned based on the following rules:

  • The largest molecules get the lowest IDs.
  • Tie breakers for atoms with the same number of atoms is done by the lowest atom index contained within the molecule getting lower IDs.
PARAMETER DESCRIPTION

bonds

A 2D numpy array where each row represents a bond [atom_index_0, atom_index_1].

TYPE: NDArray[uint64]

RETURNS DESCRIPTION

A 1D numpy array where each element at index i is the deterministic id_molecule for atom i.