Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
KinematicMover.hh
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 // :noTabs=false:tabSize=4:indentSize=4:
4 //
5 // (c) Copyright Rosetta Commons Member Institutions.
6 // (c) This file is part of the Rosetta software suite and is made available under license.
7 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
8 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
9 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
10 
11 
12 /// @brief kinematic closure move
13 /// @author Daniel J. Mandell (dmandell@itsa.ucsf.edu)
14 /// @date Tues Jan 08 12:08:31 2008
15 /// @author Amelie Stein (amelie.stein@ucsf.edu), Oct 2012 -- next-generation KIC
16 
17 
18 #ifndef INCLUDED_protocols_loops_loop_closure_kinematic_closure_KinematicMover_HH
19 #define INCLUDED_protocols_loops_loop_closure_kinematic_closure_KinematicMover_HH
20 
21 // Unit Headers
24 
25 // Package Headers
26 #include <protocols/moves/Mover.hh>
27 // AUTO-REMOVED #include <core/kinematics/MoveMap.hh>
28 // AUTO-REMOVED #include <core/scoring/ScoreFunction.hh>
30 
31 // Utility headers
32 #include <utility/LexicographicalIterator.hh>
33 
35 #include <utility/vector1.hh>
36 #include <core/chemical/AA.hh>
37 
38 
39 namespace protocols {
40 namespace loops {
41 namespace loop_closure {
42 namespace kinematic_closure {
43 
44 ///@brief A mover class for performing kinematic loop closure on a peptide segment
45 ///@detail
46 ///////////////////////////////////////////////////////////////////////////////
47 class KinematicMover : public moves::Mover {
48 
49 public:
50 
53 
54  virtual std::string get_name() const;
55 
56  void set_vary_bondangles( bool vary );
57  bool get_vary_bondangles();
58  void set_sample_nonpivot_torsions( bool sample );
60 
61  Size start_res() const {
62  return start_res_; }
63 
64  Size middle_res() const {
65  return middle_res_; }
66 
67  Size end_res() const {
68  return end_res_; }
69 
70  Size segment_length() const {
71  return seg_len_; }
72 
73  Size loop_begin() const {
74  return loop_begin_; }
75 
76  Size loop_end() const {
77  return loop_end_; }
78 
80  return BANGLE_MIN_; }
81 
83  return BANGLE_SD_; }
84 
85  void set_sweep_nonpivot_torsions( bool sweep );
88  void set_sweep_start_angle( utility::vector1< core::Real > const & angles_in_degrees );
89  void set_sweep_step_size( utility::vector1< core::Real > const & angle_steps_in_degrees );
90  void set_sweep_nsteps( utility::vector1< Size > const & nsteps );
91  /// @details returns true as long as the Lexicographical iterator has not covered all
92  /// angles -- useful in a while-loop.
93  bool sweep_incomplete() const;
94 
96  filters_ = filters_in; }
97 
99  filters_.push_back( filter ); }
100 
101  void clear_filters() {
102  filters_.clear(); }
103 
104  virtual void set_rama_check ( bool do_rama_check );
105  virtual bool get_rama_check ();
106  virtual void set_hardsphere_bump_check( bool do_bump_check );
107  virtual void set_do_sfxn_eval_every_iteration( bool do_sfxn_eval );
108  virtual bool get_hardsphere_bump_check();
109  virtual void set_pivots( Size start_res, Size middle_res, Size end_res );
110  virtual void apply( core::pose::Pose & );
111  virtual void set_idealize_loop_first( bool idealize );
112  virtual bool get_idealize_loop_first();
113  void set_temperature(core::Real temp_in);
116  bool check_rama(core::Real old_rama_score, core::Real new_rama_score);
117  bool last_move_succeeded();
118  void set_perturber( KinematicPerturberOP perturber_in );
120  {
121  return bump_overlap_factor_;
122  }
123  void set_bump_overlap_factor(core::Real bump_overlap_factor)
124  {
125  bump_overlap_factor_=bump_overlap_factor;
126  }
127 
128  // AS: for TabooSampling
129  void update_sequence( utility::vector1< core::chemical::AA > const & sequence ); // required for design and/or modeling multiple loops
130  //void refill_torsion_string_vector();
131  void insert_sampled_torsion_string_into_taboo_map( std::string const & ts ); // not sure if all of these should be public...
132  //std::string next_torsion_string();
133  bool is_in_taboo_map( std::string const & ts ) const;
136  core::Real frequency_in_taboo_map( core::Size const & pos, char const & torsion_bin ) const;
137 
138 
139 private:
140 
141  // pivot residues
144 
145  Size loop_begin_; // AS: start of the full loop, only needs to be set once, required for correct indexing of the torsion bin vector -- in contrast, start_res_-end_res_ cover the (sub)segment that's actually sampled in the current iteration
147 
148  //the perturber that sets/samples the chain angles/torsions
150 
151  // idealization
152  core::Real idl_C_N_CA_; // ideal C_N_CA bond angle from Rosetta for idealized kinematic closure
153  core::Real idl_N_CA_C_; // ideal N_CA_C bond angle from Rosetta for idealized kinematic closure
154  core::Real idl_CA_C_N_; // ideal CA_C_N bond angle from Rosetta for idealized kinematic closure
155  core::Real idl_C_N_; // ideal C_N bond length from Rosetta for idealized kinematic closure
156  core::Real idl_N_CA_; // ideal N_CA bond length from Rosetta for idealized kinematic closure
157  core::Real idl_CA_C_; // ideal CA_C bond length from Rosetta for idealized kinematic closure
158 
159  // bond angle sampling
160  core::Real BANGLE_MEAN_; // mean N-CA-C bond angle value from PDB
161  core::Real BANGLE_SD_; // N-CA-C bond angle standard deviation from PDB
162  core::Real BANGLE_MIN_; // min allowed N-CA-C bond angle sampled (otherwise softly enforced by normal distribution)
163  core::Real BANGLE_MAX_; // max allowed N-CA-C bond angle sampled (otherwise softly enforced by normal distribution)
164 
165  // omega angle sampling
166  core::Real OMEGA_MEAN_; // mean omega torsion from loop set
167  core::Real OMEGA_SCALE_FACTOR_; // chosen to reproduce observed double-exponential distribution in pdb loops
168 
169  core::Real MAX_SAMPLE_ITS_; // maximum number of iterations in torsion / bond angle sampling loop
170  bool vary_bond_angles_; // should we vary bond angles
171  bool sample_nonpivot_torsions_; // should we sample non-pivot torsions (restricted to Ramachandran space)
172 
173  bool sweep_nonpivot_torsion_; // APL: sweep through non-pivot torsions.
178  utility::LexicographicalIterator sweep_iterator_;
179 
180  bool idealize_loop_first_; // should we start with an idealized loop
181  bool do_rama_check_; // should we do a rama check before accepting loop closure solutions
182  // enables use of soft bumps
183  bool do_hardsphere_bump_check_; //hard sphere bump check before accepting
186  bool last_move_succeeded_; // did the last move succeed
187  core::Real temperature_; // current tempature of the system
188  core::Real bump_overlap_factor_; // reduce sum-squared-distance threshold by this factor in bump check
189 
190  //filters that are to be applied to every solution before it gets accepted
192 
193  // AS: for Taboo Sampling
194  std::map< std::string, bool > taboo_map_; // holds the torsion strings that have already been sampled [with a solution, no matter whether it was accepted or not], to avoid testing them again [until we've almost reached coverage of the torsion-bin space, then it is re-set] -- actually we could use a set instead...
196  std::map< utility::vector1< core::chemical::AA >, std::map< std::string, bool > > taboo_master_map_; // holds the taboo maps for different sequences, so that we don't loose all information (previously sampled angles) when switching between multiple loops)
197  utility::vector1< core::chemical::AA > sequence_; // sequence of the loop -- note that for the TabooSamplingKinematicPerturber this has to be adjusted after each design step, and then random_torsion_strings_ must be emptied and re-filled, as the torsion bins are residue-dependent
198 
199 
200 
201  // private functions
202 
203  /* AS Oct 03, 2012 -- commenting out unused function for vicinity refactoring
204  bool pivots_within_vicinity(
205  core::pose::Pose const & pose,
206  utility::vector1<core::Real> const & t_ang,
207  utility::vector1<Size> const & pivots,
208  Size const start_res,
209  Size const middle_res,
210  Size const end_res
211  );
212  */
213 
214  // this version checks rama for all residues in loop segment
215  bool perform_rama_check( core::pose::Pose const & pose,
216  utility::vector1<core::Real> const & t_ang,
217  utility::vector1<Size> const & pivots,
218  Size const start_res,
219  Size const seg_len
220  );
221 
222  // this version only checks rama for pivot residues
223  bool perform_rama_check( core::pose::Pose const & pose,
224  utility::vector1<core::Real> const & t_ang,
225  utility::vector1<Size> const & pivots,
226  Size const start_res,
227  Size const middle_res,
228  Size const end_res
229  );
230  // checks for backbone-backbone clashes for loop residues
231  bool perform_bump_check ( core::pose::Pose const & pose,
232  Size const start_res,
233  Size const end_res
234  );
235  // sets default options
236  void set_defaults();
237 
238 };
239 
240 } // namespace kinematic_closure
241 } // namespace loop_closure
242 } // namespace loops
243 } // namespace protocols
244 
245 #endif