BALL
1.4.1
|
00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 // $Id: poissonBoltzmann.h,v 1.31 2005/12/23 17:02:00 amoll Exp $ 00005 // 00006 00007 // Finite Difference Poisson Boltzmann Solver 00008 00009 #ifndef BALL_SOLVATION_POISSONBOLTZMANN_H 00010 #define BALL_SOLVATION_POISSONBOLTZMANN_H 00011 00012 #ifndef BALL_COMMON_H_ 00013 # include <BALL/common.h> 00014 #endif 00015 00016 #ifndef BALL_DATATYPE_REGULARDATA3D_H 00017 # include <BALL/DATATYPE/regularData3D.h> 00018 #endif 00019 00020 #ifndef BALL_KERNEL_SYSTEM_H 00021 # include <BALL/KERNEL/system.h> 00022 #endif 00023 00024 #ifndef BALL_DATATYPE_OPTIONS_H 00025 # include <BALL/DATATYPE/options.h> 00026 #endif 00027 00028 #include <vector> 00029 using std::vector; 00030 00031 namespace BALL 00032 { 00036 class BALL_EXPORT FDPB 00037 { 00038 00039 public: 00040 00045 enum ErrorCode 00046 { 00049 ERROR__NONE = -1, 00050 00053 ERROR__UNKNOWN = 0, 00054 00058 ERROR__NOT_IMPLEMENTED = 1, 00059 00066 ERROR__CANNOT_CREATE_ATOM_ARRAY, 00067 00074 ERROR__CANNOT_CREATE_SAS_GRID, 00075 00084 ERROR__CANNOT_CREATE_EPSILON_GRID, 00085 00093 ERROR__CANNOT_CREATE_KAPPA_GRID, 00094 00101 ERROR__CANNOT_CREATE_CHARGE_GRID, 00102 00109 ERROR__CANNOT_CREATE_PHI_GRID, 00110 00117 ERROR__SAS_GRID_REQUIRED, 00118 00126 ERROR__EPSILON_GRID_REQUIRED, 00127 00134 ERROR__ATOM_ARRAY_REQUIRED, 00135 00143 ERROR__PHI_GRID_REQUIRED, 00144 00150 ERROR__OUT_OF_MEMORY, 00151 00160 ERROR__UNKNOWN_DIELECTRIC_SMOOTHING_METHOD, 00161 00169 ERROR__UNKNOWN_CHARGE_DISTRIBUTION_METHOD, 00170 00178 ERROR__UNKNOWN_BOUNDARY_CONDITION_TYPE, 00179 00187 ERROR__NOT_A_VECTOR_IN_UPPER_LOWER, 00188 00197 ERROR__ILLEGAL_VALUE_FOR_LOWER_UPPER, 00198 00204 ERROR__SETUP_REQUIRED, 00205 00208 NUMBER_OF_ERRORS 00209 }; 00210 00216 struct BALL_EXPORT Option 00217 { 00225 static const String VERBOSITY; 00226 00236 static const String PRINT_TIMING; 00237 00245 static const String SPACING; 00246 00255 static const String BORDER; 00256 00265 static const String IONIC_STRENGTH; 00266 00272 static const String SOLUTE_DC; 00273 00279 static const String SOLVENT_DC; 00280 00286 static const String PROBE_RADIUS; 00287 00292 static const String ION_RADIUS; 00293 00299 static const String TEMPERATURE; 00300 00308 static const String BOUNDARY; 00309 00317 static const String CHARGE_DISTRIBUTION; 00318 00329 static const String DIELECTRIC_SMOOTHING; 00330 00338 static const String OFFSET; 00339 00348 static const String RMS_CRITERION; 00349 00357 static const String MAX_CRITERION; 00358 00365 static const String CHECK_AFTER_ITERATIONS; 00366 00375 static const String MAX_ITERATIONS; 00376 00385 static const String LOWER; 00386 00391 static const String UPPER; 00392 00398 static const String BOUNDING_BOX_LOWER; 00399 00404 static const String BOUNDING_BOX_UPPER; 00405 00406 }; 00407 00411 struct BALL_EXPORT Boundary 00412 { 00419 static const String ZERO; 00420 00431 static const String DEBYE; 00432 00436 static const String COULOMB; 00437 00440 static const String DIPOLE; 00441 00448 static const String FOCUSING; 00449 }; 00450 00453 struct BALL_EXPORT ChargeDistribution 00454 { 00458 static const String TRILINEAR; 00459 00463 static const String UNIFORM; 00464 }; 00465 00472 struct BALL_EXPORT DielectricSmoothing 00473 { 00476 static const String NONE; 00477 00485 static const String UNIFORM; 00486 00494 static const String HARMONIC; 00495 }; 00496 00501 struct BALL_EXPORT Default 00502 { 00507 static const int VERBOSITY; 00508 00513 static const bool PRINT_TIMING ; 00514 00519 static const float SPACING; 00520 00525 static const float BORDER; 00526 00531 static const float IONIC_STRENGTH; 00532 00537 static const float TEMPERATURE; 00538 00545 static const float PROBE_RADIUS; 00546 00551 static const float ION_RADIUS; 00552 00558 static const String BOUNDARY; 00559 00565 static const String CHARGE_DISTRIBUTION; 00566 00572 static const String DIELECTRIC_SMOOTHING; 00573 00578 static const float SOLVENT_DC; 00579 00584 static const float SOLUTE_DC; 00585 00592 static const float RMS_CRITERION; 00593 00600 static const float MAX_CRITERION; 00601 00607 static const Index MAX_ITERATIONS; 00608 00613 static const Index CHECK_AFTER_ITERATIONS; 00614 }; 00615 00627 struct BALL_EXPORT FastAtomStruct 00628 { 00629 float q; 00630 float r; 00631 float x, y, z; 00632 Index index; 00633 }; 00634 00635 typedef struct FastAtomStruct FastAtom; 00636 00637 00641 00645 FDPB(); 00646 00650 FDPB(const FDPB& fdpb); 00651 00658 FDPB(System& system); 00659 00666 FDPB(Options& new_options); 00667 00675 FDPB(System& system, Options& new_options); 00676 00679 virtual ~FDPB(); 00680 00683 void destroy(); 00684 00693 void destroyGrids(); 00694 00696 00701 00721 bool setup(System& system); 00722 00731 bool setup(System& system, Options& options); 00732 00757 bool setupEpsGrid(System& system); 00758 00759 00760 // ????? 00764 bool setupSASGrid(System& system); 00765 00776 bool setupAtomArray(System& system); 00777 00780 bool setupKappaGrid(); 00781 00784 bool setupQGrid(); 00785 00788 bool setupPhiGrid(); 00789 00792 bool setupBoundary(); 00793 00795 00798 00801 bool solve(); 00802 00810 double getEnergy() const; 00811 00815 double getReactionFieldEnergy() const; 00816 00820 double calculateReactionFieldEnergy() const; 00821 00830 Size getNumberOfIterations() const; 00831 00833 00837 00845 Index getErrorCode() const; 00846 00851 static String getErrorMessage(Index error_code); 00853 00854 00858 00861 Options options; 00862 00865 Options results; 00866 00868 00871 00876 TRegularData3D<Vector3>* eps_grid; 00877 00881 TRegularData3D<float>* kappa_grid; 00882 00891 TRegularData3D<float>* q_grid; 00892 00902 TRegularData3D<float>* phi_grid; 00903 00906 TRegularData3D<char>* SAS_grid; 00907 00911 vector<FDPB::FastAtom>* atom_array; 00912 00914 00915 protected: 00916 00917 Vector3 lower_; 00918 Vector3 upper_; 00919 Vector3 offset_; 00920 00921 bool use_offset_; 00922 00923 float spacing_; 00924 00925 // final energy of the last calculation 00926 double energy_; 00927 00928 // the reaction field energy of the last calculation 00929 double reaction_field_energy_; 00930 00931 // the indices of the boundary points, 00932 // i.e., the points that have at least one neighbouring 00933 // grid point that is inside the solute 00934 vector<Position> boundary_points_; 00935 00936 // number of iterations of the last calculation 00937 Size number_of_iterations_; 00938 00939 // error code. use getErrorMessage to access the corresponding 00940 // error message 00941 int error_code_; 00942 00943 static const char* error_message_[]; 00944 }; 00945 00946 } // namespace BALL 00947 00948 #endif