rdtools.bond#
A module contains functions to manipulate bonds in a molecule.
- rdtools.bond.add_bond(mol: RWMol, bond: tuple[int, int], bond_type: BondType = rdkit.Chem.rdchem.BondType.SINGLE, update_properties: bool = True, inplace: bool = True) RWMol #
Add a bond to a molecule.
- Parameters:
mol (Chem.RWMol) – The molecule to be added.
bond (tuple[int, int]) – The atom index of the bond to be added.
bond_type (BondType, optional) – The bond type to be added. Defaults to
Chem.BondType.SINGLE
.update_properties (bool, optional) – Whether to update the properties of the molecule. Defaults to
True
.inplace (bool, optional) – Whether to modify the molecule in place. Defaults to
True
.
- Returns:
Chem.RWMol – The molecule with bonds added.
- rdtools.bond.add_bonds(mol: RWMol, bonds: list[tuple[int, int]], bond_types: list[BondType] | None = None, update_properties: bool = True, inplace: bool = True) RWMol #
Add bonds to a molecule.
- Parameters:
mol (Chem.RWMol) – The molecule to be added.
bonds (list[tuple[int, int]]) – The atom index of the bond to be added.
bond_types (Optional[list[BondType]], optional) – The bond type to be added. Defaults to
Chem.BondType.SINGLE
.update_properties (bool, optional) – Whether to update the properties of the molecule. Defaults to
True
.inplace (bool, optional) – Whether to modify the molecule in place. Defaults to
True
.
- Returns:
Chem.RWMol – The molecule with bonds added.
- rdtools.bond.decrement_bond_order(bond: Bond) None #
Decrement the bond order of a bond by one.
- Parameters:
bond (Chem.Bond) – The bond whose order is to be decremented.
- Raises:
ValueError – If bond order is negative.
- rdtools.bond.get_all_changing_bonds(rmol: Mol, pmol: Mol) tuple[list[tuple[int, int]], list[tuple[int, int]], list[tuple[int, int]]] #
Get all bonds changed in the reaction.
Both reactant and product complexes need to be atom-mapped.
- Parameters:
rmol (Chem.Mol) – the reactant complex.
pmol (Chem.Mol) – the product complex.
- Returns:
tuple[list[tuple[int, int]], list[tuple[int, int]], list[tuple[int, int]]] –
formed bonds: A list of length-2 tuples that contain the atom indexes of the bonded atoms.
broken bonds: A list of length-2 tuples that contain the atom indexes of the bonded atoms.
bonds with BO changed: A list of length-2 tuples that contain the atom indexes of the bonded atoms.
- rdtools.bond.get_atoms_in_bonds(bonds: list[tuple[int, int]], sorted: bool = False) list[int] #
Get unique atoms in a list of bonds.
- Parameters:
bonds (list[tuple[int, int]]) – A list of length-2 tuples that contain the atom indexes of the bonded atoms.
sorted (bool, optional) – Whether to sort the atom indexes. Defaults to
False
.
- Returns:
list[int] – A list of the atom indexes of the atoms in the bonds.
- rdtools.bond.get_bonds_as_tuples(mol: Mol) list[tuple[int, int]] #
Get the bonds of a molecule as a list of tuples.
- Parameters:
mol (Chem.Mol) – The molecule whose bonds are to be returned.
- Returns:
list[tuple[int, int]] – The bonds of the molecule as a list of tuples.
- rdtools.bond.get_bonds_with_BO_changed(rmol: Mol, pmol: Mol) list[tuple[int, int]] #
Get all bonds whose bond order is changed in the reaction.
Both reactant and product complexes need to be atom-mapped. The changed bonds are the bonds that are present in both the reactant and product complexes but have a different bond order.
- Parameters:
rmol (Chem.Mol) – the reactant complex.
pmol (Chem.Mol) – the product complex.
- Returns:
list[tuple[int, int]] – A list of length-2 tuples that contain the atom indexes of the bonded atoms.
- rdtools.bond.get_broken_bonds(rmol: Mol, pmol: Mol) list[tuple[int, int]] #
Get all bonds broken in the reaction.
Both reactant and product complexes need to be atom-mapped. The broken bonds are the bonds that are present in the reactant complex but not in the product complex.
- Parameters:
rmol (Chem.Mol) – the reactant complex.
pmol (Chem.Mol) – the product complex.
- Returns:
list[tuple[int, int]] – A list of length-2 tuples that contain the atom indexes of the bonded atoms.
- rdtools.bond.get_formed_and_broken_bonds(rmol: Mol, pmol: Mol) tuple[list[tuple[int, int]], list[tuple[int, int]]] #
Get all bonds broken in the reaction.
Both reactant and product complexes need to be atom-mapped. This function doesn’t count bonds whose bond order is lowered but not equal to zero.
- Parameters:
rmol (Chem.Mol) – the reactant complex.
pmol (Chem.Mol) – the product complex.
- Returns:
tuple[list[tuple[int, int]], list[tuple[int, int]]] –
formed bonds: A list of length-2 tuples that contain the atom indexes of the bonded atoms.
broken bonds: A list of length-2 tuples that contain the atom indexes of the bonded atoms.
- rdtools.bond.get_formed_bonds(rmol: Mol, pmol: Mol) list[tuple[int, int]] #
Get all bonds formed in the reaction.
Both reactant and product complexes need to be atom-mapped to get the correct atom indexes. The formed bonds are the bonds that are present in the product complex but not in the reactant complex.
- Parameters:
rmol (Chem.Mol) – the reactant complex.
pmol (Chem.Mol) – the product complex.
- Returns:
list[tuple[int, int]] – A list of length-2 tuples that contain the atom indexes of the bonded atoms.
- rdtools.bond.increment_bond_order(bond: Bond) None #
Increment the bond order of a bond by one.
- Parameters:
bond (Chem.Bond) – The bond whose order is to be incremented.