molsysmt.molecular_mechanics.potential_energy_minimization#
- molsysmt.molecular_mechanics.potential_energy_minimization(molecular_system, method='L-BFGS', platform='CPU', engine='OpenMM', to_form=None, in_place=False, verbose=False)[source]#
Relax a molecular system to a local minimum of the potential energy.
Performs energy minimization using the chosen backend optimizer. The minimized coordinates are applied either in-place to the original molecular system or to a new copy depending on the
in_placeflag.- Parameters:
molecular_system (molecular system) – Molecular system in any of the supported forms. When
engine='OpenMM', the system may also be provided directly as anopenmm.Contextoropenmm.Simulationobject, in which case the context is used and reused without conversion.method (str, default 'L-BFGS') – Energy minimization algorithm. Currently only the L-BFGS method provided by OpenMM’s
LocalEnergyMinimizeris supported.platform (str, default 'CPU') – OpenMM platform used when creating a new context from the molecular system. Common values:
'CPU','CUDA','OpenCL','Reference'.engine ({'OpenMM'}, default 'OpenMM') – Backend used to perform the minimization. Only
'OpenMM'is currently supported.to_form (str or None, default None) – Target form for the output molecular system when
in_place=False. If None, a copy of the input is returned in its original form.in_place (bool, default False) – If True, the minimized coordinates are written back into
molecular_systemdirectly and the function returns None. If False, a new molecular system is returned with the relaxed coordinates.verbose (bool, default False) – If True, print the potential energy before and after minimization.
- Returns:
When
in_place=False, returns a molecular system with the minimized coordinates in the form specified byto_form(or the original form). Whenin_place=True, returns None and updatesmolecular_systemin place (only applicable for non-Context/Simulation forms).- Return type:
molecular system or None
- Raises:
NotImplementedError – Raised if the requested
engineis not supported.
Notes
If the input is not already an
openmm.Contextoropenmm.Simulation, the molecular system is converted to anopenmm.Contextusing the MolSysMT default attributes for any missing molecular-mechanics parameters (forcefield, integrator, temperature, etc.).The minimization is performed by OpenMM’s
LocalEnergyMinimizer.minimize, which converges to the nearest local minimum of the force-field potential energy surface.Added in version 1.0.0.