32 #include <basic/prof.hh>
33 #include <utility/string_util.hh>
34 #include <utility/tag/Tag.hh>
40 #include <boost/foreach.hpp>
41 #include <basic/Tracer.hh>
43 #include <utility/vector0.hh>
44 #include <utility/vector1.hh>
46 #define foreach BOOST_FOREACH
49 namespace simple_moves {
52 using namespace kinematics;
53 using namespace optimization;
54 using namespace scoring;
60 static basic::Tracer
TR(
"protocols.simple_moves.MinMover");
82 : protocols::moves::
Mover(
"MinMover"),
90 min_options_ =
new MinimizerOptions(
"linmin", 0.01,
true,
false,
false );
94 : protocols::moves::
Mover(name),
102 min_options_ =
new MinimizerOptions(
"linmin", 0.01,
true,
false,
false );
114 bool deriv_check_in ,
115 bool deriv_check_verbose_in
116 ) : protocols::moves::
Mover(
"MinMover"),
117 movemap_( movemap_in ),
118 scorefxn_( scorefxn_in ),
120 threshold_(1000000.0),
125 min_type_in, tolerance_in, use_nb_list_in, deriv_check_in, deriv_check_verbose_in );
143 runtime_assert( movemap_in );
144 movemap_ =
new MoveMap( *movemap_in );
156 runtime_assert( scorefxn_in );
207 PackerTaskOP task(
t->second->create_task_and_apply_taskoperations( pose ) );
210 Size const nres( task->total_residue() );
212 for (
Size i(1); i <= nres; ++i ) {
213 if ( !task->pack_residue( i ) ){
215 movemap.set(
t->first.second,
false );
217 movemap.set(
t->first.first,
false );
231 else active_movemap =
movemap()->clone();
238 PROF_START( basic::MINMOVER_APPLY );
240 AtomTreeMinimizer minimizer;
244 CartesianMinimizer minimizer;
248 PROF_STOP( basic::MINMOVER_APPLY );
252 TR.Debug << std::endl;
264 utility::lua::LuaObject
const & score_fxns,
265 utility::lua::LuaObject
const & ,
267 if( def[
"scorefxn"] ) {
275 for (utility::lua::LuaIterator i=def[
"jump"].begin(),
end; i !=
end; ++i) {
276 if( (*i).to<
int>() == -1 ) {
283 TR <<
"Setting min on jump " << (*i).to<
core::Size>() << std::endl;
289 min_type( def[
"type"] ? def[
"type" ].to<std::string>() :
"dfpmin_armijo_nonmonotone" );
290 tolerance( def[
"tolerance"] ? def[
"tolerance" ].to<core::Real>() : 0.01 );
291 cartesian( def[
"cartesian"] ? def[
"cartesian" ].to<bool>() :
false );
294 min_type(
"lbfgs_armijo_nonmonotone" );
301 utility::lua::LuaObject
const & score_fxns,
302 utility::lua::LuaObject
const & tasks,
309 movemap_->set_chi(def[
"chi"].to<bool>());
311 movemap_->set_chi(def[
"bb"].to<bool>());
326 parse_opts( tag, data, filters, movers, pose );
346 if ( tag->hasOption(
"jump") ) {
350 if (jumps.size() == 1 && (jumps[1] ==
"ALL" || jumps[1] ==
"All" || jumps[1] ==
"all" || jumps[1] ==
"*") ) {
352 }
else if( tag->getOption<
core::Size > (
"jump" ) == 0 ) {
356 Size const value = std::atoi( jump.c_str() );
357 TR <<
"Setting min on jump " << value << std::endl;
368 if (
cartesian() && !tag->hasOption(
"type") ) {
369 min_type(
"lbfgs_armijo_nonmonotone" );
377 bool const chi( tag->getOption<
bool >(
"chi" ) ), bb( tag->getOption<
bool >(
"bb" ) );
380 TR<<
"Options chi, bb: "<<chi<<
", "<<bb<<std::endl;
381 if ( tag->hasOption(
"bondangle") ) {
382 bool const value( tag->getOption<
bool>(
"bondangle") );
385 if ( tag->hasOption(
"bondlength") ) {
386 bool const value( tag->getOption<
bool>(
"bondlength") );
401 if(!tag->hasOption(tag_name)){
405 using namespace core::pack::task;
406 using namespace core::pack::task::operation;
411 string const t_o_val( tag->getOption<
string>(tag_name) );
412 StringVec
const t_o_keys( utility::string_split( t_o_val,
',' ) );
414 foreach(
string t_o_key, t_o_keys ){
415 if ( data.
has(
"task_operations", t_o_key ) ) {
416 task_factory->push_back( data.
get<
TaskOperation * >(
"task_operations", t_o_key ) );
417 TR <<
"\t " << tag_name <<
": " << t_o_key << std::endl;
419 utility_exit_with_message(
"TaskOperation " + t_o_key +
" not found in DataMap.");
423 std::make_pair<core::id::DOF_Type, core::id::TorsionType>(
435 tag->hasOption(
"bb_task_operations") ||
436 tag->hasOption(
"chi_task_operations") ||
437 tag->hasOption(
"bondangle_task_operations") ||
438 tag->hasOption(
"bondlength_task_operations")){
440 <<
"Adding the following task operations to mover " << tag->getName() <<
" "
441 <<
"called " << tag->getOption<
std::string>(
"name",
"no_name" ) <<
":" << std::endl;
447 "bondangle_task_operations",
453 "bondlength_task_operations",
462 os <<
"Minimization type:\t" << mover.
min_type() <<
"\nScorefunction:\t\t";
466 else { os <<
"none" << std::endl; }
467 os <<
"Score tolerance:\t" << mover.
tolerance() <<
"\nNb list:\t\t" << (mover.
nb_list() ?
"True" :
"False") <<
468 "\nDeriv check:\t\t" << (mover.
deriv_check() ?
"True" :
"False") << std::endl <<
"Movemap:" << std::endl;