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 1244 by gezelter, Fri Jun 4 16:21:23 2004 UTC vs.
Revision 1285 by chrisfen, Tue Jun 22 18:04:58 2004 UTC

# Line 4 | Line 4
4   #include <vector>
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 47 | Line 49 | int main(int argc, char* argv[]){
49    vector<Atype*>   vdwAtypes;
50    vector<Atype*>::iterator i;
51    Atype* at;
52 +  RigidBody* rb;
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 67 | 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 81 | 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 106 | 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 122 | 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 132 | 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 );
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 <  }
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 222 | Line 237 | int main(int argc, char* argv[]){
237      }
238    }
239  
240 <  //GridBuilder gb = new GridBuilder();
241 <  //gb->findAxesAndOrigin(theAtoms);
242 <  //gb->launchProbe(FF, sigmaGrid, sGrid, epsGrid);
243 <
240 >  rb = new RigidBody();
241 >  for( j = theAtoms.begin(); j !=  theAtoms.end(); ++j){
242 >    rb->addAtom(*j);
243 >  }
244  
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