4 |
|
#include <vector> |
5 |
|
#include "forcerCmd.h" |
6 |
|
#include "PDBReader.hpp" |
7 |
+ |
#include "RigidBody.hpp" |
8 |
|
|
9 |
|
#define MK_STR(s) # s |
10 |
|
#define STR_DEFINE(t, s) t = MK_STR(s) |
48 |
|
vector<Atype*> vdwAtypes; |
49 |
|
vector<Atype*>::iterator i; |
50 |
|
Atype* at; |
51 |
+ |
RigidBody* rb; |
52 |
|
vector<VDWAtom*> theAtoms; |
53 |
|
vector<VDWAtom*>::iterator j; |
54 |
|
VDWAtom* atom; |
108 |
|
strcpy(vdwFileName, "oplsaal.vdw"); |
109 |
|
} |
110 |
|
|
111 |
+ |
|
112 |
+ |
printf ("opening %s\n", vdwFileName); |
113 |
|
vdwFile = fopen( vdwFileName, "r" ); |
114 |
|
|
115 |
|
if( vdwFile == NULL ){ |
126 |
|
strcat( temp, vdwFileName ); |
127 |
|
strcpy( vdwFileName, temp ); |
128 |
|
|
129 |
+ |
printf ("opening %s\n", vdwFileName); |
130 |
|
vdwFile = fopen( vdwFileName, "r" ); |
131 |
|
|
132 |
|
if( vdwFile == NULL ){ |
137 |
|
vdwFileName ); |
138 |
|
exit(-1); |
139 |
|
} |
140 |
< |
printf( "VDW file %s opened sucessfully.\n", vdwFileName ); |
141 |
< |
lineNum = 0; |
142 |
< |
|
140 |
> |
} |
141 |
> |
printf( "VDW file %s opened sucessfully.\n", vdwFileName ); |
142 |
> |
lineNum = 0; |
143 |
> |
|
144 |
> |
eof_test = fgets( readLine, sizeof(readLine), vdwFile ); |
145 |
> |
lineNum++; |
146 |
> |
|
147 |
> |
if( eof_test == NULL ){ |
148 |
> |
printf("Error in reading Atoms from force file at line %d.\n", |
149 |
> |
lineNum ); |
150 |
> |
exit(-1); |
151 |
> |
} |
152 |
> |
|
153 |
> |
while( eof_test != NULL ){ |
154 |
> |
// toss comment lines |
155 |
> |
if( readLine[0] != '!' && readLine[0] != '#' ){ |
156 |
> |
|
157 |
> |
nTokens = count_tokens(readLine, " ,;\t"); |
158 |
> |
if (nTokens < 4) { |
159 |
> |
printf("Not enough tokens on line %d.\n", lineNum); |
160 |
> |
exit(-1); |
161 |
> |
} |
162 |
> |
|
163 |
> |
at = new Atype(); |
164 |
> |
foo = strtok(readLine, " ,;\t"); |
165 |
> |
at->setType(foo); |
166 |
> |
foo = strtok(NULL, " ,;\t"); |
167 |
> |
mass = atof(foo); |
168 |
> |
at->setMass(mass); |
169 |
> |
foo = strtok(NULL, " ,;\t"); |
170 |
> |
rpar = atof(foo); |
171 |
> |
at->setRpar(rpar); |
172 |
> |
foo = strtok(NULL, " ,;\t"); |
173 |
> |
eps = atof(foo); |
174 |
> |
at->setEps(eps); |
175 |
> |
vdwAtypes.push_back(at); |
176 |
> |
} |
177 |
|
eof_test = fgets( readLine, sizeof(readLine), vdwFile ); |
178 |
|
lineNum++; |
179 |
< |
|
180 |
< |
if( eof_test == NULL ){ |
181 |
< |
printf("Error in reading Atoms from force file at line %d.\n", |
182 |
< |
lineNum ); |
144 |
< |
exit(-1); |
145 |
< |
} |
146 |
< |
|
147 |
< |
while( eof_test != NULL ){ |
148 |
< |
// toss comment lines |
149 |
< |
if( readLine[0] != '!' && readLine[0] != '#' ){ |
150 |
< |
|
151 |
< |
nTokens = count_tokens(readLine, " ,;\t"); |
152 |
< |
if (nTokens < 4) { |
153 |
< |
printf("Not enough tokens on line %d.\n", lineNum); |
154 |
< |
exit(-1); |
155 |
< |
} |
156 |
< |
|
157 |
< |
at = new Atype(); |
158 |
< |
foo = strtok(readLine, " ,;\t"); |
159 |
< |
at->setType(foo); |
160 |
< |
foo = strtok(NULL, " ,;\t"); |
161 |
< |
mass = atof(foo); |
162 |
< |
at->setMass(mass); |
163 |
< |
foo = strtok(NULL, " ,;\t"); |
164 |
< |
rpar = atof(foo); |
165 |
< |
at->setRpar(rpar); |
166 |
< |
foo = strtok(NULL, " ,;\t"); |
167 |
< |
eps = atof(foo); |
168 |
< |
at->setEps(eps); |
169 |
< |
vdwAtypes.push_back(at); |
170 |
< |
} |
171 |
< |
eof_test = fgets( readLine, sizeof(readLine), vdwFile ); |
172 |
< |
lineNum++; |
173 |
< |
} |
174 |
< |
|
175 |
< |
fclose( vdwFile ); |
176 |
< |
} |
179 |
> |
} |
180 |
> |
|
181 |
> |
fclose( vdwFile ); |
182 |
> |
|
183 |
|
printf("%d Atom Types read from VDW file\n", vdwAtypes.size()); |
184 |
|
|
185 |
|
// Now, open and parse the input file! |
228 |
|
} |
229 |
|
} |
230 |
|
|
231 |
< |
//GridBuilder gb = new GridBuilder(); |
232 |
< |
//gb->findAxesAndOrigin(theAtoms); |
231 |
> |
rb = new RigidBody(); |
232 |
> |
for( j = theAtoms.begin(); j != theAtoms.end(); ++j){ |
233 |
> |
rb->addAtom(*j); |
234 |
> |
} |
235 |
> |
|
236 |
> |
//GridBuilder gb = new GridBuilder(rb); |
237 |
|
//gb->launchProbe(FF, sigmaGrid, sGrid, epsGrid); |
238 |
< |
|
229 |
< |
|
238 |
> |
|
239 |
|
} |
240 |
|
|
241 |
|
int count_tokens(char *line, char *delimiters) { |