28 #include <basic/Tracer.hh>
30 #include <utility/exit.hh>
31 #include <utility/tag/Tag.hh>
36 #include <utility/vector1.hh>
39 #include <numeric/random/random.hh>
40 #include <numeric/random/random_permutation.hh>
41 #include <utility/sort_predicates.hh>
50 using namespace operation;
51 using namespace scoring;
54 using basic::t_warning;
55 static basic::Tracer
TR(
"protocols.enzdes.PackRotamersMoverPartGreedy");
56 static numeric::random::RandomGenerator
trg_RG(10805);
76 protocols::moves::
Mover(
"PackRotamersMoverPartGreedy"),
77 scorefxn_repack_ (scorefxn),
78 scorefxn_minimize_ (scorefxn),
80 target_residues_ (target_residues)
84 protocols::moves::
Mover(
"PackRotamersMoverPartGreedy"),
86 scorefxn_minimize_(0),
96 return "PackRotamersMoverPartGreedy";
116 std::string const scorefxn_repack_greedy( tag->getOption<
std::string>(
"scorefxn_repack_greedy",
"score12" ) );
118 using namespace core::scoring;
123 if( tag->hasOption(
"target_residues") ) {
127 if( tag->hasOption(
"target_cstids") ) {
134 if( tag->hasOption(
"choose_best_n") ) {
161 using namespace core::pack::task;
163 TR<<
"Creating packer task based on specified task operations..."<< std::endl;
170 task_ = tf->create_task_and_apply_taskoperations( greedy_pose );
172 (*scorefxn_repack_)(greedy_pose);
191 task_->nonconst_residue_task( *pos_it ).prevent_repacking();
195 for (
core::Size ii=1;ii<=greedy_pose.total_residue();++ii){
196 if (
task_->being_designed(ii)) toAla.push_back( ii );
207 if (!(greedy_pose.residue(*res).name3() ==
"ALA")) pose.
replace_residue( *res, greedy_pose.residue(*res),
true);
211 TR<<
" Restrcting the following greedily found residues to repack: ";
214 if (!(greedy_pose.residue(*res).name3() ==
"ALA"))
task->nonconst_residue_task( *res ).restrict_to_repacking();
218 task->initialize_from_command_line().or_include_current(
true );
233 using namespace core::pack;
234 using namespace core::pack::task;
240 TR<<
"Considering target residue "<< cur_pose.residue( *pos_it ).name3() << *pos_it <<
": "<<std::endl;
245 allow_minimization[ *iter ] =
true;
247 allow_minimization[*pos_it] =
true;
249 TR <<
"Total number of neighbors are "<<neighbors.size()<<std::endl;
250 for (
core::Size ii=1;ii<=neighbors.size();++ii){
253 TR <<
"At iteration "<< ii <<
", current neighbor size is "<< cur_neighbors.size()<<std::endl;
257 TR <<
" Poly Ala energy is :"<< best_energy<<std::endl;
265 mutate_residue->initialize_from_command_line().or_include_current(
true );
268 upweight_1.push_back( *neigh_it );
270 upweight_2.push_back( *pos_it );
273 mutate_residue->set_IGEdgeReweights()->add_reweighter( ig_up );
278 if (i== *neigh_it) mutate_residue->nonconst_residue_task( i ).restrict_absent_canonical_aas( keep_aas );
279 else mutate_residue->nonconst_residue_task( i ).prevent_repacking();
283 prm->apply( working_pose );
286 movemap->set_jump(
false );
287 movemap->set_bb(
false );
288 movemap->set_chi( allow_minimization );
290 minmover->apply(working_pose);
296 if ( (this_energy<best_energy) || (best_neigh==0) ) {
298 cur_pose = working_pose;
299 best_neigh = *neigh_it;
300 best_energy = this_energy;
318 TR <<
"neighbors of position "<< position <<
" are: ";
325 neighbors.push_back( ii );
342 task->nonconst_residue_task( best_neigh ).restrict_to_repacking();
346 if (*neigh_it != best_neigh) temp_neighbors.push_back(*neigh_it);
347 else TR<<
" Updated current neighbors by removing "<<*neigh_it <<
" from it."<<std::endl;
349 current_neighbors = temp_neighbors;
372 using namespace core::graph;
373 using namespace core::scoring;
374 std::list< std::pair< core::Size, core::Real > > residue_energies;
377 (*scorefxn_repack_)(nonconst_pose);
385 core::Size const int_resi = (*egraph_it)->get_other_ind( res );
388 residue_energies.push_back( std::make_pair( int_resi, intE));
392 residue_energies.sort( utility::SortSecond< core::Size, core::Real >() );
394 for( std::list< std::pair<core::Size, core::Real> >::iterator it = residue_energies.begin();counter<=n_best; ++it){
395 chosen_residues.push_back( it->first );
396 TR <<
"Chose residue "<<it->first<<
" with interface energy "<<it->second <<std::endl;
399 return chosen_residues;