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 supported MolSysMT format.
method (str, default='L-BFGS') – Local minimization algorithm. OpenMM’s
LocalEnergyMinimizerimplements L-BFGS, so ‘L-BFGS’ is the only accepted value; any other name is refused.platform (str, default='CPU') – OpenMM platform name. Accepted values are ‘CPU’ and ‘CUDA’.
engine (str, default='OpenMM') – Engine performing the minimization. Only ‘OpenMM’ is implemented.
to_form (str, default=None) – Form of the returned molecular system when
in_place=False. With None the input form is preserved.in_place (bool, default=False) – Whether the minimized coordinates are written into
molecular_systeminstead of being returned in a new molecular system.verbose (bool, default=False) – Whether the potential energy before and after the minimization is printed.
- 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.