Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CartSCMinMinimizerMap.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/pack/scmin/CartSCMinMinimizerMap.hh
11 /// @brief Class for identifying the sidechain DOFs in the AtomTree which are free during
12 /// any particular call to the minimizer.
13 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com)
14 
15 #ifndef INCLUDED_core_pack_scmin_CartSCMinMinimizerMap_hh
16 #define INCLUDED_core_pack_scmin_CartSCMinMinimizerMap_hh
17 
18 // Unit headers
23 
24 // Package Headers
26 
27 // Project Headers
28 #include <core/types.hh>
30 #include <core/id/AtomID_Map.hh>
31 #include <core/id/DOF_ID.hh>
37 
38 // Utility headers
39 #include <utility/vector1.hh>
40 #include <utility/pointer/ReferenceCount.hh>
41 
42 #include <core/id/DOF_ID_Map.hh>
44 #include <core/id/TorsionID.fwd.hh>
45 #include <ObjexxFCL/FArray1D.hh>
46 
47 
48 namespace core {
49 namespace pack {
50 namespace scmin {
51 
52 /// @brief
54 {
55 public:
58 
59 public:
61  virtual ~CartSCMinMinimizerMap();
62 
63  /// @brief the CartSCMinMinimizerMap has to know how many residues are in the pose; this allows
64  /// it to do O(1) updates to its DomainMap -- this function costs O(N).
65  virtual
66  void set_total_residue( Size total_residue );
67 
68  /// @brief Disable the minimization for all residues. Ammortized O(1).
69  virtual
70  void clear_active_dofs();
71 
72  /// @brief Activate all the dofs for a particular residue. Ammortized O(1).
73  virtual
74  void activate_residue_dofs( Size resindex );
75 
76  /// @brief Invoked during the depth-first traversal through the AtomTree. The AtomTree
77  /// is indicating that a particular torsion is dependent on another torsion. Record
78  /// that fact.
79  virtual
80  void
82  DOF_ID const & new_torsion,
83  DOF_ID const & parent
84  );
85 
86  /// @brief Invoked during the depth-first traversal through the AtomTree; the atom
87  /// tree is indicating that a given atom is controlled by a particular DOF. Record
88  /// that fact.
89  virtual
90  void
91  add_atom(
92  AtomID const & atom_id,
93  DOF_ID const & dof_id
94  );
95 
96  /// @brief Traverse the atom trees in preparation for minimization to tie together all the
97  /// DOFs and the atoms they control.
98  void
99  setup( AtomTreeCollectionOP trees );
100 
101 public:
102 
103  /// Accessors
105  Size active_residue( Size index ) const { assert( index <= nactive_residues_ ); return active_residues_[ index ]; }
106 
107  /// @brief MinimizerMapBase class virtual accessor
108  virtual kinematics::DomainMap const & domain_map() const { return domain_map_; }
109 
110  /// @brief Inline accessor
111  inline kinematics::DomainMap const & dm() const { return domain_map_; }
112 
114 
115  /// @brief Initialize a multivec with the dofs reflected in the current residue(s)
116  void starting_dofs( optimization::Multivec & dofs ) const;
117 
118  /// @brief Assign the chi values to the residue(s)
120 
122  dof_node( Size index );
123 
124  virtual
125  conformation::Residue const &
126  residue( Size seqpos ) const;
127 
128  optimization::DOF_Node const &
129  dof_node_for_chi( Size resid, Size chiid ) const;
130 
132  tor_for_dof( id::DOF_ID const & dofid ) const;
133 
134  kinematics::tree::Atom const &
135  atom( AtomID const & atid ) const;
136 
138 
139  /// @brief propagate f1/f2's up from children to parents
140  void link_torsion_vectors();
141 
142  void set_natoms_for_residue( Size resid, Size natoms );
143 
144  Size get_atom_index( id::AtomID const & atm ) {
145  assert (atm.rsd()>0 && atm.rsd()<=atoms_to_dofid_.size());
146  assert (atm.atomno()>0 && atm.atomno()<=atoms_to_dofid_[atm.rsd()].size());
147  return atoms_to_dofid_[atm.rsd()][atm.atomno()];
148  }
149 
150  id::AtomID const & get_atom( Size idx ) {
151  assert (idx>0 && idx<dofid_to_atoms_.size());
152  return dofid_to_atoms_[idx];
153  }
154 
157  pose::Pose & p,
159  scoring::ScoreFunction const & sfxn,
160  scoring::MinimizationGraph & mingraph)
161  {
162  optimization::MultifuncOP retval( new CartSCMinMultifunc(p,bg_residues,sfxn,mingraph,*this) );
163  return retval;
164  }
165 
166 
167 protected:
168  void reset_dof_nodes();
169 
170 private:
171  // cartesian dofs (split per-residue)
175 
176  // map atomIDs <-> dof indices
179 
180  // temporary storage for converting coords <-> multivec
182 
183  // even though we don't need _all_ of this data, use the same datatypes as atomtree variant
186 
188 };
189 
191 
192 
193 } // namespace scmin
194 } // namespace pack
195 } // namespace core
196 
197 #endif