1 #ifndef SOLVER_FASTSOR_H
2 #define SOLVER_FASTSOR_H
12 #include "../interface/interface_abstractmodule.h"
13 #include "../misc/misc_timer.h"
14 #include "../delphi/delphi_constants.h"
16 #include "solver_exceptions.h"
23 shared_ptr<CTimer> pTimer;
33 const string& strBioModel;
34 const string& strNumSolver;
36 const delphi_integer& iAtomNum;
37 const bool& bCrgInterplateType;
38 const bool& bSpectralRadius;
39 const delphi_real& fSpectralRadius;
40 const vector<bool>& rgbPeriodicBndy;
41 const int& iNonIterateNum;
42 const delphi_real& fIonRadius;
43 const bool& bFixedRelaxParam;
44 const bool& bAutoConverge;
45 const delphi_real& fGridConverge;
46 const delphi_real& fRmsc;
47 const delphi_real& fMaxc;
48 const bool& bLogGraph;
49 const bool& bLogPotential;
50 const bool& bManualRelaxParam;
52 const string& strEpsFile;
53 const string& strPhiiFile;
56 const bool& bGridCrgOut;
60 const delphi_real& fEpsOut;
61 const delphi_real& fDebyeLength;
62 const delphi_real& fScale;
63 const delphi_real& fEpsIn;
64 const delphi_real& fIonStrength;
65 const int& iDirectEpsMap;
66 const delphi_real& fEPKT;
69 const delphi_real& fTaylorCoeff2;
70 const delphi_real& fTaylorCoeff3;
71 const delphi_real& fTaylorCoeff4;
72 const delphi_real& fTaylorCoeff5;
74 const delphi_integer& iMediaNum;
75 const delphi_integer& iObjectNum;
76 const vector<delphi_real>& prgfMediaEps;
78 const delphi_integer& iCrgGridNum;
79 const delphi_real& fMinusCrg;
80 const delphi_real& fPlusCrg;
83 const delphi_integer& iBndyGridNum;
84 const vector< SGrid<delphi_integer> >& prgigBndyGrid;
85 const vector< SGrid<delphi_integer> >& prgigEpsMap;
86 const vector<bool>& prgbDielecMap;
87 const delphi_integer& iCrg2GridNum;
88 const vector< SGridValue<delphi_real> >& prggvCrg2Grid;
89 const vector<delphi_integer>& prgiCrg2GridMap;
90 const vector<delphi_real>& prgfAtomEps;
91 const vector< SGridValue<delphi_real> >& prggvCrgedAtom;
95 delphi_integer& iGrid;
99 int& iIterateInterval;
101 delphi_real& fRelaxParam;
103 delphi_integer& iDielecBndyOdd;
104 delphi_integer& iCrgedGridSum;
105 vector<delphi_real>& prgfGridCrg;
106 vector< SGrid<delphi_integer> >& prgigGridCrgPose;
107 delphi_integer& iCrgBndyGridNum;
108 vector< SDoubleGridValue >& prgdgvCrgBndyGrid;
109 vector<delphi_real>& prgfPhiMap;
117 const delphi_integer iTotalGridNum;
118 const delphi_integer iHalfGridNum;
119 const delphi_integer iBndyDielecNum;
120 const delphi_real fDebFct;
121 const delphi_real fEpsDiff;
122 const delphi_real fSixEps;
123 const delphi_integer iEpsDim;
129 delphi_integer iDielecBndyEven;
130 vector<delphi_integer> prgiBndyDielecIndex;
131 vector< vector<delphi_real> > prgfBndyDielec;
132 vector<delphi_real> prgfSaltMap1;
133 vector<delphi_real> prgfSaltMap2;
135 delphi_integer iCrgedGridEven;
136 vector<delphi_integer> prgiCrgPose;
137 vector<delphi_real> prgfCrgValA;
138 vector<delphi_real> prgfCrgValG;
141 vector<delphi_integer> ibndx,ibndy,ibndz;
142 delphi_integer idif1x,idif2x,inc1xa,inc1xb,inc2xa,inc2xb;
143 delphi_integer idif1y,idif2y,inc1ya,inc1yb,inc2ya,inc2yb;
144 delphi_integer idif1z,idif2z,inc1za,inc1zb,inc2za,inc2zb;
145 vector<delphi_integer> sta1,sta2,fi1,fi2;
146 delphi_integer lat1,lat2,long1,long2;
147 vector<delphi_real> phimap1,phimap2;
148 vector<delphi_real> bndx1,bndx2,bndx3,bndx4;
149 vector<delphi_real> qmap1,qmap2;
150 vector<delphi_real> debmap1,debmap2;
151 delphi_real om1,om2,om3,om4,sixth;
157 void setDielecBndySaltMap();
164 bool isDipolarBndy(delphi_real *** phimap);
166 bool isFocusBndy(delphi_real *** phimap);
168 bool isCoulombBndy(delphi_real *** phimap);
170 void initOddEvenItr(
const int& forWhom);
172 void itrOddPoints(
const int& forWhom);
174 void itrEvenPoints(
const int& forWhom);
176 void conplt(
const vector<delphi_real>& array,
const string& title,
const int& iclr,
const int& iscl,
const int& imk,
177 const int& iplt,
const char symb,
const int& ixmin,
const int& ixmax,vector<string>& iplot,delphi_real& ymin,delphi_real& ymax);
179 void postItr(
const vector<delphi_real>& rmaxl,
const vector<delphi_real>& rmsl);
181 delphi_real calculateRelaxFactor();
185 void nitit(
const delphi_real& qfact);
188 CDelphiFastSOR(shared_ptr<IDataContainer> pdc,shared_ptr<CTimer> pt):
199 strBioModel(pdc->getKey_constRef<
string>(
"biomodel")),
200 strNumSolver(pdc->getKey_constRef<
string>(
"solver")),
202 iAtomNum(pdc->getKey_constRef<delphi_integer>(
"natom")),
203 bCrgInterplateType(pdc->getKey_constRef<
bool>(
"isph")),
204 bSpectralRadius(pdc->getKey_constRef<
bool>(
"iuspec")),
205 fSpectralRadius(pdc->getKey_constRef<delphi_real>(
"uspec")),
206 rgbPeriodicBndy(pdc->getKey_constRef< vector<bool> >(
"iper")),
207 iNonIterateNum(pdc->getKey_constRef<
int>(
"nnit")),
208 fIonRadius(pdc->getKey_constRef<delphi_real>(
"exrad")),
209 bFixedRelaxParam(pdc->getKey_constRef<
bool>(
"icheb")),
210 bAutoConverge(pdc->getKey_constRef<
bool>(
"iautocon")),
211 fGridConverge(pdc->getKey_constRef<delphi_real>(
"gten")),
212 fRmsc(pdc->getKey_constRef<delphi_real>(
"res1")),
213 fMaxc(pdc->getKey_constRef<delphi_real>(
"res2")),
214 bLogGraph(pdc->getKey_constRef<
bool>(
"igraph")),
215 bLogPotential(pdc->getKey_constRef<
bool>(
"ipoten")),
216 bManualRelaxParam(pdc->getKey_constRef<
bool>(
"imanual")),
218 strEpsFile(pdc->getKey_constRef<
string>(
"epsnam")),
219 strPhiiFile(pdc->getKey_constRef<
string>(
"phiinam")),
221 bDbOut(pdc->getKey_constRef<
bool>(
"idbwrt")),
222 bGridCrgOut(pdc->getKey_constRef<
bool>(
"iwgcrg")),
223 bEpsOut(pdc->getKey_constRef<
bool>(
"epswrt")),
224 bIonsEng(pdc->getKey_constRef<
bool>(
"logions")),
226 fEpsOut(pdc->getKey_constRef<delphi_real>(
"epsout")),
227 fDebyeLength(pdc->getKey_constRef<delphi_real>(
"deblen")),
228 fScale(pdc->getKey_constRef<delphi_real>(
"scale")),
229 fEpsIn(pdc->getKey_constRef<delphi_real>(
"epsin")),
230 fIonStrength(pdc->getKey_constRef<delphi_real>(
"rionst")),
231 iDirectEpsMap(pdc->getKey_constRef<
int>(
"idirectalg")),
232 fEPKT(pdc->getKey_constRef<delphi_real>(
"epkt")),
235 fTaylorCoeff2(pdc->getKey_constRef<delphi_real>(
"chi2")),
236 fTaylorCoeff3(pdc->getKey_constRef<delphi_real>(
"chi3")),
237 fTaylorCoeff4(pdc->getKey_constRef<delphi_real>(
"chi4")),
238 fTaylorCoeff5(pdc->getKey_constRef<delphi_real>(
"chi5")),
240 iMediaNum(pdc->getKey_constRef<delphi_integer>(
"nmedia")),
241 iObjectNum(pdc->getKey_constRef<delphi_integer>(
"nobject")),
242 prgfMediaEps(pdc->getKey_constRef< vector<delphi_real> >(
"medeps")),
244 iCrgGridNum(pdc->getKey_constRef<delphi_integer>(
"nqass")),
245 fMinusCrg(pdc->getKey_constRef<delphi_real>(
"qmin")),
246 fPlusCrg(pdc->getKey_constRef<delphi_real>(
"qplus")),
249 iBndyGridNum(pdc->getKey_constRef<delphi_integer>(
"ibnum")),
252 prgbDielecMap(pdc->getKey_constRef< vector<bool> >(
"idebmap")),
253 iCrg2GridNum(pdc->getKey_constRef<delphi_integer>(
"nqgrd")),
255 prgiCrg2GridMap(pdc->getKey_constRef< vector<delphi_integer> >(
"nqgrdtonqass")),
256 prgfAtomEps(pdc->getKey_constRef< vector<delphi_real> >(
"atmeps")),
261 iGrid(pdc->getKey_Ref<delphi_integer>(
"igrid")),
262 iBndyType(pdc->getKey_Ref<
int>(
"ibctyp")),
263 fNetCrg(pdc->getKey_Ref<delphi_real>(
"qnet")),
264 iLinIterateNum(pdc->getKey_Ref<
int>(
"nlit")),
265 iIterateInterval(pdc->getKey_Ref<
int>(
"icon1")),
266 iConvergeFract(pdc->getKey_Ref<
int>(
"icon2")),
267 fRelaxParam(pdc->getKey_Ref<delphi_real>(
"relpar")),
269 iDielecBndyOdd(pdc->getKey_Ref<delphi_integer>(
"icount2b")),
270 iCrgedGridSum(pdc->getKey_Ref<delphi_integer>(
"icount1b")),
271 prgfGridCrg(pdc->getKey_Ref< vector<delphi_real> >(
"gchrg")),
273 iCrgBndyGridNum(pdc->getKey_Ref<delphi_integer>(
"ibc")),
274 prgdgvCrgBndyGrid(pdc->getKey_Ref< vector<SDoubleGridValue> >(
"cgbp")),
275 prgfPhiMap(pdc->getKey_Ref< vector<delphi_real> >(
"phimap")),
283 iTotalGridNum(iGrid*iGrid*iGrid+1),
284 iHalfGridNum(iTotalGridNum/2),
285 iBndyDielecNum(2*(iBndyGridNum+1)),
286 fDebFct(fEpsOut/(fDebyeLength*fScale*fDebyeLength*fScale)),
287 fEpsDiff(fEpsIn-fEpsOut),
288 fSixEps(fEpsOut*6.0),
289 iEpsDim(iAtomNum+iObjectNum+2),
295 cout <<
"****************************************************************\n";
296 cout <<
"* CDelphiFastSOR is constructed *\n";
297 cout <<
"****************************************************************\n";
300 if (0 != strBioModel.compare(
"PBE") && 0 != strNumSolver.compare(
"DELPHI"))
307 prgfPhiMap.assign(iGrid*iGrid*iGrid,0.0);
308 qmap1.assign(iHalfGridNum,0.0);
309 qmap2.assign(iHalfGridNum,0.0);
317 cout <<
"****************************************************************\n";
318 cout <<
"* CDelphiFastSOR is destroyed *\n";
319 cout <<
"****************************************************************\n";
324 void getMCCE(
SMCCE* mcce_data) { pmcce = mcce_data; }
327 virtual void validateInput();
332 #endif // SOLVER_FASTSOR_H
Definition: solver_fastSOR.h:20
Definition: solver_exceptions.h:6
Definition: delphi_constants.h:73
Definition: interface_abstractmodule.h:23