[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [IMP-users] Error of using ConjugateOptimizer to optimize a Modeller model



It works. Thanks.

Jack.

On Wed, Oct 27, 2010 at 11:14 PM, Daniel Russel <> wrote:
> One has to tell IMP what one wants optimized, and it sounds like the modeller module, by default, doesn't mark any of the x,y,z coordinates as being things that should be optimized. To optimize all the coordinates of all the atoms, you can add the following after loading prot2:
>
> # look at all the atoms, could also do "for l in IMP.atom.get_by_type(prot2, IMP.atom.ATOM_TYPE)"
> for l in IMP.core.get_leaves(prot2):
>    # say we want to optimize the XYZ coordinates by decorating the particle with an XYZ decorator
>    # and calling the set_coordinates_are_optimized() function on that decorator
>    IMP.core.XYZ(l).set_coordinates_are_optimized(True)
>
> With IMP 1.0, you may have to do XYZ(l.get_particle()) instead of XYZ(l). I can't remember.
>
> Hope that helps.
>
> On Oct 27, 2010, at 8:40 PM, Jianlin Cheng wrote:
>
>> 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)
>> _______________________________________________
>> IMP-users mailing list
>> 
>> https://salilab.org/mailman/listinfo/imp-users
>
>
> _______________________________________________
> IMP-users mailing list
> 
> https://salilab.org/mailman/listinfo/imp-users
>