Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AtomICoor.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 /// @brief declaration of implementation class for abstract class Residue
12 /// @author Phil Bradley
13 
14 
15 #ifndef INCLUDED_core_chemical_AtomICoor_hh
16 #define INCLUDED_core_chemical_AtomICoor_hh
17 
18 
19 // Unit headers
21 
22 // Project headers
26 // AUTO-REMOVED #include <core/id/AtomID.hh>
27 
28 // Utility headers
29 #include <utility/exit.hh>
30 
31 #include <core/id/AtomID.fwd.hh>
32 
33 
34 // Commented by inclean daemon #include <ObjexxFCL/string.functions.hh>
35 
36 // C++ headers
37 // Commented by inclean daemon #include <string>
38 
39 
40 namespace core {
41 namespace chemical {
42 
43 /// @brief Atom 's ID in internal coordinates in a ResidueType
44 class ICoorAtomID {
45 public:
48 
49 public:
50  /// ICoordAtomID type
51  /**
52  - INTERNAL: atoms which inherently belong to this ResidueType
53  - POLYMER_LOWER: atom at the polymer lower connection, such as backbone C in
54  the previous residue (N-term side)
55  - POLYMER_UPPER: atom at the polymer upper connection, such as backbone N in
56  the next residue (C-term side)
57  - CONNECT: atoms from a non-adjacent residue which connect to this residue
58  by non-polymer connection, such as disulfide
59  */
60  enum Type {
61  INTERNAL = 1,
65  };
66 
67 
68 public:
69  /// @brief default constructor
71  type_( INTERNAL ),
72  atomno_( 0 )
73  {}
74 
75  /// @brief construct ICoorAtomID by atom name and its ResidueType
77  std::string name,
78  ResidueType const & rsd_type
79  );
80 
81 public:
82  /// @brief get ICoorAtomID atomno
83  Size
84  atomno() const
85  {
86  return atomno_;
87  }
88 
89  /// @brief set ICoorAtomID atomno
90  void
91  atomno( int const atomno_in )
92  {
93  atomno_ = atomno_in;
94  }
95 
96  /// @brief get ICoordAtomID type
97  Type const &
98  type() const
99  {
100  return type_;
101  }
102 
103  ///
104  bool
105  is_internal() const
106  {
107  return ( type_ == INTERNAL );
108  }
109 
110  ///
111  bool
113  {
114  return ( type_ == POLYMER_LOWER );
115  }
116 
117  ///
118  bool
120  {
121  return ( type_ == POLYMER_UPPER );
122  }
123 
124  ///
125  bool
126  is_connect( Size const connid ) const
127  {
128  return ( type_ == CONNECT && atomno_ == connid );
129  }
130 
131 public:
132 
133  ///
134  Vector const &
135  xyz( Residue const & rsd, Conformation const & conformation ) const;
136 
137  ///
138  Vector // const &
139  xyz( ResidueType const & rsd_type ) const;
140 
141  /// @brief WARNING: Slightly dangerous function intended for black magic use only.
142  /// Only to be used for situations where you *know* the ICoorAtomID can't be anything but
143  /// a real atom on the given residue, and where a conformation is absolutely not availible.
144  /// If you /can/ use ICoorAtomID::xyz( Residue const &, Conformation const &), you /should/.
145  Vector const &
146  xyz( conformation::Residue const & rsd ) const;
147 
148  ///
149  id::AtomID
150  atom_id( Size const seqpos, Conformation const & conformation ) const;
151 
152 
153 private:
154 
155 #ifdef USEBOOSTSERIALIZE
156  friend class boost::serialization::access;
157 
158  template<class Archive>
159  void serialize(Archive & ar, const unsigned int version) {
160  ar & type_;
161  ar & atomno_;
162  }
163 
164 #endif
165 
166  /// atom's "connection" type
168  /// atom's index number
170 };
171 
172 /// @brief A basic class containing info of internal coordinates needed for building an atom within a ResidueType
173 /**
174  In atom tree, each atom is defined by its internal coordinates, which include a bond distance,
175  a bond angle and a torsion angle. Of course, all these internal coordinates are only meaningful
176  in the context of three reference (stub) atoms. AtomICoor information is stored in the residue param
177  files and some terms are defined as following:\n
178  - bond distance d_ is that between the atom to be built (child) and stub_atom1 (parent)
179  - bond angle theta_ is that defined by child-parent-stub2(angle)
180  - torsion angle phi_ is that defined by child-parent-stub2-stub3(torsion)
181 */
182 class AtomICoor {
183 public:
184  /// @brief default constructor
186  index_(0),
187  phi_(0.0),
188  theta_(0.0),
189  d_(0.0),
190  stub_atom1_(),
191  stub_atom2_(),
192  stub_atom3_()
193  {}
194 
195  /// @brief constructor
197  Real const phi_in,
198  Real const theta_in,
199  Real const d_in,
200  std::string const & stub_atom1_name,
201  std::string const & stub_atom2_name,
202  std::string const & stub_atom3_name,
203  ResidueType const & rsd_type
204  ):
205  index_(0),
206  phi_( phi_in ),
207  theta_( theta_in ),
208  d_( d_in ),
209  stub_atom1_( stub_atom1_name, rsd_type ),
210  stub_atom2_( stub_atom2_name, rsd_type ),
211  stub_atom3_( stub_atom3_name, rsd_type )
212  {}
213 
215  Size const index,
216  Real const phi_in,
217  Real const theta_in,
218  Real const d_in,
219  std::string const & stub_atom1_name,
220  std::string const & stub_atom2_name,
221  std::string const & stub_atom3_name,
222  ResidueType const & rsd_type
223  ):
224  index_(index),
225  phi_( phi_in ),
226  theta_( theta_in ),
227  d_( d_in ),
228  stub_atom1_( stub_atom1_name, rsd_type ),
229  stub_atom2_( stub_atom2_name, rsd_type ),
230  stub_atom3_( stub_atom3_name, rsd_type )
231  {}
232 
233 public:
234  /// @brief accessor to stub_atom1 ICoorAtomID
235  Real
236  phi() const
237  {
238  return phi_;
239  }
240 
241  ///
242  Real
243  theta() const
244  {
245  return theta_;
246  }
247 
248  ///
249  Real
250  d() const
251  {
252  return d_;
253  }
254 
255  ///
256  ICoorAtomID const &
257  stub_atom1() const
258  {
259  return stub_atom1_;
260  }
261 
262  /// @brief accessor to stub_atom2 ICoorAtomID
263  ICoorAtomID const &
264  stub_atom2() const
265  {
266  return stub_atom2_;
267  }
268 
269  /// accessor to stub_atom3 ICoorAtomID
270  ICoorAtomID const &
271  stub_atom3() const
272  {
273  return stub_atom3_;
274  }
275 
276  ///
277  bool
278  is_internal() const
279  {
281  }
282 
283  ///
284  bool
286  {
288  }
289 
290  ///
291  bool
293  {
295  }
296 
297  ///
298  bool
299  depends_on_residue_connection( Size const connid ) const
300  {
301  return ( stub_atom1_.is_connect( connid ) ||
302  stub_atom2_.is_connect( connid ) ||
303  stub_atom3_.is_connect( connid ) );
304  }
305 
306  /// @brief accessor to stub_atom ICoorAtomID
307  ICoorAtomID &
308  stub_atom( int const atm )
309  {
310  switch( atm ) {
311  case 1: return stub_atom1_;
312  case 2: return stub_atom2_;
313  case 3: return stub_atom3_;
314  }
315  utility_exit_with_message( "ICoorAtomID::stub_atom should be 1--3" );
316  return stub_atom1_;
317  }
318 
319  /// @brief constant accessor to stub_atom ICoorAtomID
320  ICoorAtomID const &
321  stub_atom( int const atm ) const
322  {
323  switch( atm ) {
324  case 1: return stub_atom1_;
325  case 2: return stub_atom2_;
326  case 3: return stub_atom3_;
327  }
328  utility_exit_with_message( "ICoorAtomID::stub_atom should be 1--3" );
329  return stub_atom1_;
330  }
331 
333  {
334  index_ = index;
335  }
336 
338  {
339  return index_;
340  }
341 
342 public:
343 
344  Vector
345  build(
346  conformation::Residue const & rsd,
347  conformation::Conformation const & conformation
348  ) const;
349 
350  Vector
351  build(
352  ResidueType const & rsd_type
353  ) const;
354 
355  /// @brief WARNING: Slightly dangerous function intended for black magic use only.
356  /// Only to be used for situations where you *know* the Atom /and all it's stub atoms/ can't be
357  /// anything but real atoms on the given residue, and where a conformation is absolutely not availible.
358  /// If you /can/ use AtomICoor::build( Residue const &, Conformation const &), you /should/.
359  Vector
360  build( conformation::Residue const & rsd ) const;
361 
362 private:
363 
364 
365 #ifdef USEBOOSTSERIALIZE
366  friend class boost::serialization::access;
367 
368  template<class Archive>
369  void serialize(Archive & ar, const unsigned int version) {
370  ar & index_;
371  ar & phi_;
372  ar & theta_;
373  ar & d_;
374  ar & stub_atom1_;
375  ar & stub_atom2_;
376  ar & stub_atom3_;
377  }
378 #endif
379 
380 
388 };
389 
390 } // chemical
391 } // core
392 
393 
394 
395 #endif