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 1275 by chrisfen, Tue Jun 15 22:36:23 2004 UTC

# Line 4 | Line 4
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)
# Line 47 | Line 48 | int main(int argc, char* argv[]){
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;
# Line 67 | Line 69 | int main(int argc, char* argv[]){
69    int lineNum;
70    int nTokens;
71    int FF;
72 +  int bandwidth;
73    short int gotMatch;
74  
75    //parse the command line options
# Line 81 | Line 84 | int main(int argc, char* argv[]){
84      exit(1);
85    }
86  
87 +  //the bandwidth has a default value (default=8), so it is always given
88 +  bandwidth = args_info.bandwidth_arg;
89 +  
90    if (args_info.charmm_given) {
91      FF=CHARMM;
92      strcpy(vdwFileName, "charmm27.vdw");
# Line 106 | Line 112 | int main(int argc, char* argv[]){
112      strcpy(vdwFileName, "oplsaal.vdw");
113    }
114  
115 +
116 +  printf ("opening %s\n", vdwFileName);
117    vdwFile = fopen( vdwFileName, "r" );
118    
119    if( vdwFile == NULL ){
# Line 122 | Line 130 | int main(int argc, char* argv[]){
130      strcat( temp, vdwFileName );
131      strcpy( vdwFileName, temp );
132      
133 +    printf ("opening %s\n", vdwFileName);
134      vdwFile = fopen( vdwFileName, "r" );
135      
136      if( vdwFile == NULL ){
# Line 132 | Line 141 | int main(int argc, char* argv[]){
141                 vdwFileName );
142        exit(-1);
143      }
144 <    printf( "VDW file %s opened sucessfully.\n", vdwFileName );
145 <    lineNum = 0;
146 <    
144 >  }
145 >  printf( "VDW file %s opened sucessfully.\n", vdwFileName );
146 >  lineNum = 0;
147 >  
148 >  eof_test = fgets( readLine, sizeof(readLine), vdwFile );
149 >  lineNum++;
150 >  
151 >  if( eof_test == NULL ){
152 >    printf("Error in reading Atoms from force file at line %d.\n",
153 >           lineNum );
154 >    exit(-1);
155 >  }
156 >  
157 >  while( eof_test != NULL ){
158 >    // toss comment lines
159 >    if( readLine[0] != '!' && readLine[0] != '#' ){
160 >      
161 >      nTokens = count_tokens(readLine, " ,;\t");
162 >      if (nTokens < 4) {
163 >        printf("Not enough tokens on line %d.\n", lineNum);
164 >        exit(-1);
165 >      }
166 >      
167 >      at = new Atype();
168 >      foo = strtok(readLine, " ,;\t");
169 >      at->setType(foo);
170 >      foo = strtok(NULL, " ,;\t");      
171 >      mass = atof(foo);
172 >      at->setMass(mass);
173 >      foo = strtok(NULL, " ,;\t");
174 >      rpar = atof(foo);
175 >      at->setRpar(rpar);
176 >      foo = strtok(NULL, " ,;\t");
177 >      eps = atof(foo);  
178 >      at->setEps(eps);
179 >      vdwAtypes.push_back(at);        
180 >    }
181      eof_test = fgets( readLine, sizeof(readLine), vdwFile );
182      lineNum++;
183 <    
184 <    if( eof_test == NULL ){
185 <      printf("Error in reading Atoms from force file at line %d.\n",
186 <             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 <  }
183 >  }          
184 >  
185 >  fclose( vdwFile );
186 >  
187    printf("%d Atom Types read from VDW file\n", vdwAtypes.size());
188  
189    // Now, open and parse the input file!
# Line 222 | Line 232 | int main(int argc, char* argv[]){
232      }
233    }
234  
235 <  //GridBuilder gb = new GridBuilder();
236 <  //gb->findAxesAndOrigin(theAtoms);
235 >  rb = new RigidBody();
236 >  for( j = theAtoms.begin(); j !=  theAtoms.end(); ++j){
237 >    rb->addAtom(*j);
238 >  }
239 >  
240 >  //GridBuilder gb = new GridBuilder(rb);
241 >
242    //gb->launchProbe(FF, sigmaGrid, sGrid, epsGrid);
228
243  
244 +  
245   }
246  
247   int count_tokens(char *line, char *delimiters) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines