26 #include <basic/Tracer.hh>
29 #include <utility/tag/Tag.hh>
30 #include <numeric/random/random.hh>
32 #include <utility/vector1.hh>
36 #include <boost/foreach.hpp>
38 #include <utility/vector0.hh>
45 #define foreach BOOST_FOREACH
48 namespace protein_interface_design {
52 using namespace core::scoring;
54 static basic::Tracer
TR(
"protocols.protein_interface_design.movers.RandomMutation" );
55 static numeric::random::RandomGenerator
RG( 2111918 );
71 return "RandomMutation";
76 task_factory_( NULL ),
87 using namespace core::pack::task;
88 using namespace core::pack::task::operation;
89 using namespace core::chemical;
100 task =
task_factory()->create_task_and_apply_taskoperations( pose );
107 being_designed.clear();
110 if( task->residue_task( resi ).being_designed() && pose.
residue(resi).
is_protein() )
111 being_designed.push_back( resi );
113 if( being_designed.empty() ) {
114 TR.Warning <<
"WARNING: No residues are listed as designable." << std::endl;
117 core::Size const random_entry = being_designed[ (
core::Size) floor( RG.uniform() * being_designed.size() )+1 ];
118 typedef list< ResidueTypeCOP > ResidueTypeCOPList;
119 ResidueTypeCOPList
const & allowed( task->residue_task( random_entry ).allowed_residue_types() );
123 if( t->aa() != pose.
residue( random_entry ).
aa() )
124 allow_temp.push_back( t->aa() );
127 AA const target_aa( allow_temp[ (
core::Size) floor( RG.uniform() * allow_temp.size() ) + 1 ] );
131 allowed_aas[ target_aa ] =
true;
134 mutate_residue->initialize_from_command_line().or_include_current(
true );
136 if( resi != random_entry )
137 mutate_residue->nonconst_residue_task( resi ).restrict_to_repacking();
139 mutate_residue->nonconst_residue_task( resi ).restrict_absent_canonical_aas( allowed_aas );
141 TR<<
"Mutating residue "<<pose.
residue( random_entry ).
name3()<<random_entry<<
" to ";
163 cache_task_ = tag->getOption<
bool >(
"cache_task", false );