spindry.SupraMolecule
- class spindry.SupraMolecule(atoms, bonds, position_matrix, cid=None, potential=None)[source]
Bases:
MoleculeRepresentation of a supramolecule containing atoms and positions.
- Parameters:
atoms (tuple[mch.Atom, ...]) –
iterableofAtomAtoms that define the molecule.bonds (tuple[mch.Bond, ...]) –
iterableofBondBonds between atoms that define the molecule.position_matrix (np.ndarray) –
numpy.ndarrayA(n, 3)matrix holding the position of every atom in theMolecule.cid (int | None) –
int, optional Conformer id of supramolecule.potential (float | None) –
float, optional Potential energy of Supramolecule.
Methods
Get conformer id.
Yields each molecular component.
Get potential energy.
Initialize a
Supramoleculeinstance from components.Return a displaced clone Molecule.
Return clone SupraMolecule with new position matrix.
Write basic .xyz file content of Molecule.
Attributes
- classmethod init_from_components(components, cid=None, potential=None)[source]
Initialize a
Supramoleculeinstance from components.
- get_centroid(atom_ids=None)
Return the centroid.
- Parameters:
atom_ids (tuple | set | None) –
iterableofint, optional The ids of atoms which are used to calculate the centroid. Can be a singleint, if a single atom is to be used, orNoneif all atoms are to be used.- Returns:
The centroid of atoms specified by atom_ids.
- Raises:
If atom_ids has a length of 0. –
- Return type:
- get_position_matrix()
Return a matrix holding the atomic positions.
- Returns:
The array has the shape
(n, 3). Each row holds the x, y and z coordinates of an atom.- Return type:
ndarray
- get_subunits(bond_pair_ids)
Get connected graphs based on Molecule separated by bonds.
- with_displacement(displacement)[source]
Return a displaced clone Molecule.
- Parameters:
displacement (ndarray) – The displacement vector to be applied.
- Return type:
- with_position_matrix(position_matrix)[source]
Return clone SupraMolecule with new position matrix.
- Parameters:
position_matrix (ndarray) – A position matrix of the clone. The shape of the matrix is
(n, 3).- Return type:
- write_pdb_file(path)
Write basic .pdb file of Molecule to path.
- Parameters:
path (str)
- Return type:
None
- write_xyz_file(path)
Write basic .xyz file of Molecule to path.
Connectivity is not maintained in this file type!
- Parameters:
path (str)
- Return type:
None
- position_matrix: np.ndarray