57 #include <numeric/xyzVector.hh>
59 #include <ObjexxFCL/format.hh>
61 #include <utility/vector0.hh>
62 #include <utility/vector1.hh>
63 #include <utility/tag/Tag.hh>
64 #include <basic/Tracer.hh>
65 #include <basic/options/keys/pb_potential.OptionKeys.gen.hh>
72 #include <utility/excn/Exceptions.hh>
73 #include <boost/functional/hash.hpp>
76 namespace simple_moves {
85 static basic::Tracer
TR(
"protocols.protein_interface_design.movers.ddG" );
102 using namespace core;
103 using namespace protocols::simple_moves;
104 using namespace core::scoring;
110 bound_total_energy_(0.0),
111 unbound_total_energy_(0.0),
115 per_residue_ddg_(false),
117 relax_mover_( NULL ),
118 use_custom_task_(false),
122 translate_by_(DEFAULT_TRANSLATION_DISTANCE)
132 bool const symmetry ) :
134 bound_total_energy_(0.0),
135 unbound_total_energy_(0.0),
139 per_residue_ddg_(false),
141 relax_mover_( NULL ),
142 use_custom_task_(false),
146 translate_by_(DEFAULT_TRANSLATION_DISTANCE)
159 TR <<
"PB enabled" << std::endl;
169 bool const symmetry ) :
171 bound_total_energy_(0.0),
172 unbound_total_energy_(0.0),
176 per_residue_ddg_(false),
178 relax_mover_( NULL ),
179 use_custom_task_(false),
183 translate_by_(DEFAULT_TRANSLATION_DISTANCE)
197 TR <<
"PB enabled" << std::endl;
211 symmetry_ = tag->getOption<
bool>(
"symmetry",0);
213 repack_ = tag->getOption<
bool>(
"repack",0);
221 if(tag->hasOption(
"chains") &&
symmetry_)
223 throw utility::excn::EXCN_RosettaScriptsOption(
"you cannot specify multiple chains and use symmetry mode in the ddG mover at the same time right now. Sorry");
226 if( ( tag->hasOption(
"chain_num") || tag->hasOption(
"chain_name") ) && tag->hasOption(
"jump"))
228 throw utility::excn::EXCN_RosettaScriptsOption(
"you can specify either chains or jump in the ddG mover, but not both");
231 if(tag->hasOption(
"chain_num"))
236 if(tag->hasOption(
"chain_name"))
247 throw utility::excn::EXCN_RosettaScriptsOption(
"You can't move the first chain. Moving chain 2 is the same as moving chain 1, so do that instead.");
258 TR <<
"PB enabled. Translation distance = " << translate_by_ <<
" A" << std::endl;
260 TR.Warning <<
"Translation distance may be too large for PB-enabled scoring. Consider 100 (default) if you run out of memory: " << translate_by_ << std::endl;
274 using namespace core::scoring::methods;
280 energy_options->hbond_options().decompose_bb_hb_into_pair_energies(
true);
281 scorefxn_->set_energy_method_options(*energy_options);
284 Real average_ddg = 0.0;
285 std::map<Size, Real> average_per_residue_ddgs;
305 core::Real residue_ddg = bound_energy - unbound_energy;
306 if(average_per_residue_ddgs.find(i) == average_per_residue_ddgs.end())
308 average_per_residue_ddgs[i] = residue_ddg;
311 average_per_residue_ddgs[i] += residue_ddg;
318 for(std::map<Size,Real>::iterator avg_it = average_per_residue_ddgs.begin(); avg_it != average_per_residue_ddgs.end();++avg_it)
324 job->add_string_real_pair(
"ddg",average_ddg);
328 std::string residue_string(utility::to_string<core::Size>(i));
329 job->add_string_real_pair(
"residue_ddg_"+residue_string,average_per_residue_ddgs[i]);
339 using namespace core::scoring;
360 energy_map.insert(std::make_pair(resid,energy));
369 using ObjexxFCL::fmt::F;
370 using ObjexxFCL::fmt::LJ;
371 out <<
"-----------------------------------------\n";
372 out <<
" Scores Wghtd.Score\n";
373 out <<
"-----------------------------------------\n";
374 std::map< ScoreType, Real >::const_iterator unbound_it=
unbound_energies_.begin();
375 for( std::map< ScoreType, Real >::const_iterator bound_it=
bound_energies_.begin();
378 if( std::abs( unbound_it->second ) > 0.001 || std::abs( bound_it->second ) > 0.001 )
379 out <<
' ' << LJ( 24, bound_it->first ) <<
' ' << F( 9,3, bound_it->second - unbound_it->second )<<
'\n';
382 out <<
"-----------------------------------------\n";
383 out <<
"Sum ddg: "<<
sum_ddG()<<std::endl;
390 Real sum_energy(0.0);
392 std::map< ScoreType, Real >::const_iterator unbound_it=
unbound_energies_.begin();
393 for( std::map< ScoreType, Real >::const_iterator bound_it=
bound_energies_.begin();
396 sum_energy += bound_it->second - unbound_it->second;
410 using namespace pack;
411 using namespace protocols::moves;
412 using namespace core::scoring::methods;
430 runtime_assert( cached_data != 0 );
431 original_state = cached_data->get_energy_state();
448 if(
pb_enabled_ ) cached_data->set_energy_state(emoptions.pb_bound_tag());
457 task_->initialize_from_command_line().or_include_current(
true );
491 (*scorefxn_)( pose );
501 if(
pb_enabled_ ) cached_data->set_energy_state(emoptions.pb_unbound_tag());
506 Vector translation_axis(1,0,0);
514 translate->trans_axis(translation_axis);
515 translate->apply( pose );
523 translate->apply( pose );
530 (*scorefxn_)( pose );
541 cached_data->set_energy_state( original_state );
550 using namespace pack;
551 using namespace protocols::moves;
552 using namespace core::scoring::methods;
570 runtime_assert( cached_data != 0 );
571 original_state = cached_data->get_energy_state();
577 dynamic_cast<SymmetricConformation & > ( pose.conformation()) );
579 std::map< Size, core::conformation::symmetry::SymDof > dofs ( symm_conf.
Symmetry_Info()->get_dofs() );
587 if(
pb_enabled_ ) cached_data->set_energy_state(emoptions.pb_bound_tag());
596 task_->initialize_from_command_line().or_include_current(
true );
611 (*scorefxn_)( pose );
621 if(
pb_enabled_ ) cached_data->set_energy_state( emoptions.pb_unbound_tag() );
625 translate->apply( pose );
629 (*scorefxn_)( pose );
640 cached_data->set_energy_state( original_state );
648 using namespace core::scoring::methods;
669 runtime_assert( cached_data != 0 );
670 original_state = cached_data->get_energy_state();
676 if(
pb_enabled_ ) cached_data->set_energy_state( emoptions.pb_bound_tag() );
678 (*scorefxn_)( pose );
689 if(
pb_enabled_ ) cached_data->set_energy_state( emoptions.pb_unbound_tag() );
694 Vector translation_axis(1,0,0);
701 translate->trans_axis(translation_axis);
703 translate->apply( pose );
710 translate->apply( pose );
715 (*scorefxn_)( pose );
726 cached_data->set_energy_state( original_state );