6 |
|
#include "PDBReader.hpp" |
7 |
|
#include "RigidBody.hpp" |
8 |
|
#include "GridBuilder.hpp" |
9 |
+ |
#include "SphereHarm.hpp" |
10 |
|
|
11 |
|
#define MK_STR(s) # s |
12 |
|
#define STR_DEFINE(t, s) t = MK_STR(s) |
58 |
|
vector<double> sigmaGrid; |
59 |
|
vector<double> epsGrid; |
60 |
|
vector<double> sGrid; |
61 |
+ |
SphereHarm* harmonize; |
62 |
|
|
63 |
|
double mass, rpar, eps; |
64 |
+ |
double xyz3[3]; |
65 |
+ |
double moments[3][3]; |
66 |
|
string fileName; |
67 |
|
char vdwFileName[2002]; |
68 |
|
char structureFileName[2002]; |
69 |
|
char temp[200]; |
70 |
|
char readLine[500]; |
71 |
+ |
char xyzFile[200]; |
72 |
+ |
char shapeFile[200]; |
73 |
+ |
char shapeName[80]; |
74 |
|
FILE *vdwFile, *structureFile; |
75 |
|
char* ffPath_env = "VDW_PATH"; |
76 |
|
char* ffPath; |
78 |
|
char* foo; |
79 |
|
char* myType; |
80 |
|
char* vType; |
81 |
+ |
char *token; |
82 |
+ |
const char *file; |
83 |
+ |
const char *period = "."; |
84 |
+ |
int k; |
85 |
|
int lineNum; |
86 |
|
int nTokens; |
87 |
|
int FF; |
88 |
|
int bandwidth; |
89 |
+ |
int gridwidth; |
90 |
|
short int gotMatch; |
91 |
|
|
92 |
|
//parse the command line options |
101 |
|
exit(1); |
102 |
|
} |
103 |
|
|
104 |
< |
//the bandwidth has a default value (default=8), so it is always given |
104 |
> |
file = fileName.c_str(); |
105 |
> |
strcpy(xyzFile, file); |
106 |
> |
token = strtok(xyzFile, period); |
107 |
> |
strcpy(xyzFile, token); |
108 |
> |
strcpy(shapeFile, token); |
109 |
> |
strcpy(shapeName, token); |
110 |
> |
strcat(xyzFile, "Ref.xyz"); |
111 |
> |
strcat(shapeFile, ".shape"); |
112 |
> |
strcat(shapeName, "_RB_0"); |
113 |
> |
ofstream xfiles(xyzFile); |
114 |
> |
|
115 |
> |
//the bandwidth has a default value (default=16), so it is always given |
116 |
|
bandwidth = args_info.bandwidth_arg; |
117 |
+ |
gridwidth = bandwidth*2; |
118 |
|
|
119 |
|
if (args_info.charmm_given) { |
120 |
|
FF=CHARMM; |
265 |
|
for( j = theAtoms.begin(); j != theAtoms.end(); ++j){ |
266 |
|
rb->addAtom(*j); |
267 |
|
} |
268 |
< |
|
268 |
> |
|
269 |
|
rb->calcRefCoords(); |
270 |
|
|
271 |
< |
gb = new GridBuilder(rb, bandwidth); |
271 |
> |
//print a reference coordinate xyz file |
272 |
> |
xfiles << rb->getNumAtoms() << "\n\n"; |
273 |
> |
for (k=0; k<rb->getNumAtoms(); k++){ |
274 |
> |
rb->getAtomRefCoor(xyz3, k); |
275 |
> |
xfiles << rb->getAtomBase(k) << "\t" << |
276 |
> |
xyz3[0] << "\t" << xyz3[1] << "\t" << |
277 |
> |
xyz3[2] << "\n"; |
278 |
> |
} |
279 |
> |
|
280 |
> |
gb = new GridBuilder(rb, gridwidth); |
281 |
|
|
282 |
+ |
cout << "Doing GridBuilder calculations...\n"; |
283 |
|
gb->launchProbe(FF, sigmaGrid, sGrid, epsGrid); |
284 |
+ |
|
285 |
+ |
gb->printGridFiles(); |
286 |
+ |
|
287 |
+ |
//load the grid element values to the main grid vectors |
288 |
+ |
for (k=0; k<gridwidth*gridwidth; k++){ |
289 |
+ |
sigmaGrid.push_back(gb->passSig(k)); |
290 |
+ |
sGrid.push_back(gb->passS(k)); |
291 |
+ |
epsGrid.push_back(gb->passEps(k)); |
292 |
+ |
} |
293 |
|
|
294 |
< |
|
294 |
> |
//build the spherical harmonic transform object |
295 |
> |
harmonize = new SphereHarm( bandwidth ); |
296 |
> |
rb->getI(moments); |
297 |
> |
harmonize->printShapesFileStart(shapeFile, shapeName, rb->getMass(), |
298 |
> |
moments); |
299 |
> |
|
300 |
> |
//do the transforms and write to the shapes file |
301 |
> |
harmonize->doTransforms(sigmaGrid); |
302 |
> |
harmonize->printToShapesFile(shapeFile, 0); |
303 |
> |
harmonize->doTransforms(sGrid); |
304 |
> |
harmonize->printToShapesFile(shapeFile, 1); |
305 |
> |
harmonize->doTransforms(epsGrid); |
306 |
> |
harmonize->printToShapesFile(shapeFile, 2); |
307 |
> |
|
308 |
> |
//clean everything up |
309 |
> |
harmonize->~SphereHarm(); |
310 |
|
} |
311 |
|
|
312 |
|
int count_tokens(char *line, char *delimiters) { |