25 #include <basic/options/option.hh>
26 #include <basic/options/keys/out.OptionKeys.gen.hh>
27 #include <basic/options/keys/in.OptionKeys.gen.hh>
28 #include <utility/file/file_sys_util.hh>
32 #include <basic/database/open.hh>
41 #include <numeric/angle.functions.hh>
42 #include <numeric/xyz.functions.hh>
43 #include <numeric/conversions.hh>
44 #include <numeric/deriv/dihedral_deriv.hh>
47 #include <utility/pointer/ReferenceCount.hh>
50 #include <ObjexxFCL/FArray1D.hh>
52 #include <ObjexxFCL/format.hh>
54 #include <basic/Tracer.hh>
57 #include <utility/vector1.hh>
59 #include <platform/types.hh>
64 #include <utility/Bound.hh>
65 #include <utility/vector0_bool.hh>
66 #include <utility/keys/AutoKey.hh>
67 #include <utility/keys/SmallKeyVector.hh>
68 #include <utility/options/BooleanOption.hh>
89 #include <basic/options/keys/score.OptionKeys.gen.hh>
90 #include <basic/options/option.hh>
91 #include <boost/bind.hpp>
92 #include <boost/function.hpp>
93 #include <boost/functional/hash.hpp>
96 namespace std { }
using namespace std;
97 namespace ObjexxFCL { }
using namespace ObjexxFCL;
103 static basic::Tracer
tr(
"core.scoring.rna.RNA_TorsionPotential" );
105 using namespace ObjexxFCL::fmt;
106 using numeric::conversions::radians;
113 RNA_TorsionPotential::~RNA_TorsionPotential() {}
115 RNA_TorsionPotential::RNA_TorsionPotential():
116 rna_tight_torsions_( true ),
119 skip_chainbreak_torsions_( basic::options::option[ basic::options::OptionKeys::score::rna_torsion_skip_chainbreak ]() ),
121 use_new_potential_( false ),
122 use_2prime_OH_potential_( basic::options::option[ basic::options::OptionKeys::score::use_2prime_OH_potential ]() )
124 if( basic::options::option[ basic::options::OptionKeys::score::rna_torsion_potential ].user() ){
126 path_to_torsion_files_=
"scoring/rna/torsion_potentials/" + basic::options::option[ basic::options::OptionKeys::score::rna_torsion_potential ]();
128 std::cout <<
"-----------------------------------------------------------------------------------" << std::endl;
129 std::cout <<
"USER INPUTTED path_to_torsion_files_=" << basic::database::full_name(
path_to_torsion_files_) << std::endl;
135 std::cout <<
"Path name ends with 'new'... Turn on the new torsional potential" << std::endl;
137 std::cout <<
"-----------------------------------------------------------------------------------" << std::endl;
145 std::cout <<
"-----------------------------------------------------------------------------------" << std::endl;
146 std::cout <<
"DEFAULT path_to_torsion_files_=" << basic::database::full_name(
path_to_torsion_files_) << std::endl;
147 std::cout <<
"-----------------------------------------------------------------------------------" << std::endl;
161 using namespace core::id;
163 if (!rsd.
is_RNA() )
return 0.0;
166 std::cout << std::endl;
167 std::cout <<
"Intra_res: " <<
" rsd.seqpos()= " << rsd.
seqpos() << std::endl;
168 std::cout << std::endl;
180 if(
verbose_) std::cout <<
"Beta torsion" << std::endl;
186 if(
verbose_) std::cout <<
"Gamma torsion" << std::endl;
192 if(
verbose_) std::cout <<
"Delta torsion" << std::endl;
200 if(
verbose_) std::cout <<
"Chi torsion" << std::endl;
222 if(
verbose_) std::cout <<
"nu2 torsion" << std::endl;
229 if(
verbose_) std::cout <<
"nu1 torsion" << std::endl;
250 using namespace core::id;
263 if (!rsd1.
is_RNA() )
return 0.0;
264 if (!rsd2.
is_RNA() )
return 0.0;
267 std::cout << std::endl;
268 std::cout <<
"Between_res= " <<
" rsd1.seqpos()= " << rsd1.
seqpos() <<
" rsd2.seqpos()= " << rsd2.
seqpos() << std::endl;
269 std::cout << std::endl;
279 if(
verbose_) std::cout <<
"epsilon torsion" << std::endl;
286 if(
verbose_) std::cout <<
"zeta torsion" << std::endl;
294 if(
verbose_) std::cout <<
"next alpha torsion" << std::endl;
314 if ( conformation.get_torsion_angle_atom_ids( torsion_id, id1, id2, id3, id4 ) )
return false;
318 tr.Info <<
"In get_f1_f2_function: ";
319 tr.Info <<
" atom_id: " <<
id << std::endl;
326 numeric::deriv::dihedral_p1_cosine_deriv( conformation.xyz( id1 ),conformation.xyz( id2 ),
327 conformation.xyz( id3 ),conformation.xyz( id4 ), theta, f1, f2 );
328 }
else if (
id == id2 ) {
329 numeric::deriv::dihedral_p2_cosine_deriv( conformation.xyz( id1 ),conformation.xyz( id2 ),
330 conformation.xyz( id3 ),conformation.xyz( id4 ), theta, f1, f2 );
331 }
else if (
id == id3 ) {
332 numeric::deriv::dihedral_p2_cosine_deriv( conformation.xyz( id4 ),conformation.xyz( id3 ),
333 conformation.xyz( id2 ),conformation.xyz( id1 ), theta, f1, f2 );
334 }
else if (
id == id4 ) {
335 numeric::deriv::dihedral_p1_cosine_deriv( conformation.xyz( id4 ),conformation.xyz( id3 ),
336 conformation.xyz( id2 ),conformation.xyz( id1 ), theta, f1, f2 );
353 Real const radians2degrees = 1.0 / radians( 1.0 );
355 Size const current_seqpos(
id.rsd() );
360 for (
int offset = -1; offset <= +1; offset++ ) {
362 Size const seqpos = current_seqpos + offset;
364 if (seqpos < 1 )
continue;
365 if (seqpos > nres )
continue;
370 Real const alpha= numeric::principal_angle_degrees( rsd.mainchain_torsion(
ALPHA ) );
371 Real const beta = numeric::principal_angle_degrees( rsd.mainchain_torsion(
BETA ) );
372 Real const gamma= numeric::principal_angle_degrees( rsd.mainchain_torsion(
GAMMA ) );
373 Real const delta= numeric::principal_angle_degrees( rsd.mainchain_torsion(
DELTA ) );
374 Real const epsilon= numeric::principal_angle_degrees( rsd.mainchain_torsion(
EPSILON ) );
375 Real const zeta= numeric::principal_angle_degrees( rsd.mainchain_torsion(
ZETA ) );
381 Vector f1( 0.0 ), f2( 0.0 );
393 F1 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f1;
394 F2 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f2;
401 F1 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f1;
402 F2 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f2;
409 F1 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f1;
410 F2 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f2;
449 F1 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f1;
450 F2 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f2;
458 F1 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f1;
459 F2 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f2;
470 F1 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f1;
471 F2 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f2;
498 F1 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f1;
499 F2 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f2;
507 F1 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f1;
508 F2 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f2;
516 F1 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f1;
517 F2 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f2;
526 F1 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f1;
527 F2 += radians2degrees * dE_dtorsion * weights[
rna_torsion ] * f2;
540 if (fail)
return false;
542 if ( id1.
rsd() != seqpos )
return false;
543 if ( id2.
rsd() != seqpos )
return false;
544 if ( id3.
rsd() != seqpos )
return false;
545 if ( id4.
rsd() != seqpos )
return false;
595 utility_exit_with_message(
"full_torsional_potential_filename " + full_filename +
" doesn't exist!" );
608 using namespace scoring::constraints;
658 using namespace ObjexxFCL;
659 using namespace ObjexxFCL::fmt;
663 std::cout <<
A(4,
"T");
665 std::cout <<
A(4,
"F");
673 if(atom_name==
"OVU1" || atom_name==
"OVL1" || atom_name==
"OVL2"){
684 using namespace ObjexxFCL;
686 Size torsion_seq_num=torsion_id.
rsd();
687 Size lower_seq_num=0;
688 Size upper_seq_num=0;
691 if ( torsion_id.
type() !=
id::BB)
return false;
695 lower_seq_num=torsion_seq_num-1;
696 upper_seq_num=torsion_seq_num;
699 lower_seq_num=torsion_seq_num;
700 upper_seq_num=torsion_seq_num+1;
703 utility_exit_with_message(
"The torsion should be DELTA(lower), BETA(upper) or GAMMA(upper) !!" );
708 if(upper_seq_num==1)
return false;
714 utility_exit_with_message(
"seq_num " + string_of(lower_seq_num) +
" is a CUTPOINT_LOWER but seq_num " + string_of(upper_seq_num) +
" is not a cutpoint CUTPOINT_UPPER??" );
731 std::cout <<
"torsion_id: " << torsion_id << std::endl;
735 std::cout <<
"fail to get torsion!, perhap this torsion is located at a chain_break " << std::endl;
744 tr.Info <<
" Torsion containing one or more virtual atom(s)" << std::endl;
745 tr.Info <<
" torsion_id: " << torsion_id;
746 tr.Info <<
" atom_id: " << id1 <<
" " << id2 <<
" " << id3 <<
" " << id4 << std::endl;
763 if(
verbose_) std::cout <<
"torsion_id: " << torsion_id << std::endl;
767 if(
verbose_) std::cout <<
"fail to get torsion!, perhap this torsion is located at a chain_break " << std::endl;
793 if( METHOD_ONE_Is_cutpoint_closed_torsion != METHOD_TWO_Is_cutpoint_closed_torsion){
794 Output_boolean(
" METHOD_ONE_Is_cutpoint_closed_torsion= ", METHOD_ONE_Is_cutpoint_closed_torsion);
795 Output_boolean(
" METHOD_TWO_Is_cutpoint_closed_torsion= ", METHOD_TWO_Is_cutpoint_closed_torsion);
796 Output_boolean(
" Is_virtual_torsion= ", Is_virtual_torsion); std::cout << std::endl;
800 utility_exit_with_message(
"METHOD_ONE_Is_cutpoint_closed_torsion != METHOD_TWO_Is_cutpoint_closed_torsion !!" );
803 if( METHOD_ONE_Is_cutpoint_closed_torsion==
true && Is_virtual_torsion==
false ){
807 utility_exit_with_message(
"METHOD_ONE_Is_cutpoint_closed_torsion==true && Is_virtual_torsion==false !!" );
812 if(rsd_1.
seqpos()>rsd_2.
seqpos()) utility_exit_with_message(
"rsd_1.seqpos()>rsd_2.seqpos()");
813 if(rsd_2.
seqpos()>rsd_3.
seqpos()) utility_exit_with_message(
"rsd_1.seqpos()>rsd_2.seqpos()");
814 if(rsd_3.
seqpos()>rsd_4.
seqpos()) utility_exit_with_message(
"rsd_1.seqpos()>rsd_2.seqpos()");
817 utility_exit_with_message(
"(rsd_1.seqpos()!=rsd_4.seqpos()) && (rsd_1.seqpos()!=(rsd_4.seqpos()-1))");
820 bool const inter_residue_torsion= (rsd_1.
seqpos()!=rsd_4.
seqpos());
822 bool Is_chain_break_torsion=
false;
824 if(inter_residue_torsion){
835 Is_chain_break_torsion= (violate_max_O3_prime_to_P_bond_dist==
true && METHOD_ONE_Is_cutpoint_closed_torsion==
false);
840 bool should_score_this_torsion=
true;
842 if( Is_virtual_torsion==
true && METHOD_ONE_Is_cutpoint_closed_torsion==
false ) should_score_this_torsion=
false;
847 Output_boolean(
" should_score_torsion= ", should_score_this_torsion);
848 Output_boolean(
" | Is_cutpoint_closed_torsion= ", METHOD_ONE_Is_cutpoint_closed_torsion);
851 Output_boolean(
" | Is_chain_break_torsion = ", Is_chain_break_torsion) ;
852 std::cout << std::endl;
855 return should_score_this_torsion;