rdmc.conf#
-This module provides class and methods for dealing with RDKit Conformer.
--
-
- -class rdmc.conf.ConformerCluster(children: array, energies: array | None = None)# -
Bases:
-object
-
-
- -merge(clusters: list)# -
Merge the cluster with a list of clusters.
--
-
- Parameters: -
clusters (list) – A list of the ConformerCluster object to be merged in.
-
-
-
-
- -split_by_energies(decimals: int = 1, as_dict: bool = True)# -
Split the conformer by energies.
--
-
- Parameters: -
-
-
decimals (int, optional) – clustering children based on the number of digit -after the dot of the energy values. -For kcal/mol and J/mol, 0 or 1 is recommended; for -hartree, 3 or 4 is recommended. Defaults to
1
.
-as_dict (bool, optional) – If
True
, return a dict object whose keys are -energy values and values are divided ConformerCluster -object. Otherwise, return a list of ConformerClusters. -Defaults toTrue
.
-
-
-
-
- -class rdmc.conf.ConformerFilter(mol: RDKitMol)# -
Bases:
-object
-
-
- -property atom_maps# -
Store all possible atommappings of the given molecules. There are usually combinatory -explosion.
-
-
-
- -check_dihed_angle_diff(confs, threshold: float = 5.0, mask: ndarray | None = None, adjust_periodicity: bool = False, as_dict: bool = True, as_list_idx: bool = False)# -
The implementation of checking individual dihedral angle difference. This approach is also -implemented in the MSTor workflow.
--
-
- Parameters: -
-
-
confs (list) – A list of conformer IDs.
-threshold (float, optional) – The difference (in degree) used for filtering. Defaults to 5.
-mask (np.ndarray, optional) – An array that has the same length as torsions and values of True or False to -indicate which torsions are not considered. This can be helpful, e.g., to exclude -methyl torsional symmetry.
-adjust_periodicity (bool, optional) – Since dihedral angles have a period of 360 degrees. Defaults to
True
. -It is suggested to run twice with this value beTrue
andFalse
to -get a better performance.
-as_dict (bool) – Return the result as a dict object with keys for the index of clusters and values -of conformer indexes (provided in confs). Otherwise, return as a list of grouped -conformer indexes. Defaults to
True
.
-as_list_idx (bool) – Return the indexes in the confs list other than the value in the
confs
.
-
-- Returns: -
dict or list
-
-
-
-
- -filter_by_dihed_angles(clusters, threshold: float = 5.0, mask: ndarray | None = None, as_clusters: bool = True) → list# -
A method to filter comformers by calculating the differences of dihedral angles between conformers. -The check will be implemented twice, with and without considering periodicity.
--
-
- Parameters: -
-
-
clusters (ConformerCluster or list) – A single ConformerCluster object or a list of conformerClusters.
-threshold (float, optional) – The threshold (in degree) used for hierarchy clustering. Defaults to 5.
-mask (np.array, optional) – An array that has the same length as torsions and values of True or False to -indicate which torsions are not considered. This can be helpful, e.g., to exclude -methyl torsional symmetry.
-as_clusters (bool, optional) – Return the results as a list of ConformerClusters (
True
) or a list of -grouped conformer indexes (True
). Defaults toTrue
.
-
-- Returns: -
list
-
-
-
-
- -filter_by_iter_hcluster(clusters: list | ConformerCluster, threshold: float = 5.0, criterion: str = 'distance', method: str = 'average', max_iter: int = 10, as_clusters: bool = True)# -
A method to filter comformers by iteratively applying hierarchy clustering. -In a new iteration, only the distinguishable representative conformers will be used that are -generated in the previous iteration.
--
-
- Parameters: -
-
-
clusters (ConformerCluster or list) – A single ConformerCluster object or a list of conformerClusters.
-threshold (float, optional) – The threshold (in degree) used for hierarchy clustering. Defaults to 5.
-criterion (str, optional) – Specifies the criterion for forming flat clusters. Valid values are ‘inconsistent’, -‘distance’ (default), or ‘maxclust’ cluster formation algorithms
-method (str, optional) – The linkage method to use. Valid values are single, complete, average (default), -weighted, median centroid, and ward. Except median centroid (O(n^3)), others have a -computational cost scaled by O(n^2).
-adjust_periodicity (bool, optional) – Since dihedral angles have a period of 360 degrees. Defaults to
True
. -It is suggested to run twice with this value beTrue
andFalse
to -get a better performance.
-max_iter (int, optional) – The max number of iterations. Defaults to 10. There is a early-stopping techinque -if number of clusters doesn’t change with increasing number of iterations.
-as_clusters (bool, optional) – Return the results as a list of ConformerClusters (
True
) or a list of -grouped conformer indexes (True
). Defaults toTrue
.
-
-- Returns: -
list
-
-
-
-
- -generate_rmsds_of_cluster(cluster, reflect: bool = False, reorder: bool = True, max_iters: int = 1000)# -
Get the RMSDs between the representative conformer and each conformer in the cluster.
-
-
-
- -get_tor_matrix(confs: array | list, adjust_periodicity: bool = True) → ndarray# -
Get the torsional matrix consists of torsional angles for the input list of conformer indexes.
--
-
- Parameters: -
-
-
confid (int) – The conformer ID
-adjust_periodicity (bool) – Whether to adjust the periodicity for torsional angles.
-
-- Returns: -
np.array – a M (the number of conformers indicated by confs) x N (the number of torsional angles) matrix
-
-
-
-
- -get_torsional_angles(confid: int, adjust_periodicity: bool = True) → array# -
Get torsional angles for a given conformers.
--
-
- Parameters: -
-
-
confid (int) – The conformer ID.
-adjust_periodicity (bool) – Whether to adjust the periodicity for torsional angles. -Defaults to
True
.
-
-- Returns: -
np.array – A 1D array of torsional angles.
-
-
-
-
- -hierarchy_cluster(confs, threshold: float = 5.0, criterion: str = 'distance', method: str = 'average', adjust_periodicity: bool = False, as_dict: bool = True, as_list_idx: bool = False)# -
The implementation of an hierarchy clustering method based on scipy. -It is basically defining clusters based on points within a hypercube defined by threshold. -More details refer to scipy.
--
-
- Parameters: -
-
-
confs (list) – A list of conformer IDs.
-threshold (float, optional) – The threshold (in degree) used for hierarchy clustering. Defaults to
5
.
-criterion (str, optional) – Specifies the criterion for forming flat clusters. Valid values are
'inconsistent'
, -'distance'
(default), or'maxclust'
cluster formation algorithms.
-method (str, optional) – The linkage method to use. Valid values are
'single'
,'complete'
,'average'
(default), -'weighted'
,'median centroid'
, and'ward'
. Except median centroid (\(O(n^3)\)), others have a -computational cost scaled by \(O(n^2)\).
-adjust_periodicity (bool, optional) – Since dihedral angles have a period of 360 degrees, adjusting for periodicity helps -create better clustering results. Defaults to
True
. -It is suggested to run twice with this value beTrue
andFalse
to -get a better performance.
-as_dict (bool) – Return the result as a
dict
object with keys for the index of clusters and values -of conformer indexes (provided inconfs
). Otherwise, return as alist
of grouped -conformer indexes. Defaults toTrue
.
-as_list_idx (bool) – Return the indexes in the
confs
list other than the value in theconfs
. -Default toFalse
.
-
-
-
-
- -pairwise_rmsd(i: int, j: int, reflect: bool = False, reorder: bool = True, max_iters: int = 1000)# -
The implementation of calculating pairwise RMSD values.
--
-
- Parameters: -
-
-
i (int) – Index of one of the conformer. Usually, used as the ‘reference’.
-j (int) – Index of the other conformer.
-reflect (bool, optional) – Whether to reflect the j conformer to rule out -mirror symmetry. Defaults to
False
.
-reorder (bool, optional) – Whether to allow atom index order to change (based -on isomorphism check to rule out torsional symmetry -and rotational symmetry).
-max_iters (int, optional) – The max iteration in mimizing the RMSD.
-
-
-
-
- -reset_atom_maps(max_atom_maps=100000)# -
Reset the stored matches.
--
-
- Parameters: -
max_atom_maps (int) – The maximum number of atom maps to generate To avoid combinatory explosion, -it is set to avoid the program to run forever. As a cost, you may miss some mappings.
-
-
-
-
- -class rdmc.conf.RDKitConf(conf)# -
Bases:
-object
A wrapper for rdchem.Conformer.
-The method nomenclature follows the Camel style to be consistent with RDKit.
--
-
- -classmethod FromConformer(conf: Conformer) → RDKitConf# -
Convert a RDKit Chem.rdchem.Conformer to a RDKitConf. This allows a more -capable and flexible Conformer class.
--
-
- Parameters: -
conf (Chem.rdchem.Conformer) – A RDKit Conformer instance to be converted.
-
-- Returns: -
RDKitConf – The conformer corresponding to the RDKit Conformer in RDKitConf
-
-
-
-
- -classmethod FromMol(mol: RWMol | Mol, id: int = 0) → RDkitConf# -
Get a RDKitConf instance from a Chem.rdchem.Mol/RWMol instance.
--
-
- Parameters: -
-
-
mol (Union[RWMol, Mol]) – a Molecule in RDKit Default format.
-id (int) – The id of the conformer to be extracted from the molecule.
-
-- Returns: -
RDKitConf – A Conformer in RDKitConf of the given molecule
-
-
-
-
- -classmethod FromRDKitMol(rdkitmol: RDKitMol, id: int = 0) → RDkitConf# -
Get a RDKitConf instance from a RDKitMol instance. The owning molecule -of the generated conformer is RDKitMol instead of Chem.rdchem.Mol.
--
-
- Parameters: -
-
-
rdkitmol (RDKitMol) – a Molecule in RDKitMol.
-id (int) – The id of the conformer to be extracted from the molecule.
-
-- Returns: -
RDKitConf – A Conformer in RDKitConf of the given molecule
-
-
-
-
- -GetAllTorsionsDeg() → list# -
Get the dihedral angles of all torsional modes (rotors) of the Conformer. The sequence of the -values are corresponding to the torsions of the molecule (
-GetTorsionalModes
).-
-
- Returns: -
list – A list of dihedral angles of all torsional modes.
-
-
-
-
- -GetAngleDeg(atomIds: Sequence[int]) → float# -
Get the angle between atoms in degrees.
--
-
- Parameters: -
atomIds (Sequence) – A 3-element sequence object containing atom indexes.
-
-- Returns: -
float – Angle value in degrees.
-
-
-
-
- -GetAngleRad(atomIds: Sequence[int]) → float# -
Get the angle between atoms in rads.
--
-
- Parameters: -
atomIds (Sequence) – A 3-element sequence object containing atom indexes.
-
-- Returns: -
float – Angle value in rads.
-
-
-
-
- -GetBondLength(atomIds: Sequence[int]) → float# -
Get the bond length between atoms in Angstrom.
--
-
- Parameters: -
atomIds (Sequence) – A 3-element sequence object containing atom indexes.
-
-- Returns: -
float – Bond length in Angstrom.
-
-
-
-
- -GetDistanceMatrix() → ndarray# -
Get the distance matrix of the conformer.
--
-
- Returns: -
array – n x n distance matrix such that n is the number of atom.
-
-
-
-
- -GetOwningMol()# -
Get the owning molecule of the conformer.
--
-
- Returns: -
Union[Mol, RWMol, RDKitMol] – The owning molecule
-
-
-
-
- -GetTorsionDeg(torsion: list) → float# -
Get the dihedral angle of the torsion in degrees. The torsion can be defined -by any atoms in the molecule (not necessarily bonded atoms.)
--
-
- Parameters: -
torsion (list) – A list of four atom indexes.
-
-- Returns: -
float – The dihedral angle of the torsion.
-
-
-
-
- -GetTorsionalModes(indexed1: bool = False, excludeMethyl: bool = False, includeRings: bool = False) → list# -
Get all of the torsional modes (rotors) of the Conformer. This information -is obtained from its owning molecule.
--
-
- Parameters: -
-
-
indexed1 – The atom index in RDKit starts from 0. If you want to have -indexed 1 atom indexes, please set this argument to
True
.
-excludeMethyl (bool) – Whether exclude the torsions with methyl groups. Defaults to
False
.
-includeRings (bool) – Whether or not to include ring torsions. Defaults to
False
.
-
-- Returns: -
Optinal[list] – A list of four-atom-indice to indicating the torsional modes.
-
-
-
-
- -GetVdwMatrix(threshold=0.4) → ndarray | None# -
Get the derived Van der Waals matrix, which can be used to analyze -the collision of atoms. More information can be found from
-generate_vdw_mat
.-
-
- Parameters: -
threshold – float indicating the threshold to use in the vdw matrix
-
-- Returns: -
Optional[np.ndarray] – A 2D array of the derived Van der Waals Matrix, if the -the matrix exists, otherwise
-None
.
-
-
-
- -HasCollidingAtoms(threshold=0.4) → ndarray# -
-
-
- Parameters: -
threshold – float indicating the threshold to use in the vdw matrix
-
-
-
-
- -HasOwningMol()# -
Whether the conformer has a owning molecule.
--
-
- Returns: -
bool –
-True
if the conformer has a owning molecule.
-
-
-
- -SetAllTorsionsDeg(angles: list)# -
Set the dihedral angles of all torsional modes (rotors) of the Conformer. The sequence of the -values are corresponding to the torsions of the molecule (
-GetTorsionalModes
).-
-
- Parameters: -
angles (list) – A list of dihedral angles of all torsional modes.
-
-
-
-
- -SetAngleDeg(atomIds: Sequence[int], value: int | float) → float# -
Set the angle between atoms in degrees.
--
-
- Parameters: -
-
-
atomIds (Sequence) – A 3-element sequence object containing atom indexes.
-value (int or float, optional) – Bond angle in degrees.
-
-
-
-
- -SetAngleRad(atomIds: Sequence[int], value: int | float) → float# -
Set the angle between atoms in rads.
--
-
- Parameters: -
-
-
atomIds (Sequence) – A 3-element sequence object containing atom indexes.
-value (int or float, optional) – Bond angle in rads.
-
-
-
-
- -SetBondLength(atomIds: Sequence[int], value: int | float) → float# -
Set the bond length between atoms in Angstrom.
--
-
- Parameters: -
-
-
atomIds (Sequence) – A 3-element sequence object containing atom indexes.
-value (int or float, optional) – Bond length in Angstrom.
-
-
-
-
- -SetOwningMol(owningMol: RDKitMol | Mol | RWMol)# -
Set the owning molecule of the conformer. It can be either RDKitMol -or Chem.rdchem.Mol.
--
-
- Parameters: -
owningMol – Union[RDKitMol, Chem.rdchem.Mol] The owning molecule of the conformer.
-
-- Raises: -
ValueError – Not a valid
-owning_mol
input, when giving something else.
-
-
-
- -SetPositions(coords: tuple | list)# -
Set the Positions of atoms of the conformer.
--
-
- Parameters: -
coords – a list of tuple of atom coordinates.
-
-
-
-
- -SetTorsionDeg(torsion: list, degree: float | int)# -
Set the dihedral angle of the torsion in degrees. The torsion can only be defined -by a chain of bonded atoms.
--
-
- Parameters: -
-
-
torsion (list) – A list of four atom indexes.
-degree (float, int) – The dihedral angle of the torsion.
-
-
-
-
- -SetTorsionalModes(torsions: list | tuple)# -
Set the torsional modes (rotors) of the Conformer. This is useful when the -default torsion is not correct.
--
-
- Parameters: -
torsions (Union[list, tuple]) – A list of four-atom-lists indicating the torsional modes.
-
-- Raises: -
ValueError – The torsional mode used is not valid.
-
-
-
-
- -ToConformer() → Conformer# -
Get its backend RDKit Conformer object.
--
-
- Returns: -
Conformer – The backend conformer
-
-
-
-
- -ToMol() → RDKitMol# -
Convert conformer to mol.
--
-
- Returns: -
RDKitMol – The new mol generated from the conformer
-
-
-
-
- -rdmc.conf.edit_conf_by_add_bonds(conf, function_name, atoms, value)# -
RDKit forbids modifying internal coordinates with non-bonding atoms. -This function tries to provide a workaround.
--
-
- Parameters: -
-
-
conf (RDKitConf) – The conformer to be modified.
-function_name (str) – The function name of the edit.
-atoms (list) – A list of atoms representing the internal coordinates.
-value (float) – Value to be set.
-
-
rdmc.conf#
rdmc.conformer_generation.align#
-This module provides class and methods for reaction path analysis.
--
-
- -class rdmc.conformer_generation.align.NaiveAlign(coords: array, atom_maps: List[List], formed_bonds: List[tuple], broken_bonds: List[tuple])# -
Bases:
-object
This is a naive alignment algorithm aligns reactant conformers.
--
-
For 1 reactant system, the algorithm simply put the center of the reactant at the origin.
-For 2 reactant system, the resulting alignment has the following characteristics:
--
-
the centroid for fragment 1 is at the origin.
-the centroid for fragment 2 is at (R1 + R2 + D), where R1 is the radius of fragment 1, R2 is the radius -of fragment 2, and D is a pre-set distance value defined by the user.
-the centroid of the reacting atoms in fragment 1 should be around the line (0,0,0) => (1,0,0).
-the centroid of the reacting atoms in fragment 2 should be around the line (0,0,0) => (1,0,0).
-the distance between atoms to form bonds are minimized.
-
-
The following are under development:
--
-
For 3 reactant system, the feature is under-development. There should be two cases: close-linear alignment and triangle alignment, -depending on the max number of interactions among fragments.
-For 4 reactant system, the feature is under-development. There should be three cases: close-linear, square, and tetrahedron alignment, -depending on the max number of interactions among fragments.
-
-
-
- -dist = 2.0# -
-
-
- -classmethod from_complex(r_complex: RDKitMol, formed_bonds: List[tuple], broken_bonds: List[tuple], conf_id: int = 0)# -
Initialize from a reactant complex.
--
-
- Parameters: -
-
-
r_complex (RDKitMol) – The reactant complex.
-formed_bonds (List[tuple]) – bonds formed in the reaction.
-broken_bonds (List[tuple]) – bonds broken in the reaction.
-conf_id (int, optional) – The conformer id to be used in the
r_complex
. Defaults to0
.
-
-
-
-
- -classmethod from_r_and_p_complex(r_complex: RDKitMol, p_complex: RDKitMol, conf_id: int = 0)# -
Initialize from the reactant complex and the product complex. The product complex -does not need to have conformers embedded, however, it should be atom mapped with -the reactant complex.
- -
-
-
- -classmethod from_reactants(mols: List[RDKitMol], formed_bonds: List[tuple], broken_bonds: List[tuple], conf_ids: List[int] | None = None)# -
Create a complex in place by stacking the molecules together.
--
-
- Parameters: -
-
-
mols (RDKitMol) – A list of reactants.
-formed_bonds (List[tuple]) – bonds formed in the reaction.
-broken_bonds (List[tuple]) – bonds broken in the reaction.
-conf_id1 (int, optional) – The conformer id to be used in mol1. Defaults to
0
.
-conf_id2 (int, optional) – The conformer id to be used in mol2. Defaults to
0
.
-
-
-
-
- -get_alignment_coords(dist: float | None = None) → array# -
Get coordinates of the alignment.
--
-
- Parameters: -
dist (float, optional) – The a preset distance used to separate molecules. -Defaults to
-None meaning
using the value ofdist
.
-- Returns: -
np.array – The coordinates of the alignment.
-
-
-
-
- -get_fragment_radii() → List[float]# -
Get the radius of each fragment defined by the distance between the centroid to the farthest element.
--
-
- Returns: -
list – A list of radius.
-
-
-
-
- -get_reacting_atoms_in_fragments() → List[list]# -
Get the reacting atoms in each reactant.
--
-
- Returns: -
-
-
- A list of the list of reacting atoms in each reactant.
-- A list of the list of non reacting atoms in each reactant.
-
-
-
-
- -initialize_align(dist: float | None = None)# -
Initialize the alignment for the reactants. Currently only available for 1 reactant and 2 reactant systems.
--
-
- Parameters: -
dist (float, optional) – The a preset distance used to separate molecules. Defaults to
-None
, -meaning using the default value ofdist
.
-
-
-
- -rotate_fragment_separately(*angles: array, about_reacting: bool = False) → array# -
Rotate the molecule fragments in the complex by angles. The length of angles should be same as the length of -self.atom_maps.
--
-
- Parameters: -
-
-
angles (np.array) – Rotation angles for molecule fragment 1. It should be an array with a -size of
(1,3)
indicate the rotation angles about the x, y, and z axes, respectively.
-about_reacting (bool, optional) – If rotate about the reactor center instead of the centroid. Defaults to
False
.
-
-- Returns: -
np.array – The coordinates after the rotation operation.
-
-
-
-
- -score_bimolecule(angles: array) → float# -
Calculate the score of bimolecular reaction alignment.
--
-
- Parameters: -
angles (np.array) – an array with 6 elements. The first 3 angles correspond to the rotation of the first fragment, -and the last 3 angles correspond to the rotation of the second fragment.
-
-- Returns: -
float – The score value.
-
-
-
-
- -rdmc.conformer_generation.align.align_reactant_fragments(r_mol: RDKitMol, p_mol: RDKitMol) → RDKitMol# -
Given reactant and product mols, find details of formed and broken bonds and generate reacting reactant complex.
--
-
- Parameters: -
-
-
r_mol ('RDKitMol' or 'Mol') – An RDKit Mol object for reactant.
-p_mol ('RDKitMol' or 'Mol') – An RDKit Mol object for product.
-
-- Returns: -
RDKitMol – The new reactant with aligned fragments.
-
-
-
-
- -rdmc.conformer_generation.align.prepare_mols(r_mol: RDKitMol, p_mol: RDKitMol, align_bimolecular: bool = True) → Tuple[RDKitMol, RDKitMol]# -
Prepare mols for reaction path analysis. If reactant has multiple fragments, first orient reactants in reacting -orientation. Then, reinitialize coordinates of product using
-reset_pmol
function.-
-
- Parameters: -
-
-
r_mol ('RDKitMol' or 'Mol') – An RDKit Mol object for reactant.
-p_mol ('RDKitMol' or 'Mol') – An RDKit Mol object for product.
-align_bimolecular (bool, optional) – Whether or not to use alignment algorithm on bimolecular reactions. -Defaults to
True
-
-- Returns: -
-
-
r_mol (‘RDKitMol’) – The new reactant molecule.
-p_mol_new (‘RDKitMol’) – The new product molecule.
-
-
-
-
- -rdmc.conformer_generation.align.reset_pmol(r_mol: RDKitMol, p_mol: RDKitMol) → RDKitMol# -
Reset the product mol to best align with the reactant. This procedure consists of initializing the product 3D -structure with the reactant coordinates and then 1) minimizing the product structure with constraints for broken -bonds and 2) performing a second minimization with no constraints.
--
-
- Parameters: -
-
-
r_mol ('RDKitMol' or 'Mol') – An RDKit Mol object for reactant.
-p_mol ('RDKitMol' or 'Mol') – An RDKit Mol object for product.
-
-- Returns: -
RDKitMol – The new product mol with changed coordinates.
-
-
rdmc.conformer_generation.align#
rdmc.conformer_generation.embedders#
-Modules for providing initial guess geometries
--
-
- -class rdmc.conformer_generation.embedders.ConfGenEmbedder(track_stats=False)# -
Bases:
-object
Base class for conformer generation embedders.
--
-
- -embed_conformers(n_conformers: int)# -
Embed conformers according to the molecule graph.
--
-
- Parameters: -
n_conformers (int) – Number of conformers to generate.
-
-- Raises: -
NotImplementedError – This method needs to be implemented in the subclass.
-
-
-
-
- -update_mol(smiles: str)# -
Update the molecule graph based on the SMILES string.
--
-
- Parameters: -
smiles (str) – SMILES string of the molecule
-
-
-
-
- -update_stats(n_trials: int, time: float = 0.0) → dict# -
Update the statistics of the conformer generation.
--
-
- Parameters: -
-
-
n_trials (int) – Number of trials
-time (float, optional) – Time spent on conformer generation. Defaults to
0.
.
-
-- Returns: -
dict – Statistics of the conformer generation
-
-
-
-
- -write_mol_data()# -
Write the molecule data.
--
-
- Returns: -
dict – Molecule data.
-
-
-
-
- -class rdmc.conformer_generation.embedders.ETKDGEmbedder(track_stats=False)# -
Bases:
-ConfGenEmbedder
Embed conformers using ETKDG.
--
-
- -embed_conformers(n_conformers: int)# -
Embed conformers according to the molecule graph.
--
-
- Parameters: -
n_conformers (int) – Number of conformers to generate.
-
-- Returns: -
mol – Molecule with conformers.
-
-
-
-
- -class rdmc.conformer_generation.embedders.GeoMolEmbedder(trained_model_dir: str, dataset: str = 'drugs', temp_schedule: str = 'linear', track_stats: bool = False)# -
Bases:
-ConfGenEmbedder
Embed conformers using GeoMol.
--
-
- Parameters: -
-
-
trained_model_dir (str) – Directory of the trained model.
-dataset (str, optional) – Dataset used for training. Defaults to
"drugs"
.
-temp_schedule (str, optional) – Temperature schedule. Defaults to
"linear"
.
-track_stats (bool, optional) – Whether to track the statistics of the conformer generation. Defaults to
False
.
-
-
-
-
- -embed_conformers(n_conformers: int)# -
Embed conformers according to the molecule graph.
--
-
- Parameters: -
n_conformers (int) – Number of conformers to generate.
-
-- Returns: -
mol – Molecule with conformers.
-
-
-
-
- -class rdmc.conformer_generation.embedders.RandomEmbedder(track_stats=False)# -
Bases:
-ConfGenEmbedder
Embed conformers with coordinates of random numbers.
--
-
- -embed_conformers(n_conformers: int)# -
Embed conformers according to the molecule graph.
--
-
- Parameters: -
n_conformers (int) – Number of conformers to generate.
-
-- Returns: -
mol – Molecule with conformers.
-
-
rdmc.conformer_generation.embedders#
Embedding Geometries#
rdmc.conformer_generation.ts_guessers#
-Modules for providing transition state initial guess geometries.
--
-
- -class rdmc.conformer_generation.ts_guessers.AutoNEBGuesser(optimizer: Calculator = 'xtb-python not installed', track_stats: bool | None = False)# -
Bases:
-TSInitialGuesser
The class for generating TS guesses using the AutoNEB method.
--
-
- Parameters: -
-
-
optimizer (ase.calculator.calculator.Calculator) – ASE calculator. Defaults to the XTB implementation
xtb.ase.calculator.XTB
.
-track_stats (bool, optional) – Whether to track the status. Defaults to
False
.
-
-
-
-
- -property attach_calculators# -
Set the calculator for each image.
-
-
-
- -generate_ts_guesses(mols, multiplicity: int | None = None, save_dir: str | None = None)# -
Generate TS guesser.
--
-
- Parameters: -
-
-
mols (list) – A list of reactant and product pairs.
-multiplicity (int, optional) – The spin multiplicity of the reaction. Defaults to
None
.
-save_dir (Optional[str], optional) – The path to save the results. Defaults to
None
.
-
-- Returns: -
RDKitMol – The TS molecule in RDKitMol with 3D conformer saved with the molecule.
-
-
-
-
- -property optimizer# -
Optimizer used by the AutoNEB method.
-
-
-
- -class rdmc.conformer_generation.ts_guessers.DEGSMGuesser(method: str = 'GFN2-xTB', nprocs: int = 1, memory: int = 1, gsm_args: str | None = '', track_stats: bool | None = False)# -
Bases:
-TSInitialGuesser
The class for generating TS guesses using the DE-GSM method.
--
-
- Parameters: -
track_stats (bool, optional) – Whether to track the status. Defaults to
-False
.
-
-
-
- -generate_ts_guesses(mols: list, multiplicity: int | None = None, save_dir: str | None = None)# -
Generate TS guesser.
--
-
- Parameters: -
-
-
mols (list) – A list of reactant and product pairs.
-multiplicity (int, optional) – The spin multiplicity of the reaction. Defaults to
None
.
-save_dir (Optional[str], optional) – The path to save the results. Defaults to
None
.
-
-- Returns: -
RDKitMol – The TS molecule in RDKitMol with 3D conformer saved with the molecule.
-
-
-
-
- -class rdmc.conformer_generation.ts_guessers.RMSDPPGuesser(track_stats: bool | None = False)# -
Bases:
-TSInitialGuesser
The class for generating TS guesses using the RMSD-PP method.
--
-
- Parameters: -
track_stats (bool, optional) – Whether to track the status. Defaults to
-False
.
-
-
-
- -generate_ts_guesses(mols, multiplicity: int | None = None, save_dir: str | None = None)# -
Generate TS guesser.
--
-
- Parameters: -
-
-
mols (list) – A list of reactant and product pairs.
-multiplicity (int, optional) – The spin multiplicity of the reaction. Defaults to None.
-save_dir (Optional[str], optional) – The path to save the results. Defaults to None.
-
-- Returns: -
RDKitMol – The TS molecule in RDKitMol with 3D conformer saved with the molecule.
-
-
-
-
- -class rdmc.conformer_generation.ts_guessers.TSEGNNGuesser(trained_model_dir: str, track_stats: bool | None = False)# -
Bases:
-TSInitialGuesser
The class for generating TS guesses using the TS-EGNN model.
--
-
- Parameters: -
-
-
trained_model_dir (str) – The path to the directory storing the trained TS-EGNN model.
-track_stats (bool, optional) – Whether to track the status. Defaults to
False
.
-
-
-
-
- -generate_ts_guesses(mols: list, multiplicity: int | None = None, save_dir: str | None = None)# -
Generate TS guesser.
--
-
- Parameters: -
-
-
mols (list) – A list of reactant and product pairs.
-multiplicity (int, optional) – The spin multiplicity of the reaction. Defaults to
None
.
-save_dir (Optional[str], optional) – The path to save the results. Defaults to
None
.
-
-- Returns: -
RDKitMol – The TS molecule in
-RDKitMol
with 3D conformer saved with the molecule.
-
-
-
- -class rdmc.conformer_generation.ts_guessers.TSGCNGuesser(trained_model_dir: str, track_stats: bool | None = False)# -
Bases:
-TSInitialGuesser
The class for generating TS guesses using the TS-GCN model.
--
-
- Parameters: -
-
-
trained_model_dir (str) – The path to the directory storing the trained TS-GCN model.
-track_stats (bool, optional) – Whether to track the status. Defaults to
False
.
-
-
-
-
- -generate_ts_guesses(mols: list, multiplicity: int | None = None, save_dir: str | None = None)# -
Generate TS guesser.
--
-
- Parameters: -
-
-
mols (list) – A list of reactant and product pairs.
-multiplicity (int, optional) – The spin multiplicity of the reaction. Defaults to
None
.
-save_dir (Optional[str], optional) – The path to save the results. Defaults to
None
.
-
-- Returns: -
RDKitMol – The TS molecule in RDKitMol with 3D conformer saved with the molecule.
-
-
-
-
- -class rdmc.conformer_generation.ts_guessers.TSInitialGuesser(track_stats: bool | None = False)# -
Bases:
-object
The abstract class for TS initial Guesser.
--
-
- Parameters: -
track_stats (bool, optional) – Whether to track the status. Defaults to
-False
.
-
-
-
- -generate_ts_guesses(mols: list, save_dir: str | None = None) → RDKitMol# -
The key function used to generate TS guesses. It varies by the actual classes and need to implemented inside each class. -The function should at least take mols and save_dir as input arguments. The returned value should be a RDKitMol with TS -geometries.
--
-
- Parameters: -
-
-
mols (list) – A list of reactant and product pairs.
-save_dir (Optional[str], optional) – The path to save the results. Defaults to
None
for not saving.
-
-- Returns: -
RDKitMol – The TS molecule in
-RDKitMol
with 3D conformer saved with the molecule.
-- Raises: -
NotImplementedError – This method needs to be implemented in the subclass.
-
-
-
-
- -save_guesses(save_dir: str, rp_combos: list, ts_mol: RDKitMol)# -
Save the generated guesses into the given
-save_dir
.-
-
- Parameters: -
-
-
save_dir (str) – The path to the directory to save the results.
-rp_combos (list) – A list of reactant and product complex pairs used to generate transition states.
-ts_mol (RDKitMol) – The TS molecule in RDKitMol with 3D conformer saved with the molecule.
-
-
rdmc.conformer_generation.ts_guessers#
Geometry Optimization#
rdmc.conformer_generation.optimizers#
-Modules for optimizing initial guess geometries.
--
-
- -class rdmc.conformer_generation.optimizers.ConfGenOptimizer(track_stats=False)# -
Bases:
-object
Base class for the geometry optimizers used in conformer generation.
--
-
- Parameters: -
track_stats (bool, optional) – Whether to track the status. Defaults to
-False
.
-
-
-
- -optimize_conformers(mol_data: List[dict])# -
Optimize the conformers.
--
-
- Parameters: -
mol_data (List[dict]) – The list of conformers to be optimized.
-
-- Raises: -
NotImplementedError – This function should be implemented in the child class.
-
-
-
-
- -class rdmc.conformer_generation.optimizers.GaussianOptimizer(method: str = 'GFN2-xTB', nprocs: int = 1, memory: int = 1, track_stats: bool = False)# -
Bases:
-ConfGenOptimizer
Optimizer using the Gaussian.
--
-
- Parameters: -
-
-
method (str, optional) – The method to be used for species optimization. You can use the level of theory available in Gaussian. -Defaults to
"GFN2-xTB"
, which is realized by additional scripts provided in therdmc
package.
-nprocs (int, optional) – The number of processors to use. Defaults to
1
.
-memory (int, optional) – Memory in GB used by Gaussian. Defaults to
1
.
-track_stats (bool, optional) – Whether to track the status. Defaults to
False
.
-
-
-
-
- -optimize_conformers(mol: RDKitMol, multiplicity: int = 1, save_dir: str | None = None, **kwargs) → RDKitMol# -
Optimize the conformers.
--
-
- Parameters: -
-
-
mol (RDKitMol) – An RDKitMol object with all guess geometries embedded as conformers.
-multiplicity (int) – The multiplicity of the molecule. Defaults to
1
.
-save_dir (Optional[str], optional) – The path to save the results. Defaults to
None
.
-
-- Returns: -
RDKitMol – The optimized molecule as RDKitMol with 3D geometries embedded.
-
-
-
-
- -save_opt_mols(save_dir: str, opt_mol: RDKitMol, keep_ids: dict, energies: dict)# -
Save the information of the optimized stable species into the directory.
--
-
- Parameters: -
-
-
save_dir (str) – The path to the directory to save the results.
-opt_mol (RDKitMol) – The optimized stable species in RDKitMol with 3D conformer saved with the molecule.
-keep_ids (dict) – Dictionary of which opts succeeded and which failed.
-energies (dict) – Dictionary of energies for each conformer.
-
-
-
-
- -class rdmc.conformer_generation.optimizers.MMFFOptimizer(method: str = 'rdkit', track_stats: bool = False)# -
Bases:
-ConfGenOptimizer
Optimizer using the MMFF force field.
--
-
- Parameters: -
-
-
method (str, optional) – The method to be used for stable species optimization. Defaults to
"rdkit"
.
-track_stats (bool, optional) – Whether to track the status. Defaults to
False
.
-
-
-
-
- -optimize_conformers(mol_data: List[dict]) → List[dict]# -
Optimize the conformers.
--
-
- Parameters: -
mol_data (List[dict]) – The list of conformers to be optimized.
-
-- Returns: -
List[dict] – The list of optimized conformers sorted by energy.
-
-
-
-
- -class rdmc.conformer_generation.optimizers.XTBOptimizer(method: str = 'gff', level: str = 'normal', track_stats: bool = False)# -
Bases:
-ConfGenOptimizer
Optimizer using the xTB.
--
-
- Parameters: -
-
-
method (str, optional) – The method to be used for species optimization. Defaults to
"gff"
.
-level (str, optional) – The level of theory. Defaults to
"normal"
.
-track_stats (bool, optional) – Whether to track the status. Defaults to
False
.
-
-
-
-
- -optimize_conformers(mol_data: List[dict]) → List[dict]# -
Optimize the conformers.
--
-
- Parameters: -
mol_data (List[dict]) – The list of conformers to be optimized.
-
-- Returns: -
List[dict] – The list of optimized conformers sorted by energy.
-
-
rdmc.conformer_generation.optimizers#
rdmc.conformer_generation.ts_optimizers#
-Modules for optimizing transition state geometries.
--
-
- -class rdmc.conformer_generation.ts_optimizers.GaussianOptimizer(method: str = 'GFN2-xTB', nprocs: int = 1, memory: int = 1, track_stats: bool = False)# -
Bases:
-TSOptimizer
The class to optimize TS geometries using the Berny algorithm built in Gaussian. -You have to have the Gaussian package installed to run this optimizer
--
-
- Parameters: -
-
-
method (str, optional) – The method to be used for TS optimization. you can use the level of theory available in Gaussian. -We provided a script to run XTB using Gaussian, but there are some extra steps to do. -Defaults to
"GFN2-xTB"
.
-nprocs (int, optional) – The number of processors to use. Defaults to
1
.
-memory (int, optional) – Memory in GB used by Gaussian. Defaults to
1
.
-track_stats (bool, optional) – Whether to track the status. Defaults to
False
.
-
-
-
-
- -optimize_ts_guesses(mol: RDKitMol, multiplicity: int = 1, save_dir: str | None = None, **kwargs)# -
Optimize the TS guesses.
--
-
- Parameters: -
-
-
mol (RDKitMol) – An RDKitMol object with all guess geometries embedded as conformers.
-multiplicity (int) – The multiplicity of the molecule. Defaults to
1
.
-save_dir (Optional[str], optional) – The path to save the results. Defaults to
None
.
-
-- Returns: -
RDKitMol – The optimized TS molecule in RDKitMol with 3D conformer saved with the molecule.
-
-
-
-
- -class rdmc.conformer_generation.ts_optimizers.OrcaOptimizer(method: str = 'XTB2', nprocs: int = 1, track_stats: bool = False)# -
Bases:
-TSOptimizer
The class to optimize TS geometries using the Berny algorithm built in Orca. -You have to have the Orca package installed to run this optimizer.
--
-
- Parameters: -
-
-
method (str, optional) – The method to be used for TS optimization. you can use the level of theory available in Orca. -If you want to use XTB methods, you need to put the xtb binary into the Orca directory. -Defaults to
"XTB2"
.
-nprocs (int, optional) – The number of processors to use. Defaults to
1
.
-track_stats (bool, optional) – Whether to track the status. Defaults to
False
.
-
-
-
-
- -extract_frequencies(save_dir: str, n_atoms: int)# -
Extract frequencies from the Orca opt job.
--
-
- Parameters: -
-
-
save_dir (str) – Path where Orca logs are saved.
-n_atoms (int) – The number of atoms in the molecule.
-
-- Returns: -
np.ndarray – The frequencies in cm-1.
-
-
-
-
- -optimize_ts_guesses(mol: RDKitMol, multiplicity: int = 1, save_dir: str | None = None, **kwargs)# -
Optimize the TS guesses.
--
-
- Parameters: -
-
-
mol (RDKitMol) – An RDKitMol object with all guess geometries embedded as conformers.
-multiplicity (int) – The multiplicity of the molecule. Defaults to
1
.
-save_dir (Optional[str], optional) – The path to save the results. Defaults to
None
.
-
-- Returns: -
RDKitMol – The optimized TS molecule in RDKitMol with 3D conformer saved with the molecule.
-
-
-
-
- -class rdmc.conformer_generation.ts_optimizers.QChemOptimizer(method: str = 'wB97x-d3', basis: str = 'def2-tzvp', nprocs: int = 1, track_stats: bool = False)# -
Bases:
-TSOptimizer
The class to optimize TS geometries using the Baker’s eigenvector-following (EF) algorithm built in QChem. -You have to have the QChem package installed to run this optimizer.
--
-
- Parameters: -
-
-
method (str, optional) – The method to be used for TS optimization. you can use the method available in QChem. -Defaults to
"wB97x-d3"
.
-basis (str, optional) – The method to be used for TS optimization. you can use the basis available in QChem. -Defaults to
"def2-tzvp"
.
-nprocs (int, optional) – The number of processors to use. Defaults to
1
.
-track_stats (bool, optional) – Whether to track the status. Defaults to
False
.
-
-
-
-
- -optimize_ts_guesses(mol: RDKitMol, multiplicity: int = 1, save_dir: str | None = None, **kwargs)# -
Optimize the TS guesses.
--
-
- Parameters: -
-
-
mol (RDKitMol) – An RDKitMol object with all guess geometries embedded as conformers.
-multiplicity (int) – The multiplicity of the molecule. Defaults to
1
.
-save_dir (Optional[str], optional) – The path to save the results. Defaults to
None
.
-
-- Returns: -
RDKitMol – The optimized TS molecule in RDKitMol with 3D conformer saved with the molecule.
-
-
-
-
- -class rdmc.conformer_generation.ts_optimizers.SellaOptimizer(method: str = 'GFN2-xTB', fmax: float = 0.001, steps: int = 1000, track_stats: bool = False)# -
Bases:
-TSOptimizer
The class to optimize TS geometries using the Sella algorithm. -It uses XTB as the backend calculator, ASE as the interface, and Sella module from the Sella repo.
--
-
- Parameters: -
-
-
method (str, optional) – The method in XTB used to optimize the geometry. Options are -
'GFN1-xTB'
and'GFN2-xTB'
. Defaults to"GFN2-xTB"
.
-fmax (float, optional) – The force threshold used in the optimization. Defaults to
1e-3
.
-steps (int, optional) – Max number of steps allowed in the optimization. Defaults to
1000
.
-track_stats (bool, optional) – Whether to track the status. Defaults to
False
.
-
-
-
-
- -optimize_ts_guesses(mol: RDKitMol, save_dir: str | None = None, **kwargs)# -
Optimize the TS guesses.
--
-
- Parameters: -
-
-
mol (RDKitMol) – An RDKitMol object with all guess geometries embedded as conformers.
-save_dir (str, optional) – The path to save results. Defaults to
None
.
-
-- Returns: -
RDKitMol – The optimized TS molecule in RDKitMol with 3D conformer saved with the molecule.
-
-
-
-
- -class rdmc.conformer_generation.ts_optimizers.TSOptimizer(track_stats: bool | None = False)# -
Bases:
-object
The abstract class for TS optimizer.
--
-
- Parameters: -
track_stats (bool, optional) – Whether to track the status. Defaults to
-False
.
-
-
-
- -optimize_ts_guesses(mol: RDKitMol, save_dir: str, **kwargs)# -
The abstract method for optimizing TS guesses. It will be implemented in actual classes. -The method needs to take
-mol
inRDKitMol
andsave_dir
asstr
as input arguments, and -return the optimized molecule asRDKitMol
.-
-
- Parameters: -
-
-
mol (RDKitMol) – The TS in RDKitMol object with geometries embedded as conformers.
-save_dir (Optional[str], optional) – The path to save the results. Defaults to
None
.
-
-- Returns: -
RDKitMol – The optimized TS molecule in RDKitMol with 3D conformer saved with the molecule.
-
-
-
-
- -save_opt_mols(save_dir: str, opt_mol: RDKitMol, keep_ids: dict, energies: dict)# -
Save the information of the optimized TS geometries into the directory.
--
-
- Parameters: -
-
-
save_dir (str) – The path to the directory to save the results.
-opt_mol (RDKitMol) – The optimized TS molecule in RDKitMol with 3D conformer saved with the molecule.
-keep_ids (dict) – Dictionary of which opts succeeded and which failed.
-energies (dict) – Dictionary of energies for each conformer.
-
-
rdmc.conformer_generation.ts_optimizers#
rdmc.conformer_generation#
+rdmc.conformer_generation#
Postprocessing#
-
-
- rdmc.conformer_generation.verifiers - -
- rdmc.conformer_generation.ts_verifiers - -
- rdmc.conformer_generation.pruners - -
- rdmc.conformer_generation.solvation - +
- rdmc.conformer_generation.verifiers +
- rdmc.conformer_generation.ts_verifiers +
- rdmc.conformer_generation.pruners +
- rdmc.conformer_generation.solvation
rdmc.conformer_generation.pruners#
-Modules for pruning a group of conformers
--
-
- -class rdmc.conformer_generation.pruners.CRESTPruner(ethr: float = 0.15, rthr: float = 0.125, bthr: float = 0.01, ewin: float = 10000, track_stats: bool = False)# -
Bases:
-ConfGenPruner
Prune conformers using CREST.
--
-
- Parameters: -
-
-
ethr (float, optional) – Energy threshold. Defaults to
0.15
.
-rthr (float, optional) – RMSD threshold. Defaults to
0.125
.
-bthr (float, optional) – Bond threshold. Defaults to
0.01
.
-ewin (int, optional) – Energy window. Defaults to
10000
.
-track_stats (bool, optional) – Whether to track statistics. Defaults to
False
.
-
-
-
-
- -prune_conformers(current_mol_data: List[dict], unique_mol_data: List[dict] | None = None, sort_by_energy: bool = True, return_ids: bool = False)# -
Prune conformers.
--
-
- Parameters: -
-
-
current_mol_data (List[dict]) – conformer data of the current iteration.
-unique_mol_data (List[dict], optional) – Unique conformer data of previous iterations. Defaults to
None
.
-sort_by_energy (bool, optional) – Whether to sort conformers by energy. Defaults to
True
.
-return_ids (bool, optional) – Whether to return conformer IDs. Defaults to
False
.
-
-- Returns: -
List[dict] – Updated conformer data.
-
-
-
-
- -class rdmc.conformer_generation.pruners.ConfGenPruner(track_stats: bool = False)# -
Bases:
-object
Base class for conformer pruning.
--
-
- Parameters: -
track_stats (bool, optional) – Whether to track statistics. Defaults to
-False
.
-
-
-
- -prune_conformers(current_mol_data: List[dict], unique_mol_data: List[dict] | None = None, sort_by_energy: bool = True, return_ids: bool = False)# -
Prune conformers.
--
-
- Parameters: -
-
-
current_mol_data (List[dict]) – conformer data of the current iteration.
-unique_mol_data (List[dict], optional) – Unique conformer data of previous iterations. Defaults to
None
.
-sort_by_energy (bool, optional) – Whether to sort conformers by energy. Defaults to
True
.
-return_ids (bool, optional) – Whether to return conformer IDs. Defaults to
False
.
-
-- Raises: -
NotImplementedError – This method should be implemented in the subclass.
-
-
-
-
- -class rdmc.conformer_generation.pruners.TorsionPruner(mean_chk_threshold: float = 10.0, max_chk_threshold: float = 20.0, track_stats: bool = False)# -
Bases:
-ConfGenPruner
Prune conformers based on torsion angle criteria. -This method uses a mean and max criteria to prune conformers: -A conformer is considered unique if it satisfies either of the following criteria:
--
-
mean difference of all torsion angles > mean_chk_threshold
-max difference of all torsion angles > max_chk_threshold
-
New conformers are compared to all conformers that have already been deemed unique.
--
-
- Parameters: -
-
-
mean_chk_threshold (float, optional) – Mean difference threshold. Defaults to
10.
.
-max_chk_threshold (float, optional) – Max difference threshold. Defaults to
20.
.
-track_stats (bool, optional) – Whether to track statistics. Defaults to
False
.
-
-
-
-
- -calculate_torsions(mol_data: List[dict]) → List[dict]# -
Calculate torsions for a list of conformers.
--
-
- Parameters: -
mol_data (List[dict]) – conformer data.
-
-- Returns: -
List[dict] – Conformer data with values of torsions added.
-
-
-
-
- -initialize_torsions_list(smiles: str | None = None, torsions: list | None = None, excludeMethyl: bool = False)# -
Initialize the list of torsions to be used for comparison and pruning.
--
-
- Parameters: -
-
-
smiles (str, optional) – SMILES of the molecule. Defaults to
None
. This should be provided if -torsions
is not provided.
-torsions (list, optional) – List of torsions. Defaults to
None
, -in which case the torsions will be extracted from the molecule.
-excludeMethyl (bool, optional) – Whether to exclude methyl groups. Defaults to
False
.
-
-
-
-
- -initialize_ts_torsions_list(rxn_smiles: str | None = None, torsions: list | None = None, excludeMethyl: bool = False)# -
Initialize the list of torsions to be used for comparison and pruning for TS molecules.
--
-
- Parameters: -
-
-
rxn_smiles (str, optional) – SMILES of the reaction. Defaults to
None
. This should be provided if -torsions
is not provided.
-torsions (list, optional) – List of torsions. Defaults to
None
, in which case the torsions will be -extracted according to the reactants and the products.
-excludeMethyl (bool, optional) – Whether to exclude methyl groups. Defaults to
False
.
-
-
-
-
- -prune_conformers(current_mol_data: List[dict], unique_mol_data: List[dict] | None = None, sort_by_energy: bool = True, return_ids: bool = False)# -
Prune conformers.
--
-
- Parameters: -
-
-
current_mol_data (List[dict]) – conformer data of the current iteration.
-unique_mol_data (List[dict], optional) – Unique conformer data of previous iterations. Defaults to
None
.
-sort_by_energy (bool, optional) – Whether to sort conformers by energy. Defaults to
True
.
-return_ids (bool, optional) – Whether to return conformer IDs. Defaults to
False
.
-
-- Returns: -
List[dict] – Updated conformer data.
-
-
-
-
- -static rad_angle_compare(x: float, y: float) → float# -
Compare two angles in radians.
--
-
- Parameters: -
-
-
x (float) – angle in degrees.
-y (float) – angle in degrees.
-
-- Returns: -
float – Absolute difference between the two angles in radians.
-
-
-
-
- -static torsion_list_compare(c1_ts: List[float], c2_ts: List[float]) → List[float]# -
Compare two lists of torsions in radians.
--
-
- Parameters: -
-
-
c1_ts (list) – list of torsions in degrees.
-c2_ts (list) – list of torsions in degress.
-
-- Returns: -
list – Absolute difference between the two lists of torsions in radians.
-
-
rdmc.conformer_generation.pruners#
rdmc.conformer_generation.solvation#
-Modules for including computing solvation corrections.
--
-
- -class rdmc.conformer_generation.solvation.ConfSolv(trained_model_dir: str, track_stats: bool | None = False)# -
Bases:
-Estimator
Class for estimating conformer energies in solution with neural networks.
--
-
- Parameters: -
-
-
trained_model_dir (str) – The path to the directory storing the trained ConfSolv model.
-track_stats (bool, optional) – Whether to track timing stats. Defaults to
False
.
-
-
-
-
- -predict_energies(mol_data: List[dict], **kwargs) → List[dict]# -
Predict conformer free energies in a given solvent.
--
-
- Parameters: -
mol_data (List[dict]) – A list of molecule dictionaries.
-
-- Returns: -
mol_data (List[dict]) – A list of molecule dictionaries with energy values updated.
-
-
-
-
- -class rdmc.conformer_generation.solvation.Estimator(track_stats: bool | None = False)# -
Bases:
-object
The abstract class for energy estimator.
--
-
- Parameters: -
track_stats (bool, optional) – Whether to track timing stats. Defaults to
-False
.
-
-
-
- -predict_energies(mol_data: List[dict], **kwargs)# -
The abstract method for predicting energies. It will be implemented in actual classes. -The method needs to take
-mol_data
which is a dictionary containing info about the -conformers of the molecules. It will return the molecule as the samemol_data
object -with the energy values altered.-
-
- Parameters: -
mol_data (List[dict]) – A list of molecule dictionaries.
-
-- Returns: -
mol_data (List[dict]) – A list of molecule dictionaries with energy values updated.
-
-
rdmc.conformer_generation.solvation#
rdmc.conformer_generation.ts_verifiers#
-Modules for verifying optimized ts
--
-
- -class rdmc.conformer_generation.ts_verifiers.GaussianIRCVerifier(method: str = 'GFN2-xTB', nprocs: int = 1, memory: int = 1, fc_kw: str = 'calcall', track_stats: bool = False)# -
Bases:
-TSVerifier
The class for verifying the TS by calculating and checking its IRC analysis using Gaussian.
--
-
- Parameters: -
-
-
method (str, optional) – The method to be used for TS optimization. you can use the level of theory available in Gaussian. -We provided a script to run XTB using Gaussian, but there are some extra steps to do. -Defaults to
"GFN2-xTB"
.
-nprocs (int, optional) – The number of processors to use. Defaults to
1
.
-memory (int, optional) – Memory in GB used by Gaussian. Defaults to
1
.
-fc_kw (str, optional) – Keyword specifying how often to compute force constants Defaults to
"calcall"
.
-track_stats (bool, optional) – Whether to track the status. Defaults to
False
.
-
-
-
-
- -verify_ts_guesses(ts_mol: RDKitMol, multiplicity: int = 1, save_dir: str | None = None, **kwargs) → RDKitMol# -
Verifying TS guesses (or optimized TS geometries).
--
-
- Parameters: -
-
-
ts_mol ('RDKitMol') – The TS in RDKitMol object with 3D geometries embedded.
-multiplicity (int, optional) – The spin multiplicity of the TS. Defaults to
1
.
-save_dir (str, optional) – The directory path to save the results. Defaults to
None
.
-
-- Returns: -
RDKitMol – The molecule in RDKitMol object with verification results stored in
-KeepIDs
.
-
-
-
- -class rdmc.conformer_generation.ts_verifiers.OrcaIRCVerifier(method: str = 'XTB2', nprocs: int = 1, track_stats: bool = False)# -
Bases:
-TSVerifier
The class for verifying the TS by calculating and checking its IRC analysis using Orca.
--
-
- Parameters: -
-
-
method (str, optional) – The method to be used for TS optimization. you can use the level of theory available in Orca. -If you want to use XTB methods, you need to put the xtb binary into the Orca directory. -Defaults to
"XTB2"
.
-nprocs (int, optional) – The number of processors to use. Defaults to
1
.
-track_stats (bool, optional) – Whether to track the status. Defaults to
False
.
-
-
-
-
- -verify_ts_guesses(ts_mol: RDKitMol, multiplicity: int = 1, save_dir: str | None = None, **kwargs) → RDKitMol# -
Verifying TS guesses (or optimized TS geometries).
--
-
- Parameters: -
-
-
ts_mol (RDKitMol) – The TS in RDKitMol object with 3D geometries embedded.
-multiplicity (int, optional) – The spin multiplicity of the TS. Defaults to
1
.
-save_dir (str, optional) – The directory path to save the results. Defaults to
None
.
-
-- Returns: -
RDKitMol – The molecule in RDKitMol object with verification results stored in
-KeepIDs
.
-
-
-
- -class rdmc.conformer_generation.ts_verifiers.QChemIRCVerifier(method: str = 'wB97x-d3', basis: str = 'def2-tzvp', nprocs: int = 1, track_stats: bool = False)# -
Bases:
-TSVerifier
The class for verifying the TS by calculating and checking its IRC analysis using QChem.
--
-
- Parameters: -
-
-
method (str, optional) – The method to be used for TS optimization. you can use the method available in QChem. -Defaults to
"wB97x-d3"
.
-basis (str, optional) – The method to be used for TS optimization. you can use the basis available in QChem. -Defaults to
"def2-tzvp"
.
-nprocs (int, optional) – The number of processors to use. Defaults to
1
.
-track_stats (bool, optional) – Whether to track the status. Defaults to
False
.
-
-
-
-
- -verify_ts_guesses(ts_mol: RDKitMol, multiplicity: int = 1, save_dir: str | None = None, **kwargs)# -
Verifying TS guesses (or optimized TS geometries).
--
-
- Parameters: -
-
-
ts_mol ('RDKitMol') – The TS in RDKitMol object with 3D geometries embedded.
-multiplicity (int, optional) – The spin multiplicity of the TS. Defaults to
1
.
-save_dir (_type_, optional) – The directory path to save the results. Defaults to
None
.
-
-- Returns: -
RDKitMol – The molecule in RDKitMol object with verification results stored in
-KeepIDs
.
-
-
-
- -class rdmc.conformer_generation.ts_verifiers.TSScreener(trained_model_dir: str, threshold: float = 0.95, track_stats: bool | None = False)# -
Bases:
-TSVerifier
The class for screening TS guesses using graph neural networks.
--
-
- Parameters: -
-
-
trained_model_dir (str) – The path to the directory storing the trained TS-Screener model.
-threshold (float) – Threshold prediction at which we classify a failure/success. Defaults to
0.95
.
-track_stats (bool, optional) – Whether to track timing stats. Defaults to
False
.
-
-
-
-
- -verify_ts_guesses(ts_mol: RDKitMol, multiplicity: int = 1, save_dir: str | None = None, **kwargs) → RDKitMol# -
Screen poor TS guesses by using reacting mode from frequency calculation.
--
-
- Parameters: -
-
-
ts_mol ('RDKitMol') – The TS in RDKitMol object with 3D geometries embedded.
-multiplicity (int, optional) – The spin multiplicity of the TS. Defaults to 1.
-save_dir (str, optional) – The directory path to save the results. Defaults to None.
-
-- Returns: -
RDKitMol – The molecule in RDKitMol object with verification results stored in
-KeepIDs
.
-
-
-
- -class rdmc.conformer_generation.ts_verifiers.TSVerifier(track_stats: bool = False)# -
Bases:
-object
The abstract class for TS verifiers.
--
-
- Parameters: -
track_stats (bool, optional) – Whether to track status. Defaults to
-False
.
-
-
-
- -verify_ts_guesses(ts_mol: RDKitMol, multiplicity: int = 1, save_dir: str | None = None, **kwargs)# -
The abstract method for verifying TS guesses (or optimized TS geometries). The method need to take -
-ts_mol
inRDKitMol
,keep_ids
inlist
,multiplicity
inint
, andsave_dir
instr
.-
-
- Parameters: -
-
-
ts_mol ('RDKitMol') – The TS in RDKitMol object with 3D geometries embedded.
-multiplicity (int, optional) – The spin multiplicity of the TS. Defaults to
1
.
-save_dir (str, optional) – The directory path to save the results. Defaults to
None
.
-
-- Raises: -
NotImplementedError – This method needs to be implemented in the subclass.
-
-
-
-
- -class rdmc.conformer_generation.ts_verifiers.XTBFrequencyVerifier(cutoff_frequency: float = -100.0, track_stats: bool = False)# -
Bases:
-TSVerifier
The class for verifying the TS by calculating and checking its frequencies using XTB.
--
-
- Parameters: -
-
-
cutoff_frequency (float, optional) – Cutoff frequency above which a frequency does not correspond to a TS -imaginary frequency to avoid small magnitude frequencies which correspond to internal bond rotations -Defaults to
-100.
cm-1
-track_stats (bool, optional) – Whether to track stats. Defaults to
False
.
-
-
-
-
- -verify_ts_guesses(ts_mol: RDKitMol, multiplicity: int = 1, save_dir: str | None = None, **kwargs) → RDKitMol# -
Verifying TS guesses (or optimized TS geometries).
--
-
- Parameters: -
-
-
ts_mol ('RDKitMol') – The TS in RDKitMol object with 3D geometries embedded.
-multiplicity (int, optional) – The spin multiplicity of the TS. Defaults to
1
.
-save_dir (str, optional) – The directory path to save the results. Defaults to
None
.
-
-- Returns: -
RDKitMol – The molecule in RDKitMol object with verification results stored in
-KeepIDs
.
-
rdmc.conformer_generation.ts_verifiers#
rdmc.conformer_generation.verifiers#
-Modules for verifying optimized stable species
--
-
- -class rdmc.conformer_generation.verifiers.Verifier(track_stats: bool = False)# -
Bases:
-object
The abstract class for verifiers.
--
-
- Parameters: -
track_stats (bool, optional) – Whether to track status. Defaults to
-False
.
-
-
-
- -verify_guesses(mol: RDKitMol, multiplicity: int = 1, save_dir: str | None = None, **kwargs)# -
The abstract method for verifying guesses (or optimized stable species geometries). The method need to take -
-mol
in RDKitMol,keep_ids
in list,multiplicity
in int, andsave_dir
in str, and returns -alist
indicating the ones passing the check.-
-
- Parameters: -
-
-
mol ('RDKitMol') – The stable species in RDKitMol object with 3D geometries embedded.
-multiplicity (int, optional) – The spin multiplicity of the stable species. Defaults to
1
.
-save_dir (_type_, optional) – The directory path to save the results. Defaults to
None
.
-
-- Raises: -
NotImplementedError –
-
-
-
-
- -class rdmc.conformer_generation.verifiers.XTBFrequencyVerifier(cutoff_frequency: float = -100.0, track_stats: bool = False)# -
Bases:
-Verifier
The class for verifying the stable species by calculating and checking its frequencies using XTB.
--
-
- Parameters: -
-
-
cutoff_frequency (float, optional) – Cutoff frequency above which a frequency does not correspond to a TS -imaginary frequency to avoid small magnitude frequencies which correspond to internal bond rotations -Defaults to
-100.
cm-1.
-track_stats (bool, optional) – Whether to track stats. Defaults to
False
.
-
-
-
-
- -verify_guesses(mol: RDKitMol, multiplicity: int = 1, save_dir: str | None = None, **kwargs)# -
Verifying stable species guesses (or optimized stable species geometries).
--
-
- Parameters: -
-
-
mol ('RDKitMol') – The stable species in RDKitMol object with 3D geometries embedded.
-multiplicity (int, optional) – The spin multiplicity of the stable species. Defaults to
1
.
-save_dir (_type_, optional) – The directory path to save the results. Defaults to
None
.
-
-- Returns: -
RDKitMol – The molecule in RDKitMol object with verification results stored in
-KeepIDs
.
-
rdmc.conformer_generation.verifiers#
Utils#
-Utilities for conformer generation modules.
--
-
- -rdmc.conformer_generation.utils.cluster_confs(mol: RDKitMol, cutoff: float = 1.0) → RDKitMol# -
Cluster conformers of a molecule based on RMSD.
--
-
- Parameters: -
-
-
mol ('RDKitMol') – An RDKitMol object.
-cutoff (float, optional) – The cutoff for clustering. Defaults to
1.0
.
-
-- Returns: -
mol (‘RDKitMol’) – An RDKitMol object with clustered conformers.
-
-
-
-
- -rdmc.conformer_generation.utils.convert_log_to_mol(log_path: str, amplitude: float = 1.0, num_frames: int = 10, weights: bool | array = False) → None | RDKitMol# -
Convert a TS optimization log file to an RDKitMol object with conformers.
--
-
- Parameters: -
-
-
log_path (str) – The path to the log file.
-amplitude (float) – The amplitude of the motion. If a single value is provided then the guess -will be unique (if available).
0.25
is the default. Otherwise, a list -can be provided, and all possible results will be returned.
-num_frames (int) – The number of frames in each direction (forward and reverse). Defaults to
10
.
-weights (bool or np.array) – If
True
, use the sqrt(atom mass) as a scaling factor to the displacement. -IfFalse
, use the identity weights. If a N x 1np.array
is provided, then -The concern is that light atoms (e.g., H) tend to have larger motions -than heavier atoms.
-
-- Returns: -
mol (‘RDKitMol’) – An RDKitMol object.
-
-
-
-
- -rdmc.conformer_generation.utils.dict_to_mol(mol_data: List[dict], conf_copy_attrs: list | None = None)# -
Convert a dictionary that stores its conformers object, atom coordinates, -and conformer-level attributes to an RDKitMol. The method assumes that the -first conformer’s owning mol contains the conformer-level attributes, which -are extracted through the Copy function (this should be the case if the -dictionary was generated with the
-mol_to_dict
function).-
-
- Parameters: -
-
-
mol_data (list) – A list containing dictionaries of data entries for each conformer.
-conf_copy_attrs (list, optional) – Conformer-level attributes to copy to the mol. -Defaults to
None
, which means no attributes will be copied.
-
-- Returns: -
mol (‘RDKitMol’) – An RDKitMol object.
-
-
-
-
- -rdmc.conformer_generation.utils.get_conf_failure_mode(rxn_dir: str, pruner: bool = True) → dict# -
Parse a reaction directory for a TS generation run and extract failure modes (which conformer failed the -full workflow and for what reason).
--
-
- Parameters: -
-
-
rxn_dir (str) –
-(bool (pruner) – Optional) Whether or not pruner was used during workflow. Defaults to
True
.
-
-- Returns: -
failure_dict (‘dict’) – Dictionary of conformer ids mapped to the corresponding failure mode. -the
-failure_mode
can be one of the following: -opt
,prune
,freq
,irc
,workflow
,none
.
-
-
-
- -rdmc.conformer_generation.utils.get_frames_from_freq(log: ~rdmc.external.logparser.gaussian.GaussianLog, amplitude: float = 1.0, num_frames: int = 10, weights: bool | ~numpy.array = False) -> (<built-in function array>, <built-in function array>)# -
Get the reaction mode as frames from a TS optimization log file.
--
-
- Parameters: -
-
-
log (GaussianLog) – A gaussian log object with vibrational freq calculated.
-amplitude (float) – The amplitude of the motion. If a single value is provided then the guess -will be unique (if available).
0.25
is the default. Otherwise, a list -can be provided, and all possible results will be returned.
-num_frames (int) – The number of frames in each direction (forward and reverse). Defaults to
10
.
-weights (bool or np.array) – If
True
, use the sqrt(atom mass) as a scaling factor to the displacement. -IfFalse
, use the identity weights. If a N x 1np.array
is provided, then -The concern is that light atoms (e.g., H) tend to have larger motions -than heavier atoms.
-
-- Returns: -
-
-
np.array – The atomic numbers as an 1D array
-np.array – The 3D geometries at each frame as a 3D array (number of frames x 2 + 1, number of atoms, 3)
-
-
-
-
- -rdmc.conformer_generation.utils.mol_to_dict(mol: RDKitMol, copy: bool = True, iter: int | None = None, conf_copy_attrs: list | None = None) → List[dict]# -
Convert a molecule to a dictionary that stores its conformers object, atom coordinates, -and iteration numbers for a certain calculation (optional).
--
-
- Parameters: -
-
-
mol ('RDKitMol') – An RDKitMol object.
-copy (bool, optional) – Use a copy of the molecule to process data. Defaults to
True
.
-iter (int, optional) – Number of iterations. Defaults to
None
.
-conf_copy_attrs (list, optional) – Conformer-level attributes to copy to the dictionary. -Defaults to
None
, which means no attributes will be copied.
-
-- Returns: -
list – mol data as a list of dict; each dict corresponds to a conformer.
-
-
Utils#
rdmc.conformer_generation.generators#
-Modules for conformer generation workflows
--
-
- -class rdmc.conformer_generation.generators.ConformerGenerator(smiles: str, multiplicity: int | None = None, optimizer: ConfGenOptimizer | None = None, pruner: ConfGenPruner | None = None, verifiers: Verifier | List[Verifier] | None = None, sampler: TorisonalSampler | None = None, final_modules: ConfGenOptimizer | Verifier | None = None, save_dir: str | None = None)# -
Bases:
-object
A module for conformer generation. The workflow follows an embed -> optimize -> prune cycle with -custom stopping criteria. Additional final modules can be added at the user’s discretion.
--
-
- Parameters: -
-
-
smiles (str) – SMILES input for which to generate conformers.
-multiplicity (int, optional) – The spin multiplicity of the species. Defaults to
None
, -which will be interpreted from molecule generated by the smiles.
-optimizer (ConfGenOptimizer, optional) – Instance of a
ConfGenOptimizer
. -Available options areXTBOptimizer
, -GaussianOptimizer
, and -MMFFOptimizer
.
-pruner (ConfGenPruner, optional) – Instance of a
ConfGenPruner
. Available options are -CRESTPruner
and -TorsionPruner
.
-verifiers (Verifier, optional) – Instance of a
Verifier
. -Available option isXTBFrequencyVerifier
.
-sampler (TorsionalSampler, optional) – Instance of a
TorsionalSampler
.
-final_modules (list) – List of instances of optimizer/pruner to run after initial cycles complete.
-save_dir (str or Pathlike object, optional) – The path to save the intermediate files and outputs generated during the generation.
-
-
-
-
- -embed_stable_species(smiles: str, n_conformers: int = 20) → RDKitMol# -
Embed the well conformer according to the SMILES provided.
--
-
- Parameters: -
-
-
smiles (str) – The well conformer SMILES.
-n_conformers (int, optional) – The maximum number of conformers to be generated. Defaults to
20
.
-
-- Returns: -
An RDKitMol of the well conformer with 3D geometry embedded.
-
-
-
-
- -set_filter(mol: RDKitMol, n_conformers: int) → list# -
Assign the indices of conformers to track whether the conformers are passed to the following steps.
--
-
- Parameters: -
-
-
mol ('RDKitMol') – The stable species in RDKitMol object with 3D geometries embedded.
-n_conformers (int) – The maximum number of conformers to be passed to the following steps.
-
-- Returns: -
RDKitMol – with
-KeepIDs
as a list ofTrue
andFalse
indicating whether a conformer passes the check.
-
-
-
- -class rdmc.conformer_generation.generators.StochasticConformerGenerator(smiles, embedder: ConfGenEmbedder | None = None, optimizer: ConfGenOptimizer | None = None, estimator: Estimator | None = None, pruner: ConfGenPruner | None = None, metric: SCGMetric | None = None, min_iters: int | None = None, max_iters: int | None = None, final_modules: list | None = None, config: dict | None = None, track_stats: bool = False)# -
Bases:
-object
A module for stochastic conformer generation. The workflow follows an embed -> optimize -> prune cycle with -custom stopping criteria. Additional final modules can be added at the user’s discretion.
--
-
- Parameters: -
-
-
smiles (str) – SMILES input for which to generate conformers.
-embedder (ConfGenEmbedder, optional) – Instance of a
ConfGenEmbedder
. -Available options areETKDGEmbedder
, -GeoMolEmbedder
, and -RandomEmbedder
.
-optimizer (ConfGenOptimizer, optional) – Instance of a
ConfGenOptimizer
. -Available options areXTBOptimizer
, -GaussianOptimizer
, and -MMFFOptimizer
.
-estimator (Estimator, optional) – Instance of an
Estimator
. Available option is -ConfSolv
.
-pruner (ConfGenPruner, optional) – Instance of a
ConfGenPruner
. Available options are -CRESTPruner
and -TorsionPruner
.
-metric (SCGMetric, optional) – The available option is SCGMetric <rdmc.conformer_generation.metrics.SCGMetric>.
-min_iters (int, optional) – Minimum number of iterations for which to run the module.
-(int (max_iters) – Maximum number of iterations for which to run the module.
-optional} – Maximum number of iterations for which to run the module.
-final_modules (list) – List of instances of optimizer/pruner to run after initial cycles complete.
-
-
-
-
- -set_config(config: str, embedder: ConfGenEmbedder | None = None, optimizer: ConfGenOptimizer | None = None, pruner: ConfGenPruner | None = None, metric: SCGMetric | None = None, min_iters: int | None = None, max_iters: int | None = None, final_modules: list | None = None)# -
Set the configuration for the conformer generator with pre-defined options:
-"loose"
and"normal"
.-
-
- Parameters: -
-
-
embedder (ConfGenEmbedder, optional) – Instance of a
ConfGenEmbedder
. -Available options areETKDGEmbedder
, -GeoMolEmbedder
, and -RandomEmbedder
. -Defaults toETKDGEmbedder
.
-optimizer (ConfGenOptimizer, optional) – Instance of a
ConfGenOptimizer
. -Available options areXTBOptimizer
, -GaussianOptimizer
, and -MMFFOptimizer
. Defaults to -XTBOptimizer
with"gff"
method.
-pruner (ConfGenPruner, optional) – Instance of a
ConfGenPruner
. Available options are -CRESTPruner
and -TorsionPruner
. By default, -"loose"
utilizesTorsionPruner
with -mean_chk_threshold=20
andmax_chk_threshold=30
, and"normal"
utilizes -CRESTPruner
.
-metric (SCGMetric, optional) – The available option is SCGMetric <rdmc.conformer_generation.metrics.SCGMetric>. -By default, both modes use
"entropy"
metric, while"loose"
withwindow=3
andthreshold=0.05
, -and"normal"
withwindow=5
andthreshold=0.01
.
-min_iters (int, optional) – Minimum number of iterations for which to run the module. Defaults to
3
for"loose"
and5
for"normal"
.
-(int (max_iters) – Maximum number of iterations for which to run the module. Defaults to
20
for"loose"
and100
for"normal"
.
-optional} – Maximum number of iterations for which to run the module. Defaults to
20
for"loose"
and100
for"normal"
.
-final_modules (list) – List of instances of optimizer/pruner to run after initial cycles complete. By default, no final modules are used for
"loose"
. -For"normal"
, twoCRESTPruner
withewin=12
andewin=6
, are introduced -before and after aXTBOptimizer
with"gfn2"
method -and"vtight"
level.
-
-
rdmc.conformer_generation.generators#
Workflow#
-
-
- rdmc.conformer_generation.generators - -
- rdmc.conformer_generation.ts_generators - -
- rdmc.conformer_generation.metrics
-
-
SCGMetric
-
- - rdmc.conformer_generation.sampler - +
- rdmc.conformer_generation.generators +
- rdmc.conformer_generation.ts_generators +
- rdmc.conformer_generation.metrics +
- rdmc.conformer_generation.sampler
rdmc.conformer_generation.metrics#
-Modules for computing metrics to decide when to stop generating conformers
--
-
- -class rdmc.conformer_generation.metrics.SCGMetric(metric: str | None = 'entropy', window: int | None = 5, threshold: float | None = 0.01, T: float | None = 298)# -
Bases:
-object
A class to calculate and track the given metric (“entropy”, “partition function”, or “total conformers”) for a molecule over time.
--
-
- Parameters: -
-
-
metric (str, optional) – Metric to be calculated. Options are
"entropy"
,"partition function"
, or"total conformers"
. -Defaults to"entropy"
.
-window (int, optional) – Window size to compute the change in metric (doesn’t work when the metric is “total conformers”). -Defaults to
5
.
-threshold (float, optional) – Threshold for the change in metric to decide when to stop generating conformers. -Defaults to
0.01
.
-T (float, optional) – Temperature for entropy or partition function calculations. Defaults to
298
K.
-
-
-
-
- -calculate_entropy(mol_data: List[dict])# -
Calculate the entropy of a molecule.
--
-
- Parameters: -
mol_data (List[dict]) – A list of dictionaries with molecule conformers.
-
-
-
-
- -calculate_metric(mol_data: List[dict])# -
Calculate the metric for a given molecule. The calculated value will be appended to the
-metric_history
list.-
-
- Parameters: -
mol_data (List[dict]) – A list of dictionaries with molecule conformers.
-
-
-
-
- -calculate_partition_function(mol_data: List[dict])# -
Calculate the partition function of a molecule.
--
-
- Parameters: -
mol_data (List[dict]) – A list of dictionaries with molecule conformers.
-
-
-
-
- -check_metric()# -
Check if the change in metric is below the threshold.
--
-
- Returns: -
bool –
-True
if the change in metric is below the threshold,False
otherwise.
-
rdmc.conformer_generation.metrics#
rdmc.conformer_generation.sampler#
-Modules for torsional sampling
--
-
- -class rdmc.conformer_generation.sampler.TorsionalSampler(method: str = 'GFN2-xTB', nprocs: int = 1, memory: int = 1, n_point_each_torsion: int = 45, n_dimension: int = 2, optimizer: ConfGenOptimizer | TSOptimizer | None = None, pruner: ConfGenPruner | None = None, verifiers: TSVerifier | Verifier | List[TSVerifier] | List[Verifier] | None = None)# -
Bases:
-object
A class to find possible conformers by sampling the PES for each torsional pair. -You have to have the Sparrow and xtb-python packages installed to run this workflow.
--
-
- Parameters: -
-
-
method (str, optional) – The method to be used for automated conformer search. Only the methods available in Spharrow and xtb-python can be used. -Defaults to
"GFN2-xTB"
.
-nprocs (int, optional) – The number of processors to use. Defaults to
1
.
-memory (int, optional) – Memory in GB used by Gaussian. Defaults to
1
.
-n_point_each_torsion (float, optional) – Number of points to be sampled along each rotational mode. Defaults to
45.
.
-n_dimension (int, optional) – Number of dimensions. Defaults to
2
. If-1
is assigned, the number of dimension would be the number of rotatable bonds.
-optimizer (ConfGenOptimizer or TSOptimizer, optional) – The optimizer used to optimize TS or stable specials geometries. Available options for -TSOptimizer <rdmc.conformer_generation.ts_optimizers.TSOptimizer> -are
SellaOptimizer
, -OrcaOptimizer
, -andGaussianOptimizer
.
-pruner (ConfGenPruner, optional) – The pruner used to prune conformers based on geometric similarity after optimization. Available options are -
CRESTPruner
and -TorsionPruner
.
-verifiers (TSVerifier, Verifier, list of TSVerifiers or list of Verifiers, optional) – The verifier or a list of verifiers used to verify the obtained conformer. Available -options are -
GaussianIRCVerifier
, -OrcaIRCVerifier
, and -XTBFrequencyVerifier
.
-
-
-
-
- -get_conformers_by_change_torsions(mol: RDKitMol, id: int = 0, torsions: list | None = None, exclude_methyl: bool = True, on_the_fly_check: bool = True) → List[RDKitMol]# -
Generate conformers by rotating the angles of the torsions. A on-the-fly check -can be applied, which identifies the conformers with colliding atoms.
--
-
- Parameters: -
-
-
mol (RDKitMol) – A RDKitMol molecule object.
-id (int) – The ID of the conformer to be obtained. Defaults to
0
.
-torsions (list) – A list of four-atom-index lists indicating the torsional modes. Defaults to
None
, -which means all the rotatable bonds will be used.
-exclude_methyl (bool) – Whether exclude the torsions with methyl groups. Defaults to
False
. -Only valid iftorsions
is not provided.
-on_the_fly_filter (bool) – Whether to check colliding atoms on the fly. Defaults to
True
.
-
-- Returns: -
lis – A list of RDKitMol of sampled 3D geometries for each torsional mode.
-
-
-
-
- -rdmc.conformer_generation.sampler.get_energy(mol: RDKitMol, confId: int = 0, method: str = 'GFN2-xTB') → float# -
Calculate the energy of the
-RDKitMol
with givenconfId
. The unit is in kcal/mol. -Only support methods already supported either in sparrow or xtb-python.-
-
- Parameters: -
-
-
mol (RDKitMol) – A RDKitMol molecule object.
-confId (int) – The ID of the conformer for calculating energy. Defaults to
0
.
-method (str) – Which semi-empirical method to be used in running energy calculation. Defaults to
"GFN2-xTB"
.
-
-- Returns: -
The energy of the conformer.
-
-
-
-
- -rdmc.conformer_generation.sampler.get_separable_angle_list(samplings: List | Tuple, from_angles: List | Tuple | None = None) → List[List]# -
Get a angle list for each input dimension. For each dimension -The input can be a
-int
indicating the angles will be evenly sampled; -or alist
indicating the angles to be sampled;-
-
- Parameters: -
-
-
samplings (Union[List, Tuple]) – An array of sampling information. -For each element, it can be either list or int.
-from_angles (Union[List, Tuple]) – An array of initial angles. -If not set, all angles will begin at zeros.
-
-- Returns: -
list – A list of sampled angles sets.
-
-
Examples
---get_separable_angle_list([[120, 240,], 4, 0]) ->>> [[120, 240], [0, 90, 180, 270], [0]] -
-
-
- -rdmc.conformer_generation.sampler.plot_heat_map(energies: ndarray, minimum_points: List[Tuple], save_path: str, mask: ndarray | None = None, detailed_view: bool = False, title: str | None = None)# -
Plot and save the heat map of a given PES.
--
-
- Parameters: -
-
-
energies (np.ndarray) – A
np.ndarray
containing the energies for each sampled point.
-minimum_points (List[Tuple]) – A list of tuples containing the indices of the minimum points.
-save_path (str) – The path to save the plot.
-mask (np.ndarray, optional) – A
np.ndarray
containing the mask for the energies.
-detailed_view (bool) – Whether to plot the detailed view of the PES. Defaults to
False
.
-title (str, optional) – The title of the plot.
-
-
-
-
- -rdmc.conformer_generation.sampler.preprocess_energies(energies: ndarray) → Tuple[ndarray, ndarray]# -
Rescale the energy based on the lowest energy.
--
-
- Parameters: -
energies (np.ndarray) – A np.ndarray containing the energies for each sampled point.
-
-- Returns: -
tuple – The rescaled energies and the mask pointing out positions having values
-
-
rdmc.conformer_generation.sampler#
rdmc.conformer_generation.ts_generators#
-Modules for TS conformer generation workflows.
--
-
- -class rdmc.conformer_generation.ts_generators.TSConformerGenerator(rxn_smiles: str, multiplicity: int | None = None, use_smaller_multiplicity: bool = True, embedder: TSInitialGuesser | None = None, optimizer: TSOptimizer | None = None, pruner: ConfGenPruner | None = None, verifiers: TSVerifier | List[TSVerifier] | None = None, sampler: TorisonalSampler | None = None, final_modules: TSOptimizer | TSVerifier | List[TSVerifier] | None = None, save_dir: str | None = None)# -
Bases:
-object
The class used to define a workflow for generating a set of TS conformers.
--
-
- Parameters: -
-
-
rxn_smiles (str) – The SMILES of the reaction. The SMILES should be formatted similar to
"reactant1.reactant2>>product1.product2."
.
-multiplicity (int, optional) – The spin multiplicity of the reaction. The spin multiplicity will be interpreted from the reaction smiles if this -is not given by the user.
-use_smaller_multiplicity (bool, optional) – Whether to use the smaller multiplicity when the interpreted multiplicity from the reaction smiles is -inconsistent between reactants and products. Defaults to
True
.
-embedder (TSInitialGuesser, optional) – Instance of a
TSInitialGuesser
. Available options are -TSEGNNGuesser
, -TSGCNGuesser
, -AutoNEBGuesser
, -RMSDPPGuesser
, and -DEGSMGuesser
.
-optimizer (TSOptimizer, optional) – Instance of a
TSOptimizer
. Available options are -SellaOptimizer
, -OrcaOptimizer
, -GaussianOptimizer
, and -QChemOptimizer
.
-pruner (ConfGenPruner, optional) – The pruner used to prune conformers based on geometric similarity after optimization. -Instance of a
ConfGenPruner
. Available options are -CRESTPruner
and -TorsionPruner
.
-verifiers (TSVerifier or list of TSVerifiers, optional) – The verifier or a list of verifiers used to verify the obtained TS conformer. -Instance of a
TSVerifier
. -Available options are -XTBFrequencyVerifier
, -GaussianIRCVerifier
, -OrcaIRCVerifier
, -QChemIRCVerifier
, and -TSScreener
.
-sampler (TorisonalSampler, optional) – The sampler used to do automated conformer search for the obtained TS conformer. You can use -
TorsionalSampler
to define your own sampler.
-final_modules (TSOptimizer, TSVerifier or list of TSVerifiers, optional) – The final modules can include optimizer in different LoT than previous -one and verifier(s) used to verify the obtained TS conformer.
-save_dir (str or Pathlike object, optional) – The path to save the intermediate files and outputs generated during the generation. Defaults to
None
.
-
-
-
-
- -embed_stable_species(smiles: str) → rdmc.RDKitMol# -
Embed the reactant and product complex according to the SMILES provided.
--
-
- Parameters: -
smiles (str) – The reactant or product complex in SMILES. if multiple molecules involve, -use
-"."
to separate them.
-- Returns: -
RDKitMol – An RDKitMol of the reactant or product complex with 3D geometry embedded.
-
-
-
-
- -generate_seed_mols(rxn_smiles: str, n_conformers: int = 20, shuffle: bool = False) → list# -
Genereate seeds of reactant/product pairs to be passed to the following steps.
--
-
- Parameters: -
-
-
rxn_smiles (str) – The reaction smiles of the reaction.
-n_conformers (int, optional) – The maximum number of conformers to be generated. Defaults to
20
.
-shuffle (bool, optional) – Whether or not to shuffle the embedded mols. Defaults to
False
.
-
-- Returns: -
list – A list of reactant/product pairs in
-RDKitMol
.
-
-
-
- -set_filter(ts_mol: RDKitMol, n_conformers: int) → RDKitMol# -
Assign the indices of reactions to track whether the conformers are passed to the following steps.
--
-
- Parameters: -
-
-
ts_mol ('RDKitMol') – The TS in RDKitMol object with 3D geometries embedded.
-n_conformers (int) – The maximum number of conformers to be passed to the following steps.
-
-- Returns: -
RDKitMol – with
-KeepIDs
as a list ofTrue
andFalse
indicating whether a conformer passes the check.
-
rdmc.conformer_generation.ts_generators#
-
-
- rdmc.external.logparser.base
-
-
BaseLog
-
-CclibLog
-
-
CclibLog.all_geometries
-CclibLog.cclib_results
-CclibLog.charge
-CclibLog.converged_geometries
-CclibLog.freqs
-CclibLog.get_best_opt_geom()
-CclibLog.get_converged_geom_idx()
-CclibLog.get_irc_midpoint()
-CclibLog.get_lowest_e_geometry()
-CclibLog.get_mol()
-CclibLog.get_scannames()
-CclibLog.get_scanparams()
-CclibLog.get_scf_energies()
-CclibLog.get_xyzs()
-CclibLog.guess_rxn_from_irc()
-CclibLog.guess_rxn_from_normal_mode()
-CclibLog.initial_geometry
-CclibLog.interact_freq()
-CclibLog.interact_irc()
-CclibLog.interact_opt()
-CclibLog.interact_scan()
-CclibLog.multiplicity
-CclibLog.neg_freqs
-CclibLog.num_all_geoms
-CclibLog.num_converged_geoms
-CclibLog.num_neg_freqs
-CclibLog.opt_convergence
-CclibLog.optstatus
-CclibLog.plot_irc_energies()
-CclibLog.plot_opt_convergence()
-CclibLog.plot_scan_energies()
-CclibLog.view_freq()
-CclibLog.view_mol()
-CclibLog.view_traj()
-
-
- - rdmc.external.logparser.gaussian - -
- rdmc.external.logparser.qchem - -
- rdmc.external.logparser.orca - -
- rdmc.external.logparser.utils - +
- rdmc.external.logparser.base +
- rdmc.external.logparser.gaussian +
- rdmc.external.logparser.qchem +
- rdmc.external.logparser.orca +
- rdmc.external.logparser.utils
rdmc.external.logparser.base#
--
-
- -class rdmc.external.logparser.base.BaseLog(path: str, job_type: list | None = None, ts: bool | None = None)# -
Bases:
-object
The base class helps to parse the log files and provides information -helpful to analyze the calculation.
--
-
- -auto_update_prop()# -
A decorator to update the property automatically.
--
-
- Parameters: -
update_fun (str) – The method name for the update function.
-
-
Examples
-This decorator can be used as follows:
---@property -@auto_update_prop('update_prop1') -def prop1(self): - "docstring for prop1" - -def update_prop1(self): - # define how to get the value of prop1 - # and set the value to self._prop1 -
-
-
- -property finished# -
-
-
- -property is_ts# -
-
-
- -property job_type# -
-
-
- -opt_criteria = []# -
-
-
- -require_job_type()# -
A decorator to check the job type.
-
-
-
- -require_ts()# -
A decorator to check if the job involves ts.
-
-
-
- -property schemes# -
-
-
- -property success# -
-
-
- -property termination_time# -
-
-
- -time_regex = ''# -
-
-
- -class rdmc.external.logparser.base.CclibLog(path: str, job_type: list | None = None, ts: bool | None = None)# -
Bases:
-BaseLog
This class parses the log files using cclib.
--
-
- -property all_geometries# -
Return all geometries in the file as a numpy array.
--
-
- Returns: -
np.ndarray
-
-
-
-
- -property cclib_results# -
Get the cclib results.
-
-
-
- -property charge# -
The charge of the molecule.
--
-
- Returns: -
int
-
-
-
-
- -property converged_geometries# -
Return converged geometries as a numpy array.
--
-
- Returns: -
np.ndarray
-
-
-
-
- -property freqs# -
Return the frequency as a numpy array.
-
-
-
- -get_best_opt_geom(*args, **kwargs)# -
-
-
- -get_converged_geom_idx(as_numbers: bool = False)# -
Return the indexes of geometries that are converged. By default, a -numpy array of True and False will be returned. But you can output numeric -results by changing the argument.
--
-
- Parameters: -
as_numbers (bool) – Whether returns a list of numbers. Defaults to
-False
for better performance.
-- Returns: -
np.array
-
-
-
-
- -get_irc_midpoint(*args, **kwargs)# -
-
-
- -get_lowest_e_geometry(as_xyz: bool = False)# -
Get the geometry with the lowest energy in a job. By default its ID is returned.
--
-
- Parameters: -
as_xyz (bool) – if
-True
, the xyz str is returned rather than ID.
-- Returns: -
-
-
- int – the ID of the conformer
-- str – the XYZ of the conformer
-
-
-
-
- -get_mol(refid: int = -1, embed_conformers: bool = True, converged: bool = True, neglect_spin: bool = True, backend: str = 'openbabel', sanitize: bool | None = None) → RDKitMol# -
Perceive the xyzs in the file, create a
-rdmc.mol.RDKitMol()
and convert the geometries to its conformers.-
-
- Parameters: -
-
-
refid (int) –
The conformer ID in the log file to be used as the reference for mol perception. -Defaults to
--1
, meaning it is determined by the following criteria:-
-
For opt, it is the last geometry if succeeded; otherwise, the initial geometry;
-For freq, it is the geometry input;
-For scan, it is the geometry input;
-For IRC, uses the initial geometry if bidirectional job; uses the last converged -geometry if uni-directional job.
-
-embed_confs (bool) – Whether to embed intermediate conformers in the file to the obtained molecule. -Defaults to
True
. To be clear, at least one conformer will be included in -obtained mol, and its geometry is determined byrefid
.
-converged (bool) – Whether to only embed converged conformers to the obtained molecule. This option -is only valid when
embed_confs
isTrue
.
-neglect_spin (bool) – Whether to neglect the error when spin multiplicity are different -between the generated mol and the value in the output file. This -can be useful for calculations involves TS. Defaults to
True
.
-backend (str) – The backend engine for parsing XYZ. Defaults to
'openbabel'
.
-sanitize (bool) – Whether to sanitize the generated molecule. Defaults to
True
. -If a TS involved in the job, better to set itFalse
.
-
-- Returns: -
RDKitMol – a molecule generated from the output file.
-
-
-
-
- -get_scannames(*args, **kwargs)# -
-
-
- -get_scanparams(*args, **kwargs)# -
-
-
- -get_scf_energies(converged: bool = True, only_opt: bool = False, relative: bool = False)# -
Get SCF energies in kcal/mol.
--
-
- Parameters: -
-
-
converged (bool) – Only get the SCF energies for converged geometries.’ -Defaults to
True
.
-only_opt (bool) – For composite method like CBS-QB3, you can choose only to -return SCF energies only for the optimization step. Defaults -to
False
.
-relative (bool) – Only return the value relative to the minimum. Defaults to
False
.
-
-- Returns: -
np.array – The SCF energies.
-
-
-
-
- -get_xyzs(converged: bool = True, initial_geom: bool = True)# -
Get the xyz strings of geometries stored in the output file.
--
-
- Parameters: -
-
-
converged (bool) – Only return the xyz strings for converged molecules. -Defaults to True.
-initial_geom (bool) – By default cclib_results will replace the geometry 1 (index 0) -with the converged geometry. This options allows to keep the -geometry 1 as the input geometry. Defaults to True.
-
-
-
-
- -guess_rxn_from_irc(*args, **kwargs)# -
-
-
- -guess_rxn_from_normal_mode(amplitude: float = 0.25, atom_weighted: bool = False, inverse: bool = False, backend: str = 'openbabel')# -
Guess the reactants and products from the mode of the imaginary frequency. Note: this -result is not deterministic depending on the amplitude you use.
--
-
- Parameters: -
-
-
amplitude (int) – The amplitude factor on the displacement matrix to generate the -guess geometry for the reactant and the product. A smaller factor -makes the geometry close to the TS, while a wildly large factor -makes the geometry nonphysical. Can be either a float or a list of floats.
-atom_weighted (bool) – If use the sqrt(atom mass) as a scaling factor to the displacement. -The concern is that light atoms (e.g., H) tend to have larger motions -than heavier atoms.
-inverse (bool) – Inverse the direction of the reaction. Defaults to
False
.
-backend (str) – The backend engine for parsing XYZ. Defaults to
'openbabel'
.
-
-
-
-
- -property initial_geometry# -
Return the initial geometry of the job. For scan jobs and ircs jobs. -Intermediate guesses will not be returned.
-
-
-
- -interact_freq()# -
Create a IPython interactive widget to investigate the frequency calculation.
-
-
-
- -interact_irc(sanitize: bool = False, converged: bool = True, backend: str = 'openbabel', continuous_update: bool = False) → <ipywidgets.widgets.interaction._InteractFactory object at 0x7f3e07cf2710># -
Create a IPython interactive widget to investigate the IRC results.
--
-
- Parameters: -
-
-
sanitize (bool) – Whether to sanitize the molecule. Defaults to
False
.
-converged (bool) – Whether to only embed converged conformers to the mol. Defaults to
True
.
-backend (str) – The backend engine for parsing XYZ. Defaults to
'openbabel'
.
-continuous_update (bool) – Whether to update the widget continuously. Defaults to
False
.
-
-- Returns: -
interact
-
-
-
-
- -interact_opt(sanitize: bool = True, backend: str = 'openbabel', continuous_update: bool = False) → <ipywidgets.widgets.interaction._InteractFactory object at 0x7f3e07cf2710># -
Create a IPython interactive widget to investigate the optimization convergence.
--
-
- Parameters: -
-
-
sanitize (bool, optional) – Whether to sanitize the molecule. Defaults to True.
-backend (str) – The backend engine for parsing XYZ. Defaults to
'openbabel'
.
-continuous_update (bool) – Whether to update the widget continuously. Defaults to
False
.
-
-- Returns: -
interact
-
-
-
-
- -interact_scan(*args, **kwargs)# -
-
-
- -property multiplicity# -
Get the multiplicity.
--
-
- Returns: -
int
-
-
-
-
- -property neg_freqs# -
Return the imaginary frequency as a numpy array.
-
-
-
- -property num_all_geoms# -
Return the number of all geometries.
--
-
- Returns: -
int
-
-
-
-
- -property num_converged_geoms# -
Return the number of converged geometries. Useful in IRC and SCAN jobs.
--
-
- Returns: -
int
-
-
-
-
- -property num_neg_freqs# -
Return the number of imaginary frequencies.
--
-
- Returns: -
int
-
-
-
-
- -property opt_convergence# -
-
-
- -property optstatus# -
Return the geometry optimization status
-
-
-
- -plot_irc_energies(converged: bool = True, relative: bool = True, highlight_index: int | None = None, ax: matplotlib.pyplot.axes = None)# -
Plot the energy curve for the IRC trajectory. Note, the sequence may be altered if -the IRC is a two-way calculation.
--
-
- Parameters: -
-
-
converged (bool) – If only returns energies for converged geometries. Defaults to
True
.
-relative (bool) – If plot relative values (to the highest values). Defaults to
True
.
-highlight_index (int) – highlight the data corresponding to the given index.
-ax (axes) – An existing matplotlib axes instance.
-
-
-
-
- -plot_opt_convergence(logy: bool = True, relative: bool = True, highlight_index: int | None = None, ax=None)# -
Plot the convergence curve from the convergence table.
--
-
- Parameters: -
-
-
logy (bool) – If using log scale for the y axis. Defaults to
True
.
-relative (bool) – If plot relative values (to the target values). Defaults to
True
.
-highlight_index (int) – highlight the data corresponding to the given index.
-() (ax) –
-
-
-
-
- -plot_scan_energies(converged: bool = True, relative_x: bool = True, relative_y: bool = True, highlight_index: int | None = None, ax: matplotlib.pyplot.axes = None, draw_fit: bool = True)# -
Plot the energy curve for the scan trajectory.
--
-
- Parameters: -
-
-
converged (bool) – If only returns energies for converged geometries. Defaults to
True
.
-relative_x (bool) – If plot relative values (to the initial values). -Only valid for scan trajectories. Defaults to
True
.
-relative_y (bool) – If plot relative values (to the lowest values). Defaults to
True
.
-highlight_index (int) – Highlight the data corresponding to the given index. Defaults to None, no hightlighting.
-ax (axes) – Draw on an existing matplotlib axes instance. Defaults to None, creating a new axes.
-draw_fit (bool, optional) – Whether to draw a Fouries series fitted to the energies. Only valid for dihedral scans. -It will be drawn as an orange dotted curve. Defaults to True.
-
-
-
-
- -view_freq(mode_idx: int = 0, frames: int = 10, amplitude: float = 1.0, *args, **kwargs) → <ipywidgets.widgets.interaction._InteractFactory object at 0x7f3e07cf2710># -
Create a Py3DMol viewer for the frequency mode.
--
-
- Parameters: -
-
-
mode_idx (int) – The index of the frequency mode to display. Defaults to 0.
-frames (int) – The number of frames of the animation. The larger the value, -the slower the change of the animation. Defaults to 10.
-amplitude (float) – The magnitude of the mode change. Defaults to 1.0.
-
-- Returns: -
interact
-
-
-
-
- -view_mol(backend: str = 'openbabel', sanitize: bool = False, *args, **kwargs)# -
Create a Py3DMol viewer for the molecule. By default, it will shows either -the initial geometry or the converged geometry depending on what job type -involved in the file.
--
-
- Parameters: -
-
-
backend (str) – The backend engine for parsing XYZ. Defaults to
'openbabel'
.
-sanitize (bool) – Whether to sanitize the generated mol. Defaults to False.
-
-
-
-
- -view_traj(align_scan: bool = True, align_frag_idx: int = 1, backend: str = 'openbabel', converged: bool = True, **kwargs)# -
View the trajectory as a Py3DMol animation.
--
-
- Parameters: -
-
-
align_scan (bool) – If align the molecule to make the animation cleaner. -Defaults to
True
-align_frag_idx (int) – Value should be either 1 or 2. Assign which of the part to be -aligned. Defaults to
1
.
-backend (str) – The backend engine for parsing XYZ. Defaults to
'openbabel'
.
-
-
rdmc.external.logparser.base#
rdmc.external.logparser.gaussian#
--
-
- -class rdmc.external.logparser.gaussian.GaussianLog(path: str, job_type: list | None = None, ts: bool | None = None)# -
Bases:
-CclibLog
A class helps to parse the Gaussian log files and provides information -helpful to analyze the calculation.
--
-
- -opt_criteria = ['Force Maximum', 'Force RMS', 'Displacement Maximum', 'Displacement RMS']# -
-
-
- -time_regex = '[a-zA-Z]+\\s+\\d+\\s+\\d{2}\\:\\d{2}\\:\\d{2}\\s+\\d{4}'# -
rdmc.external.logparser.gaussian#
rdmc.external.logparser#
+rdmc.external.logparser#
-
-
- rdmc.external.logparser.base
-
-
BaseLog
-
-CclibLog
-
-
CclibLog.all_geometries
-CclibLog.cclib_results
-CclibLog.charge
-CclibLog.converged_geometries
-CclibLog.freqs
-CclibLog.get_best_opt_geom()
-CclibLog.get_converged_geom_idx()
-CclibLog.get_irc_midpoint()
-CclibLog.get_lowest_e_geometry()
-CclibLog.get_mol()
-CclibLog.get_scannames()
-CclibLog.get_scanparams()
-CclibLog.get_scf_energies()
-CclibLog.get_xyzs()
-CclibLog.guess_rxn_from_irc()
-CclibLog.guess_rxn_from_normal_mode()
-CclibLog.initial_geometry
-CclibLog.interact_freq()
-CclibLog.interact_irc()
-CclibLog.interact_opt()
-CclibLog.interact_scan()
-CclibLog.multiplicity
-CclibLog.neg_freqs
-CclibLog.num_all_geoms
-CclibLog.num_converged_geoms
-CclibLog.num_neg_freqs
-CclibLog.opt_convergence
-CclibLog.optstatus
-CclibLog.plot_irc_energies()
-CclibLog.plot_opt_convergence()
-CclibLog.plot_scan_energies()
-CclibLog.view_freq()
-CclibLog.view_mol()
-CclibLog.view_traj()
-
-
- - rdmc.external.logparser.gaussian - -
- rdmc.external.logparser.qchem - -
- rdmc.external.logparser.orca - -
- rdmc.external.logparser.utils - +
- rdmc.external.logparser.base +
- rdmc.external.logparser.gaussian +
- rdmc.external.logparser.qchem +
- rdmc.external.logparser.orca +
- rdmc.external.logparser.utils
rdmc.external.logparser.orca#
--
-
- -class rdmc.external.logparser.orca.ORCALog(path: str, job_type: list | None = None, ts: bool | None = None)# -
Bases:
-CclibLog
A class helps to parse the Gaussian log files and provides information -helpful to analyze the calculation.
-# Todo: -Test this class. most implementation hasn’t been tested yet.
--
-
- -property multiplicity# -
Get the multiplicity of the molecule.
-# For unknown reason sometimes multiplicity is not parsed correctly by cclib
-
-
-
- -opt_criteria = ['TolE', 'TolRMSG', 'TolMaxG', 'TolRMSD', 'TolMaxD']# -
-
-
- -time_regex = ''# -
rdmc.external.logparser.orca#
rdmc.external.logparser.qchem#
--
-
- -class rdmc.external.logparser.qchem.QChemLog(path: str, job_type: list | None = None, ts: bool | None = None)# -
Bases:
-CclibLog
A class helps to parse the Gaussian log files and provides information -helpful to analyze the calculation.
--
-
- -get_mol(refid: int = -1, embed_conformers: bool = True, neglect_spin: bool = True, backend: str = 'openbabel', sanitize: bool = True) → RDKitMol# -
Perceive the xyzs in the file and turn the geometries to conformers.
--
-
- Parameters: -
-
-
refid (int) – The conformer ID in the log file to be used as the reference for mol perception. -Defaults to -1, meaning it is determined by the following criteria: -- For opt, it is the last geometry if succeeded; otherwise, the initial geometry; -- For freq, it is the geometry input; -- For scan, it is the geometry input; -- For IRC, uses the initial geometry.
-embed_confs (bool) – Whether to embed intermediate conformers in the file to the mol. -Defaults to
True
. To clear, at least one conformer will be included in -obtained mol, and its geometry is determined by refid.
-neglect_spin (bool) – Whether to neglect the error when spin multiplicity are different -between the generated mol and the value in the output file. This -can be useful for calculations involves TS. Defaults to
True
.
-backend (str) – The backend engine for parsing XYZ. Defaults to
'openbabel'
.
-sanitize (bool) – Whether to sanitize the generated mol. Defaults to True. -If a TS involved in the job, better to set it False
-
-- Returns: -
RDKitMol – a molecule generated from the output file.
-
-
-
-
- -get_scf_energies(relative: bool = False)# -
Get SCF energies in kcal/mol.
--
-
- Parameters: -
relative (bool) – Only return the value relative to the minimum. Defaults to
-False
.
-- Returns: -
np.array – The SCF energies.
-
-
-
-
- -opt_critieria = ['Gradient', 'Displacement', 'Energy change']# -
-
-
- -time_regex = '[a-zA-Z]+\\s+\\d+\\s+\\d{2}\\:\\d{2}\\:\\d{2}\\s+\\d{4}'# -
rdmc.external.logparser.qchem#
rdmc.external.logparser.utils#
-A module contains functions to read Gaussian output file.
--
-
- -rdmc.external.logparser.utils.scheme_to_dict(scheme_str: str) → dict# -
A function to transform scheme to a dict.
--
-
- Parameters: -
scheme_str (str) – the calculation scheme used in a Gaussian job.
-
-
rdmc.external.logparser.utils#
rdmc.mathlib.curvefit#
-A module used to fit curves or surfaces. Potentially useful in characterize PES.
--
-
- -class rdmc.mathlib.curvefit.FourierSeries1D(max_num_term: int | None = None, verbose: bool = False)# -
Bases:
-object
FourierSeries1D helps to fit the potential energy surface to a 1D -Fourier Series, and evaluate the values using the fitted curve.
--
-
- -fit(X: ndarray, y: ndarray)# -
Fit the 1D Fourier series.
--
-
- Parameters: -
-
-
X (np.ndarray) – _description_
-y (np.ndarray) – 1D array. It is assumed to be a periodic function of x with -a periodicity of \(2 \pi\).
-
-
-
-
- -max_num_term = None# -
-
-
- -predict(X: ndarray)# -
Predict the value using Fourier Series. This function forces y=0 at the origin.
--
-
- Parameters: -
X (np.ndarray) – The X variable that should be a 1D array.
-
-- Returns: -
_type_ – _description_
-
-
rdmc.mathlib.curvefit#
rdmc.mathlib.geom#
-This module provides class and methods for dealing with 3D geometry operations.
--
-
- -rdmc.mathlib.geom.get_centroid(coords: array, keepdims=False) → array# -
Get the centroid given the coords of each item.
--
-
- Parameters: -
-
-
coords (np.array) – The 3D coordinates in numpy array with a size of N x 3.
-keepdims (bool) – Defaults to False (export 1D array); otherwise output an array of a size of 1 x 3.
-
-- Returns: -
np.array – 1D array indicate the coordinates of the centroid.
-
-
-
-
- -rdmc.mathlib.geom.get_distances_from_a_point(coords: array, pos: array, keepdims: bool = False)# -
Get the Euclidiean distance to a point for all elements.
--
-
- Parameters: -
-
-
coords (np.array) – The 3D coordinates in numpy array with a size of N x 3.
-pos (np.array) – The coordinates of the point.
-keepdims (bool) – Defaults to False (export 1D array); otherwise output an array of a size of 1 x 3.
-
-- Returns: -
np.array – 1D array indicate the distances.
-
-
-
-
- -rdmc.mathlib.geom.get_mass_center(coords: array, atommasses: Iterable, keepdims=False) → array# -
Get the mass center given the coords of each item and its corresponding mass.
--
-
- Parameters: -
-
-
coords (np.array) – The 3D coordinates in numpy array with a size of N x 3.
-atommasses (Iterable) – A list or an array of mass values.
-keepdims (bool) – Defaults to False (export 1D array); otherwise output an array of a size of 1 x 3.
-
-- Returns: -
np.array – 1D array indicate the coordinates of the mass center.
-
-
-
-
- -rdmc.mathlib.geom.get_max_distance_from_center(coords: array) → float# -
Get the maximum distance from the center of a set of coordinates
--
-
- Parameters: -
coords (np.array) – The 3D coordinates in numpy array with a size of N x 3.
-
-- Returns: -
float – The distance between the center and the farthest item.
-
-
-
-
- -rdmc.mathlib.geom.get_weighted_center(coords: array, weights: Iterable, keepdims=False) → array# -
Get the mass center given the coords of each item and its corresponding weight.
--
-
- Parameters: -
-
-
coords (np.array) – The 3D coordinates in numpy array with a size of N x 3.
-weights (Iterable) – A list or an array of weights corresponding to each element.
-keepdims (bool) – Defaults to False (export 1D array); otherwise output an array of a size of 1 x 3.
-
-- Returns: -
np.array – 1D array indicate the coordinates of the mass center.
-
-
-
-
- -rdmc.mathlib.geom.rotate(coords: array, angles: array, degrees: bool = False, about_center: bool = False, about: array | None = None)# -
Rotate the coordinates according to the angles about the x, y, and z axes. The rotation is -about the origin, but there are a few options about choosing the
-about
location.-
-
- Parameters: -
-
-
coords (np.array) – The 3D coordinates in numpy array with a size of \(N \times 3\).
-angles (np.array) – An array with a size of
(1,3)
indicates the rotation angles about the -x, y, and z axes, respectively.
-degrees (bool) – If the angles are defined as degrees. Defaults to
False
.
-about_center (bool) – Whether to rotate the coordinates about their center. -Defaults to
False
. Noteabout_center
cannot be assigned simultaneously withabout
.
-about (np.array) – The coordinate that the rotation is about. Should be a vector with a length of 3. -It is defaults to
None
, rotating about the origin. -about
cannot be specified along withabout_center
.
-
-- Returns: -
np.array – coordinates after the rotation.
-
-
-
-
- -rdmc.mathlib.geom.translate(coords: array, tran_vec: array) → array# -
Translate the coordinates according to the tran_vec vector.
--
-
- Parameters: -
-
-
coords (np.array) – The 3D coordinates in numpy array with a size of N x 3.
-tran_vec (np.array) – A vector indicate the direction and the magnitude of the translational operation. -It should be a numpy array with a size of (3,) or (1,3).
-
-- Returns: -
np.array – An numpy array with the same size as the original coords.
-
-
-
-
- -rdmc.mathlib.geom.translate_centroid(coords: array, new_ctr: array = array([0., 0., 0.]))# -
Translate the coordinates according to the tran_vec vector.
--
-
- Parameters: -
-
-
coords (np.array) – The 3D coordinates in numpy array with a size of N x 3.
-new_ctr (np.array) – A vector indicate the new position of the centroid. -It should be a numpy array with a size of (3,) or (1,3). -By defaults, the centroid will be moved to the origin.
-
-- Returns: -
np.array – An numpy array with the same size as the original coords.
-
-
rdmc.mathlib.geom#
rdmc.mathlib.greedymin#
-Modules for finding local minima on the scanned potential energy surface -by a greedy algorithm. Need to parallelize this.
--
-
- -rdmc.mathlib.greedymin.compare_to_adjacent_point(coord: List[Tuple], energies: ndarray, unchecked_points: List[Tuple], filters: List[Tuple]) → Tuple# -
Compare the energy of current point and those of other points.
--
-
- Parameters: -
-
-
coord (list of tuples) – The coordinate of the current point.
-energies (np.ndarray) – The energies of all points.
-unchecked_points (list of tuples) – The points that have not been checked.
-filters (list of tuples) – The filters for searching adjacent points.
-
-- Returns: -
The coordinate of the adjacent point with the lowest energy.
-
-
-
-
- -rdmc.mathlib.greedymin.get_energy(coord: List[Tuple], energies: ndarray) → float# -
Get the energies of adjacent points considering periodic boundary condition.
--
-
- Parameters: -
-
-
coord – The coordinate of a point.
-energies – The energies of all points.
-
-- Returns: -
float – The energy of the point.
-
-
-
-
- -rdmc.mathlib.greedymin.get_step_to_adjacent_points(fsize: int, dim: int = 2, cutoff: float = inf) → generator# -
Get a generator containing the adjacent points.
--
-
- Parameters: -
-
-
fsize – The filter size as positive integer.
-dim – The dimension of the PES. Default is 2.
-cutoff – The cutoff distance. only consider steps with -distance smaller than the cutoff. Default is -infinity, meaning no cutoff is applied.
-
-- Returns: -
A generator containing the adjacent coordinates.
-
-
-
-
- -rdmc.mathlib.greedymin.search_for_a_minimum(coord: tuple, energies: ndarray, unchecked_points: List[Tuple], filters: List[Tuple]) → Tuple# -
Search a local minimum on a given PES.
--
-
- Parameters: -
-
-
coord (tuple) – The coordinate of the current point.
-energies (np.ndarray) – The energies of all points.
-unchecked_points (list of tuples) – The points that have not been checked.
-filters (list of tuples) – The filters for searching adjacent points.
-minimum. (The coordinate of a local) –
-
-
-
-
- -rdmc.mathlib.greedymin.search_minimum(energies: ndarray, fsize: int, cutoff: float = inf) → List[Tuple]# -
Search all the minimums on a given PES.
--
-
- Parameters: -
-
-
energies (np.ndarray) – The energies of all points.
-fsize (int) – The filter size as positive integer.
-cutoff (float) – The cutoff distance. only consider steps with -distance smaller than the cutoff. Default is -infinity, meaning no cutoff is applied.
-
-- Returns: -
A list of coordinates of the minimums.
-
-
rdmc.mathlib.greedymin#
rdmc.mathlib#
+rdmc.mathlib#
- -GetAllConformers() → List[RDKitConf]# +GetAllConformers() → List[RDKitConf]#
Get all of the embedded conformers.
- Returns: @@ -986,7 +986,7 @@
- -GetConformer(id: int = 0) → RDKitConf# +GetConformer(id: int = 0) → RDKitConf#
Get the embedded conformer according to ID.
- Parameters: @@ -1003,7 +1003,7 @@
- -GetConformers(ids: list | tuple = [0]) → List[RDKitConf]# +GetConformers(ids: list | tuple = [0]) → List[RDKitConf]#
Get the embedded conformers according to IDs.
- Parameters: diff --git a/reference/rdmc.html b/reference/rdmc.html index c1ca8e52..45789ac9 100644 --- a/reference/rdmc.html +++ b/reference/rdmc.html @@ -453,8 +453,8 @@
- rdmc.external
-
@@ -494,223 +494,55 @@
- rdmc.external.logparser
-
-
- rdmc.external.logparser.base - -
- rdmc.external.logparser.gaussian
-
-
GaussianLog
-
- - rdmc.external.logparser.qchem
-
-
QChemLog
-
- - rdmc.external.logparser.orca
-
-
ORCALog
-
- - rdmc.external.logparser.utils - +
- rdmc.external.logparser.base +
- rdmc.external.logparser.gaussian +
- rdmc.external.logparser.qchem +
- rdmc.external.logparser.orca +
- rdmc.external.logparser.utils
- rdmc.mathlib
- rdmc.conformer_generation
- Embedding Geometries
- Geometry Optimization
- Postprocessing
-
-
- rdmc.conformer_generation.verifiers - -
- rdmc.conformer_generation.ts_verifiers - -
- rdmc.conformer_generation.pruners - -
- rdmc.conformer_generation.solvation - +
- rdmc.conformer_generation.verifiers +
- rdmc.conformer_generation.ts_verifiers +
- rdmc.conformer_generation.pruners +
- rdmc.conformer_generation.solvation
- Workflow - -
- Utils +
- Utils
- rdmc.conf
-
-
ConformerCluster
-
-ConformerFilter
-
-
ConformerFilter.atom_maps
-ConformerFilter.check_dihed_angle_diff()
-ConformerFilter.filter_by_dihed_angles()
-ConformerFilter.filter_by_iter_hcluster()
-ConformerFilter.generate_rmsds_of_cluster()
-ConformerFilter.get_tor_matrix()
-ConformerFilter.get_torsional_angles()
-ConformerFilter.hierarchy_cluster()
-ConformerFilter.pairwise_rmsd()
-ConformerFilter.reset_atom_maps()
-
-RDKitConf
-
-
RDKitConf.FromConformer()
-RDKitConf.FromMol()
-RDKitConf.FromRDKitMol()
-RDKitConf.GetAllTorsionsDeg()
-RDKitConf.GetAngleDeg()
-RDKitConf.GetAngleRad()
-RDKitConf.GetBondLength()
-RDKitConf.GetDistanceMatrix()
-RDKitConf.GetOwningMol()
-RDKitConf.GetTorsionDeg()
-RDKitConf.GetTorsionalModes()
-RDKitConf.GetVdwMatrix()
-RDKitConf.HasCollidingAtoms()
-RDKitConf.HasOwningMol()
-RDKitConf.SetAllTorsionsDeg()
-RDKitConf.SetAngleDeg()
-RDKitConf.SetAngleRad()
-RDKitConf.SetBondLength()
-RDKitConf.SetOwningMol()
-RDKitConf.SetPositions()
-RDKitConf.SetTorsionDeg()
-RDKitConf.SetTorsionalModes()
-RDKitConf.ToConformer()
-RDKitConf.ToMol()
-
-edit_conf_by_add_bonds()
-
+ - rdmc.conf
- rdmc.forcefield
OpenBabelFF
OpenBabelFF.add_angle_constraint()
@@ -833,52 +665,8 @@
parse_xyz_or_smiles_list()
-- rdmc.reaction
-
-
Reaction
-
-
Reaction.active_atoms
-Reaction.active_bonds
-Reaction.apply_resonance_correction()
-Reaction.bond_analysis()
-Reaction.broken_bonds
-Reaction.changed_bonds
-Reaction.draw_2d()
-Reaction.formed_bonds
-Reaction.from_reactant_and_product_smiles()
-Reaction.from_reaction_smiles()
-Reaction.get_reverse_reaction()
-Reaction.init_reactant_product()
-Reaction.involved_atoms
-Reaction.involved_bonds
-Reaction.is_charge_balanced
-Reaction.is_element_balanced
-Reaction.is_mult_equal
-Reaction.is_num_atoms_balanced
-Reaction.make_ts()
-Reaction.num_atoms
-Reaction.num_broken_bonds
-Reaction.num_changed_bonds
-Reaction.num_formed_bonds
-Reaction.num_products
-Reaction.num_reactants
-Reaction.require_bond_analysis()
-Reaction.to_rdkit_reaction()
-Reaction.to_smiles()
-Reaction.ts
-
-
- - rdmc.ts - +
- rdmc.reaction +
- rdmc.ts
- rdmc.utils
determine_smallest_atom_index_in_torsion()
find_internal_torsions()
@@ -899,16 +687,7 @@
set_rdconf_coordinates()
- - rdmc.view - +
- rdmc.view
- -class rdmc.reaction.Reaction(reactant: List[RDKitMol] | RDKitMol, product: List[RDKitMol] | RDKitMol, ts: RDKitMol | None = None)# -
Bases:
-object
The Reaction class that stores the reactant, product, and transition state information.
--
-
- -property active_atoms# -
-
-
- -property active_bonds# -
-
-
- -apply_resonance_correction(inplace: bool = True, kekulize: bool = True) → Reaction# -
Apply resonance correction to the reactant and product complexes.
-
-
-
- -bond_analysis()# -
Perform bond analysis on the reaction.
-
-
-
- -property broken_bonds# -
-
-
- -property changed_bonds# -
-
-
- -draw_2d(font_scale: float = 1.0, highlight_by_reactant: bool = True) → str# -
This is a modified version of the drawReaction2D function in RDKit.
--
-
- Parameters: -
-
-
font_scale (float, optional) – The font scale for the atom map number. Defaults to 1.0.
-highlightByReactant (bool, optional) – Whether to highlight the reactant(s) or product(s). Defaults to True.
-
-- Returns: -
str – The SVG string. To display the SVG, use IPython.display.SVG(svg_string).
-
-
-
-
- -property formed_bonds# -
-
-
- -classmethod from_reactant_and_product_smiles(rsmi: List[str] | str, psmi: List[str] | str)# -
Initialize the Reaction class from reactant and product smile(s).
-Args:
-
-
-
- -classmethod from_reaction_smiles(smiles: str)# -
Initialize the Reaction class from reaction SMILES.
--
-
- Parameters: -
smiles (str) – The reaction SMILES.
-
-- Returns: -
Reaction – The Reaction class.
-
-
-
-
- -get_reverse_reaction()# -
Get the reverse reaction.
-
-
-
- -init_reactant_product(reactant: List[RDKitMol] | RDKitMol, product: List[RDKitMol] | RDKitMol)# -
-
-
- -property involved_atoms# -
-
-
- -property involved_bonds# -
-
-
- -property is_charge_balanced: bool# -
Whether the charge in the reactant(s) and product(s) are balanced.
-
-
-
- -property is_element_balanced: bool# -
Whether the elements in the reactant(s) and product(s) are balanced.
-
-
-
- -property is_mult_equal: bool# -
Whether the spin multiplicity in the reactant(s) and product(s) are equal.
-
-
-
- -property is_num_atoms_balanced: bool# -
Whether the number of atoms in the reactant(s) and product(s) are balanced.
-
-
-
- -make_ts()# -
Make the transition state of the reaction based on the reactant and product. -This method assumes that the reactant complex and product complex are atom-mapped -already.
-
-
-
- -property num_atoms: bool# -
The number of atoms involved in the reactant(s) and product(s).
-
-
-
- -property num_broken_bonds# -
-
-
- -property num_changed_bonds# -
-
-
- -property num_formed_bonds# -
-
-
- -property num_products: int# -
The number of products.
-
-
-
- -property num_reactants: int# -
The number of reactants.
-
-
-
- -require_bond_analysis()# -
Timer decorator for recording the time of a function.
--
-
- Parameters: -
func (function) – The function to be decorated.
-
-- Returns: -
function – The decorated function.
-
-
-
-
- -to_rdkit_reaction() → ChemicalReaction# -
Convert the reaction to RDKit ChemicalReaction.
-
-
-
- -to_smiles(remove_hs: bool = False, remove_atom_map: bool = False, **kwargs) → str# -
Convert the reaction to reaction SMILES.
-
-
-
- -property ts# -
The transition state of the reaction.
-
- -rdmc.ts.clean_ts(r_mol: RDKitMol, p_mol: RDKitMol, ts_mol: RDKitMol)# -
Cleans transition state
-ts_mol
by removing all bonds that correspond to broken or formed bonds. -r_mol
,p_mol
, andts_mol
need to be atom mapped. Bond order changes are not considered.-
-
- Parameters: -
- - -
- Returns: -
-
-
RDKitMol – an edited version of
ts_mol
, which is the originalts_mol
with cleaned bonding.
-list –
--
-
broken bonds: A list of length-2 tuples that contains the atom indexes of the bonds broken in the reaction.
-formed bonds: A list of length-2 tuples that contains the atom indexes of the bonds formed in the reaction.
-
-
-
- -rdmc.ts.examine_normal_mode(r_mol: RDKitMol, p_mol: RDKitMol, ts_xyz: array, disp: array, amplitude: float | list = 0.25, weights: bool | array = True, verbose: bool = True, as_factors: bool = True)# -
Examine a TS’s imaginary frequency given a known reactant complex and a -product complex. The function checks if the bond changes are corresponding -to the most significant change in the normal mode. The reactant and product -complex need to be atom mapped.
--
-
- Parameters: -
-
-
r_mol ('RDKitMol') – the reactant complex.
-p_mol ('RDKitMol') – the product complex.
-ts_xyz (np.array) – The xyz coordinates of the transition state. It should have a -size of N x 3.
-disp (np.array) – The displacement of the normal mode. It should have a size of -N x 3.
-amplitude (float) – The amplitude of the motion. Defaults to
0.25
.
-weights (bool or np.array) – If
True
, use the sqrt(atom mass) as a scaling factor to the displacement. -IfFalse
, use the identity weights. If a N x 1np.array
is provided, then -The concern is that light atoms (e.g., H) tend to have larger motions -than heavier atoms.
-verbose (bool) – If print detailed information. Defaults to
True
.
-as_factors (bool) – If return the value of factors instead of a judgment. -Defaults to
False
-
-- Returns: -
-
-
- bool –
True
for pass the examination,False
otherwise.
-- list – If as_factors == True, two factors will be returned.
-
-
- -rdmc.ts.get_all_changing_bonds(r_mol: RDKitMol | Mol, p_mol: RDKitMol | Mol) → List# -
Get all bonds changed in the reaction. Both reactant and product complexes -need to be atom-mapped.
--
-
- Parameters: -
-
-
r_mol ('RDKitMol' or 'Mol') – the reactant complex.
-p_mol ('RDKitMol' or 'Mol') – the product complex.
-
-- Returns: -
list –
--
-
formed bonds: A list of length-2 tuples that contain the atom indexes of the bonded atoms.
-broken bonds: A list of length-2 tuples that contain the atom indexes of the bonded atoms.
-bonds with BO changed: A list of length-2 tuples that contain the atom indexes of the bonded atoms.
-
-
- -rdmc.ts.get_broken_bonds(r_mol: RDKitMol | Mol, p_mol: RDKitMol | Mol) → List# -
Get all bonds broken in the reaction. Both reactant and product complexes -need to be atom-mapped.
--
-
- Parameters: -
-
-
r_mol ('RDKitMol' or 'Mol') – the reactant complex.
-p_mol ('RDKitMol' or 'Mol') – the product complex.
-
-- Returns: -
list – A list of length-2 tuples that contain the atom indexes of the bonded atoms.
-
-
- -rdmc.ts.get_formed_and_broken_bonds(r_mol: RDKitMol | Mol, p_mol: RDKitMol | Mol) → List# -
Get all bonds broken in the reaction. Both reactant and product complexes -need to be atom-mapped. This function doesn’t count bonds whose bond order -is lowered but not equal to zero.
--
-
- Parameters: -
-
-
r_mol ('RDKitMol' or 'Mol') – the reactant complex.
-p_mol ('RDKitMol' or 'Mol') – the product complex.
-
-- Returns: -
list –
--
-
formed bonds: A list of length-2 tuples that contain the atom indexes of the bonded atoms.
-broken bonds: A list of length-2 tuples that contain the atom indexes of the bonded atoms.
-
-
- -rdmc.ts.get_formed_bonds(r_mol: RDKitMol | Mol, p_mol: RDKitMol | Mol) → List# -
Get all bonds formed in the reaction. Both reactant and product complexes -need to be atom-mapped.
--
-
- Parameters: -
-
-
r_mol ('RDKitMol' or 'Mol') – the reactant complex.
-p_mol ('RDKitMol' or 'Mol') – the product complex.
-
-
-
-
- Returns
list: A list of length-2 tuples that contain the atom indexes of the bonded atoms.
-
-
- -rdmc.ts.guess_rxn_from_normal_mode(xyz: array, symbols: array, disp: array, amplitude: float | list = 0.25, weights: bool | array = True, backend: str = 'openbabel', multiplicity: int = 1)# -
Guess reaction according to the normal mode analysis for a transition state.
--
-
- Parameters: -
-
-
xyz (np.array) – The xyz coordinates of the transition state. It should have a -size of \(N \times 3\).
-symbols (np.array) – The symbols of each atoms. It should have a size of \(N\).
-disp (np.array) – The displacement of the normal mode. It should have a size of -\(N \times 3\).
-amplitude (float) – The amplitude of the motion. If a single value is provided then the guess -will be unique (if available).
0.25
will be the default. Otherwise, a list -can be provided, and all possible results will be returned.
-weights (bool or np.array) – If
True
, use the \(\sqrt(atom mass)\) as a scaling factor to the displacement. -IfFalse
, use the identity weights. If a \(N \times 1\)np.ndarray
is provided, -then use the provided weights. The concern is that light atoms (e.g., H) -tend to have larger motions than heavier atoms.
-backend (str) – The backend used to perceive xyz. Defaults to
'openbabel'
.
-multiplicity (int) – The spin multiplicity of the transition states. Defaults to
1
.
-
-- Returns: -
-
-
list – Potential reactants
-list – Potential products
-
-
- -rdmc.ts.is_DA_rxn_endo(r_mol: RDKitMol, p_mol: RDKitMol, embed: bool = False)# -
Determine the Diels Alder reaction stereo type (endo or exo), -based on the provided reactants and products.
- -- -rdmc.utils.set_rdconf_coordinates(conf: Conformer | RDKitConf, coords: tuple | list | ndarray)# +rdmc.utils.set_rdconf_coordinates(conf: Conformer | RDKitConf, coords: tuple | list | ndarray)#
Set the Positions of atoms of the conformer.
- Parameters: diff --git a/reference/view.html b/reference/view.html index 9dd27614..1d0e3306 100644 --- a/reference/view.html +++ b/reference/view.html @@ -456,194 +456,8 @@
- -rdmc.view.conformer_viewer(mol: RDKitMol, conf_ids: list | None = None, highlight_ids: list | None = None, opacity: float = 0.5, style_spec: dict | None = None, viewer: view | None = None, viewer_size: tuple = (400, 400), viewer_loc: tuple | None = None) → view# -
This is a viewer for viewing multiple overlaid conformers.
--
-
- Parameters: -
-
-
mol (RDKitMol) – An RDKitMol object with embedded conformers.
-conf_ids (list, optional) – A list of conformer ids (as
int
) to be overlaid and viewed. -If not provided, all embedded conformers will be used.
-highlight_ids (list, optional) – It is possible to highlight some of the conformers while greying out -other conformers by providing the conformer IDs you want to highlight.
-opacity (float, optional) – Set the opacity of the non-highlighted conformers and is only used with the highlighting feature. -the value should be a
float
between0.0
to1.0
. The default value is0.5
. -Values below0.3
may be hard to see.
-style_spec (dict, Optional) –
Style of the shown molecule. The default setting is:
---{'stick': {'radius': 0.05, - 'color': '#f2f2f2'}, - 'sphere': {'scale': 0.25},} -
which set both bond width/color and atom sizes. For more details, please refer to the -original APIs in 3DMol.js.
-
-viewer (py3Dmol.view, optional) – Provide an existing viewer, instead of create a new one.
-viewer_size (tuple, optional) – Set the viewer size. Only useful if
viewer
is not provided. -Defaults to(400, 400)
.
-viewer_loc (tuple, optional) – The location of the viewer in the grid. E.g.,
(0, 1)
. Only useful ifviewer
is not provided.
-
-- Returns: -
py3Dmol.view – The conformer viewer.
-
-
- -rdmc.view.freq_viewer(obj: str, model: str = 'xyz', frames: int = 10, amplitude: float = 1.0, atom_index: bool = True, style_spec: dict | None = None, viewer: view | None = None, viewer_size: tuple = (400, 400), viewer_loc: tuple | None = None) → view# -
This is the viewer for frequency.
--
-
- Parameters: -
-
-
obj (str) – A string representation of the molecule can be xyz string, -sdf string, etc.
-model (str, optional) – The model (format) of the molecule representation, e.g.,
'xyz'
. -Defaults to'xyz'
.
-frames (int, optional) – Number of frames to be created.
-amplitude (float, optional) – amplitude of distortion.
-atom_index (bool, optional) – Whether to show atom index. Defaults to True.
-style_spec (dict, Optional) – Style of the shown molecule. The default is showing both -both atoms and bonds.
-viewer (py3Dmol.view, optional) – Provide an existing viewer, instead of create a new one.
-viewer_size (tuple, optional) – Set the viewer size. Only useful if
viewer
is not provided. -Defaults to (400, 400).
-viewer_loc (tuple, optional) – The location of the viewer in the grid. E.g., (0, 1). Defaults to None.
-
-- Returns: -
py3Dmol.view – The molecule frequency viewer.
-
-
- -rdmc.view.grid_viewer(viewer_grid: tuple, linked: bool = False, viewer_size: tuple | None = None) → view# -
Create a empty grid viewer.
--
-
- Parameters: -
-
-
viewer_grid (tuple) – The layout of the grid, e.g., (1, 4) or (2, 2).
-linked (bool, optional) – Whether changes in different sub viewers are linked. Defaults to False.
-viewer_size (tuple, optional) – The size of the viewer in (width, height). By Default, each block -is 250 width and 400 height.
-
-
- -rdmc.view.interactive_conformer_viewer(mol, **kwargs)# -
This is a viewer for individually viewing multiple conformers using an ipython slider widget. -Uses keywords from mol_viewer function, so all arguments of that function are available here.
--
-
- Parameters: -
mol (RDKitMol) – An RDKitMol object with embedded conformers.
-
-- Returns: -
py3Dmol.view – The molecule viewer with slider to view different conformers.
-
-
- -rdmc.view.mol_animation(obj: str, model: str = 'xyz', model_extra: dict | None = None, animate: dict | None = None, atom_index: bool = True, style_spec: dict | None = None, viewer: view | None = None, viewer_size: tuple = (400, 400), viewer_loc: tuple | None = None) → view# -
This is the most general function to view a molecule powered by py3Dmol
--
-
- Parameters: -
-
-
obj (str) – A string representation of the molecule can be xyz string, -sdf string, etc.
-model (str, optional) – The model (format) of the molecule representation, e.g.,
'xyz'
. -Defaults to'xyz'
.
-model_extra (dict, optional) – Extra specs for the model. E.g., frequency specs -Can be provided here. Default to
None
-animate (dict, optional) – Specs for animation. E.g.,
{'loop': 'backAndForth'}
.
-atom_index (bool, optional) – Whether to show atom index. Defaults to True.
-style_spec (dict, Optional) – Style of the shown molecule. The default is showing both -both atoms and bonds.
-viewer (py3Dmol.view, optional) – Provide an existing viewer, instead of create a new one.
-viewer_size (tuple, optional) – Set the viewer size. Only useful if
viewer
is not provided. -Defaults to (400, 400).
-viewer_loc (tuple, optional) – The location of the viewer in the grid. E.g., (0, 1). Defaults to None.
-
-- Returns: -
py3Dmol.view – The molecule viewer.
-
-
- -rdmc.view.mol_viewer(obj: str, model: str = 'xyz', model_extra: dict | None = None, animate: dict | None = None, atom_index: bool = True, style_spec: dict | None = None, viewer: view | None = None, viewer_size: tuple = (400, 400), viewer_loc: tuple | None = None, gv_background: bool = False, confId: int = 0) → view# -
This is the most general function to view a molecule powered by py3Dmol
--
-
- Parameters: -
-
-
obj (str) – A string representation of the molecule can be xyz string, -sdf string, etc. Or an RDKitMol object.
-model (str, optional) – The model (format) of the molecule representation, e.g.,
'xyz'
. -Defaults to'xyz'
. If RDKitMol is feed in, the model will forced to be -sdf
.
-model_extra (dict, optional) – Extra specs for the model. E.g., frequency specs -Can be provided here. Default to
None
-animate (dict, optional) – Specs for animation. E.g.,
{'loop': 'backAndForth'}
.
-atom_index (bool, optional) – Whether to show atom index. Defaults to True.
-style_spec (dict, Optional) – Style of the shown molecule. The default is showing both -both atoms and bonds.
-viewer (py3Dmol.view, optional) – Provide an existing viewer, instead of create a new one.
-viewer_size (tuple, optional) – Set the viewer size. Only useful if
viewer
is not provided. -Defaults to (400, 400).
-viewer_loc (tuple, optional) – The location of the viewer in the grid. E.g., (0, 1). Defaults to None.
-gv_background (optional, bool) – To use a background that is similar to the style of GaussView. -Defaults to
False
.
-confId (int) – Integer of embedded conformer to view
-
-- Returns: -
py3Dmol.view – The molecule viewer.
-
-
- -rdmc.view.ts_viewer(r_mol: RDKitMol, p_mol: RDKitMol, ts_mol: RDKitMol, only_ts: bool = False, alignment: list = ['r', 'p', 'ts'], vertically_aligned: bool = True, ts_bond_color: str | Tuple[str] = ('red', 'green'), ts_bond_width: float = 0.1, **kwargs)# -
View reactant, product and ts of a given reaction. The broken bonds in the TS will be shown with red -lines while the formed bonds in the TS will be shown with green lines. Uses keywords from mol_viewer -function, so all arguments of that function are available here.
--
-
- Parameters: -
-
-
r_mol (RDKitMol) – The reactant complex.
-p_mol (RDKitMol) – The product complex.
-ts_mol (RDKitMol) – The ts corresponding to r_mol and p_mol.
-only_ts (bool, optional) – Only shows TS. Defaults to showing reactant, product, and TS. Defaults to False.
-alignment (list, optional) – The alignment of reactant, product, and TS. Defaults to [‘r’, ‘p’, ‘ts’]. -It can be changed to [‘r’, ‘ts’, ‘p’] to make TS in the middle. You can even remove -‘r’ or ‘p’ to only show TS and one side of the reaction, e.g., [‘r’, ‘ts’]. -This argument is only valid when only_ts is False.
-vertically_aligned (bool, optional) – Reactant, product, and TS are vertically aligned. Defaults to True. -Only valid when only_ts is False.
-ts_bond_color (tuple or str, optional) – The TS bond color for broken bonds (defaults to “red”) and formed bonds (defaults to “green”). -If a single str is input, the same color will be used. If a length-2 tuple is provided, then the -first color will be used as the broken bond color. As a reference, normal bond color is ‘#f2f2f2’.
-ts_bond_width (float) – The width of the TS bonds. Defaults to 0.1. As a reference, normal bond width is 0.05.
-
-
- - rdmc.view#
-A module contains py3Dmol functions to draw molecules
--
-
-
-
-
-
-
-
-
-
-
-
-
-
+ @@ -683,22 +497,6 @@rdmc.view#
- - RDMC APIs#
++ diff --git a/reference/reaction.html b/reference/reaction.html index 2dff4a59..470a10c5 100644 --- a/reference/reaction.html +++ b/reference/reaction.html @@ -456,209 +456,8 @@RDMC APIs#
-
-
- - rdmc.reaction#
-Module for Reaction
--
-
+ @@ -698,47 +497,6 @@rdmc.reaction#
---- On this page --diff --git a/reference/ts.html b/reference/ts.html index 5705d6fe..4b580218 100644 --- a/reference/ts.html +++ b/reference/ts.html @@ -39,7 +39,6 @@ - @@ -457,203 +456,8 @@- - rdmc.ts#
-This module provides class and methods for dealing with Transition states.
--
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ @@ -693,23 +497,6 @@rdmc.ts#
---- On this page --diff --git a/reference/utils.html b/reference/utils.html index 1cc3e652..3b00f374 100644 --- a/reference/utils.html +++ b/reference/utils.html @@ -746,7 +746,7 @@