[IMP-users] Error of using ConjugateOptimizer to optimize a Modeller model
To:
Subject: [IMP-users] Error of using ConjugateOptimizer to optimize a Modeller model
From: Jianlin Cheng <>
Date: Wed, 27 Oct 2010 22:40:22 -0500
Reply-to: Help and discussion for users of IMP <>
Hi,
I was trying to use IMP's ConjugateOptimizer to optimize a Modeller
model according to a small set of Modeller's restraints read from a
file. The restraints seemed to be loaded successfully and the model
could be evaluated on the restraints. However, when an
ConjugateOptimizer was used to optimize the initial model according to
the restraints, the program reported an error "There are no
optimizeable degrees of freedom". Does anybody know how to solve the
problem? Both the error message and the Python program are attached
below. Thanks!
Error Message:
Traceback (most recent call last):
File "test.py", line 35, in ?
opt.optimize(100)
File "/home/chengji/imp-dev/lib64/python2.4/site-packages/IMP/__init__.py",
line 1695, in optimize
def optimize(self, *args): return _IMP.Optimizer_optimize(self, *args)
_IMP.ModelException: There are no optimizeable degrees of freedom.
Python Code:
import IMP.atom
import IMP.container
import modeller
import IMP
import IMP.modeller
# Set up Modeller and build a model from a primary sequence
e = modeller.environ()
e.edat.dynamic_sphere = False
e.libs.topology.read('${LIB}/top_heav.lib')
e.libs.parameters.read('${LIB}/par.lib')
modmodel = modeller.model(e)
modmodel.build_sequence("AYVINDSCIACGACKPECPVNIIQGSIYAIDADSCIDCGSCASVCPVGAPNPED");
# Create an IMP model and load the model
loader = IMP.modeller.ModelLoader(modmodel)
m = IMP.Model()
prot2 = loader.load_atoms(m);
#read the restraints from a modeller restraint file
restraints = loader.load_static_restraints_file("/home/chengji/imp-dev/share/doc/imp/examples/modeller/examples/my.rsr.small")
#add restraints into the IMP model
for r in restraints:
m.add_restraint(r)
# Finally, evaluate the score of the whole system (without derivatives)
print m.evaluate(False)
#use ConjugateGradients to optimize the model
opt = IMP.core.ConjugateGradients()
opt.set_model(m)
opt.set_threshold(1e-5)
opt.optimize(100)