Skip to main content

Multiple Minimum Monte Carlo

pypi Ruff

This package will help you perform a multiple minumum Monte Carlo conformer search as described in Chang et al., 1989. It is built to be used with an ASE calculator and ASE optimization tools but user-defined optimization strategies can be employed as well.

Installation

This package can be installed with pip

pip install multiple-minimum-monte-carlo

Tutorial

To run a search, you need to initialize Conformer, Calculation, and ConformerEnsemble objects. Conformer objects require either an input xyz or SMILES string. The default Calculation object is ASEOptimization which requires an ASE optimization routine (like FIRE) and an ASE calculator (the example below uses the aimnet calculator which will need to be installed separately from this package). ConformerEnsemble objects require a Conformer and Calculation object.

from ase.optimize.fire import FIRE
from ase.io import write
from aimnet.calculators import AIMNet2ASE
from multiple_minimum_monte_carlo.conformer import Conformer
from multiple_minimum_monte_carlo.calculation import ASEOptimization
from multiple_minimum_monte_carlo.conformer_ensemble import ConformerEnsemble

smiles = "CC(=O)Oc1ccccc1C(=O)O"
conformer = Conformer(smiles=smiles)
optimizer = ASEOptimization(calc=AIMNet2ASE(), optimizer=FIRE)
conformer_ensemble = ConformerEnsemble(conformer=conformer, calc=optimizer)

To run the search, call run_monte_carlo with the ConformerEnsemble object

conformer_ensemble.run_monte_carlo()

final_ensemble will be a list of coordinate arrays that arranged by their energy (lowest energy first). To read out the minimum energy compound, do this

from ase.io import write
conformer.atoms.set_positions(conformer_ensemble.final_ensemble[0])
write("lowest_energy_conformer.xyz", conformer.atoms, format="xyz")

To perform batched calculations (which will perform multiple Monte Carlo steps at once and optimize all of the sampled conformers simultaneously), we will need to use a batched optimizer. In the example below, we will use the torchsim batched calculator with the uma-s-1 MLIP (which both need to be installed separately from this package)

from multiple_minimum_monte_carlo.batch_calculation import TorchSimCalculation
from torch_sim.models.fairchem import FairChemModel
from torch_sim.optimizers import Optimizer

model = FairChemModel(model=None, model_name="uma-s-1",task_name="omol", cpu=True)
calc = TorchSimCalculation(model=model, optimizer=Optimizer.fire, max_cycles=500)
conformer_ensemble = ConformerEnsemble(conformer=conformer, calc=calc)

A note about parallel calculations

As opposed to batched calculations, you can also do calculations in parallel with a Calculation object by setting parallel=True in the ConformerEnsemble object. However, this requires that the multiprocessing start method "fork" is used which may be incompatible with certain workflows.

A note about just using input xyz structure

When you only include an input xyz structure, this code uses rdkit to construct the SMILES string. However, occassionally this will fail (i.e. when the structure is more ambiguous like a transition state). In this case, including the SMILES string will fix this issue, but the SMILES string needs to be mapped to the structure. The easiest way to do this is to use an atom-mapped SMILES string (the hydrogens also need to be mapped!) and set mapped=True in your Conformer object

User-Defined Calculation

To define a Calculation object, a class will need three function: init, run, and energy. init initializes the class with whatever information is necessary. run performs an optimization. It takes an ase.Atoms object and a list of atoms to constrain and returns an np array of cartesian coordinates (in angstroms) and a float with the energy of the conformation (in kcal/mol). energy calculates the energy of a conformer. It takes an ase.Atoms object and returns a float the with energy (in kcal/mol)

Metadata

Release files for multiple-minimum-monte-carlo 0.0.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for multiple-minimum-monte-carlo 0.0.15
File Size Uploaded Provenance
multiple_minimum_monte_carlo-0.0.15.tar.gz 24.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for multiple-minimum-monte-carlo 0.0.15
File Interpreter ABI Platform
multiple_minimum_monte_carlo-0.0.15-py3-none-any.whl Python 3 none any Details

Total release size: 46.8 kB

Release files / multiple_minimum_monte_carlo-0.0.15.tar.gz

Download URL multiple_minimum_monte_carlo-0.0.15.tar.gz
Size 24.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2b02f06a58da17db2a35a28d818e3ca4c78ef9229cca519c2c97698c97ae9f54
BLAKE2b-256 checksum
How to use checksums
74c974e426790f47dd8c4049154111f902f628c70c720eed1b7cabd02529a469
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / multiple_minimum_monte_carlo-0.0.15-py3-none-any.whl

Download URL multiple_minimum_monte_carlo-0.0.15-py3-none-any.whl
Size 22.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ffd1a88c894a28f4fd103258998797ca50636eebdd751a175cfc00cfbc39b8e2
BLAKE2b-256 checksum
How to use checksums
317a5edeb7cefacc43943345a36a2aedc26246089f30d65ba8566b5937814be4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Security for multiple-minimum-monte-carlo 0.0.15

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page