Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Chunk.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 protocols/nonlocal/Chunk.hh
11 /// @author Christopher Miles (cmiles@uw.edu)
12 
13 #ifndef INCLUDED_PROTOCOLS_NONLOCAL_CHUNK_HH
14 #define INCLUDED_PROTOCOLS_NONLOCAL_CHUNK_HH
15 
16 // Unit headers
18 
19 // External headers
20 #include <boost/scoped_ptr.hpp>
21 #include <boost/math/distributions/normal.hpp>
22 
23 // Package headers
25 
26 // Project headers
27 #include <core/types.hh>
29 
30 // Utility headers
31 #include <numeric/random/DistributionSampler.hh>
32 #include <utility/pointer/ReferenceCount.hh>
33 
34 namespace protocols {
35 namespace nonlocal {
36 
37 /// @class An object that contains the start/stop points of a continuous
38 /// region of sequence and knowledge of how to sample insertion positions
39 /// from it according to an underlying distribution. Certain residues within
40 /// the region may not be movable. Current behavior mimics but improves upon
41 /// existing end-biased selection.
43  typedef boost::math::normal Normal;
44  typedef core::Size Size;
46 
47  public:
48  // -- Construction and Assignment -- //
49 
50  /// @brief Default constructor
51  /// <region> describes the contiguous stretch of residues.
52  /// <movable> describes the modifiable degrees of freedom in the system.
53  Chunk(const RegionOP& region, const MoveMapOP& movable);
54 
55  /// @brief Copy constructor
56  Chunk(const Chunk& other);
57 
58  /// @brief Destructor
59  virtual ~Chunk() ; // auto-removing definition from header{}
60 
61  /// @brief Assignment operator
62  Chunk& operator=(const Chunk& other);
63 
64  // -- Accessors -- //
65 
66  /// @brief Chooses an allowable insertion position on [start, stop] according
67  /// to the probability distribution
68  Size choose() const;
69 
70  /// @brief Lower boundary of this chunk
71  Size start() const;
72 
73  /// @brief Upper boundary of this chunk
74  Size stop() const;
75 
76  /// @brief Returns the length of this region
77  Size length() const;
78 
79  /// @brief Returns true if at least one position on [start(), stop()] is movable
80  bool is_movable() const;
81 
82  /// @brief Returns true if there is at least one valid insertion position in
83  /// the closed region [start(), stop()], false otherwise.
84  bool valid() const;
85 
86  private:
89  boost::scoped_ptr<numeric::random::DistributionSampler<Normal> > sampler_;
90 };
91 
92 } // namespace nonlocal
93 } // namespace protocols
94 
95 #endif // PROTOCOLS_NONLOCAL_CHUNK_HH_