# Calling A Protocol From Another Protocol

3 posts / 0 new
Calling A Protocol From Another Protocol
#1

Hi,

I am having trouble calling other movers from the protocol I created and cannot find a solution. Maybe it is obvious again, but I cannot see it.

I modified the minirosetta routine to call my protocol (SymEns), which looks like the following code. This works fine and indeed generates useful output.

 int symens_main() { SymEnsProtocolOP assembly_mover = new SymEnsProtocol; protocols::moves::symmetry::SetupForSymmetryMoverOP setup_mover = new protocols::moves::symmetry::SetupForSymmetryMover; protocols::symmetric_docking::SymDockProtocolOP dock_mover = new protocols::symmetric_docking::SymDockProtocol; protocols::moves::SequenceMoverOP seq_mover = new protocols::moves::SequenceMover; seq_mover->add_mover( assembly_mover ); seq_mover->add_mover( setup_mover ); seq_mover->add_mover( dock_mover ); protocols::jd2::JobDistributor::get_instance()->go( seq_mover ); }

If I want to apply the very same movers from within my protocol, by using:

setup_mover->apply( pose );dock_mover->apply( pose );

I just get a segmentation fault as soon as the setup_mover (SetupForSymmetryMover) is called/applied.

The reason for doing this is, that I want to pass a variable from my protocol to the symmetric_docking protocol.

Thanks a lot.

Post Situation:
Wed, 2011-11-09 09:50
jurkm

I don't have enough information to help you debug. There are any number of reasons you might be getting a segfault. If you are interested in writing code, you would be well-served to compile in debug mode (warning, it's slow to compile and slow to run) and learn to use a debugger; that will unequivocally tell you where the segfault is.

Are the setup_mover and dock_mover being constructed in your code in an identical fashion to how they are constructed in the code snippet above (default constructor)? If that is the case it's tough to imagine what might be going wrong.

Wed, 2011-11-09 10:32
smlewis

Thanks for the suggestion. I compiled in debug mode. That actually helped. I will make myself familiar with XCode and use that for the future.

It was a very stupid mistake. I constructed the movers two times; once in the header file and once in the ".cc" file itself.

Thu, 2011-11-10 07:42
jurkm