chemistry_tools.pubchem.atom

Attention

This package has the following additional requirements:

cawdrey>=0.1.7
mathematical>=0.1.13
pillow>=7.0.0
pyparsing>=2.4.6
tabulate>=0.8.9

These can be installed as follows:

python -m pip install chemistry-tools[pubchem]

Represents an atom in a Compound.

Classes:

Atom(aid, number[, x, y, z, charge])

Class to represent an atom in a Compound.

Functions:

parse_atoms(atoms_dict[, coords_dict])

Parse atoms from the given dictionary.

class Atom(aid, number, x=None, y=None, z=None, charge=0)[source]

Bases: object

Class to represent an atom in a Compound.

Parameters
  • aid (int) – The Atom ID within the owning Compound.

  • number (int) – The Atomic number for this atom.

  • x (Optional[float]) – The x coordinate for this atom. Default None.

  • y (Optional[float]) – The y coordinate for this atom. Default None.

  • z (Optional[float]) – The z coordinate for this atom. Will be None in 2D Compound records. Default None.

  • charge (int) – Formal charge on atom. Default 0.

Methods:

__eq__(other)

Return self == other.

__repr__()

Return a string representation of the Atom.

set_coordinates(x, y[, z])

Set all coordinate dimensions at once.

to_dict()

Return a dictionary containing Atom data.

Attributes:

coordinate_type

Returns whether this atom has 2D or 3D coordinates.

element

The element symbol for this atom.

__eq__(other)[source]

Return self == other.

Return type

bool

__repr__()[source]

Return a string representation of the Atom.

Return type

str

property coordinate_type

Returns whether this atom has 2D or 3D coordinates.

Return type

str

property element

The element symbol for this atom.

Return type

str

set_coordinates(x, y, z=None)[source]

Set all coordinate dimensions at once.

to_dict()[source]

Return a dictionary containing Atom data.

Return type

Dict[str, Any]

parse_atoms(atoms_dict, coords_dict=None)[source]

Parse atoms from the given dictionary.

Parameters
Return type

Dict[FrozenSet[int], Atom]