31 #include <numeric/random/random.hh>
32 #include <numeric/angle.functions.hh>
33 #include <numeric/xyz.functions.hh>
34 #include <numeric/xyzVector.hh>
35 #include <numeric/conversions.hh>
36 #include <numeric/kinematic_closure/bridgeObjects.hh>
37 #include <numeric/kinematic_closure/kinematic_closure_helpers.hh>
38 #include <utility/exit.hh>
39 #include <utility/vector1.hh>
40 #include <ObjexxFCL/FArray1D.hh>
41 #include <ObjexxFCL/string.functions.hh>
42 #include <ObjexxFCL/format.hh>
46 static numeric::random::RandomGenerator
RG ( 26640 );
47 using ObjexxFCL::fmt::I;
48 using ObjexxFCL::fmt::F;
53 using numeric::conversions::radians;
54 using numeric::conversions::degrees;
55 using numeric::angle_radians;
56 using numeric::principal_angle;
57 using numeric::dihedral_radians;
63 RNA_AnalyticLoopCloser::RNA_AnalyticLoopCloser (
Size const moving_suite,
Size const chainbreak_suite ) :
64 moving_suite_ ( moving_suite ),
65 chainbreak_suite_ ( chainbreak_suite ),
68 choose_least_perturb_solution_ ( true ),
69 choose_best_solution_ ( false ),
70 choose_random_solution_ ( false ),
71 save_all_solutions_ ( false ) {
72 Mover::type (
"RNA_AnalyticLoopCloser" );
92 using namespace core::kinematics;
93 using namespace numeric::kinematic_closure;
121 for (
Size i = 1; i <= 3; i++ ) {
122 pivots[ i ] = 3 * i + 2;
133 for (
Size i = 1; i <= atoms.size(); i++ ) {
134 atoms_xyz.push_back (
Vector ( atoms[i][1], atoms[i][2], atoms[i][3] ) );
144 db_len[ 8 ] = d_O3star_nextP;
146 Real const theta_C3star_O3star_nextP = degrees ( angle_radians ( pose.
xyz (
NamedAtomID (
" C3*", cutpos_ ) ),
149 db_ang[ 8 ] = theta_C3star_O3star_nextP;
150 Real const theta_O3star_nextP_nextO5star = degrees ( angle_radians ( pose.
xyz (
NamedAtomID (
" O3*", cutpos_ ) ),
153 db_ang[ 9 ] = theta_O3star_nextP_nextO5star;
159 dt_ang[ 7 ] = phi_C4star_C3star_O3star_nextP;
160 Real const phi_C3star_O3star_nextP_nextO5star = degrees ( dihedral_radians (
165 dt_ang[ 8 ] = phi_C3star_O3star_nextP_nextO5star;
166 Real const phi_O3star_nextP_nextO5star_nextC5star = degrees ( dihedral_radians ( pose.
xyz (
NamedAtomID (
"OVU1", cutpos_ + 1 ) ),
170 dt_ang[ 9 ] = phi_O3star_nextP_nextO5star_nextC5star;
173 std::cout <<
"after chainbreak geometry fix" << std::endl;
186 if (
nsol_ == 0 )
return false;
209 AtomID id1, id2, id3, id4;
265 std::cout <<
"Problem with DOF_ID " << dof_id << std::endl;
266 utility_exit_with_message (
"Problem with DOF_ID" );
269 offset_save.push_back ( pose.
dof ( dof_id ) - radians ( original_torsion_value ) );
274 std::cout <<
" offset " << pose.
dof ( dof_id ) <<
" " << radians ( original_torsion_value )
275 <<
" " << pose.
dof ( dof_id ) - radians ( original_torsion_value ) << std::endl;
288 if (
nsol_ == 0 )
return;
292 std::cout <<
"---------------------------------- " << std::endl;
293 std::cout <<
" start pose " << std::endl;
294 std::cout <<
"---------------------------------- " << std::endl;
299 pose.
dump_pdb (
"before_closed.pdb" );
302 Real best_deviation2 ( 0.0 );
306 Size const ref_atom ( 1 );
309 ref_vectors.push_back ( pose.
xyz (
id::AtomID ( ref_atom, i ) ) );
314 Real deviation2 ( 0.0 );
317 deviation2 += ( pose.
xyz (
id::AtomID ( ref_atom, i ) ) - ref_vectors[i] ).length_squared();
320 if ( n == 1 || deviation2 < best_deviation2 ) {
321 best_deviation2 = deviation2;
329 std::cout <<
"---------------------------------- " << std::endl;
330 std::cout <<
" solution " << best_sol << std::endl;
331 std::cout <<
"---------------------------------- " << std::endl;
338 std::cout <<
"pose " << best_sol <<
": " << std::endl;
347 Real best_score ( 0.0 );
352 Real const score = ( *scorefxn_ ) ( pose );
354 if ( score < best_score || n == 1 ) {
360 std::cout <<
"solution " << n <<
": " << std::endl;
362 std::cout <<
"pose " << n <<
": " << std::endl;
373 Size const n =
static_cast<int> (
nsol_ *
RG.uniform() ) + 1;
388 pose_list.push_back ( pose_save );
391 pose.
dump_pdb (
"KIC_" + ObjexxFCL::string_of ( n ) +
".pdb" );
400 Size const n )
const {
403 for (
Size i = 1; i <= 3; i++ ) {
415 assert ( n <=
t_ang_.size() );
419 for (
Size i = 1; i <= 3; i++ ) {
421 torsions.push_back ( degrees ( principal_angle ( radians (
t_ang_[ n ][ 3 * i + 1 ] ) +
offset_save_[count] ) ) );
423 torsions.push_back ( degrees ( principal_angle ( radians (
t_ang_[ n ][ 3 * i + 2 ] ) +
offset_save_[count] ) ) );
436 return torsions_for_all_solutions;
460 std::cout <<
"------ chainTORS output ---- " << std::endl;
462 for (
Size i = 1; i <= dt_ang.size(); i++ ) {
463 std::cout << I ( 3, i ) <<
" ";
464 std::cout <<
"TORSIONS: ";
465 std::cout << F ( 8, 3, dt_ang[ i ] ) <<
" ";
466 std::cout <<
" BOND_ANGLES: ";
467 std::cout << F ( 8, 3, db_ang[ i ] ) <<
" ";
468 std::cout <<
" BOND_LENGTHS: ";
469 std::cout << F ( 8, 3, db_len[ i ] ) <<
" ";
470 std::cout << std::endl;
483 using namespace core::kinematics;
484 using namespace numeric::kinematic_closure;
489 for (
Size i = 1; i <= atom_ids_.size(); i++ ) {
491 atoms_xyz.push_back ( pose.
xyz ( atom_ids_[ i ] ) );
518 for (
Size i = 1; i <= atom_ids_.size(); i++ ) {
520 atom_xyz_vals.push_back ( atoms_xyz[i].x() );
521 atom_xyz_vals.push_back ( atoms_xyz[i].y() );
522 atom_xyz_vals.push_back ( atoms_xyz[i].z() );
523 atoms.push_back ( atom_xyz_vals );
526 chainTORS ( atoms.size(), atoms, dt_ang, db_ang, db_len, R0, Q0 );