molecupy.structures.atoms
(Atoms)¶
This module contains classes for atoms and their bonds.
-
class
molecupy.structures.atoms.
GhostAtom
(element, atom_id, atom_name)[source]¶ This class represents atoms with no location. It is a ‘ghost’ in the sense that it is accounted for in terms of its mass, but it is ‘not really there’ because it has no location and cannot form bonds.
The reason for the distinction between ghost atoms and ‘real’ atoms comes from PDB files, where often not all the atoms in the studied molecule can be located in the (for example) electron density data and so there are no coordinates for them. They do ‘exist’ but they are missing from the PDB file coordinates.
They are described in terms of an Atom ID, an Atom name, and an element. They have mass but no location, and they can still be associated with molecules and models.
Parameters: - element (str) – The atom’s element.
- atom_id (int) – The atom’s id.
- atom_name (str) – The atom’s name.
-
element
(element=None)[source]¶ Returns or sets the atom’s element.
Parameters: element (str) – If given, the atom’s element will be set to this. Return type: str
-
atom_name
(atom_name=None)[source]¶ Returns or sets the atom’s name.
Parameters: name (str) – If given, the atom’s name will be set to this. Return type: str
-
molecule
()[source]¶ Returns the
SmallMolecule
orResidue
the atom is a part of.
-
class
molecupy.structures.atoms.
Atom
(x, y, z, *args)[source]¶ Base class:
GhostAtom
Represents standard atoms which have Cartesian coordinates, and which can form bonds with other atoms.
They are distinguished from
GhostAtom
objects because they have a location in three dimensional space, though they inherit some properties from that more generic class of atom.Parameters: - x (float) – The atom’s x-coordinate.
- y (float) – The atom’s y-coordinate.
- z (float) – The atom’s z-coordinate.
- element (str) – The atom’s element.
- atom_id (int) – The atom’s id.
- atom_name (str) – The atom’s name.
-
x
(x=None)[source]¶ Returns or sets the atom’s x coordinate.
Parameters: x (float) – If given, the atom’s x coordinate will be set to this. Return type: float
-
y
(y=None)[source]¶ Returns or sets the atom’s y coordinate.
Parameters: y (float) – If given, the atom’s y coordinate will be set to this. Return type: float
-
z
(z=None)[source]¶ Returns or sets the atom’s z coordinate.
Parameters: z (float) – If given, the atom’s z coordinate will be set to this. Return type: float
-
distance_to
(other_atom)[source]¶ Returns the distance between this atom and another, in Angstroms. Alternatively, an
AtomicStructure
can be provided and the method will return the distance between this atom and that structure’s center of mass.Parameters: other_atom – The other atom or atomic structure. Return type: float
-
bond_to
(other_atom)[source]¶ Creates a
Bond
between this atom and another.Parameters: other_atom (Atom) – The other atom.
-
get_bond_with
(other_atom)[source]¶ Returns the specific
Bond
between this atom and some other atom, if it exists.Parameters: other_atom (Atom) – The other atom. Return type: Bond
-
break_bond_with
(other_atom)[source]¶ Removes the specific
Bond
between this atom and some other atom, if it exists.Parameters: other_atom (Atom) – The other atom.