stk.Bond

class stk.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)})
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.

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

Return a clone holding different atoms.

with_ids

Return a clone holding different atom ids.

clone()[source]

Return a clone.

Returns:

The clone.

Return type:

Bond

get_atom1()[source]

Get the first atom of the bond.

Returns:

The first atom of the bond.

Return type:

Atom

get_atom2()[source]

Get the second atom of the bond.

Returns:

The second atom of the bond.

Return type:

Atom

get_order()[source]

Get the bond order of the bond.

Returns:

The bond order.

Return type:

int

get_periodicity()[source]

Get the periodicity of the bond.

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.

Return type:

tuple[int, int, int]

is_periodic()[source]

Return True if the bond is periodic.

Returns:

True if the bond is periodic.

Return type:

bool

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.

Returns:

The clone.

Return type:

Bond

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.

Returns:

The clone.

Return type:

Bond