Chemistry Utilities

Chemistry and molecule utility functions.

conformer_rl.utils.chem_utils.get_conformer_energies(mol: rdkit.Chem.AllChem.Mol) List[float]

Returns a list of energies for each conformer in mol.

conformer_rl.utils.chem_utils.get_conformer_energy(mol: rdkit.Chem.AllChem.Mol, confId: Optional[int] = None) float

Returns the energy of the conformer with confId in mol.

conformer_rl.utils.chem_utils.prune_last_conformer(mol: rdkit.Chem.AllChem.Mol, tfd_thresh: float, energies: List[float]) Tuple[rdkit.Chem.AllChem.Mol, List[float]]

Prunes the last conformer of the molecule.

If no conformers in mol have a TFD (Torsional Fingerprint Deviation) with the last conformer of less than tfd_thresh, the last conformer is kept. Otherwise, the lowest energy conformer with TFD less than tfd_thresh is kept and all other conformers are discarded.

Parameters
  • mol (RDKit Mol) – The molecule to be pruned. The conformers in the molecule should be ordered by ascending energy.

  • tfd_thresh (float) – The minimum threshold for TFD between conformers.

  • energies (list of float) – A list of all the energies of the conformers in mol.

Returns

  • mol (RDKit Mol) – The updated molecule after pruning, with conformers sorted by ascending energy.

  • energies (list of float) – A list of all the energies of the conformers in mol after pruning and sorting by ascending energy.

conformer_rl.utils.chem_utils.prune_conformers(mol: rdkit.Chem.AllChem.Mol, tfd_thresh: float) rdkit.Chem.AllChem.Mol

Prunes all the conformers in the molecule.

Removes conformers that have a TFD (torsional fingerprint deviation) lower than tfd_thresh with other conformers. Lowest energy conformers are kept.

Parameters
  • mol (RDKit Mol) – The molecule to be pruned.

  • tfd_thresh (float) – The minimum threshold for TFD between conformers.

Returns

mol – The updated molecule after pruning.

Return type

RDKit Mol

conformer_rl.utils.chem_utils.tfd_matrix(mol: rdkit.Chem.AllChem.Mol) numpy.array

Calculates the TFD matrix for all conformers in a molecule.

conformer_rl.utils.chem_utils.calculate_normalizers(mol: rdkit.Chem.AllChem.Mol, num_confs: int = 200, pruning_thresh: float = 0.05) Tuple[float, float]

Calculates the \(E_0\) and \(Z_0\) normalizing constants for a molecule used in the TorsionNet 1 paper.

Parameters
  • mol (RDKit Mol) – The molecule of interest.

  • num_confs (int) – The number of conformers to generate when calculating the constants. Should equal the number of steps for each episode of the environment containing this molecule.

  • pruning_thresh (float) – TFD threshold for pruning the conformers of mol.

References

1

TorsionNet paper