stk.Atom

class stk.Atom(id, atomic_number, charge=0)[source]

Bases: object

An abstract base class for atoms.

A subclass is made for each element. The name of each subclass is the periodic table symbol of that element.

Atoms of a particular element can be made with this class or with the subclass representing that element.

Examples

Initialization.

Initialization of an Atom can happen in one of two ways. The atom can be initialized through the Atom class or through the class representing the element.

import stk

# h0 is an instance of the H class.
h0 = stk.Atom(id=0, atomic_number=1)

# h1 is also an instance of the H class.
h1 = stk.H(id=1)

When the class corresponding to the element is used directly, the atomic_number is not provided. Here are a few more examples.

# Both he0 and he1 are instances of the He class.
he0 = stk.Atom(id=2, atomic_number=2)
he1 = stk.He(id=3)

# Both c0 and c1 are instances of the
# C class.
c0 = stk.Atom(id=4, atomic_number=6)
c1 = stk.C(id=5)

Initialize an Atom.

Parameters:
  • id (int) – The id of the atom.

  • atomic_number (int) – The atomic number.

  • charge (int) – The formal charge.

Methods

clone

Return a clone.

get_atomic_number

Get the atomic number of the atom.

get_charge

Get the charge of the atom.

get_id

Get the id of the atom.

with_id

Get a clone but with a different id.

clone()[source]

Return a clone.

Returns:

The clone.

Return type:

Atom

get_atomic_number()[source]

Get the atomic number of the atom.

Returns:

The atomic number.

Return type:

int

get_charge()[source]

Get the charge of the atom.

Returns:

The charge.

Return type:

int

get_id()[source]

Get the id of the atom.

Returns:

The id.

Return type:

int

with_id(id)[source]

Get a clone but with a different id.

Parameters:

id (int) – The id of the clone.

Returns:

A clone with a new id.

Return type:

Atom