delphi_cb
 All Classes Namespaces Files Functions Variables Macros
delphi_data.h
Go to the documentation of this file.
1 
11 #ifndef CDELPHIDATA_H_
12 #define CDELPHIDATA_H_
13 
14 #include <iostream>
15 #include <string>
16 #include <vector>
17 #include <memory> // std::shared_ptr
18 
19 #include "../misc/misc_grid.h"
20 #include "../misc/misc_timer.h"
21 #include "../io/io_datatype.h"
22 #include "../interface/environment.h"
23 #include "../interface/interface_datacontainer.h"
24 #include "delphi_datamarshal.h"
25 
26 using namespace std;
27 
28 //-----------------------------------------------------------------------//
29 
30 class CDelphiData:virtual public IDataContainer
31 {
32  private:
36  shared_ptr<CDelphiDataMarshal> pddm;
37 
41  void flash() const;
42 
46  virtual void setMap();
47 
48  public:
59  CDelphiData(int argc,char* argv[],shared_ptr<CTimer> pTimer):pddm(new CDelphiDataMarshal(argc,argv,pTimer))
60  {
61 #ifdef DEBUG_OBJECT
62  cout << endl;
63  cout << "****************************************************************\n";
64  cout << "* CDelphiData is constructed *\n";
65  cout << "****************************************************************\n";
66 #endif
67 
68  flash();
69 
70  pTimer->start(); // start to record program execution time
71 
72  pddm->read(pddm->strParamFile);
73 
74  pddm->updateParameters();
75 
76  setMap();
77 
78 #ifdef DEBUG_DELPHI_MAP
79  showMap("delphicpp_datacontainer.dat");
80 #endif
81 
82  pddm.~shared_ptr(); // destroy the CDelphiDataMarshal object
83  };
84 
94  CDelphiData(SMCCE * mcce_data,shared_ptr<CTimer> pTimer):pddm(new CDelphiDataMarshal(pTimer))
95  {
96 #ifdef DEBUG_OBJECT
97  cout << endl;
98  cout << "****************************************************************\n";
99  cout << "* CDelphiData is constructed *\n";
100  cout << "****************************************************************\n";
101 #endif
102 
103  flash();
104 
105  pTimer->start(); // start to record program execution time
106 
107  /*
108  * Get values from struct mcce_data instead of reading the parameter file.
109  * The same constrains described in getStatement and getFunction must be applied here as well
110  * in order to maintain consistency.
111  */
112 
113  // equivalent to gsize = value in the parameter file
114  pddm->iGrid = mcce_data->gsize;
115  if (5 > pddm->iGrid || 2000 < pddm->iGrid) COutOfRange_GSIZE warning(pddm->iGrid);
116 
117  // equivalent to scale = value in the parameter file
118  pddm->fScale = (mcce_data->grids_per_ang+0.01*(float)mcce_data->n_retry)/pow(2,mcce_data->del_runs-1);
119  if (0.0 >= pddm->fScale || 40.0 <= pddm->fScale) COutofRange_SCALE warning(pddm->fScale);
120 
121  // equivalent to in(modpdb,file=\"apbs.pqr\",format=pqr) in the parameter file
122  pddm->strPdbFile = mcce_data->pdbfile;
123  pddm->iPdbFormatIn = mcce_data->pdbformat;
124 
125  // equivalent to indi = value in the parameter file
126  pddm->fInDielec = mcce_data->indi;
127  if (1000.0 < pddm->fInDielec) COutOfRange_INDI warning(pddm->fInDielec);
128 
129  // equivalent to exdi = value in the parameter file
130  pddm->fExDielec = mcce_data->exdi;
131  if (0.0 >= pddm->fExDielec || 1000.0 < pddm->fExDielec) COutOfRange_EXDI warning(pddm->fExDielec);
132 
133  // equivalent to ionrad = value in the parameter file
134  pddm->fIonRadius = mcce_data->ionrad;
135  if (0.0 > pddm->fIonRadius || 10.0 < pddm->fIonRadius) COutOfRange_IONRAD warning(pddm->fIonRadius);
136 
137  // equivalent to prbrad = value in the parameter file
138  pddm->vctfProbeRadius[0] = mcce_data->prbrad;
139  if (0.0 > pddm->vctfProbeRadius[0] || 10.0 <= pddm->vctfProbeRadius[0]) COutOfRange_PRBRAD warning(pddm->vctfProbeRadius[0]);
140 
141  // equivalent to salt = value in the parameter file
142  pddm->vctfSalt[0] = mcce_data->salt;
143  if (0.0 > pddm->vctfSalt[0] || 10.0 < pddm->vctfSalt[0]) COutOfRange_SALT warning(pddm->vctfSalt[0]);
144 
145  // equivalent to bndcon = value in the parameter file
146  pddm->iBndyType = mcce_data->bndcon;
147 
148  /*
149  if (3 == mcce_data->bndcon)
150  {
151  // equivalent to in(phi,file="run.phi") in the parameter file
152  pddm->vctfPhiMap = mcce_data->phimap;
153  pddm->fScale = mcce_data->scale;
154  pddm->gfBoxCenter = mcce_data->oldmid;
155  pddm->iGrid = mcce_data->igrid;
156  }
157  */
158 
159  // equivalent to center(x,y,z) in the parameter file
160  pddm->gfOffCenter.nX = mcce_data->center[0]; pddm->gfOffCenter.nY = mcce_data->center[1]; pddm->gfOffCenter.nZ = mcce_data->center[2];
161 
162  // equivalent to out(frc,file="filename") in the parameter file
163  pddm->bSiteOut = true; //pddm->strFrcFile = mcce_data->frcfile;
164 
165  // equivalent to out(phi,file="filename") in the parameter file
166  //pddm->bPhimapOut = true; pddm->strPhiFile = mcce_data->phifile;
167 
168  // equivalent to site(a,c,p) in the parameter file
169  pddm->bAtomInSite = true; pddm->bCoulombPotentialInSite = true; pddm->bGridPotentialInSite = true;
170 
171  // equivalent to energy(g,s) in the parameter file
172  pddm->bGridEng = true; pddm->bSolvEng = true;
173 
174  // equivalent to relaxationfactor=0.8 in the parameter file
175  pddm->bSpectralRadius = true; pddm->fSpectralRadius = 0.8;
176 
177  pddm->updateParameters();
178 
179  setMap();
180 
181  pddm.~shared_ptr(); // destroy the CDelphiDataMarshal object
182  };
183 
188  {
189 #ifdef DEBUG_OBJECT
190  cout << endl;
191  cout << "****************************************************************\n";
192  cout << "* CDelphiData is destroyed *\n";
193  cout << "****************************************************************\n";
194 #endif
195  }
196 
204  virtual void showMap(const string& strMapFile);
205 
213  virtual void reset(const string& strF95File);
214 };
215 
216 
217 #endif // CDELPHIDATA_H_
Definition: delphi_exceptions.h:317
~CDelphiData()
Definition: delphi_data.h:187
class CDelphiDataMarshal
Definition: delphi_exceptions.h:261
CDelphiData(SMCCE *mcce_data, shared_ptr< CTimer > pTimer)
Definition: delphi_data.h:94
Definition: interface_datacontainer.h:31
Definition: delphi_data.h:30
Definition: delphi_exceptions.h:471
Definition: delphi_constants.h:73
CDelphiData(int argc, char *argv[], shared_ptr< CTimer > pTimer)
Definition: delphi_data.h:59
Definition: delphi_exceptions.h:331
Definition: delphi_datamarshal.h:38
Definition: delphi_exceptions.h:303
Definition: delphi_exceptions.h:387
Definition: delphi_exceptions.h:345