delphi_cb
 All Classes Namespaces Files Functions Variables Macros
energy.h
1 /*
2  * energy.h
3  *
4  * Created on: Feb 23, 2014
5  * Author: Lin Wang, lwang3@g.clemson.edu
6  *
7  * This file declares the public and private variables in CDelphiEnergy Class.
8  *
9  */
10 
11 
12 #ifndef ENERGY_H_
13 #define ENERGY_H_
14 
15 #include <iostream>
16 #include <fstream>
17 #include <string>
18 #include <cmath>
19 #include <vector>
20 #include <iomanip>
21 #include "../interface/interface_abstractmodule.h"
22 #include "../misc/misc_timer.h"
23 #include "../misc/misc_grid.h"
24 #include "energy_exceptions.h"
25 
26 using namespace std;
27 
28 class CDelphiEnergy:virtual public IAbstractModule
29 {
30  private:
31 
32  shared_ptr<CTimer> pTimer;
33 
34  const int& iBndyType;
35  const string& strEnergyFile;
36  const string& strScrgFile;
37  const bool& bEngOut;
38  const bool& bSurfEngOut;
39  const bool& bSurfCrgOut;
40  const int& iSurfCrgFormatOut;
41  const bool& bGridEng;
42  const bool& bSolvEng;
43  const bool& bAnalySurfEng;
44  const bool& bAnalyEng;
45  const bool& bIonsEng;
46  const bool& bCoulombEng;
47  const bool& bPotentiallnSite;
48  const bool& bReactFieldlnFRC;
49  const bool& bBuffz;
50  const int& iCrgGridNum;
51  const delphi_real& fEpsOut;
52  const bool& bNonlinearEng;
53  const int& iMediaNum;
54 
55  const delphi_real& prgrMediaEps;
56  const int& prgiAtomMediaNum;
57  const int& iTotalBdyGridNum;
58  const int& iCrgBdyGrid;
59  const vector< SGrid<int> >& prgigBndyGrid;
60  const vector< SGridValue<delphi_real> >& prggvAtomicCrg;
61  const int& iGrid;
62  const int& iCrgedGridB;
63  const delphi_real& fEpsin;
64  // const bool& DEVELOPER; // Developer is not from datacontainer now. It changed to the flag.
65  const vector<delphi_real>& prgfPhimap;
66  const delphi_real& fScale;
67  const SGrid<delphi_real>& fgPotentialDrop;
68  const vector< SGrid<delphi_real> >& prgfgCrgPoseA;
69  const vector< SGrid<int> >& prgigGridCrgPose;
70  const vector<delphi_real>& prgfGridCrg;
71  const delphi_real& fIonStrength;
72  const SGrid<delphi_real>& fgBoxCenter;
73  const vector<bool>& prgbDielecMap;
74  const vector<delphi_real>& prgfAtomEps;
75  const SExtrema<int>& ieBuffz;
76 
77  const int& iObjectNum;
78  const int& iAtomNum;
79  const int& iDielecBndyOdd;
80  const delphi_real& fEPKT;
81  const vector<CAtomPdb>& prgapAtomPdb;
82  vector< SDoubleGridValue >& prgdgvCrgBndyGrid;
83  const vector< SGrid<delphi_real> >& prgfgSurfCrgA;
84  const vector<delphi_integer>& prgiCrgAt;
85  const vector<delphi_integer>& atsurf;
86 
87 
88  const delphi_real& fTaylorCoeff1;
89  const delphi_real& fTaylorCoeff2;
90  const delphi_real& fTaylorCoeff3;
91  const delphi_real& fTaylorCoeff4;
92  const delphi_real& fTaylorCoeff5;
93 
94  vector < SGridValue<delphi_real> > sout;
95  SGrid<int> lim_min, lim_max;
96 
97  vector <delphi_real>& schrg;
98  delphi_real& ergg;
99  delphi_real& ergc;
100  delphi_real& ergs;
101  delphi_real& ergr;
102  delphi_real& ergions;
103 
104  //***************//
105 
106  void energy_clb(delphi_real& ergc);
107  void energy_clbmedia(delphi_real& ergc);
108  void energy_clbnonl(delphi_real& ergc, delphi_real& ergest, int& igridout);
109  void energy_clbtotal(delphi_real& ergest, delphi_real& ergc);
110  void energy_react(delphi_real& ergs, delphi_real& ergas, int& iisitpot);
111  void energy_nonl(delphi_real& ergnl, int& igridout);
112 
113 
114  public:
115  CDelphiEnergy(shared_ptr<IDataContainer> pdc,shared_ptr<CTimer> pt):
116  IAbstractModule(pdc),
117  pTimer(pt),
118 
119  iBndyType(pdc->getKey_constRef<int>("ibctyp")),
120  strEnergyFile(pdc->getKey_constRef<string>("nrgnam")),
121  strScrgFile(pdc->getKey_constRef<string>("scrgnam")),
122  bEngOut(pdc->getKey_constRef<bool>("inrgwrt")),
123  bSurfEngOut(pdc->getKey_constRef<bool>("isen")),
124  bSurfCrgOut(pdc->getKey_constRef<bool>("isch")),
125  iSurfCrgFormatOut(pdc->getKey_constRef<int>("scrgfrm")),
126  bGridEng(pdc->getKey_constRef<bool>("logg")),
127  bSolvEng(pdc->getKey_constRef<bool>("logs")),
128  bAnalySurfEng(pdc->getKey_constRef<bool>("logas")),
129  bAnalyEng(pdc->getKey_constRef<bool>("loga")),
130  bIonsEng(pdc->getKey_constRef<bool>("logions")),
131  bCoulombEng(pdc->getKey_constRef<bool>("logc")),
132  bPotentiallnSite(pdc->getKey_constRef<bool>("isitpot")),
133  bReactFieldlnFRC(pdc->getKey_constRef<bool>("irea")),
134  bBuffz(pdc->getKey_constRef<bool>("ibufz")),
135  iCrgGridNum(pdc->getKey_constRef<delphi_integer>("nqass")),
136  fEpsOut(pdc->getKey_constRef<delphi_real>("epsout")),
137  bNonlinearEng(pdc->getKey_constRef<bool>("lognl")),
138  iMediaNum(pdc->getKey_constRef<delphi_integer>("nmedia")),
139  prgrMediaEps(pdc->getKey_constRef<delphi_real>("medeps")),
140  prgiAtomMediaNum(pdc->getKey_constRef<delphi_integer>("iatmmed")),
141  iTotalBdyGridNum(pdc->getKey_constRef<delphi_integer>("ibnum")),
142  iCrgBdyGrid(pdc->getKey_constRef<delphi_integer>("ibc")),
143  prgigBndyGrid(pdc->getKey_constRef< vector< SGrid<int> > >("ibgrd")),
144  iGrid(pdc->getKey_constRef<delphi_integer>("igrid")),
145  iCrgedGridB(pdc->getKey_constRef<delphi_integer>("icount1b")),
146  fEpsin(pdc->getKey_constRef<delphi_real>("epsin")),
147  // DEVELOPER(pdc->getKey_constRef<bool>("ideveloper")),
148  prgfPhimap(pdc->getKey_constRef< vector<delphi_real> >("phimap")), // phimap read function to convert to 3d array. //
149  fScale(pdc->getKey_constRef<delphi_real>("scale")),
150  fgPotentialDrop(pdc->getKey_constRef< SGrid<delphi_real> >("vdrop")),
151  prgfgCrgPoseA(pdc->getKey_constRef< vector< SGrid<delphi_real> > >("chgpos")),
152  prgfGridCrg(pdc->getKey_Ref< vector<delphi_real> >("gchrg")),
153  prgigGridCrgPose(pdc->getKey_constRef< vector< SGrid<int> > >("gchrgp")),
154  prggvAtomicCrg(pdc->getKey_constRef< vector< SGridValue<delphi_real> > >("atmcrg")),
155  fIonStrength(pdc->getKey_constRef<delphi_real>("rionst")),
156  fgBoxCenter(pdc->getKey_constRef< SGrid<delphi_real> >("oldmid")),
157  prgbDielecMap(pdc->getKey_constRef< vector<bool> >("idebmap")),
158  prgfAtomEps(pdc->getKey_constRef< vector<delphi_real> >("atmeps")),
159  ieBuffz(pdc->getKey_constRef< SExtrema<int> >("buffz")),
160 
161  iObjectNum(pdc->getKey_constRef<int>("nobject")),
162  iAtomNum(pdc->getKey_constRef<int>("natom")),
163  iDielecBndyOdd(pdc->getKey_constRef<int>("icount2b")),
164  fEPKT(pdc->getKey_constRef<delphi_real>("epkt")),
165  prgdgvCrgBndyGrid(pdc->getKey_Ref< vector<SDoubleGridValue> >("cgbp")),
166  prgapAtomPdb(pdc->getKey_Ref< vector<CAtomPdb> >("delphipdb")),
167  prgfgSurfCrgA(pdc->getKey_constRef< vector< SGrid<delphi_real> > >("scspos")),
168  prgiCrgAt(pdc->getKey_constRef< vector<delphi_integer> >("crgatn")),
169  atsurf(pdc->getKey_constRef< vector<delphi_integer> >("atsurf")),
170  fTaylorCoeff1(pdc->getKey_constRef<delphi_real>("chi1")),
171  fTaylorCoeff2(pdc->getKey_constRef<delphi_real>("chi2")),
172  fTaylorCoeff3(pdc->getKey_constRef<delphi_real>("chi3")),
173  fTaylorCoeff4(pdc->getKey_constRef<delphi_real>("chi4")),
174  fTaylorCoeff5(pdc->getKey_constRef<delphi_real>("chi5")),
175  schrg(pdc->getKey_Ref< vector<delphi_real> >("schrg")),
176  ergg(pdc->getKey_Ref<delphi_real>("ergg")),
177  ergc(pdc->getKey_Ref<delphi_real>("ergc")),
178  ergs(pdc->getKey_Ref<delphi_real>("ergs")),
179  ergr(pdc->getKey_Ref<delphi_real>("ergr")),
180  ergions(pdc->getKey_Ref<delphi_real>("ergions"))
181  {
182 #ifdef DEBUG_OBJECT
183  cout << endl;
184  cout << "****************************************************************\n";
185  cout << "* CDelphiEnergy is constructed *\n";
186  cout << "****************************************************************\n";
187 #endif
188  };
189 
190  ~CDelphiEnergy()
191  {
192 #ifdef DEBUG_OBJECT
193  cout << endl;
194  cout << "****************************************************************\n";
195  cout << "* CDelphiEnergy is destroyed *\n";
196  cout << "****************************************************************\n";
197 #endif
198  };
199 
200  virtual void validateInput(){};
201 
202  virtual void run();
203 
204 
205 };
206 
207 
208 
209 #endif /* ENERGY_H_ */
virtual void validateInput()
Definition: energy.h:200
Definition: interface_abstractmodule.h:23
Definition: energy.h:28