ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/SHAPES/forcer.cpp
(Generate patch)

Comparing trunk/SHAPES/forcer.cpp (file contents):
Revision 1271 by gezelter, Tue Jun 15 20:20:36 2004 UTC vs.
Revision 1285 by chrisfen, Tue Jun 22 18:04:58 2004 UTC

# Line 5 | Line 5
5   #include "forcerCmd.h"
6   #include "PDBReader.hpp"
7   #include "RigidBody.hpp"
8 + #include "GridBuilder.hpp"
9  
10   #define MK_STR(s) # s
11   #define STR_DEFINE(t, s) t = MK_STR(s)
# Line 52 | Line 53 | int main(int argc, char* argv[]){
53    vector<VDWAtom*> theAtoms;
54    vector<VDWAtom*>::iterator j;
55    VDWAtom* atom;
56 <
56 >  GridBuilder* gb;
57 >  vector<double> sigmaGrid;
58 >  vector<double> epsGrid;
59 >  vector<double> sGrid;
60 >  
61    double mass, rpar, eps;
62    string fileName;  
63    char vdwFileName[2002];
# Line 69 | Line 74 | int main(int argc, char* argv[]){
74    int lineNum;
75    int nTokens;
76    int FF;
77 +  int bandwidth;
78    short int gotMatch;
79  
80    //parse the command line options
# Line 83 | Line 89 | int main(int argc, char* argv[]){
89      exit(1);
90    }
91  
92 +  //the bandwidth has a default value (default=16), so it is always given
93 +  bandwidth = args_info.bandwidth_arg;
94 +  
95    if (args_info.charmm_given) {
96      FF=CHARMM;
97      strcpy(vdwFileName, "charmm27.vdw");
# Line 108 | Line 117 | int main(int argc, char* argv[]){
117      strcpy(vdwFileName, "oplsaal.vdw");
118    }
119  
120 +
121 +  printf ("opening %s\n", vdwFileName);
122    vdwFile = fopen( vdwFileName, "r" );
123    
124    if( vdwFile == NULL ){
# Line 124 | Line 135 | int main(int argc, char* argv[]){
135      strcat( temp, vdwFileName );
136      strcpy( vdwFileName, temp );
137      
138 +    printf ("opening %s\n", vdwFileName);
139      vdwFile = fopen( vdwFileName, "r" );
140      
141      if( vdwFile == NULL ){
# Line 134 | Line 146 | int main(int argc, char* argv[]){
146                 vdwFileName );
147        exit(-1);
148      }
149 <    printf( "VDW file %s opened sucessfully.\n", vdwFileName );
150 <    lineNum = 0;
151 <    
149 >  }
150 >  printf( "VDW file %s opened sucessfully.\n", vdwFileName );
151 >  lineNum = 0;
152 >  
153 >  eof_test = fgets( readLine, sizeof(readLine), vdwFile );
154 >  lineNum++;
155 >  
156 >  if( eof_test == NULL ){
157 >    printf("Error in reading Atoms from force file at line %d.\n",
158 >           lineNum );
159 >    exit(-1);
160 >  }
161 >  
162 >  while( eof_test != NULL ){
163 >    // toss comment lines
164 >    if( readLine[0] != '!' && readLine[0] != '#' ){
165 >      
166 >      nTokens = count_tokens(readLine, " ,;\t");
167 >      if (nTokens < 4) {
168 >        printf("Not enough tokens on line %d.\n", lineNum);
169 >        exit(-1);
170 >      }
171 >      
172 >      at = new Atype();
173 >      foo = strtok(readLine, " ,;\t");
174 >      at->setType(foo);
175 >      foo = strtok(NULL, " ,;\t");      
176 >      mass = atof(foo);
177 >      at->setMass(mass);
178 >      foo = strtok(NULL, " ,;\t");
179 >      rpar = atof(foo);
180 >      at->setRpar(rpar);
181 >      foo = strtok(NULL, " ,;\t");
182 >      eps = atof(foo);  
183 >      at->setEps(eps);
184 >      vdwAtypes.push_back(at);        
185 >    }
186      eof_test = fgets( readLine, sizeof(readLine), vdwFile );
187      lineNum++;
188 <    
189 <    if( eof_test == NULL ){
190 <      printf("Error in reading Atoms from force file at line %d.\n",
191 <             lineNum );
146 <      exit(-1);
147 <    }
148 <    
149 <    while( eof_test != NULL ){
150 <      // toss comment lines
151 <      if( readLine[0] != '!' && readLine[0] != '#' ){
152 <      
153 <        nTokens = count_tokens(readLine, " ,;\t");
154 <        if (nTokens < 4) {
155 <          printf("Not enough tokens on line %d.\n", lineNum);
156 <          exit(-1);
157 <        }
158 <              
159 <        at = new Atype();
160 <        foo = strtok(readLine, " ,;\t");
161 <        at->setType(foo);
162 <        foo = strtok(NULL, " ,;\t");      
163 <        mass = atof(foo);
164 <        at->setMass(mass);
165 <        foo = strtok(NULL, " ,;\t");
166 <        rpar = atof(foo);
167 <        at->setRpar(rpar);
168 <        foo = strtok(NULL, " ,;\t");
169 <        eps = atof(foo);  
170 <        at->setEps(eps);
171 <        vdwAtypes.push_back(at);        
172 <      }
173 <      eof_test = fgets( readLine, sizeof(readLine), vdwFile );
174 <      lineNum++;
175 <    }          
176 <    
177 <    fclose( vdwFile );
178 <  }
188 >  }          
189 >  
190 >  fclose( vdwFile );
191 >  
192    printf("%d Atom Types read from VDW file\n", vdwAtypes.size());
193  
194    // Now, open and parse the input file!
# Line 226 | Line 239 | int main(int argc, char* argv[]){
239  
240    rb = new RigidBody();
241    for( j = theAtoms.begin(); j !=  theAtoms.end(); ++j){
242 <          rb->addAtom(*j);
242 >    rb->addAtom(*j);
243    }
244  
245 <  //GridBuilder gb = new GridBuilder();
246 <  //gb->findAxesAndOrigin(theAtoms);
247 <  //gb->launchProbe(FF, sigmaGrid, sGrid, epsGrid);
235 <
245 >  rb->calcRefCoords();
246 >  
247 >  gb = new GridBuilder(rb, bandwidth*2);
248  
249 +  cout << "Doing GridBuilder calculations...\n";
250 +  gb->launchProbe(FF, sigmaGrid, sGrid, epsGrid);
251 +  
252 +  //write out the grid files
253 +  gb->printGridFiles();
254   }
255  
256   int count_tokens(char *line, char *delimiters) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines