Skip to content

atom

Classes:

Atom

Atom(name, atom_type, charge=0, use_general_type=False)

Methods:

  • eq

    Check if the atoms are of the same type and have a charge within the given absolute tolerance.

  • united_eq

    Like .eq, but treat the atoms as united atoms.

Attributes:

  • united_charge

    United atom charge: summed charges of this atom and the bonded hydrogens.

Source code in ties/bb/atom.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
def __init__(self, name, atom_type, charge=0, use_general_type=False):
    self._original_name = None

    self._id = None
    self.name = name
    self._original_name = name.upper()
    self.type = atom_type

    self._resname = None
    self.charge = charge
    self._original_charge = charge

    self.resid = None
    self.bonds: Bonds = Bonds()
    self.use_general_type = use_general_type
    self.hash_value = None

    self._unique_counter = Atom.counter
    Atom.counter += 1

united_charge property

united_charge

United atom charge: summed charges of this atom and the bonded hydrogens.

eq

eq(atom, atol=0)

Check if the atoms are of the same type and have a charge within the given absolute tolerance.

Source code in ties/bb/atom.py
146
147
148
149
150
151
152
153
def eq(self, atom, atol=0):
    """
    Check if the atoms are of the same type and have a charge within the given absolute tolerance.
    """
    if self.type == atom.type and np.isclose(self.charge, atom.charge, atol=atol):
        return True

    return False

united_eq

united_eq(atom, atol=0)

Like .eq, but treat the atoms as united atoms. Check if the atoms have the same atom type, and if if their charges are within the absolute tolerance. If the atoms have hydrogens, add up the attached hydrogens and use a united atom representation.

Source code in ties/bb/atom.py
155
156
157
158
159
160
161
162
163
164
165
166
167
168
def united_eq(self, atom, atol=0):
    """
    Like .eq, but treat the atoms as united atoms.
    Check if the atoms have the same atom type, and
    if if their charges are within the absolute tolerance.
    If the atoms have hydrogens, add up the attached hydrogens and use a united atom representation.
    """
    if self.type != atom.type:
        return False

    if not np.isclose(self.united_charge, atom.united_charge, atol=atol):
        return False

    return True