34 #include <basic/Tracer.hh>
39 #include <numeric/random/random.hh>
40 #include <numeric/conversions.hh>
45 #include <utility/vector1.hh>
56 static basic::Tracer
tr(
"protocols.enzdes.ModifyStoredLigandRBConfsMovers");
66 return "ModifyStoredRBConfs";
80 for(
core::Size atm = 1; atm <= res_atoms; ++atm ){
84 rescoords.
set_xyz( other_ind, save_pos );
95 if( to_return.size() == 0 )
return to_return;
96 Size center(0), nbr1(0), nbr2(0);
98 runtime_assert( confs[1]->name3() == pose_res.
name3() );
99 confs[1]->select_orient_atoms( center, nbr1, nbr2 );
100 runtime_assert( confs[1]->atom_name( center ) == pose_res.
atom_name( center ) );
101 runtime_assert( confs[1]->atom_name( nbr1 ) == pose_res.
atom_name( nbr1 ) );
102 runtime_assert( confs[1]->atom_name( nbr2 ) == pose_res.
atom_name( nbr2 ) );
104 for(
Size i = 1; i <= confs.size(); ++i ){
105 Real min_msd( pose_res.
xyz( center ).distance_squared( confs[i]->
xyz(center) ) + pose_res.
xyz( nbr1 ).distance_squared( confs[i]->
xyz(nbr1) ) + pose_res.
xyz( nbr2 ).distance_squared( confs[i]->
xyz(nbr2) ) );
106 for(
Size j = 1; j < i; ++j){
108 if( cur_msd < min_msd ) min_msd = cur_msd;
110 to_return[i] = min_msd;
121 if ( !enz_obs )
return to_return;
122 std::map< core::Size, utility::vector1< core::conformation::ResidueCOP > >
const & rb_confs( enz_obs->lig_rigid_body_confs() );
132 for(
core::Size i = 1; i <= rbs.size(); ++i ){
133 if( rbs[i].
size() > 0 ){
150 Size num_total_rbconfs,
152 ) :
parent(
"GenerateStoredRBConfs" ),
153 num_total_rbconfs_( num_total_rbconfs ), include_metals_(include_metals) {}
159 return "GenerateStoredRBConfs";
172 std::set< Size > present_confs_seqpos;
177 for(
Size i = 1; i <= rb_confs.size(); ++i ){
178 present_confs_seqpos.insert( rb_confs[i][1]->seqpos() );
180 rb_confs[i].push_back( (rb_confs[i][1])->
clone() );
189 if( present_confs_seqpos.find( i ) != present_confs_seqpos.end() )
continue;
191 tr <<
num_total_rbconfs_ <<
" random new rigid body conformations to be used in packing will be generated for residue " << pose.
residue(i).
name() <<
" " << i <<
"." << std::endl;
203 :
parent(
"ApplyRandomStoredRBConf" ) {}
215 for(
core::Size i = 1; i <= rb_confs.size(); ++i ){
216 core::Size picked_conf( numeric::random::random_range( 1, rb_confs[i].
size()) );
217 tr <<
"Randomly appying conf " << picked_conf <<
" of " << rb_confs[i].size() <<
" for respos " << rb_confs[i][picked_conf]->seqpos() << std::endl;
220 rb_confs[i][picked_conf] = exchange_res;
229 return "ApplyRandomStoredRBConf";
234 :
parent(
"MinimizeStoredRBConfs" ), sfxn_(sfxn), min_rms_(0.08) {}
244 for(
Size i = 1; i <= rb_confs.size(); ++i ){
245 if( rb_confs[i].
size() > 0){
254 return "MinimizeStoredRBConfs";
267 Size seqpos( confs[1]->seqpos() );
268 Size natoms( confs[1]->natoms() );
275 rtmin_task->initialize_from_command_line();
277 if( i == seqpos ) rtmin_task->nonconst_residue_task( i ).restrict_to_repacking();
278 else rtmin_task->nonconst_residue_task( i ).prevent_repacking();
282 for(
Size conf = 1; conf <= confs.size(); ++conf ){
293 minmover.
apply( mod_pose );
297 for(
core::Size atm = 1; atm <= natoms; ++atm ){
298 exchange_res->set_xyz( atm, newpos.xyz( exchange_res->atom_name( atm ) ) );
300 confs[conf] = exchange_res;
342 :
parent(
"DiversifyStoredRBConfs" ), min_rms_(min_rms), max_trials_(10) {}
352 for(
Size i = 1; i <= rb_confs.size(); ++i ){
353 if( rb_confs[i].
size() > 0){
363 return "DiversifyStoredRBConfs";
373 Size natoms( confs[1]->natoms() );
374 Size seqpos( confs[1]->seqpos() );
381 for(
Size j = 1; j <= min_dist.size(); ++j ){
383 if( min_dist[j] <=
min_rms_ ) confs_to_change.push_back( j );
385 if( confs_to_change.size() == 0 )
break;
387 for(
Size j = 1; j <= confs_to_change.size(); ++j ){
388 Size conf( confs_to_change[j] );
391 simple_rigbod.apply( mod_pose );
393 for(
core::Size atm = 1; atm <= natoms; ++atm ){
394 exchange_res->set_xyz( atm, newpos.xyz( exchange_res->atom_name( atm ) ) );
396 confs[conf] = exchange_res;