optimize_pme

mdhelper.openmm.utility.optimize_pme(system: System, integrator: Integrator, positions: ndarray[float] | Quantity, platform: Platform, properties: dict, min_cutoff: float | Quantity, max_cutoff: float | Quantity, *, pmeforce: NonbondedForce = None, cpu_pme: bool = True, target: float = 10, target_std: float = None, window: int = 3, fastest: int = 5, rerun: int = 2, verbose: bool = True) tuple[Quantity, bool][source]

Run a series of simulations using different parameters to determine the optimal configuration for evaluating electrostatic interactions with the particle mesh Ewald (PME) method on a GPU (CUDA or OpenCL).

The cutoff distance for the Coulomb potential can be freely varied with no accuracy penalty since OpenMM automatically selects internal parameters to satisfy the specified error tolerance. However, it may affect the accuracy of other nonbonded interactions, so care must be taken to ensure the optimal Coulomb potential cutoff is compatible with the other pair potentials in the system.

In certain cases, OpenMM can perform better with the reciprocal space calculations being done on the CPU while the direct space calculations are being evaluated on the GPU.

Parameters:
systemopenmm.System

OpenMM molecular system.

integratoropenmm.Integrator

OpenMM integrator or thermostat.

positionsnp.ndarray or unit.Quantity

Initial positions of the \(N\) particles in the system.

Shape: \((N,\,3)\).

Reference unit: \(\mathrm{nm}\).

platformopenmm.Platform

OpenMM platform.

propertiesdict

Dictionary of platform-specific properties.

min_cutofffloat or unit.Quantity

Minimum cutoff distance to test.

Reference unit: \(\mathrm{nm}\).

max_cutofffloat or unit.Quantity

Maximum cutoff distance to test.

Reference unit: \(\mathrm{nm}\).

pmeforceopenmm.NonbondedForce or openmm.AmoebaMultipoleForce, keyword-only, optional

Pair potential with electrostatic interactions that are evaluated using PME.

cpu_pmebool, keyword-only, default: True

Determines whether CPU PME should be benchmarked.

targetfloat, keyword-only, default: 10

Target simulation time for each test run, in seconds.

target_stdfloat, keyword-only, optional

Allowed variability for target, in seconds. If set to a value that is too small, the target simulation time may never be satisfied. If not specified, it is set to 10% of target.

windowint, keyword-only, default: 3

Number of previous runs to look at before deciding whether to stop testing larger cutoffs.

fastestint, keyword-only, default: 5

Number of fastest configurations to retest before deciding on the optimal cutoff distance and hardware (architecture).

rerunint, keyword-only, default 2

Number of reruns to complete for the fastest preliminary runs.

verbosebool, keyword-only, default: True

Determines whether detailed progress is shown.

Returns:
cutoffunit.Quantity

Optimal cutoff distance.

Reference unit: \(\mathrm{nm}\).

cpu_pmebool

Specifies whether to use the CPU to perform reciprocal space calculations.