Skip to content
Snippets Groups Projects
Commit 94eded67 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

Add kwargs to modelling.MinimizeModelEnergy

Add tolerance values that are passed to the according SD/LBFGS minimizers
parent 4535fd18
No related branches found
No related tags found
No related merge requests found
......@@ -256,7 +256,8 @@ def BuildSidechains(mhandle, merge_distance=4, fragment_db=None,
def MinimizeModelEnergy(mhandle, max_iterations=12, max_iter_sd=20,
max_iter_lbfgs=10, use_amber_ff=False,
extra_force_fields=list()):
extra_force_fields=list(),
tolerance_sd=1.0, tolerance_lbfgs=1.0):
'''Minimize energy of final model using molecular mechanics.
Uses :mod:`ost.mol.mm` to perform energy minimization.
......@@ -291,6 +292,14 @@ def MinimizeModelEnergy(mhandle, max_iterations=12, max_iter_sd=20,
:param max_iter_lbfgs: Max. number of iterations within LBFGS method
:type max_iter_lbfgs: :class:`int`
:param tolerance_sd: Tolerance parameter passed to ApplySD of
:class:`ost.mol.mm.Simulation` object.
:type tolerance_sd: :class:`float`
:param tolerance_lbfgs: Tolerance parameter passed to ApplyLBFGS of
:class:`ost.mol.mm.Simulation` object.
:type tolerance_lbfgs: :class:`float`
:param use_amber_ff: if True, use the AMBER force field instead of the def.
CHARMM one (see :meth:`BuildFromRawModel`).
:type use_amber_ff: :class:`bool`
......@@ -335,8 +344,8 @@ def MinimizeModelEnergy(mhandle, max_iterations=12, max_iter_sd=20,
ost.LogInfo("Perform energy minimization "
"(iteration %d, energy: %g)" % (i+1, cur_energy))
try:
sim.ApplySD(tolerance = 1.0, max_iterations = max_iter_sd)
sim.ApplyLBFGS(tolerance = 1.0, max_iterations = max_iter_lbfgs)
sim.ApplySD(tolerance = tolerance_sd, max_iterations = max_iter_sd)
sim.ApplyLBFGS(tolerance = tolerance_lbfgs, max_iterations = max_iter_lbfgs)
sim.UpdatePositions()
except Exception as ex:
# ABORT ON FAIL
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment