##
Changing the default optimization and refinement protocol

See Section A.4 for a detailed description of the optimization and refinement protocol used by `automodel`. To summarize, each model is first optimized with the variable target function method (VTFM) with conjugate gradients (CG), and is then refined using molecular dynamics (MD) with simulated annealing (SA) [Šali & Blundell, 1993]. Most of the time (70%) is spent on the MD&SA part. Our experience is that when MD&SA are used, if there are violations in the best of the 10 models, they probably come from an alignment error, not an optimizer failure (if there are no insertions longer than approximately 15 residues).

The VTFM step can be tuned by adjusting automodel.library_schedule, automodel.max_var_iterations, and automodel.max_molpdf.

The MD&SA step can be tuned by adjusting automodel.md_level.

The whole optimization can be repeated multiple times if desired (by default it is run only once) by adjusting automodel.repeat_optimization.

The energy function used in both VTFM and MD&SA can be scaled by setting environ.schedule_scale. (Note that for VTFM, the function is additionally scaled by the factors set in automodel.library_schedule.)

Example: examples/automodel/model-changeopt.py

      # Example of changing the default optmization schedule
      from modeller import *
      from modeller.automodel import *

      log.verbose()
      env = environ()

      # Give less weight to all soft-sphere restraints:
      env.schedule_scale = physical.values(default=1.0, soft_sphere=0.7)
      env.io.atom_files_directory = ['.', '../atom_files']

      a = automodel(env, alnfile='alignment.ali', knowns='5fd1', sequence='1fdx')
      a.starting_model = a.ending_model = 1

      # Very thorough VTFM optimization:
      a.library_schedule = autosched.slow
      a.max_var_iterations = 300

      # Thorough MD optimization:
      a.md_level = refine.slow

      # Repeat the whole cycle 2 times and do not stop unless obj.func. > 1E6
      a.repeat_optimization = 2
      a.max_molpdf = 1e6

      a.make()