Victor
 All Data Structures Functions Variables Friends Pages
LoopTableEntry.h
1 /* This file is part of Victor.
2 
3  Victor is free software: you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation, either version 3 of the License, or
6  (at your option) any later version.
7 
8  Victor is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with Victor. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef _LOOPTABLEENTRY_H_
18 #define _LOOPTABLEENTRY_H_
19 
20 // Includes:
21 #include <VectorTransformation.h>
22 #include <vector3.h>
23 #include <matrix3.h>
24 #include <Debug.h>
25 
26 namespace Victor { namespace Lobo {
27 
28  // Global constants, typedefs, etc. (to avoid):
29 
42  public:
43 
44  // CONSTRUCTORS/DESTRUCTOR:
46  LoopTableEntry(const LoopTableEntry& orig);
47  virtual ~LoopTableEntry();
48 
49  // PREDICATES:
50  //
51  double calculateDeviation(const LoopTableEntry&, unsigned int nAmino = 0) const;
52 
59 
60  static double getBondLengthTol() {
61  return BOND_LENGTH_TOL;
62  }
63 
64  static double getBondAngleTol() {
65  return BOND_ANGLE_TOL;
66  }
67 
68  // MODIFIERS:
69  void copy(const LoopTableEntry& orig);
70 
71  void setToSingleAminoAcid(); // initializes the entry for single aminoacid
72  void rotate(const vgVector3<float>& axis, const double angle);
73  void rotate(const vgMatrix3<float>& rotationMatrix);
74  //
75 
76  LoopTableEntry concatenate(const LoopTableEntry&, unsigned int);
77  //
80  //
82  //
83 
84  static void setBondLengthTol(float t) {
85  BOND_LENGTH_TOL = t;
86  }
87 
88  static void setBondAngleTol(float t) {
89  BOND_ANGLE_TOL = t;
90  }
91 
92  // OPERATORS:
94  vgVector3<float>& operator[](unsigned int n);
95  const vgVector3<float>& operator[](unsigned int n) const;
96 
97  // ATTRIBUTES:
98  vgVector3<float> endPoint;
99  vgVector3<float> endDirection;
100  vgVector3<float> endNormal;
101  vgVector3<float> midPoint;
102  vgVector3<float> midDirection;
103  vgVector3<float> midNormal;
104 
105  // NB: contrary to usual conventions the attributes above are _public_,
106  // for simplicity's sake, because this whole class is essentially a
107  // glorified container element (eg. like vgVector3)
108 
109  // TESTERS:
110  void printTable(unsigned int k = 0) const;
111 
112  // ATTRIBUTES:
113  static float BOND_LENGTH_TOL;
114  static float BOND_ANGLE_TOL;
115  static float BOND_LENGTH_CALPHA_TO_CPRIME;
116  static float BOND_LENGTH_CPRIME_TO_N;
117  static float BOND_ANGLE_AT_CALPHA_TO_CPRIME;
118  static float BOND_ANGLE_AT_CPRIME_TO_N;
119  static float BOND_LENGTH_N_TO_CALPHA;
120  static float BOND_ANGLE_AT_N_TO_CALPHA;
121  static float BOND_LENGTH_CALPHA_TO_CPRIME_SD;
122  static float BOND_LENGTH_CPRIME_TO_N_SD;
123  static float BOND_ANGLE_AT_CALPHA_TO_CPRIME_SD;
124  static float BOND_ANGLE_AT_CPRIME_TO_N_SD;
125  static float BOND_LENGTH_N_TO_CALPHA_SD;
126  static float BOND_ANGLE_AT_N_TO_CALPHA_SD;
127  static float LAMBDA_EP;
128  static float LAMBDA_ED;
129  static float LAMBDA_EN;
130 
131  private:
132 
133  double pGetRand();
134 
135  };
136 
137  // for internal use (in LoopTable::read()):
138 
142  public:
143 
144  CompressedLoopTableEntry() : endPoint(0, 0, 0), endDirection(0, 0, 0),
145  endNormal(0, 0, 0), midPoint(0, 0, 0), midDirection(0, 0, 0),
146  midNormal(0, 0, 0) {
147  }
148 
149  vgVector3<unsigned short>& operator[](unsigned int n) {
150  switch (n) {
151  case 0: return endPoint;
152  case 1: return endDirection;
153  case 2: return endNormal;
154  case 3: return midPoint;
155  case 4: return midDirection;
156  case 5: return midNormal;
157  }
158  ERROR("Invalid entry.", exception);
159  return endPoint;
160  }
161 
162  vgVector3<unsigned short> endPoint;
163  vgVector3<unsigned short> endDirection;
164  vgVector3<unsigned short> endNormal;
165  vgVector3<unsigned short> midPoint;
166  vgVector3<unsigned short> midDirection;
167  vgVector3<unsigned short> midNormal;
168  };
169 
170  // ---------------------------------------------------------------------------
171  // LoopTableEntry
172  // -----------------x-------------------x-------------------x-----------------
173 
179  inline double LoopTableEntry::pGetRand() {
180  double tmp = 0.0;
181  for (unsigned int i = 0; i < 12; i++)
182  tmp += static_cast<double> (rand()) / RAND_MAX;
183 
184  return tmp - 6;
185  }
186 
193  return BOND_LENGTH_CALPHA_TO_CPRIME
194  + BOND_LENGTH_TOL * BOND_LENGTH_CALPHA_TO_CPRIME_SD * pGetRand();
195  }
196 
203  return BOND_LENGTH_CPRIME_TO_N
204  + BOND_LENGTH_TOL * BOND_LENGTH_CPRIME_TO_N_SD * pGetRand();
205  }
206 
214  return BOND_ANGLE_AT_CALPHA_TO_CPRIME
215  + BOND_ANGLE_TOL * BOND_ANGLE_AT_CALPHA_TO_CPRIME_SD * pGetRand();
216  }
217 
224  return BOND_ANGLE_AT_CPRIME_TO_N
225  + BOND_ANGLE_TOL * BOND_ANGLE_AT_CPRIME_TO_N_SD * pGetRand();
226  }
227 
234  return BOND_LENGTH_N_TO_CALPHA
235  + BOND_LENGTH_TOL * BOND_LENGTH_N_TO_CALPHA_SD * pGetRand();
236  }
237 
244  return BOND_ANGLE_AT_N_TO_CALPHA
245  + BOND_ANGLE_TOL * BOND_ANGLE_AT_N_TO_CALPHA_SD * pGetRand();
246  }
247 
248 
249 }} // namespace
250 
251 #endif //_LOOPTABLEENTRY_H_
252 
253 
LoopTableEntry setToOrigin(LoopTableEntry &, unsigned int, VectorTransformation &vt)
Definition: LoopTableEntry.cc:269
float getBOND_ANGLE_AT_N_TO_CALPHA()
Definition: LoopTableEntry.h:243
LoopTableEntry concatenate(const LoopTableEntry &, unsigned int)
Definition: LoopTableEntry.cc:194
vgVector3< float > & operator[](unsigned int n)
Definition: LoopTableEntry.cc:393
void printTable(unsigned int k=0) const
Definition: LoopTableEntry.cc:431
virtual ~LoopTableEntry()
Definition: LoopTableEntry.cc:75
void setToSingleAminoAcid()
Definition: LoopTableEntry.cc:126
float getBOND_ANGLE_AT_CALPHA_TO_CPRIME()
Definition: LoopTableEntry.h:213
LoopTableEntry & operator=(const LoopTableEntry &orig)
Definition: LoopTableEntry.cc:383
This class allows to store transformation steps for transforming a vector v into v' according to the ...
Definition: VectorTransformation.h:37
void rotate(const vgVector3< float > &axis, const double angle)
Definition: LoopTableEntry.cc:159
void copy(const LoopTableEntry &orig)
Definition: LoopTableEntry.cc:111
float rotateIntoXYPlane(VectorTransformation &vt)
Definition: LoopTableEntry.cc:350
double calculateDeviation(const LoopTableEntry &, unsigned int nAmino=0) const
Definition: LoopTableEntry.cc:88
This structure allows to manage a compressed loop table information in vectors.
Definition: LoopTableEntry.h:141
LoopTableEntry()
Definition: LoopTableEntry.cc:59
float getBOND_LENGTH_CALPHA_TO_CPRIME()
Definition: LoopTableEntry.h:192
float getBOND_ANGLE_AT_CPRIME_TO_N()
Definition: LoopTableEntry.h:223
float getBOND_LENGTH_N_TO_CALPHA()
Definition: LoopTableEntry.h:233
Implements an entry for the loop table (equivalent to the old "ProteinTableEntry" from the previous v...
Definition: LoopTableEntry.h:41
float getBOND_LENGTH_CPRIME_TO_N()
Definition: LoopTableEntry.h:202