Atom class

class AaronTools.atoms.Atom(element='', coords=None, flag=False, name='', tags=None, charge=None, mass=None)

Attributes:

  • element str

  • coords np.array(float)

  • flag bool true if frozen, false if relaxed

  • name str form of d+(.d+)*

  • tags set

  • charge float

  • connected set(Atom)

  • constraint set(Atom) for determining constrained bonds

  • _rank

  • _radii float for calculating if bonded

  • _connectivity int max connections without hypervalence

  • _saturation int max connections without hypervalence or charges

__init__(element='', coords=None, flag=False, name='', tags=None, charge=None, mass=None)
Parameters:
  • element (str) – element symbol

  • coords (np.ndarray) – position

  • flag (bool) – whether atom is frozen

  • name (str) – atom name

  • tags (list) – misc. data

  • charge (float) – partial charge of atom

  • mass (float) – mass of atom

property is_dummy

returns True if the element is a dummy, False otherwise

classmethod element_is_dummy(element)

returns True if the element is a dummy, False otherwise This checks the dummy option in the AtomTypes group in config files

get_invariant()

gets initial invariant, which is formulated using:

  1. number of non-hydrogen connections (d{1}): nconn

  2. sum of bond order of non-hydrogen bonds * 10 (d{2}): nB

  3. atomic number (d{3}): z

  4. sign of charge (d{1}) (not used)

  5. absolute charge (d{1}) (not used)

  6. number of attached hydrogens (d{1}): nH

get_neighbor_id()

gets initial invariant based on self’s element and the element of the atoms connected to self

copy()

creates and returns a copy of self

is_connected(other, tolerance=None)

determines if distance between atoms is small enough to be bonded same as dist_is_connected but automatically calculates the distance between the atoms

Parameters:

tolerance (float) – buffer for consideration of what is “small enough”; default is 0.3. Cutoff for what constitutes small enough is the sum of the atoms’ radii and the tolerance value

Returns:

True if distance is small enough to be bonded, False otherwise

Return type:

boolean

dist_is_connected(other, dist_to_other, tolerance)

determines if distance between atoms is small enough to be bonded. Used to optimize connected checks when distances can be quickly precalculated, like with scipy.spatial.distance_matrix

Parameters:
  • other (Atom) – atom to measure the distance between

  • tolerance (float) – buffer for consideration of what is “small enough”; default is 0.3. Cutoff for what constitutes small enough is the sum of the atoms’ radii and the tolerance value

  • dist_to_other (float) – distance between the atoms in Angstroms

Returns:

True if distance is small enough to be bonded, False otherwise

Return type:

boolean

add_bond_to(other)

add self and other to eachother’s connected attribute

bond(other)

retrieves bond vectors

Returns:

the vector self–>other

Return type:

np.array

dist(other)

retrieves distance between Atoms

Returns:

the distance between self and other

Return type:

float

angle(a1, a3)

determines angle between three Atoms

Returns:

the a1-self-a3 angle

Return type:

float

property mass

retrieves mass of an Atom

Returns:

atomic mass

Return type:

float

classmethod get_shape(shape_name)

returns dummy atoms in an idealized vsepr geometry

shape_name can be:

  • point

  • linear 1

  • linear 2

  • bent 2 tetrahedral

  • bent 2 planar

  • trigonal planar

  • bent 3 tetrahedral

  • t shaped

  • tetrahedral

  • sawhorse

  • seesaw

  • square planar

  • trigonal pyramidal

  • trigonal bipyramidal

  • square pyramidal

  • pentagonal

  • hexagonal

  • trigonal prismatic

  • pentagonal pyramidal

  • octahedral

  • capped octahedral

  • hexagonal pyramidal

  • pentagonal bipyramidal

  • capped trigonal prismatic

  • heptagonal

  • hexagonal bipyramidal

  • heptagonal pyramidal

  • octagonal

  • square antiprismatic

  • trigonal dodecahedral

  • capped cube

  • biaugmented trigonal prismatic

  • cubic

  • elongated trigonal bipyramidal

  • capped square antiprismatic

  • enneagonal

  • heptagonal bipyramidal

  • hula-hoop

  • triangular cupola

  • tridiminished icosahedral

  • muffin

  • octagonal pyramidal

  • tricapped trigonal prismatic

classmethod linear_shape()

returns a list of 3 dummy atoms in a linear shape

classmethod trigonal_planar_shape()

returns a list of 4 dummy atoms in a trigonal planar shape

classmethod tetrahedral_shape()

returns a list of 5 dummy atoms in a tetrahedral shape

classmethod trigonal_bipyramidal_shape()

returns a list of 6 dummy atoms in a trigonal bipyramidal shape

classmethod octahedral_shape()

returns a list of 7 dummy atoms in an octahedral shape

classmethod trigonal_prismatic_shape()

returns a list of 7 dummy atoms in a trigonal prismatic shape

classmethod capped_octahedral_shape()

returns a list of 8 dummy atoms in a capped ocrahedral shape

classmethod capped_trigonal_prismatic_shape()

returns a list of 8 dummy atoms in a capped trigonal prismatic shape

classmethod pentagonal_bipyramidal_shape()

returns a list of 8 dummy atoms in a pentagonal bipyramidal shape

classmethod biaugmented_trigonal_prismatic_shape()

returns a list of 9 dummy atoms in a biaugmented trigonal prismatic shape

classmethod cubic_shape()

returns a list of 9 dummy atoms in a cubic shape

classmethod elongated_trigonal_bipyramidal_shape()

returns a list of 9 dummy atoms in an elongated trigonal bipyramidal shape

classmethod hexagonal_bipyramidal_shape()

returns a list of 9 dummy atoms in a hexagonal bipyramidal shape

classmethod square_antiprismatic_shape()

returns a list of 9 dummy atoms in a square antiprismatic shape

classmethod trigonal_dodecahedral_shape()

returns a list of 9 dummy atoms in a trigonal dodecahedral shape

classmethod heptagonal_bipyramidal_shape()

returns a list of 10 dummy atoms in a heptagonal bipyramidal shape

classmethod capped_cube_shape()

returns a list of 10 dummy atoms in a capped cube shape

classmethod capped_square_antiprismatic_shape()

returns a list of 10 dummy atoms in a capped square antiprismatic shape

classmethod enneagonal_shape()

returns a list of 10 dummy atoms in an enneagonal shape

classmethod hula_hoop_shape()

returns a list of 10 dummy atoms in a hula hoop shape

classmethod triangular_cupola_shape()

returns a list of 10 dummy atoms in a triangular cupola shape

classmethod tridiminished_icosahedral_shape()

returns a list of 10 dummy atoms in a tridiminished icosahedral shape

classmethod muffin_shape()

returns a list of 10 dummy atoms in a muffin shape

classmethod octagonal_pyramidal_shape()

returns a list of 10 dummy atoms in an octagonal pyramidal shape

classmethod tricapped_trigonal_prismatic_shape()

returns a list of 10 dummy atoms in a tricapped trigonal prismatic shape

static new_shape(old_shape, new_connectivity, bond_change)

returns the name of the expected vsepr geometry when the number of bonds changes by +/- 1

Parameters:
  • old_shape (str) – vsepr geometry name

  • new_connectivity (int) – connectivity (see Atom._connectivity)

  • bond_change (int) – +1 or -1, indicating that the number of bonds is changing by 1

get_vsepr()

determine vsepr geometry around an atom

Returns:

  • shape, score:

    as a string and the score assigned to that shape

  • None:

    if self has > 6 bonds

scores > 0.5 are generally questionable

see atom.get_shape for a list of shapes

draw_atom(ax, fp=40, ascale=0.5, linewidth=0.1)

Draw HoukMol style atom and add to Matplotlib axis ax

Parameters:
  • ax (matplotlib.pyplot.Axis) – Matplotlib axis object

  • fp (float) – z-value for focal point to add simple perspective (Default: 40)

  • ascale (float) – scaling factor for covalent radii (Default: 0.5)

  • linewidth (float) – linewidth (in points) for atom details (default: 0.1)