Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FoldResonance.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 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
4 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
5 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
6 
7 /// @file CrossPeakList.hh
8 /// @author Oliver Lange
9 
10 #ifndef INCLUDED_protocols_noesy_assign_FoldResonance_hh
11 #define INCLUDED_protocols_noesy_assign_FoldResonance_hh
12 
13 
14 // Unit Headers
15 //#include <protocols/noesy_assign/FoldResonance.fwd.hh>
16 
17 // Package Headers
18 
19 // Project Headers
20 #include <core/types.hh>
21 
22 // Utility headers
23 #include <assert.h>
24 
25 // C++ headers
26 #include <string>
27 #include <cmath>
28 #include <iostream>
29 
30 namespace protocols {
31 namespace noesy_assign {
32 
34 public:
35  FoldResonance() : start_( 0 ), window_( 0 ) {}
36 
38  start_ = start;
39  window_ = end-start;
40  }
41 
42  bool is_folded_down( core::Real freq ) const {
43  return window_ > 0.1 && freq < start();
44  }
45 
46  bool is_folded_up( core::Real freq ) const {
47  return window_ > 0.1 && freq > end();
48  }
49 
50  bool is_folded( core::Real freq ) const {
51  return is_folded_down(freq) || is_folded_up( freq );
52  }
53 
54  core::Real start() const { return start_; }
55  core::Real end() const { return start_+window_; }
56 
58  if ( !is_folded( freq ) ) return freq;
59  //e return std::fmod( freq-start_, window_ ) + start_; //modulus does not necessarily work right with negative values
60  while( is_folded_down( freq ) ) { freq+=window_; }
61  while( is_folded_up( freq ) ) { freq-=window_; }
62  assert( !is_folded( freq ) );
63  return freq;
64  }
65 
66  bool is_folded() const {
67  return window_ > 0; //< BOGUS_SW-1;
68  }
69 
70  void show( std::ostream& os ) const {
71  if ( is_folded() ) {
72  os << "FOLDED with " << window_ << " " << start() << " " << end() << std::endl;
73  } else {
74  os << "UNFOLDED" << std::endl;
75  }
76  }
77 
78 private:
81 };
82 
83 }
84 }
85 
86 #endif