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 atomsimport 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 the first atom of the bond.
Get the second atom of the bond.
Get the bond order of the bond.
Get the periodicity of the bond.
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.
- get_atom1()[source]
Get the first atom of the bond.
- Return type:
- Returns:
The first atom of the bond.
- get_atom2()[source]
Get the second atom of the bond.
- Return type:
- Returns:
The second atom of the bond.
- get_periodicity()[source]
Get the periodicity of the bond.
- Return type:
- 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:
- Returns:
True
if the bond is periodic.