00001
00002
00003
00004
00005 #ifndef BALL_STRUCTURE_DOCKING_GEOMETRICFIT_H
00006 #define BALL_STRUCTURE_DOCKING_GEOMETRICFIT_H
00007
00008 #ifndef BALL_DATATYPE_REGULARDATA3D_H
00009 #include <BALL/DATATYPE/regularData3D.h>
00010 #endif
00011
00012 #ifndef BALL_KERNEL_SYSTEM_H
00013 #include <BALL/KERNEL/system.h>
00014 #endif
00015
00016 #ifndef BALL_MATHS_COMPLEX_H
00017 #include <BALL/MATHS/complex.h>
00018 #endif
00019
00020 #ifndef BALL_MATHS_FFT3D_H
00021 #include <BALL/MATHS/FFT3D.h>
00022 #endif
00023
00024 #ifndef BALL_STRUCTURE_DOCKING_DOCKINGALGORITHM_H
00025 #include <BALL/STRUCTURE/DOCKING/dockingAlgorithm.h>
00026 #endif
00027
00028 namespace BALL
00029 {
00036 class BALL_EXPORT GeometricFit
00037 : public DockingAlgorithm
00038 {
00039 public:
00040 BALL_CREATE(GeometricFit)
00041
00042
00047 struct BALL_EXPORT Option
00048 {
00049
00050
00051
00052
00053 static const String NEAR_RADIUS;
00054
00055
00056
00057 static const String GRID_SPACING;
00058
00059
00060 static const String GRID_SIZE;
00061
00062
00063
00064 static const String SURFACE_THICKNESS;
00065
00066
00067
00068
00069 static const String DEGREE_INTERVAL;
00070
00071
00072 static const String TOP_N;
00073
00080 static const String SURFACE_TYPE;
00081
00082
00083 static const String BEST_NUM;
00084
00085
00086 static const String VERBOSITY;
00087
00088
00089 static const String PHI_MIN;
00090 static const String PHI_MAX;
00091 static const String DEG_PHI;
00092
00093 static const String THETA_MIN;
00094 static const String THETA_MAX;
00095 static const String DEG_THETA;
00096
00097 static const String PSI_MIN;
00098 static const String PSI_MAX;
00099 static const String DEG_PSI;
00100
00101
00102
00103 static const String PENALTY_STATIC;
00104 static const String PENALTY_MOBILE;
00105
00106
00107 static const String NUMBER_OF_PROCESSES;
00108
00109
00110 static const String SLAVE_PATH;
00111 };
00112
00113 struct BALL_EXPORT Default
00114 {
00115
00116
00117 static const float NEAR_RADIUS;
00118
00119
00120
00121 static const float GRID_SPACING;
00122
00123
00124 static const int GRID_SIZE;
00125
00126
00127
00128 static const float SURFACE_THICKNESS;
00129
00130
00131
00132
00133 static const double DEGREE_INTERVAL;
00134
00138 static const int SURFACE_TYPE;
00139
00140
00141 static const int TOP_N;
00142
00143
00144
00145 static const int BEST_NUM;
00146
00147
00148
00149
00150
00151 static const int VERBOSITY;
00152
00153
00154 static const float PHI_MIN;
00155 static const float PHI_MAX;
00156 static const float DEG_PHI;
00157
00158 static const float THETA_MIN;
00159 static const float THETA_MAX;
00160 static const float DEG_THETA;
00161
00162 static const float PSI_MIN;
00163 static const float PSI_MAX;
00164 static const float DEG_PSI;
00165
00166
00167
00168 static const int PENALTY_STATIC;
00169 static const int PENALTY_MOBILE;
00170
00171
00172 static const int NUMBER_OF_PROCESSES;
00173
00174
00175 static const String SLAVE_PATH;
00176 };
00177
00183 class BALL_EXPORT Peak_
00184 {
00185 public:
00186
00187
00188 Peak_();
00189
00190
00191 ~Peak_();
00192
00193
00194 bool operator < (const Peak_& p) const;
00195
00196 double value;
00197 Vector3 orientation;
00198 Vector3 translation;
00199 };
00200
00204 class BALL_EXPORT RotationAngles_
00205 {
00206 public:
00207
00208
00209 RotationAngles_();
00210
00211
00212 RotationAngles_( int step );
00213
00214
00215 ~RotationAngles_() {};
00216
00217
00218
00219 bool generateSomeAngles( const float deg_phi, const float deg_psi, const float deg_theta,
00220 const float phi_min, const float phi_max,
00221 const float psi_min, const float psi_max,
00222 const float theta_min, const float theta_max );
00223
00224
00225
00226 bool generateAllAngles( const int deg );
00227
00228 int getRotationNum()
00229 {
00230 return ang_num_;
00231 }
00232
00233 int getXAng( int n )
00234 {
00235 return phi_[n];
00236 }
00237
00238 int getYAng( int n )
00239 {
00240 return theta_[n];
00241 }
00242
00243 int getZAng( int n )
00244 {
00245 return psi_[n];
00246 }
00247
00248
00249 vector<int> phi_;
00250 vector<int> theta_;
00251 vector<int> psi_;
00252
00253 private:
00254 int ang_num_;
00255 int max_rotation_;
00256 };
00257
00258
00259
00260 enum ProteinIndex{ PROTEIN_A = 1, PROTEIN_B = 2 };
00261
00262
00263 enum SurfaceType { CONNOLLY = 1, VAN_DER_WAALS = 2, FTDOCK = 3 };
00264
00265
00266
00267 GeometricFit();
00268
00274 GeometricFit(System &system1, System &system2);
00275
00280 GeometricFit(Options& new_options);
00281
00286 GeometricFit(System &system1,System &system2 ,Options& new_options);
00287
00288
00289
00290
00291
00292
00293
00294 ~GeometricFit();
00295
00298 virtual void setup(System& system1, System& system2, Options& new_options);
00299
00300 virtual void setup(System& system1, System& system2);
00301
00304 void start();
00305
00306 #ifdef BALL_HAS_MPI
00307
00308 void MPI_Slave_start(int argc, char**argv);
00309 #endif
00310
00311
00312 float getProgress() const;
00313
00314
00315 bool hasFinished() const;
00316
00319 Vector3 getTranslation(Index con_num) const;
00320
00323 Vector3 getOrientation(Index con_num) const;
00324
00327 ConformationSet getConformationSet(Index total_number = 0);
00328
00330
00331
00334 Options options;
00335
00336 protected:
00337
00338
00339 void destroy_();
00340
00341
00342 void findInsidePoints_( System& system, ProteinIndex pro_idx );
00343
00344
00345 void findConnollySurfacePoints_( System& system, ProteinIndex pro_idx );
00346
00347
00348 void findVanDerWaalsSurfacePoints_( System& system, ProteinIndex pro_idx );
00349
00350
00351 void findFTDockInsidePoints_( System& system, ProteinIndex pro_idx );
00352
00353
00354 void findFTDockSurfacePoints_( System& system, ProteinIndex pro_idx );
00355
00358 Vector3 getMassCenter_( System& system );
00359
00362 float getRadius_( System& system );
00363
00364 void doPreTranslation_( ProteinIndex pro_idx );
00365
00366 void initGridSizes_();
00367
00373 int optimizeGridSize_( int raw_size );
00374
00377 void initFFTGrid_( ProteinIndex pro_idx );
00378
00379
00380 void makeFFTGrid_( ProteinIndex pro_idx );
00381
00382
00383 void getGlobalPeak_(Peak_* peak_list);
00384
00385
00386 void changeProteinOrientation_( System& system, Vector3 euler_ang );
00387
00388
00389 void calcConjugate_( ProteinIndex pro_idx );
00390
00391
00392 void FFTGridMulti_();
00393
00394
00395 Vector3 getTranslation_( const Vector3& mat_pos );
00396
00397 Vector3 getSeparation_( const Vector3& mat_pos );
00398
00399
00400
00401
00402
00403
00404
00405 FFT3D* FFT_grid_a_;
00406
00407
00408 FFT3D* FFT_grid_b_;
00409
00410 float radius_a_;
00411 float radius_b_;
00412
00413 Vector3 FFT_grid_lower_index_;
00414 Vector3 FFT_grid_upper_index_;
00415 Vector3 FFT_grid_lower_coord_;
00416 Vector3 FFT_grid_upper_coord_;
00417
00418 Vector3 FFT_grid_size_index_;
00419
00420
00421
00422 Vector3 pre_translation_a_;
00423 Vector3 pre_translation_b_;
00424
00425 Vector3 FFT_grid_origin_;
00426
00427
00428 int current_round_;
00429
00430
00431 int total_round_;
00432
00433
00434 std::multiset<Peak_> peak_set_;
00435
00436
00437 System system_backup_a_;
00438 System system_backup_b_;
00439
00440
00441 vector<Vector3> translations_;
00442 vector<Vector3> orientations_;
00443
00444 };
00445
00446 }
00447
00448 #endif