pywindow.Molecule¶
- class pywindow.Molecule(mol, system_name, mol_id)[source]¶
Bases:
objectContainer for a single molecule.
This class is meant for the analysis of single molecules, molecular pores especially. The object passed to this class should therefore be a finite and interconnected individuum.
This class should not be initialised directly, but result from
MolecularSystem.system_to_molecule()orMolecularSystem.make_modular().Methods in
Moleculeallow to calculate:The maximum diameter of a molecule.
The average diameter of a molecule.
The intrinsic void diameter of a molecule.
The intrinsic void volume of a molecule.
The optimised intrinsic void diameter of a molecule.
The optimised intrinsic void volume of a molecule.
The circular diameter of a window of a molecule.
- mol¶
dictTheMolecular.System.systemdictionary passed to theMoleculewhich is esentially a container of the information that compose a molecular entity, such as the coordinates and atom ids and/or elements.
- elements¶
numpy.arrayAn array containing the elements, as strings, composing the molecule.
- atom_ids¶
numpy.array(conditional) If theMolecule.molcontains ‘atom_ids’ keyword, the force field ids of the elements.
- coordinates¶
numpy.arrayThe x, y and z atomic Cartesian coordinates of all elements.
- parent_system¶
strThenameofMolecularSystempassed toMolecule.
Methods
Return the average diamension of a molecule.
Return the xyz coordinates of the centre of mass of a molecule.
Return the maximum diamension of a molecule.
Return the intrinsic pore diameter.
Return the intrinsic pore diameter (for the optimised pore centre).
Return the intrinsic pore volume.
Return the intrinsic pore volume (for the optimised pore centre).
Return the diameters of all windows in a molecule.
Dump a
Moleculeto a file (PDB or XYZ).Dump content of
Molecule.propertiesto a JSON dictionary.Perform a full structural analysis of a molecule.
Create a
Moleculefromrdkit.Chem.rdchem.Mol.Return the molecular weight of a molecule.
Shift a molecule to Origin.
- classmethod load_rdkit_mol(mol, system_name='rdkit', mol_id=0)[source]¶
Create a
Moleculefromrdkit.Chem.rdchem.Mol.To be used only by expert users.
- Parameters:
- Returns:
- Return type:
- calculate_average_diameter()[source]¶
Return the average diamension of a molecule.
- Returns:
The average dimension of the molecule.
- Return type:
- calculate_centre_of_mass()[source]¶
Return the xyz coordinates of the centre of mass of a molecule.
- Returns:
The centre of mass of the molecule.
- Return type:
ndarray
- calculate_maximum_diameter()[source]¶
Return the maximum diamension of a molecule.
- Returns:
The maximum dimension of the molecule.
- Return type:
- calculate_pore_diameter()[source]¶
Return the intrinsic pore diameter.
- Returns:
The intrinsic pore diameter.
- Return type:
- calculate_pore_diameter_opt()[source]¶
Return the intrinsic pore diameter (for the optimised pore centre).
Similarly to
calculate_pore_diameter()this method returns the the intrinsic pore diameter, however, first a better approximation of the pore centre is found with optimisation.- Returns:
The intrinsic pore diameter.
- Return type:
- calculate_pore_volume()[source]¶
Return the intrinsic pore volume.
- Returns:
The intrinsic pore volume.
- Return type:
- calculate_pore_volume_opt()[source]¶
Return the intrinsic pore volume (for the optimised pore centre).
Similarly to
calculate_pore_volume()this method returns the the volume intrinsic pore diameter, however, for thecalculate_pore_diameter_opt()returned value.- Returns:
The intrinsic pore volume.
- Return type:
- calculate_windows(ncpus=1)[source]¶
Return the diameters of all windows in a molecule.
This function first finds and then measures the diameters of all the window in the molecule.
- Returns:
An array of windows’ diameters. Or, None, ff no windows were found.
- Parameters:
ncpus (int)
- Return type:
ndarray | None
- dump_molecule(filepath=None, include_coms=False, override=False)[source]¶
Dump a
Moleculeto a file (PDB or XYZ).For validation purposes an overlay of window centres and COMs can also be dumped as:
He - for the centre of mass
Ne - for the centre of the optimised cavity
Ar - for the centres of each found window
- Parameters:
filepath (Path | str | None) – The filepath for the dumped file. If
None, the file is dumped locally withmolecule_idas filename. (default=None)include_coms (bool) – If True, dump also with an overlay of window centres and COMs. (default=False)
override (bool) – If True, any file in the filepath will be override. (default=False)
- Return type:
None
- dump_properties_json(filepath=None, molecular=False, override=False)[source]¶
Dump content of
Molecule.propertiesto a JSON dictionary.- Parameters:
filepath (Path | str | None) – The filepath for the dumped file. If
None, the file is dumped localy withmolecule_idas filename. (defualt=None)molecular (bool) – If False, dump only the content of
Molecule.properties, if True, dump all the information aboutMolecule.override (bool) – If True, any file in the filepath will be override. (default=False)
- Return type:
None
- full_analysis(ncpus=1)[source]¶
Perform a full structural analysis of a molecule.
This invokes other methods:
- Parameters:
ncpus (int) –
intNumber of CPUs used for the parallelised parts ofpywindow.utilities.find_windows(). (default=1=serial)- Returns:
Molecule.propertiesThe updated
Molecule.propertieswith returns of all used methods.
- Return type: