00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 // $Id: generalizedBornCase.h,v 1.1 2005/11/21 19:38:38 anker Exp $ 00005 // 00006 00007 #ifndef BALL_SOLVATION_GENERALIZED_BORN_H 00008 #define BALL_SOLVATION_GENERALIZED_BORN_H 00009 00010 #ifndef BALL_COMMON_H 00011 # include <BALL/common.h> 00012 #endif 00013 00014 #ifndef BALL_KERNEL_PTE_H 00015 # include <BALL/KERNEL/PTE.h> 00016 #endif 00017 00018 #ifndef BALL_KERNEL_ATOMCONTAINER_H 00019 # include <BALL/KERNEL/atomContainer.h> 00020 #endif 00021 00022 #ifndef BALL_DATATYPE_STRINGHASHMAP_H 00023 # include <BALL/DATATYPE/stringHashMap.h> 00024 #endif 00025 00026 #ifndef BALL_FORMAT_INIFILE_H 00027 # include <BALL/FORMAT/INIFile.h> 00028 #endif 00029 00030 #ifndef BALL_FORMAT_PARAMETERSECTION_H 00031 # include <BALL/FORMAT/parameterSection.h> 00032 #endif 00033 00034 #include <map> 00035 #include <set> 00036 00037 namespace BALL 00038 { 00061 class GeneralizedBornModel 00062 { 00063 public: 00064 00065 struct Option 00066 { 00068 static const String VERBOSITY; 00069 00071 static const String LAMBDA; 00072 00074 static const String DELTA; 00075 00077 static const String KAPPA; 00078 00080 static const String RHO_0; 00081 00083 static const String DC_SOLVENT; 00084 00086 static const String DC_SOLUTE; 00087 00089 static const String FILENAME; 00090 }; 00091 00092 struct Default 00093 { 00095 static const Size VERBOSITY; 00096 00098 static const float LAMBDA; 00099 00101 static const float DELTA; 00102 00104 static const float KAPPA; 00105 00107 static const float RHO_0; 00108 00110 static const float DC_SOLVENT; 00111 00113 static const float DC_SOLUTE; 00114 00116 static const String FILENAME; 00117 }; 00118 00120 GeneralizedBornModel() 00121 throw(Exception::FileNotFound); 00122 00124 ~GeneralizedBornModel(); 00125 00127 void clear(); 00128 00130 bool setup(const AtomContainer& ac) 00131 throw(Exception::FileNotFound); 00132 00134 void setScalingFactorFile(const String& filename); 00135 00137 void setScalingFactors(const StringHashMap<float>& scaling_factors); 00138 00140 const StringHashMap<float>& getScalingFactors() const; 00141 00143 void setSolventDC(float solvent_dc); 00144 00146 void setSoluteDC(float solute_dc); 00147 00149 float calculateEnergy(); 00150 00153 float calculateSolvationEnergy(); 00154 00158 void calculatePotential(HashMap<const Atom*, float>& p_hash) const; 00159 00162 float calculatePotential(const Atom& atom_i) const; 00163 00165 bool readScalingFactors(const String& inifile_name) 00166 throw(Exception::FileNotFound); 00167 00168 00169 private: 00170 00171 /* Parameters for the generalized Born model 00172 */ 00173 class GBParameters : public ParameterSection 00174 { 00175 public: 00176 00177 GBParameters(); 00178 00179 ~GBParameters(); 00180 00181 bool extractSection(Parameters& parameters, const String& section_name); 00182 00183 const StringHashMap<float>& getScalingFactors() const; 00184 00185 float getSoluteDC() const; 00186 00187 float getSolventDC() const; 00188 00189 float getKappa() const; 00190 00191 private: 00192 00193 /*_ 00194 */ 00195 StringHashMap<float> scaling_factors_; 00196 00197 /*_ 00198 */ 00199 float dc_solute_; 00200 00201 /*_ 00202 */ 00203 float dc_solvent_; 00204 00205 /*_ 00206 */ 00207 float lambda_; 00208 00209 /*_ 00210 */ 00211 float delta_; 00212 00213 /*_ 00214 */ 00215 float kappa_; 00216 00217 /*_ 00218 */ 00219 float rho_0_; 00220 00221 }; 00222 00225 AtomContainer* ac_; 00226 00229 std::vector<const Atom*> atoms_; 00230 00233 std::vector<float> born_radii_; 00234 00238 std::vector< std::pair<Size, Size> > pair_list_; 00239 00242 std::vector< float > pair_distances_; 00243 std::vector< float > pair_charges_; 00244 std::vector< std::vector< float > > squared_distances_; 00245 00248 float dc_solute_; 00249 float dc_solvent_; 00250 00254 StringHashMap<float> scaling_factors_; 00255 std::vector<float> scaling_factor_; 00256 00259 String scaling_factor_filename_; 00260 00265 float lambda_; 00266 00272 float delta_; 00273 00277 float kappa_; 00278 00281 float rho_0_; 00282 00285 float to_kJ_mol_; 00286 00289 void calculateBornRadii_(); 00290 00294 float calculateCreationEnergy_() const; 00295 00299 float calculateTransferEnergy_() const; 00300 00306 float f_GB_(Size i, Size j) const; 00307 00310 float coulombIntegralApproximation_(float distance, float scaled_radius_j, 00311 float radius_i) const; 00312 00313 00314 00315 }; 00316 00317 00318 } // namespace BALL 00319 00320 #endif // BALL_SOLVATION_GENERALIZED_BORN_H