Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RotamerBoltzmannWeight.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 sw=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @author Sarel Fleishman (sarelf@uw.edu)
13 
14 #include <core/chemical/AA.hh>
15 #include <core/pose/Pose.hh>
16 #include <core/pose/selection.hh>
17 #include <core/pose/util.hh>
18 #include <core/pose/PDBInfo.hh>
20 #include <utility/tag/Tag.hh>
25 // AUTO-REMOVED #include <protocols/protein_interface_design/movers/BuildAlaPose.hh>
26 // AUTO-REMOVED #include <protocols/simple_moves/MakePolyXMover.hh>
28 #include <basic/Tracer.hh>
34 // AUTO-REMOVED #include <core/pack/rotamer_set/RotamerSets.hh>
38 #include <utility/vector1.hh>
39 #include <boost/foreach.hpp>
40 #define foreach BOOST_FOREACH
43 #include <core/graph/Graph.hh>
45 // AUTO-REMOVED #include <core/optimization/MinimizerOptions.hh>
46 #include <core/scoring/Energies.hh>
47 
48 // Neil headers 110621
49 // AUTO-REMOVED #include <core/conformation/symmetry/util.hh>
53 #include <protocols/jd2/Job.hh>
55 #include <ObjexxFCL/format.hh>
56 
57 // Jacob headers 120423/120817
59 #include <utility/string_util.hh>
60 
61 #include <utility/vector0.hh>
62 
63 //Auto Headers
68 namespace protocols {
69 namespace simple_filters {
70 
71 static basic::Tracer TR( "protocols.simple_filters.RotamerBoltzmannWeight" );
72 
73 ///@brief default ctor
75  parent( "RotamerBoltzmannWeight" ),
76  task_factory_( NULL ),
77  rb_jump_( 1 ),
78  sym_dof_names_( "" ),
79  unbound_( true ),
80  scorefxn_( NULL ),
81  temperature_( 0.8 ),
82  ddG_threshold_( 1.5 ),
83  repacking_radius_( 6.0 ),
84  energy_reduction_factor_( 0.5 ),
85  compute_entropy_reduction_( false ),
86  repack_( true ),
87  type_( "" ),
88  skip_ala_scan_( false ),
89  fast_calc_(false),
90  no_modified_ddG_(false)
91 {
93 }
94 
95 void
96 RotamerBoltzmannWeight::repack( bool const repack ){
97  repack_ = repack;
98 }
99 
100 bool
102 {
103  return repack_;
104 }
105 
106 void
108 {
109  threshold_probabilities_per_residue_[ aa_type ] = probability;
110 }
111 
114 {
115  return( threshold_probabilities_per_residue_[ aa_type ] );
116 }
117 
118 void
120 {
121  energy_reduction_factor_ = factor;
122 }
123 
126 {
127  return( energy_reduction_factor_ );
128 }
129 
132  return temperature_;
133 }
134 
135 void
137 {
138  temperature_ = temp;
139 }
140 
143 {
144  return task_factory_;
145 }
146 
147 void
149 {
151 }
152 
153 void
155 {
156  runtime_assert( jump );
157  rb_jump_ = jump;
158 }
159 
162 {
163  return rb_jump_;
164 }
165 
166 void
168 {
169  sym_dof_names_ = dof_names;
170 }
171 
174 {
175  return sym_dof_names_;
176 }
177 
178 void
180 {
181  repacking_radius_ = rad;
182 }
183 
186 {
187  return repacking_radius_;
188 }
189 
190 bool
192 {
193  return( true );
194 }
195 
196 /// @details iterate over all packable residues according to the task factory and for each
197 /// determine whether it contributes to binding at least ddG_threshold R.e.u. (using alanine scanning
198 /// This list will later be used to do the Boltzmann weight calculations.
201 {
202  runtime_assert( task_factory() );
203  TR<<"----------First pass alanine scanning to identify hot spot residues------------"<<std::endl;
204  utility::vector1< core::Size > hotspot_residues;
205  hotspot_residues.clear();
207  ala_scan.repack( repack() );
208  if( repack() )
209  ala_scan.repeats( 3 );
210  else
211  ala_scan.repeats( 1 );
212  core::Size const jump( rb_jump() );
213  ala_scan.jump( jump );
214  ala_scan.scorefxn( scorefxn() );
215  if( repack() )
216  TR<<"All energy calculations will be computed subject to repacking in bound and unbound states (ddG).";
217  else
218  TR<<"All energy calculations will be computed subject to no repacking in the bound and unboud states (dG)";
219  core::Real orig_ddG(0.0);
220  if( !skip_ala_scan() ){
221  protocols::simple_filters::DdgFilter ddg_filter( 100/*ddg_threshold*/, scorefxn(), jump, 1 /*repeats*/ );
222  ddg_filter.repack( repack() );
223  orig_ddG = ddg_filter.compute( pose );
224  TR<<"\nOriginal complex ddG "<<orig_ddG<<std::endl;
225  }
226  core::pack::task::PackerTaskCOP packer_task( task_factory()->create_task_and_apply_taskoperations( pose ) );
227  for( core::Size resi=1; resi<=pose.total_residue(); ++resi ){
228  if( packer_task->being_packed( resi ) && pose.residue( resi ).is_protein()){
229  if( skip_ala_scan() ){
230  TR<<"Adding residue "<<resi<<" to hotspot list\n";
231  hotspot_residues.push_back( resi );
232  }
233  else{
234  core::Real const ala_scan_ddG( ala_scan.ddG_for_single_residue( pose, resi ) );
235  core::Real const ddG( ala_scan_ddG - orig_ddG );
236  TR<<"ddG for resi "<<pose.residue( resi ).name3()<<resi<<" is "<<ddG<<std::endl;
237  ddGs_[ resi ] = ddG;
238  if( ddG >= ddG_threshold() )
239  hotspot_residues.push_back( resi );
240  }
241  }
242  }
243  TR<<"----------Done with first pass alanine scanning to identify hot spot residues------------"<<std::endl;
244  return( hotspot_residues );
245 }
246 
247 
250  ddGs_.clear();
251  rotamer_probabilities_.clear();
252 
254  // for(Size i = 1; i <= hotspot_res.size(); ++i) {
255  // std::cerr << "RotamerBoltzmannWeight calc res: " << hotspot_res[i] << std::endl;
256  // }
257  core::pose::Pose unbound_pose( const_pose );
258  if( hotspot_res.size()==0 ) {
259  if( type_ == "monomer" ) {
260  protocols::toolbox::SelectResiduesByLayer srb( true, true, false );
262  select_aa_types.push_back( core::chemical::aa_tyr );
263  select_aa_types.push_back( core::chemical::aa_phe );
264  select_aa_types.push_back( core::chemical::aa_trp );
265  select_aa_types.push_back( core::chemical::aa_leu );
266  select_aa_types.push_back( core::chemical::aa_ile );
267  srb.restrict_aatypes_for_selection( select_aa_types );
268  hotspot_res = srb.compute( const_pose );
269  } else {
270  if( unbound() ){
271  using namespace protocols::moves;
272 
273  if ( sym_dof_names() != "" ) { // JB 120817
274  utility::vector1<std::string> sym_dof_name_list = utility::string_split( sym_dof_names() , ',' ); // JB 120817
275  for (Size i = 1; i <= sym_dof_name_list.size(); i++) { // JB 120817
276  int sym_aware_jump_id = core::pose::symmetry::sym_dof_jump_num( unbound_pose, sym_dof_name_list[i] ); // JB 120817
277  rigid::RigidBodyTransMoverOP translate( new rigid::RigidBodyTransMover( unbound_pose, sym_aware_jump_id ) ); // JB 120817
278  translate->step_size( 1000.0 ); // JB 120817
279  translate->apply( unbound_pose ); // JB 120817
280  } // JB 120817
281  } else { // JB 120817
282  int sym_aware_jump_id = core::pose::symmetry::get_sym_aware_jump_num(unbound_pose, rb_jump() ); // JB 120420
283  rigid::RigidBodyTransMoverOP translate( new rigid::RigidBodyTransMover( unbound_pose, sym_aware_jump_id ) ); // JB 120420
284  translate->step_size( 1000.0 );
285  translate->apply( unbound_pose );
286  }
287  }
288  hotspot_res = first_pass_ala_scan( const_pose );
289  }
290  }
291  //unbound_pose.dump_pdb("unbound_pose.pdb");
292  if( hotspot_res.size() == 0 ){
293  TR<<"No hot-spot residues detected in first pass alanine scan. Doing nothing"<<std::endl;
294  return( 0 );
295  } else {
296  TR<<hotspot_res.size()<<" hot-spot residues detected."<<std::endl;
297  }
298 
300 
301  foreach( core::Size const hs_res, hotspot_res ){
302  core::Real const boltz_weight( fast_calc_ ? rotboltz_calc.computeBoltzWeight( unbound_pose, hs_res ) : compute_Boltzmann_weight( unbound_pose, hs_res ) );
303  TR<<const_pose.residue( hs_res ).name3()<<hs_res<<" "<<boltz_weight<<'\n';
304  rotamer_probabilities_[ hs_res ] = boltz_weight;
305  if ( write2pdb() ) { write_to_pdb( hs_res, const_pose.residue( hs_res ).name3(), boltz_weight ); }
306  }
307  TR.flush();
308  core::Real avg = 0.0;
309  for( std::map<core::Size,core::Real>::const_iterator i = rotamer_probabilities_.begin(); i != rotamer_probabilities_.end(); ++i) {
310  avg += i->second;
311  }
312  return - avg / (core::Real)rotamer_probabilities_.size();
313 }
314 
317 {
318  using namespace core::pack::rotamer_set;
319  using namespace core::pack::task;
320  using namespace core::conformation;
321 
322  TR<<"-----Computing Boltzmann weight for residue "<<resi<<std::endl;
323 /// build a rotamer set for resi while pruning clashes against a poly-alanine background
324  core::pose::Pose pose( const_pose );
325 
326  Residue const & res = pose.residue( resi );
327  RotamerSetFactory rsf;
328  RotamerSetOP rotset = rsf.create_rotamer_set( res );
329  rotset->set_resid( resi );
332  tf->push_back( new core::pack::task::operation::IncludeCurrent );
333  PackerTaskOP ptask( tf->create_task_and_apply_taskoperations( pose ) );
335  core::pack::make_symmetric_PackerTask_by_truncation(pose, ptask); // NK 110621
336  }
337  ResidueLevelTask & restask( ptask->nonconst_residue_task( resi ) );
338  restask.restrict_to_repacking();
339  core::graph::GraphOP packer_graph = new core::graph::Graph( pose.total_residue() );
340  ptask->set_bump_check( true );
341  rotset->build_rotamers( pose, *scorefxn_, *ptask, packer_graph, false );
342  // TR << "num rotamers for resi " << resi << " is: " << rotset->num_rotamers() << std::endl;
343 
344 /// des_around will mark all residues around resi for design, the rest for packing.
346  des_around->design_shell( repacking_radius() );
347  des_around->include_residue( resi );
348  tf->push_back( des_around );
349  PackerTaskOP task = tf->create_task_and_apply_taskoperations( pose );
352  }
354 
357  core::pose::symmetry::make_symmetric_movemap( pose, *mm ); // NK 110621
358  }
359  mm->set_bb( false );
360  if( unbound() ) // the complex was split, don't minimize rb dof
361  mm->set_jump( false );
362  else // minimize rb if bound
363  mm->set_jump( rb_jump(), true ); // Need to modify for multicomponent symmetries (JBB)
364  for( core::Size i=1; i<=pose.total_residue(); ++i ){
365  if( task->being_designed( i ) ){
366  task->nonconst_residue_task( i ).restrict_to_repacking(); // mark all des around to repacking only
367  mm->set_chi( i, true );
368  }
369  else{
370  task->nonconst_residue_task( i ).prevent_repacking(); /// mark all non-desaround positions for no repacking
371  mm->set_chi( i, false );
372  }
373  }
374  task->nonconst_residue_task( resi ).prevent_repacking();
375  core::pack::pack_rotamers( pose, *scorefxn_, task );
376  protocols::moves::MoverOP min_mover;
378  min_mover = new protocols::simple_moves::symmetry::SymMinMover( mm, scorefxn_, "dfpmin_armijo_nonmonotone", 0.01, true, false, false ); // NK 110621
379  } else {
380  min_mover = new protocols::simple_moves::MinMover( mm, scorefxn_, "dfpmin_armijo_nonmonotone", 0.01, true, false, false ); // NK 110621
381  }
382  min_mover->apply( pose );
383  core::pose::Pose const const_min_pose( pose );
384  core::Real const init_score( stf.compute( const_min_pose ) );
385  TR<<"Total score for input pose: "<<init_score<<std::endl;
387  for( Rotamers::const_iterator rotamer = rotset->begin(); rotamer != rotset->end(); ++rotamer ){
388  pose = const_min_pose;
389  pose.replace_residue( resi, **rotamer, false/*orient bb*/ );
390  core::pack::pack_rotamers( pose, *scorefxn(), task );
391  // std::cerr << "CHI " << rotamer->chi1() << " " << rotamer->chi2() << std::endl;
392  min_mover->apply( pose );
393  core::Real const score( stf.compute( pose ) );
394  TR<<"This rotamer has score "<<score<<std::endl;
395  scores.push_back( score );
396  }
397  core::Real boltz_sum ( 0.0 );
398  foreach( core::Real const score, scores )
399  boltz_sum += exp(( init_score - score )/temperature());
400 
401  return( 1/boltz_sum );
402 }
403 
406 {
407  return ddG_threshold_;
408 }
409 
410 void
412 {
413  ddG_threshold_ = ddG;
414 }
415 
418 {
419  compute( pose );
420  if (no_modified_ddG_) {
421  core::Real avg = 0.0;
422  for( std::map<core::Size,core::Real>::const_iterator i = rotamer_probabilities_.begin(); i != rotamer_probabilities_.end(); ++i) {
423  avg += i->second;
424  }
425  return - avg / (core::Real)rotamer_probabilities_.size();
426  }
427  return( compute_modified_ddG( pose, TR ));
428 }
429 
432 {
433  using namespace core::graph;
434  using namespace core::scoring;
435 
436  core::pose::Pose nonconst_pose( pose );
437  (*scorefxn())(nonconst_pose);
438  EnergyMap const curr_weights = nonconst_pose.energies().weights();
439 
440  core::Size const res_chain( pose.residue( res ).chain() );
441  core::Real total_residue_energy( 0.0 );
442  for( EdgeListConstIterator egraph_it = nonconst_pose.energies().energy_graph().get_node( res )->const_edge_list_begin(); egraph_it != nonconst_pose.energies().energy_graph().get_node( res )->const_edge_list_end(); ++egraph_it){
443  core::Size const int_resi = (*egraph_it)->get_other_ind( res );
444  core::Size const int_resi_chain( pose.residue( int_resi ).chain() );
445  if( int_resi_chain != res_chain ){ // only sum over interaction energies with the residue's non-host chain
446  EnergyEdge const * Eedge = static_cast< EnergyEdge const * > (*egraph_it);
447  core::Real const intE = Eedge->dot( curr_weights );
448  total_residue_energy += intE;
449  }//fi
450  }//for each egraph_it
451  return( total_residue_energy );
452 }
453 
454 
455 void
456 RotamerBoltzmannWeight::report( std::ostream & out, core::pose::Pose const & pose ) const
457 {
458  if( type_ == "monomer" || no_modified_ddG_ ) {
459  out<<"RotamerBoltzmannWeightFilter returns "<<compute( pose )<<std::endl;
460  out<<"RotamerBoltzmannWeightFilter final report\n";
461  out<<"Residue"<<'\t'<<"ddG"<<'\t'<<"RotamerProbability"<<'\n';
462  for( std::map< core::Size, core::Real >::const_iterator rot( rotamer_probabilities_.begin() ); rot != rotamer_probabilities_.end(); ++rot ){
463  core::Size const res( rot->first );
464  core::Real const prob( rot->second );
465  core::Real const ddG( 0.0 );
466  out<<pose.residue( res ).name3()<< pose.pdb_info()->number( res )<<'\t'<<ddG<<'\t'<<prob<<'\t';
467  out<<'\n';
468  }
469  } else
470  compute_modified_ddG( pose, out );
471 }
472 
473 void
478  core::pose::Pose const & )
479 {
480  using namespace utility::tag;
481 
482  TR << "RotamerBoltzmannWeightFilter"<<std::endl;
484  repacking_radius( tag->getOption< core::Real >( "radius", 6.0 ) );
485  type_ = tag->getOption< std::string >( "type", "" );
486  rb_jump( tag->getOption< core::Size >( "jump", 1 ) );
487  sym_dof_names( tag->getOption< std::string >( "sym_dof_names" , "" ) );
488  unbound( tag->getOption< bool >( "unbound", 1 ) );
489  ddG_threshold( tag->getOption< core::Real >( "ddG_threshold", 1.5 ) );
490  temperature( tag->getOption< core::Real >( "temperature", 0.8 ) );
491  std::string const scorefxn_name( tag->getOption< std::string >( "scorefxn", "score12" ) );
492  scorefxn( data.get< core::scoring::ScoreFunction * >( "scorefxns", scorefxn_name ) );
493  energy_reduction_factor( tag->getOption< core::Real >( "energy_reduction_factor", 0.5 ) );
494  compute_entropy_reduction( tag->getOption< bool >( "compute_entropy_reduction", 0 ) );
495  repack( tag->getOption< bool >( "repack", 1 ) );
496  utility::vector0< TagPtr > const branch( tag->getTags() );
497  foreach( TagPtr const tag, branch ){
498  using namespace core::chemical;
499 
500  std::string const residue_type( tag->getName() );
501  AA const aa( aa_from_name( residue_type ) );
502  core::Real const threshold_probability_input( tag->getOption< core::Real >( "threshold_probability" ) );
503 
504  threshold_probability( aa, threshold_probability_input );
505  }
506 
507  target_residues_ = tag->getOption<std::string>("target_residues","");
508 
509  fast_calc_ = tag->getOption< bool >("fast_calc",0);
510  no_modified_ddG_ = tag->getOption< bool >("no_modified_ddG",0);
511 
512  skip_ala_scan( tag->getOption< bool >( "skip_ala_scan", 0 ) );
513  write2pdb( tag->getOption< bool >( "write2pdb", 0 ) );
514  TR<<"with options repacking radius: "<<repacking_radius()<<" and jump "<<rb_jump()<<" unbound "<<unbound()<<" ddG threshold "<<ddG_threshold()<<" temperature "<<temperature()<<" energy reduction factr "<<energy_reduction_factor()<<" entropy_reduction "<<compute_entropy_reduction()<<" repack "<<repack()<<" skip_ala_scan "<<skip_ala_scan()<<std::endl;
515 }
516 void RotamerBoltzmannWeight::parse_def( utility::lua::LuaObject const & def,
517  utility::lua::LuaObject const & score_fxns,
518  utility::lua::LuaObject const & tasks ) {
519  TR << "RotamerBoltzmannWeightFilter"<<std::endl;
520  task_factory( protocols::elscripts::parse_taskdef( def["tasks"], tasks ));
521  repacking_radius(def["radius"] ? def["radius"].to<core::Real>() : 6.0);
522  type_ = def["type"] ? def["type"].to<std::string>() : "";
523  rb_jump(def["jump"] ? def["jump"].to<core::Size>() : 1);
524  unbound(def["unbound"] ? def["unbound"].to<bool>() : true);
525  ddG_threshold(def["ddG_threshold"] ? def["ddG_threshold"].to<core::Real>() : 1.5);
526  temperature(def["temperature"] ? def["temperature"].to<core::Real>() : 0.8);
527  if( def["scorefxn"] ) {
528  scorefxn_ = protocols::elscripts::parse_scoredef( def["scorefxn"], score_fxns );
529  } else {
530  scorefxn_ = score_fxns["score12"].to<core::scoring::ScoreFunctionSP>()->clone();
531  }
532  energy_reduction_factor(def["energy_reduction_factor"] ? def["energy_reduction_factor"].to<core::Real>() : 0.5);
533  compute_entropy_reduction(def["compute_entropy_reduction"] ? def["compute_entropy_reduction"].to<bool>() : false);
534  repack(def["repack"] ? def["repack"].to<bool>() : true);
535 
536  if( def["per_aa_threshold"] ) {
537  for (utility::lua::LuaIterator i=def["per_aa_threshold"].begin(), end; i != end; ++i) {
538  core::chemical::AA const aa( core::chemical::aa_from_name( i.skey() ) );
539  threshold_probability( aa, (*i).to<core::Real>() );
540  }
541  }
542 
543  target_residues_ = def["target_residues"] ? def["target_residues"].to<std::string>() : "";
544 
545  fast_calc_ = def["fast_calc"] ? def["fast_calc"].to<bool>() : false;
546  no_modified_ddG_ = def["no_modified_ddG"] ? def["no_modified_ddG"].to<bool>() : false;
547 
548  skip_ala_scan( def["skip_ala_scan"] ? def["skip_ala_scan"].to<bool>() : false );
549  write2pdb( def["write2pdb"] ? def["write2pdb"].to<bool>() : false );
550  TR<<"with options repacking radius: "<<repacking_radius()<<" and jump "<<rb_jump()<<" unbound "<<unbound()<<" ddG threshold "<<ddG_threshold()<<" temperature "<<temperature()<<" energy reduction factr "<<energy_reduction_factor()<<" entropy_reduction "<<compute_entropy_reduction()<<" repack "<<repack()<<" skip_ala_scan "<<skip_ala_scan()<<std::endl;
551 }
552 
553 /// @brief Output per-residue Boltzmann weights to the output pdb file if desired
554 void RotamerBoltzmannWeight::write_to_pdb( core::Size const residue, std::string const residue_name, core::Real const boltzmann_weight ) const
555 {
556 
558  std::string user_name = this->get_user_defined_name();
559  std::string output_string = "RotamerBoltzmannWeight " + user_name + ": " + residue_name + ObjexxFCL::string_of(residue) + " = " + ObjexxFCL::string_of(boltzmann_weight);
560  job->add_string(output_string);
561 
562 }
563 
566  return new RotamerBoltzmannWeight();
567 }
568 
570 
573  return new RotamerBoltzmannWeight( *this );
574 }
575 
576 void
579 }
580 
583  return scorefxn_;
584 }
585 
586 bool
588  return unbound_;
589 }
590 
591 void
593  unbound_ = u;
594 }
595 
596 bool
598  return( compute_entropy_reduction_ );
599 }
600 
601 void
604 }
605 
608 
610 RotamerBoltzmannWeightFilterCreator::keyname() const { return "RotamerBoltzmannWeight"; }
611 
612 bool
614 {
615  return skip_ala_scan_;
616 }
617 
618 void
620 {
621  skip_ala_scan_ = s;
622 }
623 
626 {
627  return type_;
628 }
629 
630 void
632 {
633  type_ = s;
634 }
635 
636 bool
638 {
639  return write2pdb_;
640 }
641 
642 void
644  write2pdb_ = write;
645 }
646 
647 /// Note that compute( pose ) needs to have been run first. This merely sums over the probabilities
649 RotamerBoltzmannWeight::compute_modified_ddG( core::pose::Pose const & pose, std::ostream & out ) const
650 {
651  if (no_modified_ddG_) return (0.0);
652  protocols::simple_filters::DdgFilter ddg_filter( 100/*ddg_threshold*/, scorefxn(), rb_jump(), repack() ? 3 : 1 /*repeats*/ ); //120423
653  ddg_filter.repack( repack() );
654 
655  core::Real const ddG_in( ddg_filter.compute( pose ) ); //problem
656  core::Real modified_ddG( ddG_in );
657  out<<"Residue"<<'\t'<<"ddG"<<'\t'<<"RotamerProbability"<<'\t'<<"EnergyReduction\n";
658  for( std::map< core::Size, core::Real >::const_iterator rot( rotamer_probabilities_.begin() ); rot != rotamer_probabilities_.end(); ++rot ){
659  core::Size const res( rot->first );
660  core::Real const prob( rot->second );
661  core::Real const ddG( ddGs_[ res ] );
662  out<<pose.residue( res ).name3()<< pose.pdb_info()->number( res )<<'\t'<<ddG<<'\t'<<prob<<'\t';
663  core::Real const threshold_prob( threshold_probability( pose.residue( res ).aa() ) );
664 
665  //out<<"prob: "<<prob<<"and threshold: " <<threshold_prob<<"\n";
666  if( prob <= threshold_prob ){
667  //core::Real const int_energy( interface_interaction_energy( pose, res ) );
668  //core::Real const energy_reduction( energy_reduction_factor() * int_energy );
669  core::Real const energy_reduction( -1 * temperature() * log( prob ) * energy_reduction_factor() );
670  //out<<"after if statemnet energy reduction: "<<energy_reduction<<"this is prob: "<<prob<<"and this is threshold: " <<threshold_prob<<"\n";
671  out<<energy_reduction;
672  modified_ddG += energy_reduction;
673  }
674  else
675  out<<0;
676  out<<'\n';
677  }
678  out<<"ddG before, after modification: "<<ddG_in<<", "<<modified_ddG<<std::endl;
679  return( modified_ddG );
680 }
681 
682 
683 } // simple_filters
684 } // protocols