Atoms
- class Atom(atom_id: int, atom_type: str, residue_id: int, residue_name: str, atom_name: str, charge_group_num: int, partial_charge: float, mass: float, x: float = 0.0, y: float = 0.0, z: float = 0.0, formerly=None)[source]
Bases:
objectRepresents an atom with its properties in a molecular system.
- Parameters:
atom_id (int) – The unique identifier of the atom.
atom_type (str) – The type of the atom, usually based on its element.
residue_id (int) – The unique identifier of the residue containing the atom.
residue_name (str) – The name of the residue containing the atom.
atom_name (str) – The name of the atom, often based on its position within the residue.
charge_group_num (int) – The charge group the atom belongs to.
partial_charge (float) – The partial charge of the atom.
mass (float) – The mass of the atom.
x (float, optional) – The Atom’s x position in 3D space, defaults to 0.0
y (float, optional) – The Atom’s y position in 3D space, defaults to 0.0
z (float, optional) – The Atom’s z position in 3D space, defaults to 0.0
formerly (int, optional) – The atom id of the atom this atom was before renumbering, defaults to None
- angle_neighbours() set[Atom][source]
Find neighbouring Atoms that this Atom produces Angles with.
- Returns:
set of Atoms that this Atom participates in Angles with.
- Return type:
set[Atom]
- bond_neighbours() set[Atom][source]
List all the atoms that this atom bonds with.
- Returns:
set of Atoms that this Atom is bonded to.
- Return type:
set[Atom]
- deduplicate_bonds()[source]
Remove any bonds from this atom that are duplicates. Used by Polymer.extend() to remove duplicated bonds after new ones are made during extension. The ‘extend’ function creates two new identical bonds between the existing polymer and incoming monomer, one from the polymer to the monomer and the other from the monomer to the polymer, but only one of them is needed.
- dihedral_neighbours() set[Atom][source]
Find neighbouring Atoms that this Atom produces Dihedrals with.
- Returns:
set of Atoms that this Atom participates in Dihedrals with.
- Return type:
set[Atom]
- property element: str
- classmethod from_dict(data) Atom[source]
Create a new Atom from a dictionary, such as that created with Atom.to_dict().
The structure of the dictionary is as below: {“atom_id”: self.atom_id, “atom_type”: self.atom_type, “residue_id”: self.residue_id, “residue_name”: self.residue_name, “atom_name”: self.atom_name, “charge_group_num”: self.charge_group_num, “partial_charge”: self.partial_charge, “mass”: self.mass, “x”: self.x, “y”: self.y, “z”: self.z} * Note that the “formerly” kew will only be present if it’s value is not None.
- Parameters:
data (dict) – dictionary containing data to make an Atom, generate with ‘to_dict()’.
- Returns:
a new Atom
- Return type:
Atom
- classmethod from_line(line: str) Atom[source]
Class method to construct Atom from the line of an ITP file
- Parameters:
line (str) – the ITP file line
- Returns:
the new Atom
- Return type:
Atom
- property is_virtual: bool
Check if atom is ‘virtual’ or a dummy.
- Returns:
True if Atom’s atom_type is ‘X’, but False otherwise
- Return type:
- remove()[source]
Delete self from all related Bonds, Pairs and Exclusions. Used to cleanup and remove attributes during Polymer.extend().
- to_dict() dict[source]
Convert this Atom to a dictionary representation.
The structure of the dictionary is as below: {“atom_id”: self.atom_id, “atom_type”: self.atom_type, “residue_id”: self.residue_id, “residue_name”: self.residue_name, “atom_name”: self.atom_name, “charge_group_num”: self.charge_group_num, “partial_charge”: self.partial_charge, “mass”: self.mass, “x”: self.x, “y”: self.y, “z”: self.z} * Note that the self.formerly attribute will only be included with a “formerly” key if the attribute is not None.
- Returns:
a dictionary containing the attributes of this Atom.
- Return type: