BALL 1.5.0
Loading...
Searching...
No Matches
geometricFit.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4
5#ifndef BALL_DOCKING_GEOMETRICFIT_H
6#define BALL_DOCKING_GEOMETRICFIT_H
7
8#ifndef BALL_DATATYPE_REGULARDATA3D_H
10#endif
11
12#ifndef BALL_KERNEL_SYSTEM_H
13#include <BALL/KERNEL/system.h>
14#endif
15
16#ifndef BALL_MATHS_COMPLEX_H
17#include <BALL/MATHS/complex.h>
18#endif
19
20#ifndef BALL_MATHS_FFT3D_H
21#include <BALL/MATHS/FFT3D.h>
22#endif
23
24#ifndef BALL_DOCKING_COMMON_DOCKINGALGORITHM_H
26#endif
27
28namespace BALL
29{
37 : public DockingAlgorithm
38 {
39 public:
41
42
48 {
49 // the parameter r,
50 // "Any grid point is considered inside the molecule if there is at
51 // least one atom nucleus within a distance r from it."
52 // Default value is 1.8 Angstrom
53 static const String NEAR_RADIUS;
54
55 // Default grid spacing.
56 // Default value is 1.0 Angstrom
57 static const String GRID_SPACING;
58
59 // grid size = (ceil)(molecule size / grid spacing);
60 static const String GRID_SIZE;
61
62 // The thickness of the surface of the protein
63 // Default value is 1.0 Angstrom
65
66 // Degree interval is the delta parameter,
67 // which is the degrees that protein B rotates every time
68 // Default value is 20 degrees
69 static const String DEGREE_INTERVAL;
70
71 // How many peaks should the program keep for each rotation
72 static const String TOP_N;
73
80 static const String SURFACE_TYPE;
81
82 // How many results should be kept in total (also in DockingAlgorithms)
83 static const String BEST_NUM;
84
85 // Verbosity of the Algorithm (also in DockingAlgorithm)
86 static const String VERBOSITY;
87
88 // Euler angels for redocking
89 static const String PHI_MIN;
90 static const String PHI_MAX;
91 static const String DEG_PHI;
92
93 static const String THETA_MIN;
94 static const String THETA_MAX;
95 static const String DEG_THETA;
96
97 static const String PSI_MIN;
98 static const String PSI_MAX;
99 static const String DEG_PSI;
100
101 // penalty value of the inside points
102 // Default value for static protein is -15, for mobile protein 1
103 static const String PENALTY_STATIC;
104 static const String PENALTY_MOBILE;
105
106 // Number of processes in total for a parallel run
108
109 // Full path to the slave to spawn
110 static const String SLAVE_PATH;
111 };
112
114 {
115 // Default parameter r,
116 // Default value is 1.8 Angstrom
117 static const float NEAR_RADIUS;
118
119 // Default grid spacing.
120 // Default value is 1.0 Angstrom
121 static const float GRID_SPACING;
122
123 // grid size = (ceil)(molecule size / grid spacing);
124 static const int GRID_SIZE;
125
126 // Default thickness of the surface of the protein
127 // Default value is 1.0 Angstrom
128 static const float SURFACE_THICKNESS;
129
130 // Degree interval is the delta parameter,
131 // which is the degrees that protein B rotates every time
132 // Default value is 20 degrees
133 static const double DEGREE_INTERVAL;
134
138 static const int SURFACE_TYPE;
139
140 // How many peaks should the program keep for each rotation
141 static const int TOP_N;
142
143 // How many overall top best peaks should the program keep
144 // after doing all rotations.
145 static const int BEST_NUM;
146
147 // Verbosity of the algorithm
148 // Default value is 0
149 // For values > 1, some information is printed on Log
150 // For values > 5, timing information is included
151 static const int VERBOSITY;
152
153 // Euler angels for redocking
154 static const float PHI_MIN;
155 static const float PHI_MAX;
156 static const float DEG_PHI;
157
158 static const float THETA_MIN;
159 static const float THETA_MAX;
160 static const float DEG_THETA;
161
162 static const float PSI_MIN;
163 static const float PSI_MAX;
164 static const float DEG_PSI;
165
166 // penalty value of the inside points
167 // Default value for static protein is -15, for mobile protein 1
168 static const int PENALTY_STATIC;
169 static const int PENALTY_MOBILE;
170
171 // number of processes for a parallel run
172 static const int NUMBER_OF_PROCESSES;
173
174 // Full path to the slave to spawn
175 static const String SLAVE_PATH;
176 };
177
183 {
184 public:
185
186 // constructor
188
189 // destructor
191
192 // Operator <
193 bool operator < (const Peak_& p) const;
194
195 double value;
198 };
199
203 {
204 public:
205
206 // constructor
208
209 // constructor
210 RotationAngles_( int step );
211
212 // destructor
214
215 // generate all non-degenerate rotation angles.
216 // This algorithm is based on ???
217 bool generateSomeAngles( const float deg_phi, const float deg_psi, const float deg_theta,
218 const float phi_min, const float phi_max,
219 const float psi_min, const float psi_max,
220 const float theta_min, const float theta_max );
221
222 // generate all non-degenerate rotation angles.
223 // This algorithm is based on ???
224 bool generateAllAngles( const int deg );
225
227 {
228 return ang_num_;
229 }
230
231 int getXAng( int n ) // get the euler angle rotate around x axis
232 {
233 return phi_[n];
234 }
235
236 int getYAng( int n ) // get the euler angle rotate around y axis
237 {
238 return theta_[n];
239 }
240
241 int getZAng( int n ) // get the euler angle rotate around z axis
242 {
243 return psi_[n];
244 }
245
246 // TODO: This class is a bit strange...
247 vector<int> phi_;
248 vector<int> theta_;
249 vector<int> psi_;
250
251 private:
252 int ang_num_;
253 int max_rotation_;
254 };
255
256 // PROTEIN_A is the static protein, i.e., the bigger one;
257 // PROTEIN_B is the mobile protein, i.e., the smaller one.
258 enum ProteinIndex{ PROTEIN_A = 1, PROTEIN_B = 2 };
259
260 // The surface type to use for construction of the grids.
261 enum SurfaceType { CONNOLLY = 1, VAN_DER_WAALS = 2, FTDOCK = 3 };
262
267
273 GeometricFit(System &system1, System &system2);
274
279 GeometricFit(Options& new_options);
280
285 GeometricFit(System &system1,System &system2 ,Options& new_options);
286
287
291 GeometricFit( const GeometricFit& geo_fit );
292
293 // Destructor
295
298 virtual void setup(System& system1, System& system2, Options& new_options);
299
300 virtual void setup(System& system1, System& system2);
301
304 void start();
305
306#ifdef BALL_HAS_MPI
308 void MPI_Slave_start(int argc, char**argv);
309#endif
310
311 // return the overall docking progress as a percentage
312 float getProgress() const;
313
314 //
315 bool hasFinished() const;
316
320
324
328
330 // the member variables
331
335
336 protected:
337
338 // Free all allocated memory and destroys the options and results
339 void destroy_();
340
341 // find the inside points
342 void findInsidePoints_( System& system, ProteinIndex pro_idx );
343
344 // find out the surface points according to the Connolly's surface definition.
346
347 // find out the surface points according to the van der Waal's surface definition.
349
350 // find the inside points using the same algorithm as FTDock
352
353 // find out the surface points according to the FTDock surface definition.
355
359
362 float getRadius_( System& system );
363
365
367
373 int optimizeGridSize_( int raw_size );
374
377 void initFFTGrid_( ProteinIndex pro_idx );
378
379 // make grid from System
380 void makeFFTGrid_( ProteinIndex pro_idx );
381
382 // get the global peaks and put them into a list
383 void getGlobalPeak_(Peak_* peak_list);
384
385 // change the orientation of protein around its center according to euler_ang
386 void changeProteinOrientation_( System& system, Vector3 euler_ang );
387
388 // calculate the conjugate of each point in FFT grid
390
391 // calculate the product of the two FFT grids
393
394 // get the transformation of the peak value according to its position in matrix
395 Vector3 getTranslation_( const Vector3& mat_pos );
396
397 Vector3 getSeparation_( const Vector3& mat_pos );
398
399
400 // here we have two units for the size
401 // index : in the unit of grid points
402 // coord : in the unit of Angstrom
403
404 // the FFT grid for protein A
406
407 // the FFT grid for protein B
409
412
417
419
420 // the translation we do to the system b before FFT
421 // it is to reduse the size of the FFT_grid
424
426
427 // current execution progress
429
430 // execution round of whole work
432
433 // ordered set of the top_n peaks
434 std::multiset<Peak_> peak_set_;
435
436 // Needed to produce the correct results in getRankedConformations
439
440 // Vectors to store orientation and translation of the results in the ranked conformations
441 vector<Vector3> translations_;
442 vector<Vector3> orientations_;
443
444 }; // class GeometricFit
445
446} // namespace BALL
447
448#endif
#define BALL_CREATE(name)
Definition create.h:62
GeometricFit(System &system1, System &system2, Options &new_options)
Vector3 FFT_grid_upper_index_
void findInsidePoints_(System &system, ProteinIndex pro_idx)
void changeProteinOrientation_(System &system, Vector3 euler_ang)
ConformationSet getConformationSet(Index total_number=0)
Vector3 getMassCenter_(System &system)
GeometricFit(const GeometricFit &geo_fit)
Vector3 getSeparation_(const Vector3 &mat_pos)
Vector3 FFT_grid_lower_coord_
Vector3 FFT_grid_lower_index_
void initFFTGrid_(ProteinIndex pro_idx)
void calcConjugate_(ProteinIndex pro_idx)
int optimizeGridSize_(int raw_size)
void findConnollySurfacePoints_(System &system, ProteinIndex pro_idx)
GeometricFit(System &system1, System &system2)
Vector3 FFT_grid_size_index_
void findFTDockInsidePoints_(System &system, ProteinIndex pro_idx)
float getRadius_(System &system)
std::multiset< Peak_ > peak_set_
void makeFFTGrid_(ProteinIndex pro_idx)
Vector3 getTranslation(Index con_num) const
void findFTDockSurfacePoints_(System &system, ProteinIndex pro_idx)
vector< Vector3 > translations_
void doPreTranslation_(ProteinIndex pro_idx)
Vector3 FFT_grid_upper_coord_
bool hasFinished() const
GeometricFit(Options &new_options)
virtual void setup(System &system1, System &system2, Options &new_options)
vector< Vector3 > orientations_
void getGlobalPeak_(Peak_ *peak_list)
virtual void setup(System &system1, System &system2)
void findVanDerWaalsSurfacePoints_(System &system, ProteinIndex pro_idx)
Vector3 getTranslation_(const Vector3 &mat_pos)
float getProgress() const
Vector3 getOrientation(Index con_num) const
static const String GRID_SIZE
static const String DEGREE_INTERVAL
static const String NUMBER_OF_PROCESSES
static const String THETA_MIN
static const String DEG_THETA
static const String PHI_MIN
static const String THETA_MAX
static const String TOP_N
static const String DEG_PHI
static const String PSI_MAX
static const String DEG_PSI
static const String GRID_SPACING
static const String PENALTY_MOBILE
static const String BEST_NUM
static const String SLAVE_PATH
static const String PENALTY_STATIC
static const String PHI_MAX
static const String PSI_MIN
static const String NEAR_RADIUS
static const String SURFACE_TYPE
static const String VERBOSITY
static const String SURFACE_THICKNESS
static const float SURFACE_THICKNESS
static const float THETA_MIN
static const float GRID_SPACING
static const int NUMBER_OF_PROCESSES
static const float PSI_MAX
static const double DEGREE_INTERVAL
static const int PENALTY_STATIC
static const float PSI_MIN
static const float DEG_PHI
static const float DEG_THETA
static const float PHI_MAX
static const float PHI_MIN
static const float DEG_PSI
static const int PENALTY_MOBILE
static const int SURFACE_TYPE
static const String SLAVE_PATH
static const float NEAR_RADIUS
static const float THETA_MAX
bool generateSomeAngles(const float deg_phi, const float deg_psi, const float deg_theta, const float phi_min, const float phi_max, const float psi_min, const float psi_max, const float theta_min, const float theta_max)
bool generateAllAngles(const int deg)
#define BALL_EXPORT