18 #include <basic/prof.hh>
33 #include <basic/Tracer.hh>
41 #include <utility/tag/Tag.hh>
47 #include <numeric/random/random.hh>
59 #include <utility/string_util.hh>
60 #include <utility/vector0.hh>
61 #include <utility/vector1.hh>
64 #include <utility/excn/Exceptions.hh>
73 using namespace core::pose;
74 using namespace basic;
75 using namespace protocols::moves;
78 static numeric::random::RandomGenerator
Rg(38627227);
79 static basic::Tracer
TR(
"protocols.simple_moves.sidechain_moves.SidechainMCMover");
82 namespace simple_moves {
83 namespace sidechain_moves {
86 SidechainMCMoverCreator::keyname()
const {
87 return SidechainMCMoverCreator::mover_name();
91 SidechainMCMoverCreator::create_mover()
const {
96 SidechainMCMoverCreator::mover_name() {
100 SidechainMCMover::SidechainMCMover():
109 inherit_scorefxn_temperature_(false),
114 score_post_apply_(0),
115 metropolis_hastings_mover_(0)
121 protocols::simple_moves::sidechain_moves::
SidechainMover(rotamer_library),
129 inherit_scorefxn_temperature_(false),
134 score_post_apply_(0),
135 metropolis_hastings_mover_(0)
146 ig_->set_scorefunction( *sfxn );
172 bool const DEBUG =
false;
174 using namespace core::scoring;
175 using namespace protocols;
176 using namespace protocols::moves;
209 ig_->initialize( pose );
225 if (
TR.visible( basic::t_debug )) {
226 TR.Debug <<
"old-chi-angles: ";
227 for(
unsigned int i = 1; i <= new_state->nchi(); i++){
228 TR.Debug << new_state->chi( i ) <<
" ";
230 TR.Debug << std::endl;
237 if (
TR.visible( basic::t_debug )) {
238 TR.Debug <<
"new-chi-angles: ";
239 for(
unsigned int i = 1; i <= new_state->nchi(); i++){
240 TR.Debug << new_state->chi( i ) <<
" ";
242 TR.Debug << std::endl;
246 PROF_START( SIMPLEINTGRAPH );
247 core::Real delta_energy =
ig_->consider_substitution( rand_res, new_state );
248 PROF_STOP( SIMPLEINTGRAPH );
260 if( (s1 - s2) - delta_energy > 0.05 ) {
261 TR.Debug <<
"WARNING: ENERGIES DON'T MATCH UP! " << s1 <<
" " << s2 <<
" " << (s1 - s2) <<
" " << delta_energy << std::endl;
267 TR.Debug <<
"energies match up " << std::endl;
278 TR.Debug <<
"current energy after accept: " <<
sfxn_(temp) <<
" delta " << (s2-s1) << std::endl;
284 if (
TR.visible( basic::t_debug )) {
285 TR.Debug <<
"passed metropolis! assigning new move to current " << std::endl;
289 PROF_START( SIMPLEINTGRAPH );
290 ig_->commit_change( rand_res );
291 PROF_STOP( SIMPLEINTGRAPH );
292 current_energy -= delta_energy;
295 best_[ rand_res ] = new_state;
299 PROF_START( SIMPLEINTGRAPH );
300 ig_->reject_change( rand_res );
301 PROF_STOP( SIMPLEINTGRAPH );
324 return "SidechainMCMover";
333 if( probability < 1 &&
Rg.uniform() >= probability ) {
335 if (
TR.visible( basic::t_debug )) {
336 TR.Debug <<
"delta energy is " << delta_energy <<
" probability: " << probability <<
" accepted: FALSE " << std::endl;
343 if (
TR.visible( basic::t_debug )) {
344 TR.Debug <<
"delta energy is " << delta_energy <<
" probability: " << probability <<
" accepted: TRUE" << std::endl;
354 if ( tag->hasOption(
"task_operations") ) {
360 StringVec
const t_o_keys( utility::string_split( t_o_val,
',' ) );
361 for ( StringVec::const_iterator t_o_key( t_o_keys.begin() ),
end( t_o_keys.end() );
362 t_o_key !=
end; ++t_o_key ) {
363 if ( data.
has(
"task_operations", *t_o_key ) ) {
366 throw utility::excn::EXCN_RosettaScriptsOption(
"TaskOperation " + *t_o_key +
" not found in protocols::moves::DataMap.");
376 pt->restrict_to_repacking();
391 using namespace core::scoring;