Skip to content

Info

Information(parent_molecule_object)

A class for storing and accessing information about the elements of a pymolecule.Molecule object

Initializes the pymolecule.Information class.

PARAMETER DESCRIPTION
parent_molecule_object

The pymolecule.Molecule object associated with this class.

atom_information = None instance-attribute

bonds = None instance-attribute

constants: dict[str, Any] = {} instance-attribute

coordinates = None instance-attribute

coordinates_undo_point = None instance-attribute

filename = '' instance-attribute

hierarchy = {} instance-attribute

parent_molecule = parent_molecule_object instance-attribute

remarks = [] instance-attribute

assign_elements_from_atom_names(selection=None)

Determines the elements of all atoms from the atom names. Note that this will overwrite any existing element assignments, including those explicitly specified in loaded files. Note that this doesn't populate elements_stripped.

PARAMETER DESCRIPTION
selection

An optional np.array containing the indices of the atoms to consider when calculating the center of mass. If ommitted, all atoms of the pymolecule.Molecule object will be considered.

DEFAULT: None

assign_masses()

Assigns masses to the atoms of the pymolecule.Molecule object.

belongs_to_dna(atom_index)

Checks if the atom is part of DNA.

PARAMETER DESCRIPTION
atom_index

An int, the index of the atom to consider.

RETURNS DESCRIPTION

A boolean. True if part of dna, False if not.

belongs_to_protein(atom_index)

Checks if the atom is part of a protein. Taken primarily from Amber residue names.

PARAMETER DESCRIPTION
atom_index

An int, the index of the atom to consider.

RETURNS DESCRIPTION

A boolean. True if part of protein, False if not.

belongs_to_rna(atom_index)

Checks if the atom is part of RNA.

PARAMETER DESCRIPTION
atom_index

An int, the index of the atom to consider.

RETURNS DESCRIPTION

A boolean. True if part of rna, False if not.

bounding_box(selection=None, padding=0.0)

Calculates a box that bounds (encompasses) a set of atoms.

PARAMETER DESCRIPTION
selection

An optional np.array containing the indices of the atoms to consider. If ommitted, all atoms of the pymolecule.Molecule object will be considered.

DEFAULT: None

padding

An optional float. The bounding box will extend this many angstroms beyond the atoms being considered.

DEFAULT: 0.0

RETURNS DESCRIPTION

A numpy array representing two 3D points, (min_x, max_x, min_y) and (max_y, min_z, max_z), that bound the molecule.

bounding_sphere(selection=None, padding=0.0)

Calculates a sphere that bounds (encompasses) a set of atoms. (Note that this is not necessarily the sphere with the smallest radius.)

PARAMETER DESCRIPTION
selection

An optional np.array containing the indices of the atoms to consider. If ommitted, all atoms of the pymolecule.Molecule object will be considered.

DEFAULT: None

padding

An optional float. The bounding sphere will extend this many angstroms beyond the atoms being considered.

DEFAULT: 0.0

RETURNS DESCRIPTION

A tuple containing two elements. The first is a np.array representing a 3D point, the (x, y, z) center of the sphere. The second is a float, the radius of the sphere.

center_of_mass(selection=None)

Determines the center of mass.

PARAMETER DESCRIPTION
selection

An optional np.array containing the indices of the atoms to consider when calculating the center of mass. If ommitted, all atoms of the pymolecule.Molecule object will be considered.

DEFAULT: None

RETURNS DESCRIPTION

A np.array containing to the x, y, and z coordinates of the center of mass.

define_molecule_chain_residue_spherical_boundaries()

Identifies spheres that bound (encompass) the entire molecule, the chains, and the residues. This information is stored in pymolecule.Molecule.information.hierarchy.

geometric_center(selection=None)

Determines the geometric center.

PARAMETER DESCRIPTION
selection

An optional np.array containing the indices of the atoms to consider when calculating the geometric center. If ommitted, all atoms of the pymolecule.Molecule object will be considered.

DEFAULT: None

RETURNS DESCRIPTION

A np.array containing to the x, y, and z coordinates of the geometric center.

get_atom_information()

get_bounding_box(selection=None, padding=0.0)

Calculates a box that bounds (encompasses) a set of atoms.

selection -- An optional np.array containing the indices of the atoms to consider. If ommitted, all atoms of the Molecule object will be considered. padding -- An optional float. The bounding box will extend this many angstroms beyond the atoms being considered.

A numpy array representing two 3D points, (min_x, min_y, min_z) and (max_x, max_y, max_z), that bound the molecule.

get_constants()

get_coordinates()

hybridization(atom_index)

Attempts to determine the hybridization of an atom based on the angle between the atom and two of its neighbors. May not work for 5+ connectivity.

PARAMETER DESCRIPTION
atom_index

An int, the index of the atom whose hybridization is to be determined.

RETURNS DESCRIPTION

An int, where 3 corresponds to sp3 hybridization, 2 corresponds to sp2 hybridization, 1 corresponds to sp1 hybridization, and -1 means not enough information.

set_atom_information(atom_information)

set_coordinates(coordinates)

total_mass(selection=None)

Calculates the total atomic mass.

PARAMETER DESCRIPTION
selection

An optional np.array containing the indices of the atoms to consider when calculating the total mass. If ommitted, all atoms of the pymolecule.Molecule object will be considered.

DEFAULT: None

RETURNS DESCRIPTION

A double, the total mass.

total_number_of_atoms(selection=None)

Counts the number of atoms.

PARAMETER DESCRIPTION
selection

An optional np.array containing the indices of the atoms to count. If ommitted, all atoms of the pymolecule.Molecule object will be considered.

DEFAULT: None

RETURNS DESCRIPTION

An int, the total number of atoms.

total_number_of_heavy_atoms()

Counts the number of heavy atoms (i.e., atoms that are not hydrogens).

PARAMETER DESCRIPTION
selection

An optional np.array containing the indices of the atoms to count. If ommitted, all atoms of the pymolecule.Molecule object will be considered.

RETURNS DESCRIPTION

An int, the total number of heavy (non-hydrogen) atoms.