Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Translator.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
11 /// @author Oliver Lange
12 
13 #ifndef INCLUDED_core_coarse_Translator_hh
14 #define INCLUDED_core_coarse_Translator_hh
15 
16 // Unit headers
18 // you cannot #include yourself #include <core/coarse/Translator.hh>
19 
20 // Coarse headers
21 #include <core/coarse/Rules.hh>
22 
23 // Project headers
24 //#include <core/chemical/ResidueTypeSet.hh>
25 //#include <core/chemical/ResidueTypeSet.fwd.hh>
26 //#include <core/chemical/AtomTypeSet.hh>
27 //#include <core/chemical/MMAtomTypeSet.fwd.hh>
28 #include <core/chemical/AA.hh>
29 
30 // AUTO-REMOVED #include <core/conformation/Residue.hh>
31 // AUTO-REMOVED #include <core/pose/Pose.fwd.hh>
33 #ifdef WIN32
35 #endif
37 
38 // Utility headers
39 // AUTO-REMOVED #include <utility/vector1.hh>
40 #include <utility/pointer/access_ptr.hh>
41 #include <utility/pointer/owning_ptr.hh>
42 #include <utility/pointer/ReferenceCount.hh>
43 
44 
45 
46 // std headers
47 #include <ostream>
48 #include <string>
49 
50 //Auto Headers
53 
54 
55 
56 /* TODO:
57 
58 make atoms in beads weighted
59 then a true centroid representation wouldn't need any change of the programming but just different rules
60 w=1 for CB and w=0 for all others
61 but all sidechain atoms in B1
62 
63 */
64 
65 namespace core {
66 namespace coarse {
67 
69  /* The responsibility of this class is to provide a
70  map of atom-names between fine and coarse representations
71  for instance, bead1 contains fa_atoms { CB , HB1, HB2, HB3 etc}
72  FULL_ATOM contains fa_atoms{H CA O N}
73 
74  organization:
75  beads[0] is AtomList of fa_atoms
76  beads[1..n] contains AtomLists for beads.
77  corresponding bead names are bead_names_[1..n]
78  (bead_names_[0] == "FULL_ATOM" )
79  */
80 
81 public:
82 
83  //little helper struct. A BeadAtom is contained in the AtomList which describes
84  // the ingredients of a bead. The name_ refers to the atom name in the fine-grain residue
85  // the field weight_ controls how much the respective xyz coords, contribute to the bead-center
86  struct BeadAtom {
87  BeadAtom( std::string name ) : name_(name), weight_(1.0) {};
88  BeadAtom( std::string name, Real weight ) : name_(name), weight_(weight) {};
89  bool operator == ( BeadAtom const &other ) const { return other.name_==name_; };
92  };
93 
94  //
95  typedef std::vector<BeadAtom> AtomList;
96  typedef std::vector<AtomList> BeadList;
97  typedef std::vector<std::string> BeadNames;
98 
99 public:
100 
101  /// @brief constructor
102  Translator( RuleSet const &rules,
103  chemical::ResidueTypeCOP fine_res,
104  chemical::ResidueTypeAP coarse_res
105  );
106 
107 private:
108  /// @brief private copy and assigment
109  /// a translator is intimately connected to its coarse_res_type,
110  /// (coarse_res_type points to its translator object and vice versa... better not to copy such things
111  Translator( const Translator& t ) : ReferenceCount(t) {} ;
112  Translator & operator= ( const Translator& ) { return *this; };
113 
114 public:
115 
116  //
117  void pretty_print( std::ostream &os ) const;
118 
119  /// @brief returns bead index for 'atom' in the fine-grained residue, e.g. 1 for CB, HB1, HB2, ...
120  int map_atom_to_bead( std::string const atom ) const;
121 
122  /// @brief number of chi-angles in coarse residue
123  int coarse_nchi() const;
124 
125  /// @brief residue_type ID (they are the same for coarse and fine, return either)
126  std::string const &name() const;
127 
128  /// @brief return a coarse residue with coordinates computed from the fine residue
130 
131 
132  /// @brief return a DunbrackRotamerLibrary, Rotamer's and their statistics are computed from the fine residues
133  // DunbrackLibrary by calling coarsify (see below) (not inlined, to avoid circular includes)
135 
136  /// @brief compute a coarse DunbrackLibrary from a fine RotamerLibrary (not inlined, to avoid circular includes)
138  coarsify(
140  ) const;
141 
142 protected:
143 
144  //helper routines for construction of Translator
145 
146  /// @brief add BeadAtom to AtomList
147  void add_atom(AtomList &list, const chemical::ResidueType &res, Rule::AtomToken const &atom);
148  void add_atom(AtomList &list, const chemical::ResidueType &res, int pos);
149 
150  /// @brief add all non-assigned sidechain atoms to AtomList
152 
153  /// @brief add all non-assigned atoms to AtomList
154  void add_all_remaining(AtomList &list, const chemical::ResidueType &res);
155 
156  /// @brief the PARAM files contain random geometries. fix them by coarsifying the fine-grained geometries
157  /// automatically -- called by constructor
158  void fix_coarsetype_geometry(chemical::ResidueTypeAP coarse_res_type);
159 
160 private:
161  /// @brief Pointers to the connected Residue Sets... CHECK these should probably be access pointers CHECK
164 
165  /// @brief list of beads, a bead is a AtomList --- which atoms of fine_rsd belong to bead of coarse_rsd
167 
168  /// @brief store atom and bead names of the coarse-grained residue,
169  /// first bead is FULL_ATOM and contains the names of all atoms that remain in full.
171 
172 };
173 
174 
175 } //namespace coarse
176 } // namespace core
177 
178 #endif