Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ConstraintSetMover.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 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 /// @file
11 /// @brief Assigns a ConstraintSet to a pose. Reads and creats ConstraintSet from file via command line option -constraints::cst_file, unless a ConstraintSet is supplied via the constructor or the constraint_set() method.
12 /// @author ashworth
13 
16 
17 // AUTO-REMOVED #include <protocols/moves/DataMap.hh>
18 
19 #include <core/pose/Pose.hh>
22 #include <utility/tag/Tag.hh>
23 
24 #include <basic/options/option.hh>
25 #include <basic/options/keys/constraints.OptionKeys.gen.hh>
26 
27 //Auto Headers
28 
29 #include <utility/vector0.hh>
30 #include <utility/vector1.hh>
31 #include <basic/Tracer.hh>
32 
33 static basic::Tracer TR( "protocols.simple_moves.ConstraintSetMover" );
34 
35 namespace protocols {
36 namespace simple_moves {
37 
38 using namespace core;
39  using namespace basic::options;
40  using namespace scoring;
41  using namespace constraints;
42 
43 using namespace utility::tag;
44 
47 {
49 }
50 
53  return new ConstraintSetMover;
54 }
55 
58 {
59  return "ConstraintSetMover";
60 }
61 
63  : protocols::moves::Mover( ConstraintSetMoverCreator::mover_name() )
64 {
65  read_options();
66 }
67 
69 
71  : protocols::moves::Mover(type)
72 {
73  read_options();
74 }
75 
76 void
78 {
79  if ( option[ OptionKeys::constraints::cst_file ].user() )
80  cst_file_ = option[ OptionKeys::constraints::cst_file ]().front();
81  if ( option[ OptionKeys::constraints::cst_fa_file ].user() )
82  cst_fa_file_ = option[ OptionKeys::constraints::cst_fa_file ]().front();
84 }
85 
86 void
88 {
89  constraint_set_low_res_ = new ConstraintSet( *cst_set );
90  constraint_set_high_res_ = new ConstraintSet( *cst_set );
91 }
92 
93 void
95 {
96  cst_file_ = cst_file;
97  cst_fa_file_ = cst_file;
98 }
99 
100 
103 
104 void
106 {
107  if ( !constraint_set_low_res_ && !pose.is_fullatom() ) {
108  // uninitialized filename not tolerated, in order to avoid potential confusion
109  if ( cst_file_.empty() ) utility_exit_with_message("Can\'t read constraints from empty file!");
110  // special case: set cst_file_ to "none" to effectively remove constraints from Pose
111  else if ( cst_file_ == "none" ) constraint_set_low_res_ = new ConstraintSet;
112  else {
115  //ConstraintIO::get_instance()->read_constraints_new( cst_file_, new ConstraintSet, pose );
116  }
117  }
118 
119  if ( !constraint_set_high_res_ && pose.is_fullatom() ) {
120  // uninitialized filename not tolerated, in order to avoid potential confusion
121  if ( cst_fa_file_.empty() ) utility_exit_with_message("Can\'t read constraints from empty file!");
122  // special case: set cst_file_ to "none" to effectively remove constraints from Pose
123  else if ( cst_fa_file_ == "none" ) constraint_set_high_res_ = new ConstraintSet;
124  else {
127  //ConstraintIO::get_instance()->read_constraints_new( cst_fa_file_, new ConstraintSet, pose );
128  }
129  }
130 
131  if ( pose.is_fullatom() ) {
133  } else {
135  }
136 }
137 
141 }
142 
145 
146 void
148  TagPtr const tag,
150  Filters_map const &,
152  Pose const &
153 )
154 {
155  if ( tag->hasOption("cst_file") ) cst_file_ = tag->getOption<std::string>("cst_file");
156  if ( tag->hasOption("cst_fa_file") ) cst_fa_file_ = tag->getOption<std::string>("cst_fa_file");
157  else cst_fa_file_=cst_file_;
158  TR << "of type ConstraintSetMover with constraint file: "<< cst_file_ <<std::endl;
159  if ( cst_fa_file_ != cst_file_ ) {
160  TR << "of type ConstraintSetMover with fullatom constraint file: "<< cst_fa_file_ <<std::endl;
161  }
162 }
163 void ConstraintSetMover::parse_def( utility::lua::LuaObject const & def,
164  utility::lua::LuaObject const & /*score_fxns*/,
165  utility::lua::LuaObject const & /*tasks*/,
166  protocols::moves::MoverCacheSP /*cache*/ ) {
167  if ( def["cst_file"] ) cst_file_ = def["cst_file"].to<std::string>();
168  if ( def["cst_fa_file"] ) cst_fa_file_ = def["cst_fa_file"].to<std::string>();
169  else cst_fa_file_=cst_file_;
170  TR << "of type ConstraintSetMover with constraint file: "<< cst_file_ <<std::endl;
171  if ( cst_fa_file_ != cst_file_ ) {
172  TR << "of type ConstraintSetMover with fullatom constraint file: "<< cst_fa_file_ <<std::endl;
173  }
174 }
175 } // moves
176 } // protocols