32 #include <utility/tag/Tag.hh>
36 #include <numeric/random/random.hh>
37 #include <numeric/random/random_permutation.hh>
40 #include <basic/Tracer.hh>
49 #include <utility/vector1.hh>
50 #include <utility/options/IntegerVectorOption.hh>
51 #include <numeric/xyz.functions.hh>
56 static basic::Tracer
TR(
"protocols.moves.RigidBodyMover");
57 static basic::Tracer
TRBM(
"protocols.moves.RigidBodyMover");
60 static numeric::random::RandomGenerator
RG(43225);
69 protocols::canonical_sampling::ThermodynamicMover(),
70 rb_jump_( 1 ), dir_(
n2c ), rot_center_( 0.0 ), freeze_(false)
72 Mover::type(
"RigidBodyBase" );
80 protocols::canonical_sampling::ThermodynamicMover(),
81 rb_jump_( rb_jump_in ), dir_( dir_in ), rot_center_( 0.0 ), freeze_(false)
83 Mover::type(
"RigidBodyBase" );
85 dir_ = ( numeric::random::uniform() < 0.5 ?
c2n :
n2c );
93 protocols::canonical_sampling::ThermodynamicMover( src ),
94 rb_jump_( src.rb_jump_ ),
96 rot_center_( src.rot_center_ ),
104 return "RigidBodyMover";
116 int const rb_jump_in,
123 rot_mag_( rot_mag_in ),
124 trans_mag_( trans_mag_in ),
125 partner_( partner_in ),
126 interface_(interface_in)
129 TRBM.Debug <<
"rb_jump " << rb_jump_in << std::endl;
132 Mover::type(
"RigidBodyPerturb" );
141 Mover::type(
"RigidBodyPerturb" );
145 int const rb_jump_in,
152 rot_mag_( rot_mag_in ),
153 trans_mag_( trans_mag_in ),
154 partner_( partner_in ),
156 ok_for_centroid_calculation_( ok_for_centroid_calculation )
159 TRBM.Debug <<
"rb_jump " << rb_jump_in << std::endl;
162 Mover::type(
"RigidBodyPerturb" );
174 rot_mag_( rot_mag_in ),
175 trans_mag_( trans_mag_in ),
176 partner_( partner_in ),
177 interface_(interface_in)
181 Mover::type(
"RigidBodyPerturb" );
182 for (
Size i=1, i_end = pose_in.
num_jump(); i<= i_end; ++i ) {
189 T(
"protocols.moves.rigid_body") <<
"[WARNING] no movable jumps!" << std::endl;
201 rot_mag_( rot_mag_in ),
202 trans_mag_( trans_mag_in ),
203 partner_( partner_in ),
204 interface_(interface_in)
209 Mover::type(
"RigidBodyPerturb" );
215 rot_mag_( src.rot_mag_ ),
216 trans_mag_( src.trans_mag_ ),
217 partner_( src.partner_ ),
218 interface_( src.interface_ ),
219 movable_jumps_( src.movable_jumps_ )
234 TR.Debug <<
"Set movable jump #" <<
rb_jump_ << std::endl;
253 Warning() <<
"Large Gaussian rotational perturbations don't make sense! Bad choices with -dock_pert? Use -randomize[12] instead." << std::endl;
267 return "RigidBodyPerturbMover";
282 utility_exit_with_message(
"Rotation point is automatically determined ONLY");
288 os <<
"Jump number: " << mover.
rb_jump() << std::endl;
289 os <<
"Magnitude of translational movement (deg): " << mover.
get_trans_mag() << std::endl <<
290 "Magnitude of rotational movement (deg): " << mover.
get_rot_mag() << std::endl;
318 return "RigidBodyPerturbNoCenter";
334 int const rb_jump_in,
338 rot_mag_( rot_mag_in ),
339 trans_mag_( trans_mag_in )
350 Real const rot_mag_in,
351 Real const trans_mag_in,
355 rot_mag_( rot_mag_in ),
356 trans_mag_( trans_mag_in )
359 TRBM.Debug <<
"rot_mag " << rot_mag_in << std::endl;
360 TRBM.Debug <<
"trans_mag " << trans_mag_in << std::endl;
362 for (
Size i=1, i_end = pose_in.
num_jump(); i<= i_end; ++i ) {
371 T(
"protocols.moves.rigid_body") <<
"[WARNING] no movable jumps!" << std::endl;
382 rot_mag_( src.rot_mag_ ),
383 trans_mag_( src.trans_mag_ ),
384 movable_jumps_( src.movable_jumps_ )
408 TR.Debug <<
"Set movable jump# " <<
rb_jump_ << std::endl;
416 return "RigidBodyPerturbNoCenterMover";
424 update_center_after_move_(true)
432 int const rb_jump_in,
436 bool update_center_after_move
439 partner_( partner_in ),
440 phi_angle_(phi_angle),
441 psi_angle_(psi_angle),
442 update_center_after_move_(update_center_after_move)
454 partner_( src.partner_ ),
455 phi_angle_( src.phi_angle_ ),
456 psi_angle_( src.psi_angle_ )
464 TRBM <<
"Randomize: " <<
"Jump (before): " << flexible_jump << std::endl;
467 TRBM <<
"Randomize: " <<
"Rot (before): "
475 TRBM <<
"Randomize: " <<
"Jump (after): " << flexible_jump << std::endl;
484 TRBM <<
"Randomize: " <<
"Rot (after): "
488 TRBM <<
"Randomize: " <<
"---" << std::endl;
493 return "RigidBodyRandomizeMover";
509 os <<
"Jump number: " << randommover.
rb_jump() <<
"\nPhi angle: " << randommover.
get_phi() <<
510 "\nPsi angle: " << randommover.
get_psi() << std::endl;
524 RigidBodyMover( rb_jump_in ), spin_axis_( 0.0 ), update_spin_axis_( true )
532 spin_axis_( src.spin_axis_ ),
533 update_spin_axis_( src.update_spin_axis_ )
554 TRBM <<
"Spin: " <<
"Jump (before): " << flexible_jump << std::endl;
565 TRBM <<
"Spin: " <<
"Rot (before: "
572 TRBM <<
"Spin: " <<
"Jump (after): " << flexible_jump << std::endl;
576 TRBM <<
"Spin: " <<
"Rot (after): "
580 TRBM <<
"Spin: " <<
"---" << std::endl;
585 return "RigidBodySpinMover";
591 os <<
"Jump number: " << spinmover.
rb_jump() << std::endl;
616 angle_magnitude_( src.angle_magnitude_)
630 TRBM <<
"Spin: " <<
"Jump (before): " << flexible_jump << std::endl;
641 TRBM <<
"Spin: " <<
"Rot (before: "
648 TRBM <<
"Spin: " <<
"Jump (after): " << flexible_jump << std::endl;
652 TRBM <<
"Spin: " <<
"Rot (after): "
656 TRBM <<
"Spin: " <<
"---" << std::endl;
661 return "RigidBodyDeterministicSpinMover";
667 os <<
"Jump number: " << spinmover.
rb_jump() << std::endl;
693 step_size_( src.step_size_ ),
694 trans_axis_( src.trans_axis_ )
702 TRBM <<
"Translate: " <<
"Jump (before): " << flexible_jump << std::endl;
705 TRBM <<
"Translate: " <<
"Jump (after): " << flexible_jump << std::endl;
711 return "RigidBodyTransMover";
717 os <<
"Jump number: " << mover.
rb_jump() << std::endl;
729 int const rb_jump_in,
733 step_size_( step_size_in ),
745 step_size_( src.step_size_ ),
746 random_step_(src.random_step_),
747 trans_axis_(src.trans_axis_)
776 return "UniformSphereTransMover";
788 int const rb_jump_in,
809 using namespace core::conformation::symmetry;
813 TRBM.Debug <<
"Randomize: " <<
"Jump (before): " << flexible_jump << std::endl;
831 flexible_jump.set_translation( trans );
846 flexible_jump.get_rotation();
847 flexible_jump.set_rotation( rot );
857 if ( i ==
X_ANGLE_DOF ) rot = numeric::x_rotation_matrix_degrees(angle);
858 if ( i ==
Y_ANGLE_DOF ) rot = numeric::y_rotation_matrix_degrees(angle);
859 if ( i ==
Z_ANGLE_DOF ) rot = numeric::z_rotation_matrix_degrees(angle);
861 rot *= flexible_jump.get_rotation();
862 flexible_jump.set_rotation( rot );
873 rot *= flexible_jump.get_rotation();
874 flexible_jump.set_rotation( rot );
879 TRBM.Debug <<
"Randomize: " <<
"Jump (after): " << flexible_jump << std::endl;
880 TRBM.Debug <<
"Randomize: " <<
"---" << std::endl;
885 return "RigidBodyDofRandomizeMover";
896 std::map< Size, core::conformation::symmetry::SymDof >
const & dofs
918 using namespace core::conformation::symmetry;
920 std::map< Size, SymDof >::iterator it;
921 std::map< Size, SymDof >::iterator it_begin =
dofs_.begin();
922 std::map< Size, SymDof >::iterator it_end =
dofs_.end();
923 for ( it = it_begin; it != it_end; ++it ) {
924 int jump_nbr ( (*it).first );
925 SymDof dof ( (*it).second );
927 dofrandommover.
apply( pose );
933 return "RigidBodyDofSeqRandomizeMover";
952 int const rb_jump_in,
964 core::Vector zero(0,0,0), x(1,0,0), y(0,1,0), z(0,0,1);
980 std::map< Size, core::conformation::symmetry::SymDof > dofs
992 std::map< Size, core::conformation::symmetry::SymDof >::iterator it;
993 std::map< Size, core::conformation::symmetry::SymDof >::iterator it_begin = dofs.begin();
994 std::map< Size, core::conformation::symmetry::SymDof >::iterator it_end = dofs.end();
995 for ( it = it_begin; it != it_end; ++it ) {
996 int jump_nbr ( (*it).first );
999 trans_jumps.push_back( jump_nbr );
1003 if ( trans_jumps.empty() ) {
1004 T(
"protocols.moves.rigid_body") <<
"[WARNING] no movable jumps!" << std::endl;
1007 rb_jump_ = numeric::random::random_element( trans_jumps );
1008 std::map< Size, core::conformation::symmetry::SymDof >::iterator jump_iterator =
1010 if ( jump_iterator == dofs.end() ) {
1011 T(
"protocols.moves.rigid_body") <<
"[WARNING] jump dof not found!" << std::endl;
1018 core::Vector zero(0,0,0), x(1,0,0), y(0,1,0), z(0,0,1);
1036 jump_dir_( src.jump_dir_ ),
1037 step_size_( src.step_size_ ),
1038 trans_axis_( src.trans_axis_ )
1048 TRBM.Debug <<
"Translate: " <<
"Jump (before): " << flexible_jump << std::endl;
1053 TRBM.Debug <<
"Translate: " <<
"Jump (after): " << flexible_jump << std::endl;
1059 return "RigidBodyDofTransMover";
1073 std::map< Size, core::conformation::symmetry::SymDof > dofs
1084 std::map< Size, core::conformation::symmetry::SymDof >::iterator it;
1085 std::map< Size, core::conformation::symmetry::SymDof >::iterator it_begin = dofs.begin();
1086 std::map< Size, core::conformation::symmetry::SymDof >::iterator it_end = dofs.end();
1087 for ( it = it_begin; it != it_end; ++it ) {
1088 int jump_nbr ( (*it).first );
1091 trans_jumps.push_back( jump_nbr );
1095 if ( trans_jumps.empty() ) {
1096 T(
"protocols.moves.rigid_body") <<
"[WARNING] no movable jumps!" << std::endl;
1108 rb_jumps_( src.rb_jumps_ ),
1109 step_size_( src.step_size_ ),
1110 trans_axis_( src.trans_axis_ )
1118 std::map< Size, core::conformation::symmetry::SymDof >::iterator jump_iterator;
1126 for ( it = start; it !=
end; ++it ) {
1127 jump_iterator =
dofs_.find( *it );
1128 if ( jump_iterator ==
dofs_.end() ) {
1129 T(
"protocols.moves.rigid_body") <<
"[WARNING] jump dof not found!" << std::endl;
1137 dofmover.
apply( pose );
1145 return "RigidBodyDofSeqTransMover";
1159 std::map< Size, core::conformation::symmetry::SymDof > dofs
1170 std::map< Size, core::conformation::symmetry::SymDof >::iterator it;
1171 std::map< Size, core::conformation::symmetry::SymDof >::iterator it_begin = dofs.begin();
1172 std::map< Size, core::conformation::symmetry::SymDof >::iterator it_end = dofs.end();
1173 for ( it = it_begin; it != it_end; ++it ) {
1174 int jump_nbr ( (*it).first );
1177 trans_jumps.push_back( jump_nbr );
1181 if ( trans_jumps.empty() ) {
1182 T(
"protocols.moves.rigid_body") <<
"[WARNING] no movable jumps!" << std::endl;
1193 rb_jumps_( src.rb_jumps_ ),
1194 step_size_( src.step_size_ ),
1195 trans_axis_( src.trans_axis_ )
1204 std::map< Size, core::conformation::symmetry::SymDof >::iterator jump_iterator;
1215 jump_iterator =
dofs_.find( jump_ );
1216 if ( jump_iterator ==
dofs_.end() ) {
1217 T(
"protocols.moves.rigid_body") <<
"[WARNING] jump dof not found!" << std::endl;
1225 dofmover.
apply( pose );
1232 return "RigidBodyDofRandomTransMover";
1239 int const rb_jump_in,
1245 rot_mag_( rot_mag_in ),
1246 trans_mag_( trans_mag_in )
1262 std::map< Size, core::conformation::symmetry::SymDof > dofs,
1263 Real const rot_mag_in,
1264 Real const trans_mag_in
1267 rot_mag_( rot_mag_in ),
1268 trans_mag_( trans_mag_in )
1276 std::map< Size, core::conformation::symmetry::SymDof >::iterator it;
1277 std::map< Size, core::conformation::symmetry::SymDof >::iterator it_begin = dofs.begin();
1278 std::map< Size, core::conformation::symmetry::SymDof >::iterator it_end = dofs.end();
1279 for ( it = it_begin; it != it_end; ++it ) {
1280 moving_jumps.push_back( (*it).first );
1283 if ( moving_jumps.empty() ) {
1284 T(
"protocols.moves.rigid_body") <<
"[WARNING] no movable jumps!" << std::endl;
1287 rb_jump_ = numeric::random::random_element( moving_jumps );
1288 std::map< Size, core::conformation::symmetry::SymDof >::iterator jump_iterator =
1290 if ( jump_iterator == dofs.end() ) {
1291 T(
"protocols.moves.rigid_body") <<
"[WARNING] jump dof not found!" << std::endl;
1302 rot_mag_( src.rot_mag_ ),
1303 trans_mag_( src.trans_mag_ )
1314 for (
Size i = 1; i<= 3; ++i ) {
1325 for (
Size i = 4; i<= 6; ++i ) {
1341 return "RigidBodyDofPerturbMover";
1346 std::map< Size, core::conformation::symmetry::SymDof > dofs,
1347 Real const rot_mag_in,
1348 Real const trans_mag_in
1351 rot_mag_( rot_mag_in ),
1352 trans_mag_( trans_mag_in )
1360 std::map< Size, core::conformation::symmetry::SymDof >::iterator it;
1361 std::map< Size, core::conformation::symmetry::SymDof >::iterator it_begin = dofs.begin();
1362 std::map< Size, core::conformation::symmetry::SymDof >::iterator it_end = dofs.end();
1363 for ( it = it_begin; it != it_end; ++it ) {
1364 moving_jumps.push_back( (*it).first );
1367 if ( moving_jumps.empty() ) {
1368 T(
"protocols.moves.rigid_body") <<
"[WARNING] no movable jumps!" << std::endl;
1381 rb_jumps_( src.rb_jumps_ ),
1382 rot_mag_( src.rot_mag_ ),
1383 trans_mag_( src.trans_mag_ )
1391 std::map< Size, core::conformation::symmetry::SymDof >::iterator jump_iterator;
1400 for ( it = start; it !=
end; ++it ) {
1401 jump_iterator =
dofs_.find( *it );
1402 if ( jump_iterator ==
dofs_.end() ) {
1403 T(
"protocols.moves.rigid_body") <<
"[WARNING] jump dof not found!" << std::endl;
1407 dofmover.
apply( pose );
1414 return "RigidBodyDofSeqPerturbMover";