SBBond#

This class describes a bond in a structural model.

A bond has links to two atoms: the left one and the right one. You can get these atoms as follows:

print(bond.leftAtom)
print(bond.rightAtom)

# get the atom opposite to the given one in a bond
print(bond.getOppositeAtom(bond.leftAtom))

You can also get some parameters of a bond, such as its type, length, or the middle point position:

print(bond.bondType)
print(bond.getLength())
print(bond.getMidPoint())

To construct a new bond you need to provide the left and the right atoms, and you can also specify the bond order (the default bond order is 1.0 corresponding to the single bond type):

Create a bond#
    bond = SBBond(atom1, atom2, SBQuantity.dimensionless(2.0))

# make the operation undoable
SAMSON.beginHolding("Add bond")

# hold the node for undo/redo
SAMSON.hold(bond)
# create the bond in SAMSON
bond.create()

structuralModel.addChild(bond)

# add the bond to a parent of one of the atoms
if atom1.getParent():
    atom1.getParent().addChild(bond)

# stop holding the undoable operation
SAMSON.endHolding()

See also

Building

SAMSON SDK: SBMStructuralModelNodeBond

class samson.SBBond(*args, **kwargs)#

Bases: SBStructuralNode

This class describes a bond in a structural model.

Overloaded function.

  1. __init__(self: samson.SBBond) -> None

Constructs a bond

  1. __init__(self: samson.SBBond, leftAtom: samson.SBAtom, rightAtom: samson.SBAtom, order: float = 1.0) -> None

Constructs a bond between atoms leftAtom and rightAtom and a specific bond order.

Parameters:
  • leftAtom (samson.SBAtom) – A first atom.

  • rightAtom (samson.SBAtom) – A second atom.

  • order (float, default=1.0) – The bond order.

  1. __init__(self: samson.SBBond, leftAtom: samson.SBAtom, rightAtom: samson.SBAtom, order: samson.SBQuantity.unitsSI) -> None

Constructs a bond between atoms leftAtom and rightAtom and a specific bond order.

Parameters:
  • leftAtom (samson.SBAtom) – A first atom.

  • rightAtom (samson.SBAtom) – A second atom.

  • order (samson.SBQuantity) – The bond order.

class BondType(self: samson.SBBond.BondType, value: int)#

Bases: pybind11_object

Members:

Undefined : The undefined bond type

Single : The single bond type

Double : The double bond type

Triple : The triple bond type

Amide : The amide bond type

Aromatic : The aromatic bond type

Dummy : The dummy bond type

Amide = <BondType.Amide: 4>#
Aromatic = <BondType.Aromatic: 5>#
Double = <BondType.Double: 2>#
Dummy = <BondType.Dummy: 6>#
Single = <BondType.Single: 1>#
Triple = <BondType.Triple: 3>#
Undefined = <BondType.Undefined: 0>#
property name#
property value#
clearCustomType(self: samson.SBBond) None#

Clears the bond’s custom type.

clearStatusBit(self: samson.SBBond) None#

Clears the bond’s status bit

getBondTypeAsString(self: samson.SBBond) str#

Returns the string representation of the type of the bond.

static getBondTypeString(bondType: samson.SBBond.BondType) str#

Returns the string corresponding to the bondType.

getDisplacement(self: samson.SBBond) samson.SBPhysicalVector3#

Gets the displacement used for display when multiple bond rendering is turned on.

getLength(self: samson.SBBond) samson.SBQuantity.unitsSI#

Gets the length of the bond.

getMidPoint(self: samson.SBBond) samson.SBPhysicalVector3#

Gets the mid point of the bond.

getOppositeAtom(self: samson.SBBond, atom: samson.SBAtom) samson.SBAtom#

Returns a pointer to the atom opposite to atom, when atom is either the left atom or the right atom of the bond. If the atom is not the left or right atom then it return None.

Parameters:

atom (samson.SBAtom) – An atom

Returns:

An atom opposite to atom in the bond

Return type:

samson.SBAtom

isAmideBond(self: samson.SBBond) bool#

Returns True if the bond is an amide bond, i.e. between a Nitrogen and a carbonyl Carbon: N-C=O.

isCarbonylBond(self: samson.SBBond) bool#

Returns True if the bond is a carbonyl bond (C=O).

isEsterBond(self: samson.SBBond) bool#

Returns True if the bond is an ester bond, i.e. between an Oxygen and a carbonyl Carbon: O-C=O.

isLinking(*args, **kwargs)#

Overloaded function.

  1. isLinking(self: samson.SBBond, elementType: samson.SBElement.ElementType) -> bool

Returns True if and only if at least one of the atoms that the bond links is of element type elementType.

  1. isLinking(self: samson.SBBond, nodeIndexer: samson.SBNodeIndexer) -> bool

Returns True if and only if either atom is in nodeIndexer, or descends from a node of nodeIndexer.

isPrimaryAmideBond(self: samson.SBBond) bool#

Returns True if the bond is a primary amide bond, i.e. an amid bond where the Nitrogen atom has exactly one non-Hydronen bond.

isSecondaryAmideBond(self: samson.SBBond) bool#

Returns True if the bond is a secondary amide bond, i.e. an amid bond where the Nitrogen atom has exactly two non-Hydronen bonds.

isTertiaryAmideBond(self: samson.SBBond) bool#

Returns True if the bond is a tertiary amide bond, i.e. an amid bond where the Nitrogen atom has exactly three non-Hydronen bonds.

Amide = <BondType.Amide: 4>#
Aromatic = <BondType.Aromatic: 5>#
Double = <BondType.Double: 2>#
Dummy = <BondType.Dummy: 6>#
Single = <BondType.Single: 1>#
Triple = <BondType.Triple: 3>#
Undefined = <BondType.Undefined: 0>#
property bondType#

The bond type.

property customType#

The bond’s custom type.

property hasCustomType#

Returns True when the bond’s custom type is set. A read-only property.

property hasStatusBit#

Returns True when the bond’s status bit is set. A read-only property.

property leftAtom#

Returns a pointer to the left atom.

property order#

The bond order.

property rightAtom#

Returns a pointer to the right atom.

property statusBit#

The bond’s status bit.