41 #include <basic/Tracer.hh>
42 #include <utility/vector1.hh>
43 #include <utility/io/ozstream.hh>
44 #include <utility/io/izstream.hh>
45 #include <numeric/xyzVector.hh>
46 #include <numeric/xyzMatrix.hh>
47 #include <numeric/conversions.hh>
51 #include <ObjexxFCL/string.functions.hh>
62 static basic::Tracer
TR(
"protocols.swa.rigid_body_sampler" ) ;
63 using numeric::conversions::radians;
64 using numeric::conversions::degrees;
84 fixed_res_( fixed_res ),
85 moving_res_( moving_res ),
86 reference_axes_(
Matrix::identity() ),
87 reference_centroid_(
Vector( 0.0, 0.0, 0.0 ) ),
89 o2star_trials_( false ),
90 ignore_o2star_hbonds_in_filter_( false ),
91 assign_WC_edges_( false ),
92 reference_energy_( 0.0 ),
94 fa_rep_cutoff_( 0.0 ),
95 CONTACT_CUTOFF_squared_( 4.5 * 4.5 ),
96 STERIC_DIST_CUTOFF_squared_( 2.5 * 2.5 ),
97 MIN_NUM_CONTACTS_( 1 ),
125 using namespace scoring::rna;
126 using namespace kinematics;
127 static RNA_CentroidInfo rna_centroid_info;
167 std::cout << i++ <<
" out of " << N_SAMPLE_ALPHA <<
". Current count: " <<
count_total_ <<
168 ". num poses that pass cuts: " <<
count_good_ << std::endl;
171 if ( cosbeta < -1.0 ){
172 beta_ = -1.0 * degrees( std::acos( -2.0 - cosbeta ) );
173 }
else if ( cosbeta > 1.0 ){
174 beta_ = -1.0 * degrees( std::acos( 2.0 - cosbeta ) );
176 beta_ = degrees( std::acos( cosbeta ) );
179 std::cout <<
"BETA: " <<
beta_ << std::endl;
185 if ( (beta_<-179.999 || beta_>179.999) ){
186 gamma_min_local = 0.0;
187 gamma_max_local = 0.0;
188 gamma_increment_local = 1.0;
191 for (
gamma_ = gamma_min_local;
gamma_ <= gamma_max_local;
gamma_ += gamma_increment_local ){
211 using namespace core::chemical;
224 using namespace core::io::silent;
225 using namespace core::scoring;
226 using namespace protocols::swa;
227 using namespace pose;
239 Pose pose_to_translate_virtual_o2star = pose_to_translate;
240 Pose pose_virtual_o2star = pose;
257 if ( !
check_contact( translation, moving_atoms, fixed_atoms ) ) {
282 Real const energy = (*scorefxn_)( pose );
301 using namespace core::io::silent;
302 using namespace core::scoring;
304 (*scorefxn_)( pose );
310 s.add_energy(
"alphaRB",
alpha_ );
311 s.add_energy(
"betaRB" ,
beta_ );
312 s.add_energy(
"gammaRB",
gamma_ );
313 s.add_energy(
"x",
delx_ );
314 s.add_energy(
"y",
dely_ );
315 s.add_energy(
"z",
delz_ );
321 s.add_energy(
"all_rms", rmsd );
324 sfd_->add_structure( s );
331 using namespace core::io::silent;
332 using namespace core::scoring;
333 using namespace protocols::rna;
340 Size edge1( 0 ), edge2( 0 );
341 for (
Size n = 1; n <= base_pair_list.size(); n++ ) {
344 if( base_pair.
res1 == 1 && base_pair.
res2 == 2 ){
345 edge1 = base_pair.
edge1; edge2 = base_pair.
edge2;
347 if( base_pair.
res2 == 1 && base_pair.
res1 == 2 ){
348 edge1 = base_pair.
edge2; edge2 = base_pair.
edge1;
363 using namespace core::io::silent;
364 using namespace utility::io;
365 izstream input( rigid_body_sample_file );
368 std::cerr <<
"No file: " << rigid_body_sample_file << std::endl;
369 utility_exit_with_message(
"No file" );
374 Real alpha, beta, gamma, x, y, z;
376 while ( input >> alpha ) {
378 input >> beta >> gamma >> x >> y >> z >> skip;
380 alpha, beta, gamma, x, y, z );
383 (*scorefxn_)( pose );
386 std::string const tag =
"S_" + ObjexxFCL::lead_zero_string_of( count_total_, 6 );
389 sfd_->add_structure( s );
432 for (
Size n = 1; n <= subset_res.size(); n++ ) {
433 Size const i = subset_res[ n ];
448 Real const CONTACT_CUTOFF_ = setting;
468 using namespace core::scoring;
492 Size num_contacts( 0 );
494 for (
Size i = 1; i <= moving_atoms.size(); i++ ) {
495 Vector const test_cbeta = moving_atoms[ i ] + translation;
497 for (
Size j = 1; j <= partner_atoms.size(); j++ ) {
498 Vector const & partner_cbeta = partner_atoms[ j ];
515 Real const STERIC_DIST_CUTOFF_ = setting;
526 for (
Size i = 1; i <= moving_atoms.size(); i++ ) {
527 Vector const test_atom = moving_atoms[ i ] + translation;
529 for (
Size j = 1; j <= partner_atoms.size(); j++ ) {
530 Vector const & partner_atom = partner_atoms[ j ];
541 for (
Size n = 1; n <= vec.size(); n++ ) {
542 if ( i == vec[n] )
return true;
551 using namespace core::scoring;
555 hbond_options->use_hb_env_dep(
false );
559 Size num_cross_hbonds( 0 );
560 Real const HBOND_ENERGY_CUTOFF( -0.5 );
562 for (
Size i = 1; i <= hbond_set->nhbonds(); i++ ) {
566 Size const don_hatm = hbond.don_hatm();
567 Size const acc_res_num = hbond.acc_res();
568 Size const acc_atm = hbond.acc_atm();
570 if ( hbond.energy() > HBOND_ENERGY_CUTOFF )
continue;
581 if ( num_cross_hbonds >=
min_hbonds_ )
return true;
592 Real const DIST_CUTOFF = 4.0;
598 if ( ( o2star_xyz - pose.
residue(
fixed_res_[m] ).
xyz( k ) ).length() < DIST_CUTOFF )
return true;
619 using namespace core::scoring;
621 static bool init(
false );
624 rep_scorefxn->set_weight(
fa_rep, 1.0 );
628 Real const fa_rep_score = (*rep_scorefxn)( pose );
639 rigid_body_settings.push_back(
alpha_ );
640 rigid_body_settings.push_back(
beta_ );
641 rigid_body_settings.push_back(
gamma_ );
642 rigid_body_settings.push_back(
delx_ );
643 rigid_body_settings.push_back(
dely_ );
644 rigid_body_settings.push_back(
delz_ );
645 rigid_body_settings.push_back( energy );
740 out <<
"0.0 0.0 0.0 0.0 0.0 0.0 " <<
' ' << 0.0 <<
' ' <<
count_no_contact_ * volume_element << std::endl;
741 out <<
"0.0 0.0 0.0 0.0 0.0 0.0 " <<
' ' << 999.99 <<
' ' <<
count_clash_ * volume_element << std::endl;
748 out <<
' ' << volume_element << std::endl;
758 using namespace core::io::silent;
764 sfd.write_silent_struct( *s, silent_file, write_score_only );
766 utility::io::ozstream out;
767 out.open_append( silent_file );
770 for ( ++iter; iter !=
sfd_->end(); ++iter ){
772 sfd.write_silent_struct( *s, out, write_score_only );
785 Real const energy_hist_min_ = -5.0;
786 Real const energy_hist_max_ = 10.0;
787 Real const energy_increment_ = 0.01;
789 for (
Real energy = energy_hist_min_; energy < energy_hist_max_; energy += energy_increment_ ){
790 histogram_energy.push_back( energy );
791 volumes.push_back( 0.0 );
795 std::map< Size, utility::vector1< Real > > histogram_rigid_body_settings;
802 Real const energy = rigid_body_setting[ 7 ];
804 if ( energy < energy_hist_min_ ) {
805 good_energy_rigid_body_settings.push_back( rigid_body_setting );
806 }
else if ( energy > energy_hist_max_ ){
807 count_clash_local += 1;
809 Size const bin =
static_cast< Size >( ( energy - energy_hist_min_) / energy_increment_ ) + 1;
810 volumes[ bin ] += volume_element;
811 histogram_rigid_body_settings[ bin ] = rigid_body_setting;
819 out <<
"0.0 0.0 0.0 0.0 0.0 0.0 " <<
' ' << 0.00 <<
' ' <<
count_no_contact_ * volume_element << std::endl;
820 out <<
"0.0 0.0 0.0 0.0 0.0 0.0 " <<
' ' << 999.99 <<
' ' << count_clash_local * volume_element << std::endl;
822 for (
Size i = 1; i <= histogram_energy.size(); i++ ){
823 if ( volumes[ i ] > 0.0 ){
826 for (
Size n = 1; n <= 6; n++ ){
827 out <<
' ' << rigid_body_setting[ n ];
829 out <<
' ' << histogram_energy[ i ];
830 out <<
' ' << volumes[ i ] << std::endl;
835 for (
Size i = 1; i <= good_energy_rigid_body_settings.size(); i++ ){
838 for (
Size n = 1; n <= rigid_body_setting.size(); n++ ){
839 out <<
' ' << rigid_body_setting[ n ];
841 out <<
' ' << volume_element << std::endl;