Bond

class Bond(atom1, atom2, order, periodicity=(0, 0, 0))[source]

Bases: object

Represents an atomic bond.

Examples

Changing the Atoms of a Bond

You want to substitute the atoms in the bond for other atoms. You can do this by using with_atoms() to create a clone of the bond, which holds the replacement atoms

import stk
bond = stk.Bond(stk.C(0), stk.C(12), 2)
# Replace C(0) with H(13) but keep C(12).
clone = bond.with_atoms({0: stk.H(13)})

Methods

clone()

Return a clone.

get_atom1()

Get the first atom of the bond.

get_atom2()

Get the second atom of the bond.

get_order()

Get the bond order of the bond.

get_periodicity()

Get the periodicity of the bond.

is_periodic()

Return True if the bond is periodic.

with_atoms(atom_map)

Return a clone holding different atoms.

with_ids(id_map)

Return a clone holding different atom ids.

__init__(atom1, atom2, order, periodicity=(0, 0, 0))[source]

Initialize a Bond.

Parameters
  • atom1 (Atom) – The first atom in the bond.

  • atom2 (Atom) – The second atom in the bond.

  • order (int) – The bond order.

  • periodicity (tuple[int, int, int]) – The directions across which the bond is periodic. For example, (1, 0, -1) means that when going from atom1 to atom2 the bond is periodic across the x axis in the positive direction, is not periodic across the y axis and is periodic across the z axis in the negative direction.

clone()[source]

Return a clone.

Return type

Bond

Returns

The clone.

get_atom1()[source]

Get the first atom of the bond.

Return type

Atom

Returns

The first atom of the bond.

get_atom2()[source]

Get the second atom of the bond.

Return type

Atom

Returns

The second atom of the bond.

get_order()[source]

Get the bond order of the bond.

Return type

int

Returns

The bond order.

get_periodicity()[source]

Get the periodicity of the bond.

Return type

tuple[int, int, int]

Returns

The directions across which the bond is periodic. For example, (1, 0, -1) means that when going from atom1 to atom2 the bond is periodic across the x axis in the positive direction, is not periodic across the y axis and is periodic across the z axis in the negative direction.

is_periodic()[source]

Return True if the bond is periodic.

Return type

bool

Returns

True if the bond is periodic.

with_atoms(atom_map)[source]

Return a clone holding different atoms.

Parameters

atom_map (dict[int, Atom]) – Maps the id of an atom in the bond to the new atom the clone should hold. If the id of an atom in the bond is not found in atom_map, the atom will not be replaced in the clone.

Return type

Bond

Returns

The clone.

with_ids(id_map)[source]

Return a clone holding different atom ids.

Parameters

id_map (dict[int, int]) – Maps the id of an atom in the bond to the new id the clone should hold. If the id of an atom in the bond is not found in id_map, the atom id will not be replaced in the clone.

Return type

Bond

Returns

The clone.