21 #include <numeric/xyzMatrix.hh>
22 #include <numeric/xyzVector.hh>
23 #include <numeric/xyz.functions.hh>
24 #include <basic/database/open.hh>
28 #include <utility/tag/Tag.hh>
31 #include <boost/lexical_cast.hpp>
32 #include <utility/exit.hh>
33 #include <basic/Tracer.hh>
36 #include <basic/options/option.hh>
37 #include <basic/options/keys/symmetry.OptionKeys.gen.hh>
41 namespace simple_moves {
44 static basic::Tracer
TR(
"protocols.simple_moves.symmetry.DetectSymmetry");
59 return "DetectSymmetry";
64 subunit_tolerance_( 0.01),
65 plane_tolerance_( 1e-3 )
69 subunit_tolerance_( subunit_tolerance ),
70 plane_tolerance_( plane_tolerance )
77 if( n_jumps == 0 ) utility_exit_with_message(
"Only one chain! no posible symmetry.");
78 Size symmetric_type = n_jumps + 1;
79 TR << symmetric_type <<
" number of subunits found" << std::endl;
82 const Pose ref_pose( pose, 1, seq1.size() );
83 for(
Size i = 1; i < symmetric_type; ++i){
84 if( seq1 != pose.
chain_sequence(i) ) utility_exit_with_message(
"subunits have different sequence! structure can't be symmetric");
85 Pose test_pose( pose, i*seq1.size()+1 , (i + 1)*seq1.size() );
87 TR.Debug <<
"rms chain " << i + 1 <<
" " << rms << std::endl;
88 if( rms >
subunit_tolerance_ ) utility_exit_with_message(
"rmsd between subunits higher than subunit tolerance");
91 TR << seq1.size() <<
" residues per subunit" << std::endl;
104 core::Real angle_cm_orig_x = numeric::angle_degrees(cm_chain_A,
xyzVector(cm_chain_A[0],0,0),
xyzVector(cm_chain_A[0],cm_chain_A[1], 0));
105 TR.Debug <<
"Angle between center of mass of chain A and x axis: " << angle_cm_orig_x << std::endl;
106 TR.Debug <<
"start - center of mass chain A " << cm_chain_A[0] <<
" " << cm_chain_A[1] <<
" " << cm_chain_A[2] <<
" " << std::endl;
107 xyzMatrix x_rot = numeric::x_rotation_matrix_degrees(angle_cm_orig_x * ((cm_chain_A[2] < 0.0)? -1 : 1) );
110 angle_cm_orig_x = numeric::angle_degrees(cm_chain_A,
xyzVector(cm_chain_A[0],0,0),
xyzVector(cm_chain_A[0],cm_chain_A[1], 0));
111 TR.Debug <<
"t1 - Angle between center of mass of chain A and x axis: " << angle_cm_orig_x << std::endl;
112 TR.Debug <<
"t1 - center of mass chain A " << cm_chain_A[0] <<
" " << cm_chain_A[1] <<
" " << cm_chain_A[2] <<
" " << std::endl;
116 xyzMatrix z_rot = numeric::z_rotation_matrix_degrees(angle_cm_orig_z * ((cm_chain_A[0] < 0.0) ? -1 : 1) );
119 TR.Debug <<
"t2 - Angle between center of mass of chain A and y axis: " << angle_cm_orig_z << std::endl;
120 TR.Debug <<
"t2 - center of mass chain A " << cm_chain_A[0] <<
" " << cm_chain_A[1] <<
" " << cm_chain_A[2] <<
" " << std::endl;
124 TR.Debug <<
"t4 - center of mass chain B " << cm_chain_B[0] <<
" " << cm_chain_B[1] <<
" " << cm_chain_B[2] <<
" " << std::endl;
125 core::Real angle_cm_orig_y = numeric::angle_degrees(cm_chain_B,
xyzVector(0,cm_chain_B[1],0),
xyzVector(cm_chain_B[0],cm_chain_B[1], 0));
126 xyzMatrix y_rot = numeric::y_rotation_matrix_degrees(angle_cm_orig_y * ((cm_chain_B[2] > 0.0) ? -1 : 1));
127 TR.Debug <<
"t4 - Angle between center of mass of chain B and y axis: " << angle_cm_orig_y << std::endl;
130 TR.Debug <<
"t4 - center of mass chain B " << cm_chain_B[0] <<
" " << cm_chain_B[1] <<
" " << cm_chain_B[2] <<
" " << std::endl;
146 Pose new_pose( pose, 1, seq1.size() );
149 std::string db_file =
"symmetry/cyclic/C" + boost::lexical_cast<
std::string >( symmetric_type ) +
"_Z.sym";
150 std::string path_to_symdef = basic::database::full_name(db_file);
154 basic::options::option[basic::options::OptionKeys::symmetry::symmetry_definition].value( db_file );