delphi_cb
 All Classes Namespaces Files Functions Variables Macros
io.h
Go to the documentation of this file.
1 
8 #ifndef CIO_H_
9 #define CIO_H_
10 
11 #include <iostream>
12 #include <iomanip>
13 #include <fstream>
14 #include <string> // std::string
15 #include <vector> // std::vector
16 #include <locale>
17 #include <stdlib.h> // atof
18 #include <cmath>
19 
20 #include "../interface/environment.h"
21 #include "../misc/misc_grid.h"
22 #include "io_datatype.h"
23 #include "io_exceptions.h"
24 
25 using namespace std;
26 
27 const int SIZEFILE = 1;
28 const int CHARGEFILE = 2;
29 
30 const int STDPDB = 10;
31 const int MODPDB = 20;
32 const int PQRPDB = 21;
33 const int MOD4PDB = 30;
34 const int PQR4PDB = 31;
35 
36 class CIO
37 {
38  protected:
42  const delphi_real fDielec;
43 
47  const delphi_real fEPKT;
48 
49  /*
50  * ******************** miscellany functions defined in io_misc.cpp *******************
51  */
52 
58  string toUpperCase(const string& strLine);
59 
65  string removeSpace(const string& strLine);
66 
72  bool checkFileFormat(const string& strFile);
73 
74  /*
75  * ******************* for reading atom force (radii/size and charge) file *******************
76  * ********** these static attributes are declared here and defined in io_force.cpp **********
77  */
78 
83  static delphi_integer iRadiusNum;
84 
89  static vector<CForce> prgas;
90 
95  static delphi_integer iCrgNum;
96 
101  static vector<CForce> prgac;
102 
108  void readFileInNotPKFormat(ifstream& ifFileStream, const int& iFileType);
109 
115  void readFileInPKFormat(ifstream& ifFileStream, const int& iFileType);
116 
117 #ifdef DEBUG_IO_FORCE
118 
123  void printForce(const int& iFileType, const vector<CForce>& prgaf);
124 #endif
125 
136  delphi_integer FindRecordIndex(const string& strAtom,const string& strResidue,const string& strResidueNum,
137  const string& strChain,const delphi_integer& iRecordNum,vector<CForce>* prgaf);
138 
149  delphi_integer FindRecord(const string& strAtom,const string& strResidue,const string& strResidueNum,
150  const string& strChain,const int& iFileType, delphi_real& fValue);
151 
152  //void checkCharge(const bool& bSurfCrgInSite);
153 
154  /*
155  * ********** functions defined in io_pdb.cpp for reading PDB file in various formats ********
156  */
157 
162  delphi_integer iObjectMediaNum;
163 
168  void readStdPdbFile(ifstream& ifPdbFileStream);
169 
174  void readModFile1(ifstream& ifPdbFileStream);
175 
180  void readModFile4(ifstream& ifPdbFileStream);
181 
186  void readPqrFile(ifstream& ifPdbFileStream);
187 
192  void readMod4File(ifstream& ifPdbFileStream);
193 
198  void readPqr4File(ifstream& ifPdbFileStream);
199 
206  void readUnformattedPdb(const string& strPdbFile,ifstream& ifPdbFileStream,bool& bPostProcess);
207 
208 #ifdef DEBUG_IO_PDB
209 
212  void printPDB();
213 #endif
214 
220 
225  vector<delphi_integer> prgiObjectMediaNum;
226 
227  public:
228 
233  delphi_integer iMediaNum;
234 
239  delphi_integer iObjectNum;
240 
245  delphi_integer iAtomNum;
246 
251  delphi_integer iResidueNum;
252 
258 
263  vector<CAtomPdb> vctapAtomPdb;
264 
269  vector<delphi_real> vctfMediaEps;
270 
276  vector<string> vctstrObject;
277 
282  vector<delphi_integer> vctiAtomMediaNum;
283 
287  CIO():fDielec(4.0),fEPKT(167100.9162872952/297.3342119)
288  {
289 #ifdef DEBUG_OBJECT
290  cout << endl;
291  cout << "****************************************************************\n";
292  cout << "* CIO is constructed *\n";
293  cout << "****************************************************************\n";
294 #endif
295 
296  //iRadiusNum = 0;
297  //iCrgNum = 0;
298  iMediaNum = 1;
299  iObjectNum = 1;
300  iAtomNum = 0;
301  iObjectMediaNum = 1;
302  bOnlyMolecule = true;
303  bExistRadiiInfo = false;
304  iResidueNum = 0;
305  };
306 
310  CIO(delphi_real fDielecIn,delphi_real fEPKTIn):fDielec(fDielecIn),fEPKT(fEPKTIn)
311  {
312 #ifdef DEBUG_OBJECT
313  cout << endl;
314  cout << "****************************************************************\n";
315  cout << "* CIO is constructed *\n";
316  cout << "****************************************************************\n";
317 #endif
318 
319  //iRadiusNum = 0;
320  //iCrgNum = 0;
321  iMediaNum = 1;
322  iObjectNum = 1;
323  iAtomNum = 0;
324  iObjectMediaNum = 1;
325  bOnlyMolecule = true;
326  bExistRadiiInfo = false;
327  iResidueNum = 0;
328  };
329 
334  {
335 #ifdef DEBUG_OBJECT
336  cout << endl;
337  cout << "****************************************************************\n";
338  cout << "* CIO is destroyed *\n";
339  cout << "****************************************************************\n";
340 #endif
341  };
342 
343 
348  void readForceFile(const string& strFile);
349 
356  void readPdbFile(const string& strPdbFile,const int& iPdbFormat,const bool& bPdbUnformat);
357 
362  void writeUnformatPdb(const string& strPdbFile);
363 
369  void writeModifiedPdb(const string& strPdbFile,const int& iModPdbFormatOut);
370 
371  /*
372  * miscellany
373  */
374 
385  void setDelphiAtom(const bool& bSolvePB,const bool& bSurfCrgInSite,const string& strSizeFile,
386  const string& strCrgFile,const string& strPdbFile,const int& iPdbFormat,
387  const bool& bPdbUnformat);
388 
396  SGrid<delphi_real> readFrcFile(const string& strFrcFile,const SGrid<delphi_real>& fgOffCenter,
397  const delphi_real& fScale);
398 
410  void writeEpsMap(const delphi_integer& iAtomNumIn,const delphi_integer& iObjectNumIn,
411  const delphi_integer& iGrid,const delphi_real& fScale,const SGrid<delphi_real>& fgBoxCenter,
412  const vector< SGrid<delphi_integer> >& vctigEpsMap,const vector<bool>& vctbDielecMap,
413  const string& strEpsFile);
414 
415  /*
416  * for reading/writing PHI file
417  */
418 
419  /*
420  *for writing ENERGY file
421  */
422 
423  /*
424  * for writing HSURF2 file
425  */
426 
427  /*
428  *for writing SURFEN file
429  */
430 
431  /*
432  * for writing SCRG file
433  */
434 
435 };
436 
437 #endif // CIO_H_
static vector< CForce > prgac
Definition: io.h:101
delphi_integer iObjectNum
Definition: io.h:239
vector< CAtomPdb > vctapAtomPdb
Definition: io.h:263
static delphi_integer iRadiusNum
Definition: io.h:83
delphi_integer iResidueNum
Definition: io.h:251
vector< delphi_real > vctfMediaEps
Definition: io.h:269
const delphi_real fDielec
Definition: io.h:42
warnings/exceptions occurring in class CIO
CIO(delphi_real fDielecIn, delphi_real fEPKTIn)
Definition: io.h:310
vector< delphi_integer > vctiAtomMediaNum
Definition: io.h:282
static delphi_integer iCrgNum
Definition: io.h:95
~CIO()
Definition: io.h:333
delphi_integer iAtomNum
Definition: io.h:245
bool bExistRadiiInfo
Definition: io.h:219
Definition: io.h:36
defining data types used for IO class
static vector< CForce > prgas
Definition: io.h:89
bool bOnlyMolecule
Definition: io.h:257
delphi_integer iObjectMediaNum
Definition: io.h:162
const delphi_real fEPKT
Definition: io.h:47
delphi_integer iMediaNum
Definition: io.h:233
vector< delphi_integer > prgiObjectMediaNum
Definition: io.h:225
CIO()
Definition: io.h:287
vector< string > vctstrObject
Definition: io.h:276