28 #include <utility/tag/Tag.hh>
29 #include <utility/exit.hh>
30 #include <utility/vector0.hh>
31 #include <utility/vector1.hh>
34 #include <basic/Tracer.hh>
35 #include <utility/excn/Exceptions.hh>
50 static basic::Tracer
TR(
"protocols.moves.RampingMover" );
60 xval_start_ramp_( xval_start_ramp ),
61 xval_end_ramp_( xval_end_ramp )
63 runtime_assert( 0 <= xval_start_ramp && xval_start_ramp <= 1 );
64 runtime_assert( 0 <= xval_end_ramp && xval_end_ramp <= 1 );
65 runtime_assert( xval_start_ramp <= xval_end_ramp );
85 inv_xval_at_0p5_( 1 / xval_at_0p5 )
87 runtime_assert( xval_at_0p5 != 0.0 );
103 static Real const ln_0p5 = std::log( 0.5 );
113 inv_one_minus_xval_at_0p5_( 1 / ( 1 - xval_at_0p5 ))
117 inv_one_minus_xval_at_0p5_( 1 / ( 1 - 0.66 ))
126 static Real const ln_0p5 = std::log( 0.5 );
141 ramp_one_weight_( true ),
142 score_type_( core::scoring::
fa_rep ),
143 ramping_funcs_for_weights_( core::scoring::
n_score_types, 0 ),
162 scorefxn_( scorefxn_in ),
163 ramp_one_weight_( true ),
164 score_type_( score_type_in ),
165 start_weights_( scorefxn_in->weights() ),
166 ramping_funcs_for_weights_( core::scoring::
n_score_types, 0 ),
167 outer_cycles_( outer_cycles_in ),
168 inner_cycles_( inner_cycles_in ),
187 scorefxn_( scorefxn_in ),
188 ramp_one_weight_( false ),
189 score_type_( core::scoring::
fa_rep ),
190 start_weights_( start_weights ),
191 end_weights_( end_weights ),
192 ramping_funcs_for_weights_( core::scoring::
n_score_types, 0 ),
193 outer_cycles_( outer_cycles_in ),
194 inner_cycles_( inner_cycles_in ),
222 if(!tag->hasOption(
"outer_cycles")) {
223 throw utility::excn::EXCN_RosettaScriptsOption(
"You must specify the option outer_cycles in RampingMover");
225 if(!tag->hasOption(
"inner_cycles")) {
226 throw utility::excn::EXCN_RosettaScriptsOption(
"You must specify the option inner_cycles in RampingMover");
228 if(!tag->hasOption(
"mover")) {
229 throw utility::excn::EXCN_RosettaScriptsOption(
"You must specify the option mover in RampingMover");
240 throw utility::excn::EXCN_RosettaScriptsOption(
"scorefxn required to create a RampingMover");
246 Movers_map::const_iterator find_mover(movers.find(mover_name));
247 if(find_mover == movers.end()) {
248 throw utility::excn::EXCN_RosettaScriptsOption(
"cannot find "+mover_name+
" in mover map.");
250 mover_ = find_mover->second;
253 if ( montecarlo_name !=
"none" ) {
263 if ( tag->hasOption(
"start_weight") ||
264 tag->hasOption(
"end_weight") ||
265 tag->hasOption(
"scoretype") ||
266 tag->hasOption(
"ramp_func") ) {
269 if(!tag->hasOption(
"start_weight")) {
270 throw utility::excn::EXCN_RosettaScriptsOption(
"One-weight ramping mode: you must specify the option start_weight in RampingMover");
272 if(!tag->hasOption(
"end_weight")) {
273 throw utility::excn::EXCN_RosettaScriptsOption(
"One-weight ramping mode: you must specify the option end_weight in RampingMover");
275 if(!tag->hasOption(
"score_type")) {
276 throw utility::excn::EXCN_RosettaScriptsOption(
"One-weight ramping mode: you must specify the option score_type in RampingMover");
278 if(!tag->hasOption(
"ramp_func")) {
279 throw utility::excn::EXCN_RosettaScriptsOption(
"One-weight ramping mode: you must specify the option ramp_func in RampingMover");
295 throw utility::excn::EXCN_RosettaScriptsOption(
"The value for option score_type \"" + score_type +
"\" is not a valid name for a score_type" );
302 if( tag->hasOption(
"unramped_weights_from_sfxn")) {
304 if ( ! datamap.
has(
"scorefxns", scorefxn_key ) ) {
305 throw utility::excn::EXCN_RosettaScriptsOption(
"ScoreFunction " + scorefxn_key +
" not found in DataMap.");
316 rampterm_it=rampterm_tags.begin(), rampterm_it_end = rampterm_tags.end();
317 rampterm_it!=rampterm_it_end; ++rampterm_it ) {
318 TagPtr const tag_ptr = *rampterm_it;
319 if ( ! tag_ptr->hasOption(
"score_type") ) {
320 throw utility::excn::EXCN_RosettaScriptsOption(
"Ramping mover Add statement requires the score_type option");
322 if ( ! tag_ptr->hasOption(
"start_weight") ) {
323 throw utility::excn::EXCN_RosettaScriptsOption(
"Ramping mover Add statement requires the start_weight option");
325 if ( ! tag_ptr->hasOption(
"end_weight") ) {
326 throw utility::excn::EXCN_RosettaScriptsOption(
"Ramping mover Add statement requires the end_weight option");
328 if ( ! tag_ptr->hasOption(
"ramp_func") ) {
329 throw utility::excn::EXCN_RosettaScriptsOption(
"Ramping mover Add statement requires the ramp_func option");
338 throw utility::excn::EXCN_RosettaScriptsOption(
"The value for option score_type \"" + score_type +
"\" is not a valid name for a score_type" );
345 TR <<
"Ramping weight " << score_type << std::endl;
378 return "RampingMover";
438 scorefxn_->set_weight( iist, emap[ iist ] );
439 if ( emap[ iist ] == 0.0 )
continue;
452 if ( func_name ==
"geometric" ) {
455 }
else if ( func_name ==
"linear" ) {
457 }
else if ( func_name ==
"fast_linear" ) {
461 }
else if ( func_name ==
"inverse_geometric") {
465 utility_exit_with_message(
"option ramping_func in RampingMover must be: geometric, linear, fast_linear, or inverse_geometric");