Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JumpAtom.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 //
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 core/kinematics/tree/JumpAtom.hh
11 /// @brief Jump atom
12 /// @author Phil Bradley
13 
14 
15 #ifndef INCLUDED_core_kinematics_tree_JumpAtom_hh
16 #define INCLUDED_core_kinematics_tree_JumpAtom_hh
17 
18 
19 // Package headers
20 #include <core/kinematics/Jump.hh>
23 
24 // Project headers
25 // AUTO-REMOVED #include <core/id/AtomID_Map.hh>
27 
28 // Numeric headers
29 #include <numeric/xyzMatrix.fwd.hh>
30 #include <numeric/xyzVector.fwd.hh>
31 
32 // C++ headers
33 #include <algorithm>
34 
35 #include <utility/vector1.hh>
36 
37 
38 
39 namespace core {
40 namespace kinematics {
41 namespace tree {
42 
43 /// @brief an atom who are connected to its parent via rigid-body transformation "Jump"
44 ///
45 /// See @ref atomtree_overview "AtomTree overview and concepts" for details.
46 ///
47 class JumpAtom : public Atom_
48 {
49 
50 
51 private: // Types
52 
53 
54  typedef Atom_ Super;
55 
56 
57 public:
58 
59  /// @brief Perform a depth-first traversal of the tree that would be effected by
60  /// a DOF change from this atom. Stop at atoms that have already been traversed.
61  virtual
62  void
63  dfs(
64  AtomDOFChangeSet & changeset,
65  ResidueCoordinateChangeList & res_change_list,
66  Size const start_atom_index
67  ) const;
68 
69  ///////////////////////////////////////////////////////////////////////////
70  // go back and forth between DOFs and coords
71 
72  /// @brief The atom must retrieve an appropriate stub from its parent; it is the root
73  /// of the subtree being refolded. Valid only if this atom is the maximal root of a subtree
74  /// requiring coordinate updates -- if any ancestor of this atom requires a coordinate update,
75  /// then the Stub this atom generates for itself will be invalid.
76  virtual
77  void
79 
80  /// @brief update this atom's xyz position
81  virtual
82  void
84  Stub & stub
85  );
86 
88 
89  /// update the jump info
90  virtual
91  void
93  Stub & stub,
94  bool const recursive = true
95  );
96 
97 
98  ///////////////////////////////////////////////////////////////////////////
99  // access DOFs
100 
101  /// @brief set a degree of freedom for jump
102  virtual
103  void
104  set_dof(
105  DOF_Type const type,
106  Real const value
107  );
108 
109  /// @brief set degrees of freedom (internal coordinates). For use in
110  /// output-sensitive refold subroutine.
111  virtual
112  void
113  set_dof(
114  DOF_Type const type,
115  core::Real const value,
116  AtomDOFChangeSet & changeset
117  );
118 
119 
120  /// @brief get a degree of freedom from jump
121  virtual
122  Real
123  dof(
124  DOF_Type const type
125  ) const;
126 
127  /// @brief access the jump
128  virtual
129  Jump const &
130  jump() const;
131 
132  /// @brief set the jump
133  virtual
134  void
135  jump( Jump const & jump_in );
136 
137 
138  /// @brief set the jump. For use with output-sensitive refold subroutine.
139  virtual
140  void
141  jump( Jump const & jump_in, AtomDOFChangeSet & changeset );
142 
143 
144  /// @brief copy this atom
145  virtual
146  AtomOP
147  clone( AtomAP parent_in, AtomPointer2D & atom_pointer ) const;
148 
149 
150  ///////////////////////////////////////////////////////////////////////////
151  ///@brief for minimizing, add DOF(RB) for a JumpAtom into the MinimizerMap
152  virtual
153  void
155  DOF_ID & last_torsion,
156  DOF_ID_Mask const & allow_move,
157  MinimizerMapBase & min_map
158  ) const;
159 
160  ///@brief get rotation axis and end_pos for a JumpAtom.
161  virtual
162  void
164  Vector & axis,
165  Position & end_pos,
166  DOF_Type const type
167  ) const;
168 
169 
170  ///////////////////////////////////////////////////////////////////////////
171  // miscellaneous inspection
172 
173  /// @brief a jump atom is a jump? of course yes!!!
174  inline
175  virtual
176  bool
177  is_jump() const { return true; }
178 
179  ///\brief when other atoms are inserted insert after 1st child if available.
180  /// --> this enables us to keep a stub of Downstream Jump atoms inside a single residue
181  virtual
182  bool
183  keep_1st_child_pos() const { return false; }
184 
185  /// whether a jump should be fixed in some special cases
186  virtual
187  bool
189  DOF_Type const type
190  ) const;
191 
192 
193  ///////////////////////////////////////////////////////////////////////////
194 
195  /// @brief copy DOFs, xyz's
196  virtual
197  void
198  copy_coords( Atom const & src );
199 
200 
201 
202  //protected:
203 
204  ///////////////////////////////////////////////////////////////////////////
205  ///////////////////////////////////////////////////////////////////////////
206  // protected methods
207  ///////////////////////////////////////////////////////////////////////////
208  ///////////////////////////////////////////////////////////////////////////
209 
210  // useful helper function for manipulating stubs
211  ///@brief update the stub without actually updating coordinates
212  /** since for a jump atom, update internal coords or xyz dont change input
213  jump, so we do not do anything here*/
214  inline
215  virtual
216  void
218  Stub & //stub
219  ) const
220  {} // stub doesnt change
221 
222 
223 public: // Properties
224 
225 
226  /////////////////////////////////////////////////////////////////////////////
227  /// @brief stub_atom1 of a jump-atom
228  /** it is itself if a stub can be defined for it. Otherwise it is parent*/
229  inline
230  AtomCOP
231  stub_atom1() const
232  {
233  return ( stub_defined() ? this : parent() );
234  }
235 
236 
237  /////////////////////////////////////////////////////////////////////////////
238  /// @brief stub_atom2 of a jump-atom
239  /** it is its first bonded child if a stub can be defined for it. Otherwise
240  it is parent's stub_atom2. */
241  inline
242  AtomCOP
243  stub_atom2() const
244  {
245  if ( stub_defined() ) {
246  return get_nonjump_atom(0);
247  } else {
248  return parent()->stub_atom2();
249  }
250  }
251  /////////////////////////////////////////////////////////////////////////////
252  /// @brief stub_atom3 of a jump atom
253  /** it is its child's child or its second child if a stub can be defined for it,
254  otherwise it is its parent's stub_atom3 */
255  inline
256  AtomCOP
257  stub_atom3() const
258  {
259  //std::cout << "stub_atom3: " << this << ' ' << parent_ << std::endl();
260  if ( stub_defined() ) {
261  AtomCOP first( get_nonjump_atom(0) );
262  AtomCOP second( first->get_nonjump_atom(0) );
263  if ( second != 0 ) {
264  return second;
265  } else {
266  return get_nonjump_atom(1);
267  }
268  } else {
269  return parent()->stub_atom3();
270  }
271  }
272 
273 
274 private: // Fields
275 
276 
277  ///////////////////////////////////////////////////////////////////////////
278  ///////////////////////////////////////////////////////////////////////////
279  // data
280  ///////////////////////////////////////////////////////////////////////////
281  ///////////////////////////////////////////////////////////////////////////
282 
283  /// @brief Jump
284  /**
285  A jump atom is connected to its parent via rigid-body transformation("jump").
286  It requires two stubs to define a jump, one is the parent atoms's stub and
287  the other is the stub centered at this jump atom, which requires at least
288  three atoms on the jump atom's side (including itself). For example, a stub
289  is defined from B-A-C or A-B-C (A is the jump atom, B and C are its offspring).
290  If less than 3 atoms on the jump atom's side, i.e., stub_defined() == False,
291  this atom will just use its parent stub.
292  */
294 
295 
296 }; // JumpAtom
297 
302 
303 } // namespace tree
304 } // namespace kinematics
305 } // namespace core
306 
307 
308 #endif // INCLUDED_core_kinematics_JumpAtom_HH