next up previous contents index
Next: schedule.make_for_model() trim Up: The schedule class: variable Previous: The schedule class: variable   Contents   Index

schedule() -- create a new schedule

schedule(last_scales, steps)
This creates a new schedule object, which can contain multiple schedule steps, given by the list steps. Each step then defines some of the optimization parameters: (1) the optimization method; (2) maximal number of residues that the restraints are allowed to span (Section 6.7.7); (3) the individual scaling factors for all the physical restraint types. last_scales is used by schedule.make_for_model().

The usual schedule for the variable target function part of optimization in comparative modeling is as follows. The residue range (Restraints.pick() and Section 6.7.7) is increased with increasingly larger steps until the protein length is reached. The scaling of homology-derived and bonded stereochemical restraints increases from a small value to 1 in the initial few steps to allow for imperfect starting geometries, especially those that result from selection.randomize_xyz() and long insertions or deletions. (For automodel, the restraints are additionally scaled by environ.schedule_scale. This is useful when template-derived fold restraints have to be weakened relative to some external restraints, so that the fold can actually reflect these external restraints, even when they are quite different from the template-derived restraints.) The soft-sphere overlap restraints are slowly introduced only in the last four steps of the variable target function method to save CPU time and increase the radius of convergence.

In comparative modeling by the automodel class in the default mode, the variable target function method is usually followed by simulated annealing with molecular dynamics. In this last stage, all homology-derived and stereochemical restraints are generally used scaled only by environ.schedule_scale. Thus, it is recommended that if you define your own schedule, the scaling factors for the last step are all 1, so that the energy surface followed in optimization is continuous.

There are a number of variables defined in the automodel class that can be used to influence the thoroughness of both the variable target function and molecular dynamics parts of the optimization; see Section 2.2.2.
Example: examples/commands/make_schedule.py


# This will create a VTFM optimization schedule and then
# use it to optimize the model

from modeller import *
from modeller.scripts import complete_pdb

# Load in optimizer and schedule support
from modeller import schedule, optimizers

log.verbose()

env = environ()
env.io.atom_files_directory = ['../atom_files']
env.edat.dynamic_sphere = True

env.libs.topology.read(file='$(LIB)/top_heav.lib')
env.libs.parameters.read(file='$(LIB)/par.lib')
code = '1fas'
mdl = complete_pdb(env, code)

# Generate the restraints:
atmsel = selection(mdl)
mdl.restraints.make(atmsel, restraint_type='stereo', spline_on_site=False)

# Create our own library schedule:
# 5 steps of conjugate gradients (CG), each step using a larger
# residue range (2 up to 9999) and energy scaling factor (0.01 up to 1.0),
# followed by 3 steps of molecular dynamics (MD) at successively lower
# temperature. The scaling factors for the last 5 steps are always retained.
CG = optimizers.conjugate_gradients
MD = optimizers.molecular_dynamics
libsched = schedule.schedule(5,
          [ schedule.step(CG, 2, physical.values(default=0.01)),
            schedule.step(CG, 5, physical.values(default=0.1)),
            schedule.step(CG, 10, physical.values(default=0.2)),
            schedule.step(CG, 50, physical.values(default=0.5)),
            schedule.step(CG, 9999, physical.values(default=1.0)),
            schedule.step(MD(temperature=300.), 9999, \
                          physical.values(default=1.0)),
            schedule.step(MD(temperature=200.), 9999, \
                          physical.values(default=1.0)),
            schedule.step(MD(temperature=100.), 9999, \
                          physical.values(default=1.0)) ])

# Make a trimmed schedule suitable for our model, and scale it by schedule_scale
mysched = libsched.make_for_model(mdl) * env.schedule_scale

# Write the trimmed schedule to a file
fh = open(code+'.sch', 'w')
mysched.write(fh)
fh.close()

# Optimize for all steps in the schedule
for step in mysched:
    step.optimize(atmsel, output='REPORT', max_iterations=200)

mdl.write(file=code+'.B')


next up previous contents index
Next: schedule.make_for_model() trim Up: The schedule class: variable Previous: The schedule class: variable   Contents   Index
Automatic builds 2010-04-21