Builder.add()

Add an atom.

Usage

Source

Builder.add(
    symbol,
    parent=None,
    slot=None,
    *,
    toward=None,
    length=None,
)

Parameters

symbol: str

Atomic symbol.

parent: int | None = None

Atom to bond to. Must be None for the first atom, which goes at the origin.

slot: int | None = None

Slot of parent to bond through. If neither this nor toward is given, use the first empty slot.

toward: ArrayLike | None = None

Direction to bond in. The empty slot of parent closest to this direction is used.

length: float | None = None
Bond length. Defaults to xh_length for bonds to hydrogen and xy_length otherwise.

Returns

int
Index of the new atom.

Raises

ValueError
If the parent, slot, or position is invalid.