spindry.Molecule
- class spindry.Molecule(atoms, bonds, position_matrix)[source]
Bases:
objectMolecule to optimize.
- Parameters:
Methods
Yield the atoms in the molecule, ordered as input.
Yield the bonds in the molecule, ordered as input.
Return the centroid.
Return the number of atoms in the molecule.
Return a matrix holding the atomic positions.
Get connected graphs based on Molecule separated by bonds.
Return a displaced clone Molecule.
Return clone Molecule with new position matrix.
Write basic .pdb file of Molecule to path.
Write basic .xyz file content of Molecule.
Write basic .xyz file of Molecule to path.
Attributes
- get_atoms()[source]
Yield the atoms in the molecule, ordered as input.
- Return type:
abc.Iterable[Atom]
- get_bonds()[source]
Yield the bonds in the molecule, ordered as input.
- Return type:
abc.Iterable[Bond]
- get_centroid(atom_ids=None)[source]
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()[source]
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
- 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 Molecule 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)[source]
Write basic .pdb file of Molecule to path.
- Parameters:
path (str)
- Return type:
None
- write_xyz_file(path)[source]
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