MMFFOptimizeMoleculesConfs#

nvmolkit.mmffOptimization.MMFFOptimizeMoleculesConfs(
molecules: list[Mol],
maxIters: int = 200,
nonBondedThreshold: float = 100.0,
hardwareOptions: HardwareOptions | None = None,
) list[list[float]]#

Optimize conformers for multiple molecules using MMFF force field with BFGS minimization.

This function performs GPU-accelerated MMFF optimization on multiple molecules with multiple conformers each. It uses CUDA for GPU acceleration and OpenMP for CPU parallelization to achieve high performance.

Parameters:
  • molecules – List of RDKit molecules to optimize. Each molecule should have conformers already generated.

  • maxIters – Maximum number of BFGS optimization iterations (default: 200)

  • nonBondedThreshold – Radius threshold for non-bonded interactions in Ångströms (default: 100.0)

  • hardwareOptions – Configures CPU and GPU batching, threading, and device selection. Will attempt to use reasonable defaults if not set.

Returns:

List of lists of energies, where each inner list contains the optimized energies for all conformers of the corresponding molecule. The order matches the input molecule order and conformer iteration order.

Raises:
  • ValueError – If any molecule in the input list is invalid

  • RuntimeError – If CUDA operations fail or optimization encounters errors

Example

>>> from rdkit import Chem
>>> from rdkit.Chem import rdDistGeom
>>> from nvmolkit.mmffOptimization import MMFFOptimizeMoleculesConfs
>>> from nvmolkit.types import HardwareOptions
>>>
>>> # Load molecules and generate conformers
>>> mol1 = Chem.AddHs(Chem.MolFromSmiles('CCO'))
>>> mol2 = Chem.AddHs(Chem.MolFromSmiles('CCC'))
>>> rdDistGeom.EmbedMultipleConfs(mol1, numConfs=5)
>>> rdDistGeom.EmbedMultipleConfs(mol2, numConfs=3)
>>>
>>> # Set custom runtime performance options (optional)
>>> hardware_options = HardwareOptions(batchSize=200, batchesPerGpu=4)
>>> energies = MMFFOptimizeMoleculesConfs(
...     [mol1, mol2],
...     maxIters=500,
...     hardwareOptions=hardware_options
... )
>>>
>>> # energies[0] contains 5 energies for mol1's conformers
>>> # energies[1] contains 3 energies for mol2's conformers

Note

  • Input molecules are modified in-place with optimized conformer coordinates