Changeset c75363 for molecuilder/src/parser.cpp
- Timestamp:
- May 2, 2008, 1:25:48 PM (17 years ago)
- Children:
- 30fda2
- Parents:
- e936b3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/parser.cpp
re936b3 rc75363 43 43 stringstream line; 44 44 45 line << argv[1] << FRAGMENTPREFIX << TEFACTORSFILE;45 //line << argv[1] << FRAGMENTPREFIX << TEFACTORSFILE; 46 46 return FilePresent(line.str().c_str()); 47 47 }; … … 106 106 // count the number of matrices 107 107 MatrixCounter = -1; // we count one too much 108 line << name << FRAGMENTPREFIX << TEFACTORSFILE;108 line << name << FRAGMENTPREFIX << KEYSETFILE; 109 109 input.open(line.str().c_str(), ios::in); 110 110 if (input == NULL) { … … 417 417 bool ForceMatrix::ParseIndices(char *name) 418 418 { 419 ifstream input;420 char *FragmentNumber = NULL;421 char filename[1023];422 stringstream line;423 424 419 cout << "Parsing force indices." << endl; 425 420 Indices = (int **) Malloc(sizeof(int *)*(MatrixCounter+1), "ForceMatrix::ParseIndices: **Indices"); 426 line << name << FRAGMENTPREFIX << FORCESFILE; 427 input.open(line.str().c_str(), ios::in); 428 //cout << "Opening " << line.str() << " ... " << input << endl; 429 if (input == NULL) { 430 cout << endl << "Unable to open " << line.str() << ", is the directory correct?" << endl; 431 return false; 432 } 433 for (int i=0;(i<MatrixCounter) && (!input.eof());i++) { 434 // get the number of atoms for this fragment 435 stringstream line; 436 input.getline(filename, 1023); 437 line.str(filename); 438 // parse the values 421 for (int i=0;i<MatrixCounter;i++) { 439 422 Indices[i] = (int *) Malloc(sizeof(int)*RowCounter[i], "ForceMatrix::ParseIndices: *Indices[]"); 440 FragmentNumber = FixedDigitNumber(MatrixCounter, i); 441 cout << FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:"; 442 Free((void **)&FragmentNumber, "ForceMatrix::ParseIndices: *FragmentNumber"); 443 for(int j=0;(j<RowCounter[i]) && (!line.eof());j++) { 444 line >> Indices[i][j]; 445 cout << " " << Indices[i][j]; 446 } 447 cout << endl; 423 for(int j=0;j<RowCounter[i];j++) 424 Indices[i][j] = j; 448 425 } 449 426 Indices[MatrixCounter] = (int *) Malloc(sizeof(int)*RowCounter[MatrixCounter], "ForceMatrix::ParseIndices: *Indices[]"); … … 451 428 Indices[MatrixCounter][j] = j; 452 429 } 453 input.close();454 430 return true; 455 431 };
Note:
See TracChangeset
for help on using the changeset viewer.