63 #include <ObjexxFCL/FArray1D.hh>
64 #include <ObjexxFCL/FArray2D.hh>
66 #include <numeric/conversions.hh>
71 #include <ObjexxFCL/format.hh>
129 using namespace core::scoring;
130 using namespace core::optimization;
139 minimizer.run( pose, mm, *(scorefxn), options );
148 for(
Size n=1; n<=seq_num_list.size()-1; n++){
149 if( (seq_num_list[n]+1)!=seq_num_list[n+1])
return false;
157 for(
Size n=1; n<=seq_num_list.size()-1; n++){
158 if( (seq_num_list[n]-1)!= seq_num_list[n+1])
return false;
169 if(verbose) std::cout <<
"Applying PROTONATED_H1_ADENOSINE variant_type to seq_num " << seq_num << std::endl;
174 utility_exit_with_message(
"Cannot apply PROTONATED_H1_ADENOSINE variant_type to seq_num: " + ObjexxFCL::string_of(seq_num) +
". This residue have a incompatible VIRTUAL_RNA_RESIDUE variant type." );
180 std::cout <<
"WARNING pose already have PROTONATED_H1_ADENOSINE variant_type at seq_num= " << seq_num <<
", early RETURN!" << std::endl;
186 utility_exit_with_message(
"Cannot apply PROTONATED_H1_ADENOSINE variant_type to seq_num: " + ObjexxFCL::string_of(seq_num) +
". pose.total_residue()<seq_num" );
190 utility_exit_with_message(
"working_seq_num=" + ObjexxFCL::string_of(seq_num) +
" cannot have PROTONATED_H1_ADENOSINE variant type since it is not a adenosine!");
202 working_cutpoint_closed_list.clear();
210 using namespace core::chemical;
211 using namespace ObjexxFCL;
214 utility_exit_with_message(
"Cannot apply VIRTUAL_RNA_RESIDUE VARIANT TYPE to seq_num: " + string_of(seq_num) +
". pose.total_residue()<seq_num" );
219 std::cout <<
"Removing PROTONATED_H1_ADENOSINE variant_type from seq_num= " << seq_num <<
" before adding VIRTUAL_RNA_RESIDUE variant_type since the two variant_types are not compatible!" << std::endl;
227 bool Is_cutpoint_closed=
false;
231 utility_exit_with_message(
"seq_num " + string_of(seq_num) +
" is a CUTPOINT_LOWER but seq_num " + string_of(seq_num+1) +
" is not a cutpoint CUTPOINT_UPPER??" );
233 Is_cutpoint_closed=
true;
237 for(
Size n=1; n<=working_cutpoint_closed_list.size(); n++){
238 if(seq_num==working_cutpoint_closed_list[n]) {
239 Is_cutpoint_closed=
true;
245 bool const Is_cutpoint_open=( pose.
fold_tree().
is_cutpoint( seq_num ) && Is_cutpoint_closed==
false);
248 if (Is_cutpoint_open) {
249 utility_exit_with_message(
"Cannot apply VIRTUAL_RNA_RESIDUE VARIANT TYPE to seq_num: " + string_of(seq_num) +
". The residue is 5' of a OPEN cutpoint" );
253 utility_exit_with_message(
"Cannot apply VIRTUAL_RNA_RESIDUE VARIANT TYPE to seq_num: " + string_of(seq_num) +
". pose.total_residue()==seq_num" );
261 if( (pose.
total_residue()!=seq_num) && (Is_cutpoint_open==
false) ) {
269 using namespace core::chemical;
270 using namespace ObjexxFCL;
273 utility_exit_with_message(
"Cannot remove VIRTUAL_RNA_RESIDUE VARIANT TYPE to seq_num: " + string_of(seq_num) +
". pose.total_residue()<seq_num" );
277 utility_exit_with_message(
"Cannot remove VIRTUAL_RNA_RESIDUE VARIANT TYPE to seq_num: " + string_of(seq_num) +
". pose.total_residue()==seq_num" );
288 using namespace ObjexxFCL;
293 std::cout <<
"(seq_num+1)= " << (seq_num+1) << std::endl;
294 utility_exit_with_message(
"(seq_num+1)>pose.total_residue()!" );
298 std::cout <<
"Problem seq_num= " << seq_num << std::endl;
299 utility_exit_with_message(
"res (" + string_of(seq_num) +
") has_variant_type VIRTUAL_RNA_RESIDUE but res seq_num+1 (" + string_of(seq_num+1) +
")does not have variant_type VIRTUAL_RNA_RESIDUE_UPPER");
318 utility_exit_with_message(
"target_variants.size()!=pose.residue(seq_num).type().variant_types().size()");
321 Size skip_variant_count=0;
323 for (
Size i=1; i<= target_variants.size(); i++ ) {
326 if ( pose.
residue(seq_num).
type().
has_variant_type( target_variants[i] )==false ) utility_exit_with_message(
"pose.residue(seq_num).type().has_variant_type( target_variants[i] )==false!");
328 bool skip_this_variant=
false;
330 if(target_variants[i]==
"LOWER_TERMINUS") skip_this_variant=
true;
332 if(target_variants[i]==
"UPPER_TERMINUS") skip_this_variant=
true;
334 if(skip_this_variant){
335 skip_variant_count++;
344 std::cout <<
"pose.residue(seq_num).type().variant_types().size()=" << pose.
residue(seq_num).
type().
variant_types().size() << std::endl;
345 std::cout <<
"skip_variant_count=" << skip_variant_count << std::endl;
346 utility_exit_with_message(
"pose.residue(seq_num).type().variant_types().size()!=skip_variant_count");
357 using namespace ObjexxFCL;
359 if(is_working_res.size()==0){
360 utility_exit_with_message(
"is_working_res.size()==0");
363 if(full_to_sub.empty()==
true){
364 utility_exit_with_message(
"full_to_sub.empty()==true");
367 Size const total_res=is_working_res.size();
370 for (
Size n = 1; n <= res_vector.size(); n++ ) {
372 if(res_vector[ n ] >total_res) utility_exit_with_message(
"res_vector[ n ] (" +string_of(res_vector[ n ]) +
") > total_res (" + string_of(total_res) +
")!");
374 if ( !is_working_res[ res_vector[ n ] ] )
continue;
375 working_res_vector.push_back( full_to_sub.find(res_vector[ n ])->second);
378 return working_res_vector;
388 std::map< core::Size, core::Size >
const & full_to_sub = job_parameters->const_full_to_sub();
400 std::map< core::Size, core::Size >
const & sub_to_full( job_parameters->const_sub_to_full() );
403 for (
Size n = 1; n <= working_res_vector.size(); n++ ){
405 if(sub_to_full.find(working_res_vector[ n ])==sub_to_full.end()){
406 utility_exit_with_message(
"sub_to_full.find(working_res_vector[ n ]).end()==sub_to_full.end()!");
409 full_res_vector.push_back( sub_to_full.find(working_res_vector[ n ])->second);
412 return full_res_vector;
420 using namespace ObjexxFCL;
424 if(full_seq_num<1) utility_exit_with_message(
"full_seq_num (" + string_of(full_seq_num) +
") is lesser then 1");
426 if(full_seq_num>is_working_res.size()) utility_exit_with_message(
"full_seq_num (" +string_of(full_seq_num)+
") is greater than is_working_res.size() (" +string_of(is_working_res.size()) +
")");
434 using namespace ObjexxFCL;
440 return is_working_res[full_seq_num];
447 using namespace ObjexxFCL;
449 std::map< core::Size, core::Size >
const & full_to_sub = job_parameters->const_full_to_sub();
451 std::string const & working_sequence= job_parameters->working_sequence();
454 utility_exit_with_message(
"full_seq_num (" + string_of(full_seq_num) +
") is NOT working_res" );
457 Size const working_seq_num= full_to_sub.find(full_seq_num)->second;
459 if(working_seq_num<1) utility_exit_with_message(
"working_seq_num (" + string_of(working_seq_num) +
") is lesser then 1");
461 if(working_seq_num>working_sequence.size()) utility_exit_with_message(
"working_seq_num (" + string_of(working_seq_num) +
") is greater than working_sequence.size() ( " +string_of(working_sequence.size()) +
")");
463 return working_seq_num;
469 std::map< core::Size, core::Size >
472 std::map< core::Size, core::Size > full_to_input_res_map;
474 for(
Size n=1; n<=input_res_vector.size(); n++){
475 full_to_input_res_map[input_res_vector[n]]=n;
478 return full_to_input_res_map;
498 std::stringstream ss (std::stringstream::in | std::stringstream::out);
502 if(ss.fail()) utility_exit_with_message(
"In string_to_real(): ss.fail() for ss << input_string | string ("+input_string+
")");
506 if(ss.fail()) utility_exit_with_message(
"In string_to_real(): ss.fail() for ss >> int_of_string | string ("+input_string+
")");
508 return int_of_string;
529 std::stringstream ss (std::stringstream::in | std::stringstream::out);
533 if(ss.fail()) utility_exit_with_message(
"In string_to_real(): ss.fail() for ss << input_string | string ("+input_string+
")");
535 ss >> real_of_string;
537 if(ss.fail()) utility_exit_with_message(
"In string_to_real(): ss.fail() for ss >> real_of_string | string ("+input_string+
")");
539 return real_of_string;
552 string::size_type lastPos = str.find_first_not_of(delimiters, 0);
554 string::size_type pos = str.find_first_of(delimiters, lastPos);
556 while (string::npos != pos || string::npos != lastPos){
558 tokens.push_back(str.substr(lastPos, pos - lastPos));
560 lastPos = str.find_first_not_of(delimiters, pos);
562 pos = str.find_first_of(delimiters, lastPos);
569 for(
Size j=1; j<=residue_pair_list.size(); j++){
570 if(seq_num==residue_pair_list[j].first || seq_num==residue_pair_list[j].second) {
579 for(
Size j=1; j<=residue_list.size(); j++){
580 if(seq_num==residue_list[j]) {
592 using namespace chemical;
596 utility_exit_with_message(
"The rna base " +
name_from_aa(rsd.
aa()) +
" contain lesser than 8 heavy atoms" );
599 Size non_virtual_atom_count=0;
602 non_virtual_atom_count++;
606 bool const method_1= ( non_virtual_atom_count< 8) ?
true :
false;
609 if(method_1!=method_2){
610 Output_boolean(
"Is_virtual_base determination by method_1: ", method_1 );
611 Output_boolean(
"Is_virtual_base determination by method_2: ", method_2 );
612 std::cout << std::endl;
613 utility_exit_with_message(
"Is_virtual_base determination by the two methods are not the same!" );
635 Size const res_num_1,
636 Size const res_num_2,
638 bool const base_only){
640 using namespace ObjexxFCL;
643 utility_exit_with_message(
"rsd_1.aa()!= rsd_2.aa(). res_num_1= " + string_of(res_num_1) +
" name_from_aa(rsd_1.aa())=" +
name_from_aa(rsd_1.
aa()) +
" res_num_2= " + string_of(res_num_2) +
" name_from_aa(rsd_2.aa())=" +
name_from_aa(rsd_2.
aa()) );
648 for(
Size atomno_1=first_atom; atomno_1<= rsd_1.
nheavyatoms(); ++atomno_1) {
652 if ( !rsd_2.
has( atom_name_1 ) )
continue;
658 if(atom_name_1!=atom_name_2){
659 utility_exit_with_message(
"atom_name_1 != atom_name_2, atom_name_1= " + atom_name_1 +
" atom_name_2= " + atom_name_2);
667 atom_ID_map.
set( id1, id2 );
703 using namespace chemical;
712 std::cout <<
"ref_pose.sequence()= " << ref_pose.
sequence() << std::endl;
713 std::cout <<
"mod_pose.sequence()= " << mod_pose.
sequence() << std::endl;
714 utility_exit_with_message(
"ref_pose.sequence()!=mod_pose.sequence()");
735 bool found_non_virtual_base=
false;
736 for(
Size n=1; n<=working_best_alignment.size(); n++){
737 Size const seq_num=working_best_alignment[n];
740 found_non_virtual_base=
true;
744 if(found_non_virtual_base==
false){
745 for(
Size n=1; n<=working_best_alignment.size(); n++){
746 Size const seq_num=working_best_alignment[n];
747 std::cout <<
"seq_num= " << seq_num;
750 std::cout << std::endl;
752 std::string error_message=
"Error in aligning " + moving_tag +
" to " + static_tag +
". No non-virtual_base in working_best_alignment to align the poses!";
753 std::cout << error_message << std::endl;
754 utility_exit_with_message(error_message);
764 std::cout << error_message << std::endl;
765 utility_exit_with_message( moving_tag +
" is messed up ...this is probably an alignment problem");
771 std::cout <<
"( " << pair_size.first <<
", " << pair_size.second <<
" ) ";
776 std::cout << std::setw(spacing) <<
std::left << output_string <<
" :";
777 for(
Size n=1; n<=pair_size_vector.size(); n++){
780 std::cout << std::endl;
786 return (pair_one.first < pair_two.first);
797 return (seq_num_1 < seq_num_2);
807 using namespace ObjexxFCL;
808 using namespace ObjexxFCL::fmt;
810 std::cout << std::setw(spacing) << tag;
816 for(
Size n=1; n<=sorted_seq_num_list.size(); n++){
818 while(seq_num<sorted_seq_num_list[n]){
819 std::cout <<
A(4,
" ");
822 std::cout << I(4, sorted_seq_num_list[n]);
826 std::cout << std::endl;
839 if( sorted_seq_num_list_1.size() !=sorted_seq_num_list_2.size() )
return false;
841 for(
Size n=1; n<=sorted_seq_num_list_1.size(); n++){
842 if( sorted_seq_num_list_1[n]!=sorted_seq_num_list_2[n] )
return false;
851 using namespace ObjexxFCL;
852 using namespace ObjexxFCL::fmt;
854 std::cout << std::setw(tag_spacing) << tag;
858 for(
Size seq_num=1; seq_num<=max_seq_num; seq_num++){
860 if(my_map.find(seq_num)!=my_map.end()){
861 prepend_char = (my_map.find(seq_num)->second) ?
'P' :
'A';
865 std::cout << std::setw(spacing) << prepend_char;
867 std::cout << std::endl;
875 for(
Size n=1; n<=size_list.size(); n++){
876 bool_list.push_back(size_list[n]);
884 using namespace ObjexxFCL;
885 using namespace ObjexxFCL::fmt;
887 std::cout << std::setw(spacing) << tag;
889 for(
Size seq_num=1; seq_num <= bool_list.size(); seq_num++){
892 std::cout << std::endl;
898 using namespace ObjexxFCL;
899 using namespace ObjexxFCL::fmt;
901 std::cout << std::setw(spacing) << tag;
903 for(
Size seq_num=1; seq_num <= size_list.size(); seq_num++){
904 std::cout << I(4, size_list[seq_num]);
906 std::cout << std::endl;
948 using namespace core::conformation;
949 using namespace core::scoring;
950 using namespace core::scoring::constraints;
951 using namespace core::id;
953 using numeric::conversions::radians;
955 Size three_prime_res=five_prime_res+1;
965 Real const O3_P_distance( 1.593 );
966 Real const O3_angle( 119.8 );
967 Real const P_angle( 108.97 );
969 Real const distance_stddev( 0.0659 );
970 Real const angle_stddev_degrees_P( 8.54 );
971 Real const angle_stddev_degrees_O3( 5.73 );
978 FuncOP const O3_angle_func(
new HarmonicFunc( radians( O3_angle ), radians( angle_stddev_degrees_P ) ) );
979 FuncOP const P_angle_func(
new HarmonicFunc( radians( P_angle ), radians( angle_stddev_degrees_O3 ) ) );
986 AtomID const C3_id( rsd1.atom_index(
"C3*" ), five_prime_res);
987 AtomID const O3_id( rsd1.atom_index(
"O3*" ), five_prime_res);
988 AtomID const P_id( rsd2.atom_index(
"P" ), three_prime_res);
989 AtomID const O5_id( rsd2.atom_index(
"O5*" ), three_prime_res);
995 cst_set->add_constraint(
new AngleConstraint( C3_id, O3_id, P_id, O3_angle_func ) );
998 cst_set->add_constraint(
new AngleConstraint( O3_id, P_id, O5_id, P_angle_func ) );
1012 std::cout << std::endl;
1014 Size title_length=title.size();
1015 Size char_per_line=80;
1016 Size dash_length=char_per_line-title_length;
1018 for(
Size i=1; i<=dash_length/2; i++){
1024 for(
Size i=1; i<=dash_length/2; i++){
1028 std::cout << std::endl;
1036 std::cout <<
"fold tree of " << pose_name <<
": " << std::endl;
1038 std::cout << std::setw(30) <<
"jump_point_num= " << i;
1039 std::cout <<
" cutpoint= " << fold_tree.
cutpoint(i);
1056 std::ifstream my_file;
1058 my_file.open(file_name.c_str());
1060 bool const file_exist=my_file.is_open();
1075 using namespace ObjexxFCL;
1078 utility_exit_with_message(
"file_name (" + file_name +
") doesn't exist!");
1081 int const retcode=std::remove(file_name.c_str());
1086 std::perror(error_message.c_str());
1087 utility_exit_with_message( error_message +
", retcode= " + string_of(retcode));
1097 Size const spacing=10;
1099 std::cout << std::setw(18) <<
"Torsions= ";
1100 std::cout << std::setw(spacing)<< rotamer[1] <<
" ";
1101 std::cout << std::setw(spacing)<< rotamer[2] <<
" ";
1102 std::cout << std::setw(spacing)<< rotamer[3] <<
" ";
1103 std::cout << std::setw(spacing)<< rotamer[4] <<
" ";
1104 std::cout << std::setw(spacing)<< rotamer[5] <<
" ";
1105 std::cout << std::setw(spacing)<< rotamer[6] <<
" ";
1106 std::cout << std::setw(spacing)<< rotamer[7] <<
" ";
1107 std::cout << std::setw(spacing)<< rotamer[8] <<
" ";
1108 std::cout << std::setw(spacing)<< rotamer[9] <<
" ";
1109 std::cout << std::setw(spacing)<< rotamer[10] <<
" ";
1110 std::cout << std::setw(spacing)<< rotamer[11] <<
" ";
1111 std::cout << std::setw(spacing)<< rotamer[12] <<
" ";
1112 std::cout << std::setw(spacing)<< rotamer[13] <<
" ";
1113 std::cout << std::endl;
1149 suite_square_deviation(pose1, pose2, prepend_res, moving_res_num, moving_res_num, atom_count, sum_sd,
false, ignore_virtual_atom);
1151 sum_sd=sum_sd/(atom_count);
1152 Real rmsd=sqrt(sum_sd);
1154 if(atom_count==0) rmsd=0.0;
1156 return (std::max(0.01, rmsd));
1167 using namespace ObjexxFCL;
1170 if( pose1.
sequence()!=full_sequence ){
1171 std::cout <<
"pose1.sequence()= " << pose1.
sequence() << std::endl;
1172 std::cout <<
"pose2.sequence()= " << pose2.
sequence() << std::endl;
1173 std::cout <<
"full_sequence= " << full_sequence << std::endl;
1174 utility_exit_with_message(
"pose1.sequence()!=full_sequence" );
1177 if( pose2.
sequence()!=full_sequence ){
1178 std::cout <<
"pose1.sequence()= " << pose1.
sequence() << std::endl;
1179 std::cout <<
"pose2.sequence()= " << pose2.
sequence() << std::endl;
1180 std::cout <<
"full_sequence= " << full_sequence << std::endl;
1181 utility_exit_with_message(
"pose2.sequence()!=full_sequence" );
1222 Output_boolean(
"ignore_virtual_atom= ",ignore_virtual_atom); std::cout << std::endl;
1229 for(
Size i=1; i<=residue_list.size(); i++){
1231 Size const full_seq_num= residue_list[i];
1233 bool Is_prepend=
false;
1234 bool both_pose_res_is_virtual=
false;
1237 both_pose_res_is_virtual=
true;
1240 if( (full_seq_num+1)<=total_res){
1243 utility_exit_with_message(
"pose1's full_seq_num= " + string_of(full_seq_num) +
" is a virtual res but seq_num+1 is not a virtual_res_upper!" );
1249 utility_exit_with_message(
"pose2's full_seq_num= " + string_of(full_seq_num) +
" is a virtual res but seq_num+1 is not a virtual_res_upper!" );
1255 std::cout <<
"full_seq_num= " << full_seq_num;
1257 Output_boolean(
" both_pose_res_is_virtual= ",both_pose_res_is_virtual); std::cout << std::endl;
1260 if(both_pose_res_is_virtual)
continue;
1264 suite_square_deviation(pose1, pose2, Is_prepend, full_seq_num, full_seq_num, atom_count, sum_sd, verbose, ignore_virtual_atom);
1266 if( ( (full_seq_num+1)<=total_res) &&
Contain_seq_num(full_seq_num+1, residue_list)==
false){
1268 if(verbose) std::cout <<
"Phosphate_edge_res_(full_seq_num+1)= " << full_seq_num+1 << std::endl;
1276 sum_sd=sum_sd/(atom_count);
1277 Real rmsd=sqrt(sum_sd);
1279 if(atom_count==0) rmsd=0.0;
1282 std::cout <<
"sum_sd= " << sum_sd <<
" atom_count= " << atom_count <<
" rmsd= " << rmsd << std::endl;
1286 return (std::max(0.01, rmsd));
1295 Output_boolean(
"ignore_virtual_atom= ",ignore_virtual_atom); std::cout << std::endl;
1303 for(
Size i=1; i<=residue_list.size(); i++){
1305 Size const full_seq_num= residue_list[i];
1306 Size const seq_num=full_to_sub.find(full_seq_num)->second;
1307 bool Is_prepend=Is_prepend_map.find(full_seq_num)->second;
1308 bool both_pose_res_is_virtual=
false;
1310 both_pose_res_is_virtual=
true;
1315 std::cout <<
"Full_seq_num= " << full_seq_num <<
" partial_seq_num= " << seq_num;
1316 Output_boolean(
" Is_prepend= ",Is_prepend);
Output_boolean(
" both_pose_res_is_virtual= ",both_pose_res_is_virtual); std::cout << std::endl;
1319 if(both_pose_res_is_virtual)
continue;
1323 suite_square_deviation(pose1, pose2, Is_prepend, seq_num, seq_num, atom_count, sum_sd, verbose, ignore_virtual_atom);
1327 sum_sd=sum_sd/(atom_count);
1328 Real rmsd=sqrt(sum_sd);
1330 if(atom_count==0) rmsd=0.0;
1333 std::cout <<
"sum_sd= " << sum_sd <<
" atom_count= " << atom_count <<
" rmsd= " << rmsd << std::endl;
1337 return (std::max(0.01, rmsd));
1347 std::map< core::Size, core::Size >
const & full_to_sub = job_parameters_->const_full_to_sub();
1348 std::map< core::Size, bool >
const & Is_prepend_map = job_parameters_->Is_prepend_map();
1350 return rmsd_over_residue_list( pose1, pose2, rmsd_res_list, full_to_sub, Is_prepend_map,
false , ignore_virtual_atom);
1358 using namespace conformation;
1363 std::cout <<
"num_atoms: " <<
num_atoms << std::endl;
1367 std::cout <<
" atom num = " << n;
1368 std::cout <<
" atom_name of the pose1 " << pose1.
residue(suite_num_1).
atom_name(n);
1369 std::cout <<
" atom_name of the pose2 " << pose2.
residue(suite_num_2).
atom_name(n) << std::endl;
1379 Size num_side_chain_atom;
1382 if(verbose) std::cout <<
"name_from_aa: RAD" << std::endl;
1383 num_side_chain_atom=11;
1385 if(verbose) std::cout <<
"name_from_aa: RCY" << std::endl;
1386 num_side_chain_atom=9;
1388 if(verbose) std::cout <<
"name_from_aa: RGU" << std::endl;
1389 num_side_chain_atom=12;
1391 if(verbose) std::cout <<
"name_from_aa: URA" << std::endl;
1392 num_side_chain_atom=9;
1394 std::cout <<
"Error, cannot identify residue type" << std::endl;
1395 num_side_chain_atom=0;
1399 return num_side_chain_atom;
1413 if(atom_name_1!=atom_name_2){
1414 utility_exit_with_message(
"atom_name_1 != atom_name_2, atom_name_1= " + atom_name_1 +
" atom_name_2= " + atom_name_2);
1423 Distance const dist_squared = (rsd_1.
xyz( atomno_1) - rsd_2.
xyz( atomno_2)).length_squared();
1427 std::cout <<
" atom_name of the atom1= " << atom_name_1 <<
" " << rsd_1.
seqpos();
1428 std::cout <<
" atom_name of the atom2= " << atom_name_2 <<
" " << rsd_2.
seqpos();
1429 std::cout <<
" Dist_squared= " << dist_squared << std::endl;
1432 return dist_squared;
1446 if(res_aa!=res_aa2) utility_exit_with_message(
"res_aa (" +
name_from_aa(res_aa) +
")!=res_aa2 (" +
name_from_aa(res_aa2) +
") " );
1453 if ( verbose ) std::cout <<
" MOVING_RES_1: " << moving_res_1 <<
" MOVING_RES_2: " << moving_res_2 << std::endl;
1457 for(
Size n = 1; n<= num_side_chain_atom; n++){
1459 Size const atomno_1=(n-1)+first_sidechain_atom1;
1460 Size const atomno_2=(n-1)+first_sidechain_atom2;
1468 if(ignore_virtual_atom){
1490 if(res_aa!=res_aa2) utility_exit_with_message(
"res_aa (" +
name_from_aa(res_aa) +
")!=res_aa2 (" +
name_from_aa(res_aa2) +
") " );
1492 if ( verbose ) std::cout <<
" MOVING_RES_1: " << moving_res_1 <<
" MOVING_RES_2: " << moving_res_2 << std::endl;
1494 for(
Size atomno = 1; atomno <= 4; atomno++){
1499 if(ignore_virtual_atom){
1522 sum_sd=sum_sd/(atom_count);
1523 Real rmsd=sqrt(sum_sd);
1525 if(atom_count==0) rmsd=0.0;
1527 return (std::max(0.01, rmsd));
1538 if(res_aa!=res_aa2) utility_exit_with_message(
"res_aa (" +
name_from_aa(res_aa) +
")!=res_aa2 (" +
name_from_aa(res_aa2) +
") " );
1545 if ( verbose ) std::cout <<
" MOVING_RES_1: " << moving_res_1 <<
" MOVING_RES_2: " << moving_res_2 << std::endl;
1547 Size const num_heavy_backbone_atoms=11;
1549 for(
Size atomno = 1; atomno <= num_heavy_backbone_atoms; atomno++){
1551 Size const res_count = (atomno <=4) ? 2 : 1;
1553 for(
Size ii=1; ii<res_count; ii++){
1555 Size const res_num_1= moving_res_1 + (ii-1);
1556 Size const res_num_2= moving_res_2 + (ii-1);
1561 if(ignore_virtual_atom){
1562 if(rsd_1.atom_type(atomno).name()==
"VIRT" || rsd_2.
atom_type(atomno).
name()==
"VIRT")
continue;
1565 if(rsd_1.atom_type(atomno).name()==
"VIRT" && rsd_2.
atom_type(atomno).
name()==
"VIRT")
continue;
1574 for(
Size n = 1; n<= num_side_chain_atom; n++){
1576 Size const atomno_1=(n-1)+first_sidechain_atom1;
1577 Size const atomno_2=(n-1)+first_sidechain_atom2;
1582 if(ignore_virtual_atom){
1608 if(res_aa!=res_aa2) utility_exit_with_message(
"res_aa (" +
name_from_aa(res_aa) +
")!=res_aa2 (" +
name_from_aa(res_aa2) +
") " );
1615 if(
false && verbose){
1616 std::cout <<
" residue type1= " << res_aa <<
" residue type2= " << res_aa2;
1617 std::cout <<
" 1st_side_atom1= " << first_sidechain_atom1;
1618 std::cout <<
" 1st_side_atom2= " << first_sidechain_atom2;
1620 std::cout <<
" nheavyatoms2= " << pose2.
residue(moving_res_2).
nheavyatoms() << std::endl;
1621 std::cout <<
" num_side_chain_atom = " << num_side_chain_atom << std::endl;
1625 if ( verbose ) std::cout <<
" MOVING_RES_1: " << moving_res_1 <<
" MOVING_RES_2: " << moving_res_2 <<
" PREPEND? " << prepend_res << std::endl;
1627 Size const num_heavy_backbone_atoms=11;
1629 for(
Size atomno = 1; atomno <= num_heavy_backbone_atoms; atomno++){
1632 Size const res_num_1= (prepend_res && atomno <= 4) ? moving_res_1 + 1: moving_res_1;
1633 Size const res_num_2= (prepend_res && atomno <= 4) ? moving_res_2 + 1: moving_res_2;
1639 if(ignore_virtual_atom){
1654 for(
Size n = 1; n<= num_side_chain_atom; n++){
1657 Size const atomno_1=(n-1)+first_sidechain_atom1;
1658 Size const atomno_2=(n-1)+first_sidechain_atom2;
1663 if(ignore_virtual_atom){
1678 if(verbose &&
false){
1679 Size const res_num_1= (prepend_res) ? moving_res_1 + 1: moving_res_1;
1680 Size const res_num_2= (prepend_res) ? moving_res_2 + 1: moving_res_2;
1682 std::cout <<
" atom_name of the pose1= " << pose1.
residue(res_num_1).
atom_name(2) <<
" " << res_num_1;
1683 std::cout <<
" atom_name of the pose2= " << pose2.
residue(res_num_2).
atom_name(3) <<
" " << res_num_2;
1684 std::cout <<
" Switch Phosphate1= " <<
" dist_squared= " << dist_squared << std::endl;
1685 dist_squared = (pose1.
residue(res_num_1).
xyz( 3 ) - pose2.
residue(res_num_2).
xyz( 2 ) ).length_squared();
1686 std::cout <<
" atom_name of the pose1= " << pose1.
residue(res_num_1).
atom_name(3) <<
" " << res_num_1;
1687 std::cout <<
" atom_name of the pose2= " << pose2.
residue(res_num_2).
atom_name(2) <<
" " << res_num_2;
1688 std::cout <<
" Switch Phosphate2= " <<
" dist_squared= " << dist_squared << std::endl;
1700 if ( gap_size > 1 )
return true;
1703 Size const three_prime_chain_break_res= five_prime_chain_break_res + 1;
1717 using namespace ObjexxFCL;
1719 Distance const dist_square=(xyz_1 - xyz_2).length_squared();
1721 if ( gap_size > 1 ){
1728 return( dist_square < (dist_cutoff*dist_cutoff) );
1731 }
else if ( gap_size == 1 ) {
1737 }
else if (gap_size ==0){
1739 static Distance const cutoff_distance_min_square( 2.0*2.0 );
1740 static Distance const cutoff_distance_max_square( 4.627*4.627 );
1743 if( ( dist_square > cutoff_distance_max_square) || dist_square < cutoff_distance_min_square )
return false;
1748 std::string const exit_message=
"Invalid gap_size= " + string_of(gap_size) +
" !!";
1749 utility_exit_with_message( exit_message );
1752 utility_exit_with_message(
"Should not reach this point of the function!" );
1761 Size const five_prime_chain_break_res,
Size const gap_size ){
1763 if( gap_size != 0 ){
1764 std::cout <<
"gap_size= " << gap_size;
1765 utility_exit_with_message(
"gap_size!=0" );
1769 Size const three_prime_chain_break_res= five_prime_chain_break_res + 1;
1771 Distance C5_O3_dist=(three_prime_pose.
residue(three_prime_chain_break_res).
xyz(
"C5*") - five_prime_pose.
residue(five_prime_chain_break_res).
xyz(
"O3*") ).length();
1775 static Distance const C5_O3_min( 2.866000 );
1776 static Distance const C5_O3_max( 3.968000 );
1777 static Distance const leniency_dist( 0.0);
1781 if( (C5_O3_dist > (C5_O3_max+leniency_dist )) || (C5_O3_dist < (C5_O3_min-leniency_dist )) )
return false;
1791 Distance C4_C3_dist=(three_prime_pose.
residue(three_prime_chain_break_res).
xyz(
" C4*") - five_prime_pose.
residue(five_prime_chain_break_res).
xyz(
" C3*") ).length();
1793 if( (C4_C3_dist > (C4_C3_max+leniency_dist )) || (C4_C3_dist < (C4_C3_min-leniency_dist )) )
return false;
1809 start_vector.normalize();
1810 end_vector.normalize();
1812 Real dot_product=dot( start_vector, end_vector);
1815 if(dot_product > -1.00 && dot_product < -0.95 ) {C4_C3_dist_min= 2.428; C4_C3_dist_max= 4.337; }
1816 else if(dot_product > -0.95 && dot_product < -0.90 ) {C4_C3_dist_min= 2.238; C4_C3_dist_max= 4.582; }
1817 else if(dot_product > -0.90 && dot_product < -0.85 ) {C4_C3_dist_min= 2.064; C4_C3_dist_max= 4.743; }
1818 else if(dot_product > -0.85 && dot_product < -0.80 ) {C4_C3_dist_min= 1.979; C4_C3_dist_max= 4.882; }
1819 else if(dot_product > -0.80 && dot_product < -0.75 ) {C4_C3_dist_min= 1.833; C4_C3_dist_max= 4.995; }
1820 else if(dot_product > -0.75 && dot_product < -0.70 ) {C4_C3_dist_min= 1.735; C4_C3_dist_max= 5.099; }
1821 else if(dot_product > -0.70 && dot_product < -0.65 ) {C4_C3_dist_min= 1.659; C4_C3_dist_max= 5.195; }
1822 else if(dot_product > -0.65 && dot_product < -0.60 ) {C4_C3_dist_min= 1.590; C4_C3_dist_max= 5.273; }
1823 else if(dot_product > -0.60 && dot_product < -0.55 ) {C4_C3_dist_min= 1.500; C4_C3_dist_max= 5.347; }
1824 else if(dot_product > -0.55 && dot_product < -0.50 ) {C4_C3_dist_min= 1.418; C4_C3_dist_max= 5.417; }
1825 else if(dot_product > -0.50 && dot_product < -0.45 ) {C4_C3_dist_min= 1.337; C4_C3_dist_max= 5.488; }
1826 else if(dot_product > -0.45 && dot_product < -0.40 ) {C4_C3_dist_min= 1.282; C4_C3_dist_max= 5.552; }
1827 else if(dot_product > -0.40 && dot_product < -0.35 ) {C4_C3_dist_min= 1.223; C4_C3_dist_max= 5.611; }
1828 else if(dot_product > -0.35 && dot_product < -0.30 ) {C4_C3_dist_min= 1.145; C4_C3_dist_max= 5.659; }
1829 else if(dot_product > -0.30 && dot_product < -0.25 ) {C4_C3_dist_min= 1.075; C4_C3_dist_max= 5.713; }
1830 else if(dot_product > -0.25 && dot_product < -0.20 ) {C4_C3_dist_min= 1.022; C4_C3_dist_max= 5.769; }
1831 else if(dot_product > -0.20 && dot_product < -0.15 ) {C4_C3_dist_min= 0.963; C4_C3_dist_max= 5.812; }
1832 else if(dot_product > -0.15 && dot_product < -0.10 ) {C4_C3_dist_min= 1.019; C4_C3_dist_max= 5.861; }
1833 else if(dot_product > -0.10 && dot_product < -0.05 ) {C4_C3_dist_min= 1.331; C4_C3_dist_max= 5.904; }
1834 else if(dot_product > -0.05 && dot_product < 0.00 ) {C4_C3_dist_min= 1.532; C4_C3_dist_max= 5.942; }
1835 else if(dot_product > 0.00 && dot_product < 0.05 ) {C4_C3_dist_min= 1.768; C4_C3_dist_max= 5.979; }
1836 else if(dot_product > 0.05 && dot_product < 0.10 ) {C4_C3_dist_min= 1.953; C4_C3_dist_max= 6.017; }
1837 else if(dot_product > 0.10 && dot_product < 0.15 ) {C4_C3_dist_min= 2.121; C4_C3_dist_max= 6.046; }
1838 else if(dot_product > 0.15 && dot_product < 0.20 ) {C4_C3_dist_min= 2.292; C4_C3_dist_max= 6.083; }
1839 else if(dot_product > 0.20 && dot_product < 0.25 ) {C4_C3_dist_min= 2.424; C4_C3_dist_max= 6.118; }
1840 else if(dot_product > 0.25 && dot_product < 0.30 ) {C4_C3_dist_min= 2.563; C4_C3_dist_max= 6.140; }
1841 else if(dot_product > 0.30 && dot_product < 0.35 ) {C4_C3_dist_min= 2.726; C4_C3_dist_max= 6.171; }
1842 else if(dot_product > 0.35 && dot_product < 0.40 ) {C4_C3_dist_min= 2.849; C4_C3_dist_max= 6.200; }
1843 else if(dot_product > 0.40 && dot_product < 0.45 ) {C4_C3_dist_min= 2.998; C4_C3_dist_max= 6.219; }
1844 else if(dot_product > 0.45 && dot_product < 0.50 ) {C4_C3_dist_min= 3.128; C4_C3_dist_max= 6.245; }
1845 else if(dot_product > 0.50 && dot_product < 0.55 ) {C4_C3_dist_min= 3.261; C4_C3_dist_max= 6.261; }
1846 else if(dot_product > 0.55 && dot_product < 0.60 ) {C4_C3_dist_min= 3.380; C4_C3_dist_max= 6.284; }
1847 else if(dot_product > 0.60 && dot_product < 0.65 ) {C4_C3_dist_min= 3.523; C4_C3_dist_max= 6.298; }
1848 else if(dot_product > 0.65 && dot_product < 0.70 ) {C4_C3_dist_min= 3.658; C4_C3_dist_max= 6.315; }
1849 else if(dot_product > 0.70 && dot_product < 0.75 ) {C4_C3_dist_min= 3.785; C4_C3_dist_max= 6.329; }
1850 else if(dot_product > 0.75 && dot_product < 0.80 ) {C4_C3_dist_min= 3.914; C4_C3_dist_max= 6.340; }
1851 else if(dot_product > 0.80 && dot_product < 0.85 ) {C4_C3_dist_min= 4.065; C4_C3_dist_max= 6.350; }
1852 else if(dot_product > 0.85 && dot_product < 0.90 ) {C4_C3_dist_min= 4.209; C4_C3_dist_max= 6.356; }
1853 else if(dot_product > 0.90 && dot_product < 0.95 ) {C4_C3_dist_min= 4.374; C4_C3_dist_max= 6.357; }
1854 else if(dot_product > 0.95 && dot_product < 1.00 ) {C4_C3_dist_min= 4.570; C4_C3_dist_max= 6.349; }
1856 std::cout <<
"dot_product= " << dot_product << std::endl;
1857 utility_exit_with_message(
"Invalid dot_product!" );
1910 using namespace core::id;
1912 std::cout <<
"Freeze pose sugar torsions, total_residue=" << total_residue << std::endl;
1914 for(
Size i=1; i<=total_residue; i++){
1927 using namespace ObjexxFCL;
1928 using namespace ObjexxFCL::fmt;
1932 std::cout <<
A(4,
"T");
1934 std::cout <<
A(4,
"F");
1942 using namespace ObjexxFCL;
1943 using namespace ObjexxFCL::fmt;
1946 std::cout <<
A(4,
"T");
1948 std::cout <<
A(4,
"F");
1956 using namespace ObjexxFCL;
1957 using namespace ObjexxFCL::fmt;
1958 using namespace core::id;
1959 using namespace core::kinematics;
1965 std::cout <<
"--------------------------------------------------------------------------------------" << std::endl;
1966 std::cout <<
"Movemap (in term of partial_pose seq_num): " << std::endl;
1967 std::cout <<
A(spacing,
"res_num" ) <<
A(spacing,
" alpha ") <<
A(spacing,
" beta ") <<
A(spacing,
" gamma ");
1968 std::cout <<
A(spacing,
" delta ") <<
A(spacing,
"eplison ") <<
A(spacing,
" zeta ") <<
A(spacing,
" chi_1 ");
1969 std::cout <<
A(spacing,
" nu_2 ") <<
A(spacing,
" nu_1 ") <<
A(spacing,
"chi_O2* ") << std::endl;
1971 for(
Size n=1; n<= total_residue; n++){
1973 std::cout << I(spacing, 3 , n);
1984 std::cout << std::endl;
1986 std::cout <<
"--------------------------------------------------------------------------------------" << std::endl;
1990 std::cout <<
"print movemap jump_points [explicit method]: " << std::endl;
1995 std::cout <<
"n=" << n <<
" | jump_pos1= " << jump_pos1 <<
" | jump_pos2= " << jump_pos2;
1997 std::cout << std::endl;
2000 std::cout <<
"--------------------------------------------------------------------------------------" << std::endl;
2004 std::cout <<
"print movemap jump_points [iterator method]: " << std::endl;
2006 std::cout <<
"movemap jump==true for jump_pos1=" << it->first <<
" | jump_pos2=" << it->second << std::endl;
2008 std::cout <<
"--------------------------------------------------------------------------------------" << std::endl;
2016 using namespace core::chemical;
2017 using namespace core::scoring;
2018 using namespace core::kinematics;
2019 using namespace ObjexxFCL;
2032 std::string const exit_message=
"seq_num= " + string_of(seq_num) +
", rsd.type().atom_name(at) !=\" O2*\" ";
2033 utility_exit_with_message( exit_message);
2042 if(verbose) std::cout <<
"res " << seq_num <<
" is core::chemical::aa_vrt! " << std::endl;
2043 Is_O2star_hydrogen_virtual_list.push_back(
false);
2051 if(verbose) std::cout <<
"res " << seq_num <<
" has a virtual o2star hydrogen! " << std::endl;
2052 Is_O2star_hydrogen_virtual_list.push_back(
true);
2054 Is_O2star_hydrogen_virtual_list.push_back(
false);
2059 if(Is_O2star_hydrogen_virtual_list.size()!=pose.
total_residue()) utility_exit_with_message(
"Is_O2star_hydrogen_virtual_list.size()!=pose.total_residue()");
2063 Size num_o2star_moving_res=0;
2064 for(
Size n=1; n<=moving_res.size(); n++){
2065 Size const seq_num=moving_res[n];
2068 if(Is_O2star_hydrogen_virtual_list[seq_num])
continue;
2071 surrounding_O2star_hydrogen.push_back(seq_num);
2072 num_o2star_moving_res++;
2082 bool Is_surrounding_res=
false;
2087 if(Is_O2star_hydrogen_virtual_list[seq_num])
continue;
2091 for(
Size ii=1; ii<=moving_res.size(); ii++){
2092 if(Is_surrounding_res==
true)
break;
2096 for(
Size moving_at=1; moving_at<=moving_rsd.
natoms(); moving_at++){
2098 if( moving_rsd.
atom_type(moving_at).
name()==
"VIRT" )
continue;
2105 Real const dist_square = (surrounding_rsd.
xyz(surr_at)-moving_rsd.
xyz(moving_at) ).length_squared();
2107 if( dist_square < cutoff_dist*cutoff_dist){
2108 if(verbose) std::cout <<
"res " << seq_num <<
" is a 1st layer surrounding O2star_hydrogen res, dist_square = " << dist_square << std::endl;
2109 surrounding_O2star_hydrogen.push_back(seq_num);
2110 Is_surrounding_res=
true;
2121 bool add_new_O2star_hydrogen=
false;
2131 if(Is_O2star_hydrogen_virtual_list[seq_num])
continue;
2133 for(
Size ii=1; ii<=surrounding_O2star_hydrogen.size(); ii++){
2138 Real const cutoff_dist=4.5;
2140 Real const dist_square = (rsd_1.
xyz(at_1)-rsd_2.
xyz(at_2) ).length_squared();
2142 if( dist_square < cutoff_dist*cutoff_dist){
2143 if(verbose) std::cout <<
"res " << seq_num <<
" is layer " << layer_num <<
" surrounding O2star_hydrogen res, dist_square = " << dist_square << std::endl;
2144 surrounding_O2star_hydrogen.push_back(seq_num);
2145 add_new_O2star_hydrogen=
true;
2152 if(add_new_O2star_hydrogen==
false)
break;
2156 for(
Size ii=1; ii<=surrounding_O2star_hydrogen.size(); ii++){
2158 Size const seq_num=surrounding_O2star_hydrogen[ii];
2160 if(Is_O2star_hydrogen_virtual_list[seq_num]){
2161 std::string const exit_message=
"surrounding_O2star_hydrogen res " + string_of(seq_num) +
" has a virtual o2star hydrogen!! ";
2162 utility_exit_with_message( exit_message);
2167 std::cout <<
"num_o2star_moving_res= " << num_o2star_moving_res <<
" surrounding_O2star_hydrogen.size()= " << surrounding_O2star_hydrogen.size() << std::endl;
2170 return surrounding_O2star_hydrogen;
2182 O2star_pack_seq_num.push_back(seq_num);
2196 task->initialize_from_command_line();
2228 o2star_pack_task->nonconst_residue_task(seq_num).and_extrachi_cutoff( 0 );
2229 o2star_pack_task->nonconst_residue_task(seq_num).or_ex4(
true );
2230 o2star_pack_task->nonconst_residue_task(seq_num).or_include_current(
true );
2233 o2star_pack_task->nonconst_residue_task(seq_num).prevent_repacking();
2237 return o2star_pack_task;
2241 o2star_pack_task_ = pack::task::TaskFactory::create_packer_task( pose );
2243 for(Size seq_num=1; seq_num<=pose.total_residue(); seq_num++){
2245 if(Contain_seq_num(seq_num, O2star_pack_seq_num) && pose.residue(seq_num).is_RNA() ){ //pack this residue!
2247 o2star_pack_task_->nonconst_residue_task(seq_num).and_extrachi_cutoff( 0 );
2248 o2star_pack_task_->nonconst_residue_task(seq_num).or_ex4( true ); //extra O2star sampling
2249 o2star_pack_task_->nonconst_residue_task(seq_num).or_include_current( true );
2250 // How about bump check?
2252 o2star_pack_task_->nonconst_residue_task(seq_num).prevent_repacking();
2264 using namespace core::id;
2267 std::cout << std::setw(5) <<
" ep= " << std::setw(15) << suite_lower_res.
mainchain_torsion(5);
2268 std::cout << std::setw(5) <<
" z= " << std::setw(15) << suite_lower_res.mainchain_torsion(6);
2271 Size const three_prime_chainbreak=five_prime_chainbreak+1;
2275 std::cout << std::setw(5) <<
" a= " << std::setw(15) << suite_upper_res.
mainchain_torsion(1);
2276 std::cout << std::setw(5) <<
" b= " << std::setw(15) << suite_upper_res.
mainchain_torsion(2);
2277 std::cout << std::setw(5) <<
" g= " << std::setw(15) << suite_upper_res.
mainchain_torsion(3);
2280 std::cout << std::endl;
2291 using namespace core::chemical;
2292 using namespace core::conformation;
2293 using namespace core::id;
2294 using namespace core::io::pdb;
2299 if(verbose)
Output_title_text(
"ENTER Correctly_position_cutpoint_phosphate_torsions function");
2303 if(verbose) std::cout <<
" res_aa: " << res_aa << std::endl;
2305 Size three_prime_chainbreak=five_prime_chainbreak+1;
2309 std::cout << std::setw(50) <<
"Before_prepending_dummy_nucleotide";
2318 std::cout << std::setw(50) <<
"Before_setting_torsion_to_A_form";
2356 std::cout << std::setw(50) <<
"After_setting_torsion_to_A_form";
print_backbone_torsions(current_pose, five_prime_chainbreak+1);
2363 std::cout << std::setw(50) <<
"After_deleting_dummy_nucleotide";
print_backbone_torsions(current_pose, five_prime_chainbreak);
2366 if(verbose)
Output_title_text(
"EXIT Correctly_position_cutpoint_phosphate_torsions function");
2374 using namespace core::chemical;
2375 using namespace core::conformation;
2376 using namespace core::id;
2377 using namespace core::scoring::rna;
2378 using namespace core::kinematics;
2381 std::cout <<
"template_pose.total_residue()= " << template_pose.
total_residue() <<
" pose.total_residue()= " << pose.
total_residue() << std::endl;
2382 utility_exit_with_message(
"template_pose.total_residue()!=pose.total_residue()" );
2388 utility_exit_with_message(
"(template_pose.fold_tree()==pose.fold_tree())==false" );
2392 std::cout <<
"start_torsion_ID: " << start_torsion_ID;
2393 utility_exit_with_message(
"start_torsion_ID.type()!=id::BB" );
2397 std::cout <<
"end_torsion_ID: " << start_torsion_ID;
2398 utility_exit_with_message(
"end_torsion_ID.type()!=id::BB" );
2402 for(
Size seq_num=start_torsion_ID.
rsd(); seq_num<=end_torsion_ID.
rsd(); seq_num++){
2407 if(seq_num==start_torsion_ID.
rsd() && n<start_torsion_ID.
torsion())
continue;
2409 if(seq_num==end_torsion_ID.
rsd() && n>end_torsion_ID.
torsion())
continue;
2416 bool copy_side_chain=
true;
2418 if(seq_num==start_torsion_ID.
rsd() && start_torsion_ID.
torsion()> 4 ) copy_side_chain=
false;
2419 if(seq_num==end_torsion_ID.
rsd() && end_torsion_ID.
torsion()< 4 ) copy_side_chain=
false;
2421 if(copy_side_chain){
2452 std::cout <<
"remove_chain_break_jump_point " << std::endl;
2457 pose.
fold_tree( fold_tree_without_cutpoint );
2468 using namespace core::conformation;
2470 if(moving_base==reference_base){
2471 utility_exit_with_message(
"moving_base==reference_base!" );
2477 if(moving_base>reference_base){
2480 cutpoint=moving_base-1;
2484 cutpoint=moving_base;
2492 fold_tree.new_jump( reference_base , moving_base , cutpoint);
2494 if(verbose) std::cout <<
"after add new jump point" << std::endl;
2501 for (
Size n = 1; n <= fold_tree.num_jump(); n++ ) {
2502 if (( fold_tree.upstream_jump_residue(n) == i && fold_tree.downstream_jump_residue(n) == j ) ||
2503 ( fold_tree.upstream_jump_residue(n) == j && fold_tree.downstream_jump_residue(n) == i )){
2510 fold_tree.set_jump_atoms( jump_num, rsd1.atom_name( rsd1.chi_atoms(1)[4] ), rsd2.atom_name( rsd2.chi_atoms(1)[4] ) );
2524 fold_tree.
new_jump( moving_suite, moving_suite+1, moving_suite );
2526 int const i( moving_suite ), j( moving_suite+1 );
2532 utility_exit_with_message(
"Problem with jump number" );
2558 for (
Size i = 1; i <= rotamer_list.size(); i++ ) {
2559 pose.
set_torsion( rotamer_list[ i ].
id , rotamer_list[i].value);
2566 template< typename T >
2569 principal_angle_degrees( T const & angle )
2571 return remainder( angle, T( 360.0 ) );
2576 using namespace core::scoring;
2577 using namespace core::scoring::rna;
2582 Real delta = numeric::principal_angle_degrees(rsd.mainchain_torsion(
DELTA ));
2583 Real chi = numeric::principal_angle_degrees(rsd.chi(1));
2584 Real nu_2 = numeric::principal_angle_degrees(rsd.chi(2));
2585 Real nu_1 = numeric::principal_angle_degrees(rsd.chi(3));
2590 if((delta>-0.01 && delta<0.01) || (nu_2>-0.01 && nu_2<0.01) || (nu_1>-0.01 && nu_1<0.01)){
2591 std::cout <<
"Warning: " << tag <<
" is probably a messed up pose, will be ignored" << std::endl;
2592 std::cout <<
" seq_num= " << seq_num <<
" delta= " << delta <<
" chi= " << chi <<
" nu_2= " << nu_2 <<
" nu_1= " << nu_1 << std::endl;
2593 if( (rsd.has_variant_type(
"VIRTUAL_RNA_RESIDUE")==
true) || (rsd.has_variant_type(
"VIRTUAL_RIBOSE")==
true) ){
2594 std::cout <<
"OK lets NOT ignore yet since this rsd has virtual_res or virtual_ribose variant type..continue checking.. " << std::endl;
2607 using namespace core::scoring;
2608 using namespace core::scoring::rna;
2610 Real const CHI_CUTOFF=15.0;
2615 if(chi<=CHI_CUTOFF){
2628 using namespace core::scoring;
2629 using namespace core::scoring::rna;
2632 Real const DELTA_CUTOFF( rna_fitted_torsion_info.delta_cutoff() );
2634 if(verbose) std::cout <<
" DELTA_CUTOFF angle=" << DELTA_CUTOFF;
2637 Real delta = numeric::principal_angle_degrees(rsd.mainchain_torsion(
DELTA ));
2639 if((delta>1.0 && delta<179.00)==
false){
2640 std::cout <<
" seq_num= " << seq_num <<
" delta angle= " << delta << std::endl;
2644 std::cout <<
"Warning: delta angle is out of range for virtual_residue at seq_num "<< seq_num<<
"!" << std::endl;
2648 Real principal_delta=numeric::principal_angle_degrees(delta);
2652 if( ( delta+359<principal_delta )==
false || (delta+361>principal_delta)==
false){
2653 utility_exit_with_message(
"delta<-180 but delta+359<principal_delta )==false || (delta+361>principal_delta)==false!" );
2658 if(( delta-359>principal_delta )==
false || (delta-361<principal_delta)==
false){
2659 utility_exit_with_message(
"delta>180 but delta-359>principal_delta )==false || (delta-361<principal_delta)==false!" );
2663 delta=principal_delta;
2666 if((delta>1.0 && delta<179.00)==
false) utility_exit_with_message(
"principal delta angle out of range!" );
2671 if(verbose) std::cout <<
" delta angle=" << delta << std::endl;
2673 if (delta <= DELTA_CUTOFF) {
2694 endwait = clock () + mseconds * CLOCKS_PER_SEC/1000 ;
2695 while (clock() < endwait) {}
2731 atom_pos= new_coordinate_matrix * rsd_at_origin.
xyz(
at);
2732 atom_pos= atom_pos + new_centroid;
2734 xyz_list.push_back(std::make_pair(
id, atom_pos));
2744 using namespace core::chemical;
2745 using namespace core::conformation;
2751 silent_file_data.
read_file( silent_file );
2753 Size num_matching_tag=0;
2756 if ( iter->decoy_tag() != input_tag )
continue;
2757 num_matching_tag += 1;
2758 iter->fill_pose( import_pose, *rsd_set );
2761 if( num_matching_tag!=1 ){
2762 utility_exit_with_message(
"num_matching_tag=(" + ObjexxFCL::string_of(num_matching_tag) +
")!=1 for tag " + input_tag +
" in silent file (" + silent_file +
")!" );
2766 utility_exit_with_message(
"import_pose " + input_tag +
" from silent_file " + silent_file +
" is a messed up pose!");
2776 size_t found=full_path.rfind(
'/');
2780 if(found!=std::string::npos){
2781 basename=full_path.substr(found+1);
2795 using namespace ObjexxFCL;
2800 Size num_atom_contacts_so_far=0;
2802 if(num_atom_contacts_cutoff<1){
2803 utility_exit_with_message(
"num_atom_contacts_cutoff(" + string_of(num_atom_contacts_cutoff) +
")<1!" );
2806 for(
Size at_ONE=1; at_ONE<= rsd_ONE.natoms(); at_ONE++){
2807 for(
Size at_TWO=1; at_TWO<= rsd_TWO.natoms(); at_TWO++){
2809 if(rsd_ONE.atom_type(at_ONE).name()==
"VIRT")
continue;
2810 if(rsd_TWO.atom_type(at_TWO).name()==
"VIRT")
continue;
2812 Real const VDW_radius_ONE=rsd_ONE.atom_type(at_ONE).lj_radius();
2813 Real const VDW_radius_TWO=rsd_TWO.atom_type(at_TWO).lj_radius();
2815 Real const cutoff_sum_VDW_radius=VDW_radius_ONE+VDW_radius_TWO-atom_atom_overlap_dist_cutoff;
2817 if(cutoff_sum_VDW_radius<0) utility_exit_with_message(
"(VDW_radius_ONE+VDW_radius_TWO-atom_atom_overlap_dist_cutoff)<0!!" );
2819 Real const atom_atom_dist_squared=(rsd_ONE.xyz(at_ONE)-rsd_TWO.xyz(at_TWO)).length_squared();
2821 if(atom_atom_dist_squared<(cutoff_sum_VDW_radius*cutoff_sum_VDW_radius)){
2822 num_atom_contacts_so_far++;
2824 std::cout <<
"res_ONE= " << res_ONE <<
" res_TWO= " << res_TWO <<
" num_atom_contacts_so_far= " << num_atom_contacts_so_far <<
"|";
2825 std::cout <<
" VDW_radius_ONE= " << VDW_radius_ONE <<
" VDW_radius_TWO= " << VDW_radius_TWO;
2826 std::cout <<
" atom_atom_overlap_dist_cutoff= " << atom_atom_overlap_dist_cutoff <<
" cutoff_sum_VDW_radius= " << cutoff_sum_VDW_radius;
2827 std::cout <<
" atom_atom_dist= " << (rsd_ONE.xyz(at_ONE)-rsd_TWO.xyz(at_TWO)).length();
2828 std::cout <<
" " << rsd_ONE.atom_name(at_ONE) <<
" of res_ONE and " << rsd_TWO.atom_name(at_TWO) <<
" of res_TWO are in contact! " << std::endl;
2832 if(num_atom_contacts_so_far==num_atom_contacts_cutoff){
2836 if(num_atom_contacts_so_far>num_atom_contacts_cutoff){
2837 utility_exit_with_message(
"num_atom_contacts_so_far(" + string_of(num_atom_contacts_so_far) +
")>num_atom_contacts_cutoff(" + string_of(num_atom_contacts_cutoff) +
")");
2852 using namespace core::chemical;
2853 using namespace core::conformation;
2854 using namespace core::id;
2858 Size const three_prime_res = five_prime_res+1;
2862 for(
Size n=1; n<=3; n++){
2866 for(
Size n=5; n<=6; n++){
2877 bool const verbose){
2879 if(allow_bulge_res_list.size()!=0){
2880 utility_exit_with_message(
"allow_bulge_res_list.size()!=0" );
2884 std::cout <<
"allow_bulge_res_list.size()==0, ";
2885 std::cout <<
"Getting default_allowed_bulge_res!" << std::endl;
2893 if(seq_num == 1)
continue;
2897 bool Is_cutpoint_closed=
false;
2905 bool near_cutpoint_closed= Is_cutpoint_lower || Is_cutpoint_upper;
2911 bool near_cutpoint_open = near_cutpoint && !near_cutpoint_closed;
2913 if( near_cutpoint_open )
continue;
2915 allow_bulge_res_list.push_back(seq_num);
2928 bool const allow_pre_virtualize,
2929 bool const allow_consecutive_bulges,
2930 bool const verbose){
2932 using namespace core::pose;
2933 using namespace core::scoring;
2934 using namespace ObjexxFCL;
2939 Real const rna_bulge_bonus=( scorefxn->get_weight(
rna_bulge) )*10;
2943 if(allow_bulge_res_list.size()==0){
2949 std::cout <<
"Enter virtualize_bulges() " << std::endl;
2950 std::cout <<
"rna_bulge_bonus= " << rna_bulge_bonus << std::endl;
2951 Output_boolean(
"allow_pre_virtualize= ",allow_pre_virtualize); std::cout << std::endl;
2952 Output_boolean(
"allow_consecutive_bulges= ",allow_consecutive_bulges); std::cout << std::endl;
2958 for(
Size seq_num=1; seq_num<=total_res; seq_num++){
2967 if(allow_pre_virtualize==
false){
2968 for(
Size seq_num=1; seq_num<=total_res; seq_num++){
2971 utility_exit_with_message(
"allow_pre_virtualize==false but seq_num= " + string_of(seq_num) +
" is already virtualized!!" );
2977 Real const start_score=(*scorefxn)(working_pose);
2980 Size num_res_virtualized=0;
2985 Real const base_score=(*scorefxn)(base_pose);
2989 Size num_res_virtualized_in_this_round=0;
2991 for(
Size seq_num=1; seq_num<=total_res; seq_num++){
2997 utility_exit_with_message(
"seq_num= " + string_of(seq_num) +
" is a virtual res but seq_num+1 is not a virtual_res_upper!" );
3001 utility_exit_with_message(
"input_pose have virtual at seq_num= " + string_of(seq_num) +
" but input_pose doesn't!" );
3007 if(allow_consecutive_bulges==
false){
3008 if( (seq_num+1)<=total_res){
3012 if( (seq_num-1)>=1){
3018 working_pose=base_pose;
3020 Real const new_score=(*scorefxn)(working_pose);
3022 if(new_score<base_score){
3023 num_res_virtualized++;
3024 num_res_virtualized_in_this_round++;
3026 std::cout <<
"tag= " << tag <<
" round_num= " << round_num <<
" seq_num= " << seq_num <<
". new_score (" << new_score <<
") is lesser than base_score (" << base_score <<
"). " << std::endl;
3033 if(num_res_virtualized_in_this_round==0)
break;
3038 working_pose=input_pose;
3039 Real const final_score=(*scorefxn)(working_pose);
3041 if(num_res_virtualized>0){
3042 std::cout <<
"----------------------------------------------------------" << std::endl;
3043 std::cout <<
"Inside virtualize_bulges() " << std::endl;
3044 std::cout <<
"TOTAL_NUM_ROUND= " << round_num << std::endl;
3045 std::cout <<
"tag= " << tag << std::endl;
3046 std::cout <<
"num_res_virtualized= " << num_res_virtualized << std::endl;
3047 std::cout <<
"start_score= " << start_score << std::endl;
3048 std::cout <<
"final_score= " << final_score << std::endl;
3049 std::cout <<
"----------------------------------------------------------" << std::endl;
3053 return num_res_virtualized;
3064 size_t found=pdb_filename.rfind(
'/');
3066 if(found!=std::string::npos){
3067 tag = pdb_filename.substr(found+1);
3072 size_t found_2=tag.rfind(
".pdb");
3074 if(found_2!=std::string::npos){
3075 tag = tag.substr(0,tag.size()-4);
3087 for (
Size i = 1; i <= num_cutpoint; i++ ) {
3091 char upstream_res=working_sequence[k-1];
3092 char downstream_res= working_sequence[m-1];
3100 if(upstream_res==
'u' || upstream_res==
'c'){
3101 upstream_jump_atom=
" C2 ";
3102 }
else if(upstream_res==
'a' || upstream_res==
'g'){
3103 upstream_jump_atom=
" C4 ";
3105 utility_exit_with_message(
"Invalid upstream_res!!" );
3108 if(downstream_res==
'u' || downstream_res==
'c'){
3109 downstream_jump_atom=
" C2 ";
3110 }
else if(downstream_res==
'a' || downstream_res==
'g'){
3111 downstream_jump_atom=
" C4 ";
3113 utility_exit_with_message(
"Invalid downstream_res!!" );
3116 std::cout <<
"upstream_res= " << k << upstream_res <<
" upstream_jump_atom= " << upstream_jump_atom;
3117 std::cout <<
" downstream_res= " << k << downstream_res <<
" downstream_jump_atom= " << downstream_jump_atom << std::endl;
3119 fold_tree.
set_jump_atoms( i, downstream_jump_atom, upstream_jump_atom);
3141 using namespace ObjexxFCL;
3146 empty_seq_num_list.clear();
3148 std::cout <<
"full_sequence= " << JP->full_sequence();
3149 std::cout <<
" working_sequence= " << JP->working_sequence();
3150 std::cout <<
" moving_res= " << JP->moving_res();
3151 std::cout <<
" working_moving_res= " << JP->working_moving_res();
3152 std::cout <<
" working_moving_suite= " << JP->working_moving_suite() << std::endl;
3155 std::cout <<
"gap_size= " << JP->gap_size();
3156 std::cout <<
" five_prime_chain_break_res= " << JP->five_prime_chain_break_res();
3159 Output_boolean(
" output_extra_RMSDs= ", JP-> output_extra_RMSDs() ); std::cout << std::endl;
3171 std::cout <<
"------------full_stuff------------" << std::endl;
3174 for(
Size n=1; n<=JP->input_res_vectors().size(); n++){
3175 Output_seq_num_list(
"input_res_vectors[" + string_of(n) +
"]", JP->input_res_vectors()[n] );
3179 if(JP->force_syn_chi_res_list().size()>0)
Output_seq_num_list(
"force_syn_chi_res_list= " , JP->force_syn_chi_res_list() );
3180 if(JP->force_north_ribose_list().size()>0)
Output_seq_num_list(
"force_north_ribose_list= ", JP->force_north_ribose_list() );
3181 if(JP->force_south_ribose_list().size()>0)
Output_seq_num_list(
"force_south_ribose_list= ", JP->force_south_ribose_list() );
3182 if(JP->protonated_H1_adenosine_list().size()>0)
Output_seq_num_list(
"protonated_H1_adenosine_list ", JP->protonated_H1_adenosine_list() );
3195 std::cout <<
"------------working_stuff------------" << std::endl;
3197 Output_seq_num_list(
"working_global_sample_res_list= ", JP->working_global_sample_res_list() );
3198 if(JP->force_syn_chi_res_list().size()>0)
Output_seq_num_list(
"working_force_syn_chi_res_list= ", JP->working_force_syn_chi_res_list() );
3199 if(JP->force_north_ribose_list().size()>0)
Output_seq_num_list(
"working_force_north_ribose_list= ", JP->working_force_north_ribose_list() );
3200 if(JP->force_south_ribose_list().size()>0)
Output_seq_num_list(
"working_force_south_ribose_list= ", JP->working_force_south_ribose_list() );
3201 if(JP->protonated_H1_adenosine_list().size()>0)
Output_seq_num_list(
"working_protonated_H1_adenosine_list= ", JP->working_protonated_H1_adenosine_list() );
3206 if(Is_simple_full_length_JP==
false){
3215 Output_seq_num_list(
"working_moving_partition_pos= ", JP->working_moving_partition_pos() );
3220 if(Is_simple_full_length_JP==
false){
3223 for(
Size n=1; n<=JP->partition_definition().size(); n++){
3224 vector1_partition_definition.push_back(JP->partition_definition()(n) );
3229 std::cout <<
"root_res= " << JP->fold_tree().root() << std::endl;
3401 using namespace core::id;
3419 std::cout <<
"print_atom_info for pose: " << pose_name <<
" seq_num= " << seq_num << std::endl;
3434 std::cout <<
"individual_atom_info: rsd_name " << rsd_name;
3437 std::cout <<
"|element()=" << rsd.
atom_type(atomno).
element() <<
"|" << std::endl;
3448 if(base_state==
BOTH){
3449 base_state_string=
"BOTH";
3450 }
else if(base_state==
ANTI){
3451 base_state_string=
"ANTI";
3452 }
else if(base_state==
SYN){
3453 base_state_string=
"SYN" ;
3454 }
else if(base_state==
NONE){
3455 base_state_string=
"NONE";
3457 std::cout <<
"Invalid base state=" << base_state << std::endl;
3458 utility_exit_with_message(
"Invalid base state!" );
3461 std::cout << tag << std::setw(4) <<
std::left << base_state_string <<
" ";
3471 if(pucker_state==
NORTH){
3472 pucker_state_string=
"NORTH";
3473 }
else if(pucker_state==
SOUTH){
3474 pucker_state_string=
"SOUTH";
3475 }
else if(pucker_state==
ALL){
3476 pucker_state_string=
"ALL";
3478 std::cout <<
"Invalid pucker state=" << pucker_state << std::endl;
3479 utility_exit_with_message(
"Invalid pucker state!" );
3482 std::cout << tag << std::setw(5) <<
std::left << pucker_state_string <<
" ";
3495 using namespace core::scoring;
3500 atr_rep_screening_scorefxn_->set_weight(
fa_atr , 0.23 );
3501 atr_rep_screening_scorefxn_->set_weight(
fa_rep , 0.12 );
3512 sampling_scorefxn_ = scorefxn_->clone();
3516 sampling_scorefxn_->set_weight(
fa_rep, 0.12 );
3520 sampling_scorefxn_->set_weight(
chainbreak, 0.0 );
3554 o2star_pack_scorefxn_->set_weight(
fa_atr, sampling_scorefxn_->get_weight(
fa_atr ) );
3555 o2star_pack_scorefxn_->set_weight(
fa_rep, sampling_scorefxn_->get_weight(
fa_rep ) );
3558 o2star_pack_scorefxn_->set_weight(
hbond_sc, sampling_scorefxn_->get_weight(
hbond_sc ) );
3561 o2star_pack_scorefxn_->set_weight(
fa_sol, sampling_scorefxn_->get_weight(
lk_nonpolar ) );
3563 o2star_pack_scorefxn_->set_energy_method_options( sampling_scorefxn_->energy_method_options() );
3570 using namespace core::id;
3571 using namespace core::conformation;
3574 utility_exit_with_message(
"template_pose.total_residue()!=mod_pose.total_residue()");
3583 do_update_list[seq_num]=
true;
3589 if(do_update_list[seq_num]==
true){
3604 using namespace core::scoring;
3616 if ( old_weight != 0.0 ) {
3618 rescaled_scorefxn->set_weight(
ScoreType(n), old_weight*scaling_factor);
3622 std::cout << std::endl;
3625 std::cout <<
"n_score_types= " <<
int(
n_score_types) <<
" non_zero_weight= " << non_zero_weight <<
" scaling_factor= " << scaling_factor << std::endl;
3630 return rescaled_scorefxn;
3639 using namespace core::scoring;
3640 using namespace ObjexxFCL::fmt;
3642 std::cout <<
"----------------" << title <<
"----------------" << std::endl;
3644 std::cout <<
"----------------------------------------------\n";
3645 std::cout <<
" Scores Weight\n";
3646 std::cout <<
"----------------------------------------------\n";
3655 std::cout <<
' ' << LJ(30,
ScoreType(n)) <<
' '<< F(11,5, weight ) << std::endl;
3660 for(
Size n=1; n<=title.size(); n++){
3664 std::cout <<
"----------------" << dash_string <<
"----------------" << std::endl;