I figured out the problem, not sure if it's a bug or not.
In my system some atoms are fixed and some are flexible. The ones that are fixed I call
atom.set_coordinates_are_optimized(0)
which prevents them from moving in MD.
Then I create the optimizer and velocity scaler as such:
mdOptimizer = IMP.atom.MolecularDynamics(model) vsos = IMP.atom.VelocityScalingOptimizerState(IMP.atom.get_leaves(protein), 0, 0) vsIndex = mdOptimizer.add_optimizer_state(vsos) vsos.set_temperature(100.0) . . .
mdOptimizer.optimize(100) #throws exception
The error comes if I call set_coordinates_are_optimized(0) *after* creating the VelocityScalingOptimizerState. If I call set_coordinates_are_optimized(0) before creating vsos, it works fine.
dave
On 6/26/12 1:12 PM, Daniel Russel wrote: > I forwarded this to imp-dev since I am not super familiar with the MD > support int IMP. My guess is that the velocities are not being added > before the OptimizerState is called. > > As for the other questions, the general error handler function is now > IMP::base::handle_error (and is now documented). You can also do > "catch throw" in gdb to break any time there is an exception, but this > is a bit annoying when reading pdbs as exceptions are thrown over > missing/unknown atoms. > > On Tue, Jun 26, 2012 at 12:15 PM, Dave Barkan <dbarkan@salilab.org > mailto:dbarkan@salilab.org> wrote: > > Hey Daniel, > > I am getting an IMP usage exception when I try to use a > VelocityScalingOptimizerState (output run from gdb): > > Traceback (most recent call last): > File "generateTrajectories.py", line 56, in <module> > p.runMolecularDynamics() > File > "/trombone1/home/dbarkan/IMP/impBuildFour/imp/debug/build/lib/IMP/pepdock/peptideDocker.py", > line 107, in runMolecularDynamics > self.mdHandler.runMdStage(i) > File > "/trombone1/home/dbarkan/IMP/impBuildFour/imp/debug/build/lib/IMP/pepdock/md.py", > line 59, in runMdStage > > self.mdOptimizer.optimize(self.schedule.getStepCountForMdStage(stageNumber)) > File > "/trombone1/home/dbarkan/IMP/impBuildFour/imp/debug/build/lib/IMP/__init__.py", > line 3049, in optimize > return _IMP.Optimizer_optimize(self, *args) > _IMP.UsageException: Usage check failure: Can't get attribute that > is not there > Context: MD 0::optimize/simulate > > WARNING No frames were saved to file "HierarchySaveLink0" even > though objects were added. > WARNING Object "HierarchySaveLink0" was never used. See the > IMP::Object documentation for an explanation. > WARNING Object "lj_flex_flex" was never used. See the IMP::Object > documentation for an explanation. > [Inferior 1 (process 40694) exited with code 01] > > I can use other OptimizerStates without seeing this error. > VelocityScalingOptimizerState was working before but stopped after > I changed some of my code (no IMP updates) around so I am probably > not initializing something correctly. > > I tried running it with gdb but it appears to exit without > allowing me to see the backtrace (it says 'no stack' when I type > backtrace). Previously I was able to set a breakpoint when a usage > exception was occurring by typing > > break IMP::internal::assert_fail > > before running gdb. But that seems to no longer work: > > (gdb) break IMP::internal::assert_fail > Function "IMP::internal::assert_fail" not defined. > Make breakpoint pending on future shared library load? (y or [n]) > > So my questions: > > 1. Does anything immediately stand out to you with the error? > 2. Can I get gdb to stop upon the Usage Exception with the stack > in memory so I can track down the error? > > Thanks, > Dave > >