--- trunk/OOPSE/libmdtools/ZConsReader.cpp 2004/03/01 20:01:50 1074 +++ trunk/OOPSE/libmdtools/ZConsReader.cpp 2004/04/14 15:37:41 1108 @@ -118,23 +118,28 @@ void ZConsReader::readHeader(){ zconsPos.push_back(zmolPos); } + curZPos.resize(nZMol); + curFZ.resize(nZMol); } void ZConsReader::readNextFrame(){ const int MAXBUFFERSIZE = 2000; char line[MAXBUFFERSIZE]; int tempNZMol; - int zmolIndex; - float zmolPos; - float zmolForce; int sscanfCount; - + int tempIndex; + float tempCurTime; + float tempFZ; + float tempCurZPos; + float tempZconsPos; + istream->getline(line, MAXBUFFERSIZE); - sscanfCount = sscanf(line, "%f", curTime); + sscanfCount = sscanf(line, "%f", &tempCurTime); if (sscanfCount != 1){ cerr << "ZConsReader Error : reading file error" << endl; exit(1); } + curTime = tempCurTime; istream->getline(line, MAXBUFFERSIZE); sscanfCount = sscanf(line, "%d", &tempNZMol); @@ -150,11 +155,16 @@ void ZConsReader::readNextFrame(){ for(int i = 0; i < nZMol; i++){ istream->getline(line, MAXBUFFERSIZE); - sscanfCount = sscanf(line, "%d\t%f\t%f", &zmolIndex, &zmolForce, &zmolPos); - if (sscanfCount != 3){ + sscanfCount = sscanf(line, "%d\t%f\t%f\t%f", &tempIndex, &tempFZ, &tempCurZPos,&tempZconsPos); + if (sscanfCount != 4){ cerr << "ZConsReader Error : reading file error" << endl; exit(1); } + + index[i] = tempIndex; + curFZ[i] = tempFZ; + curZPos[i]= tempCurZPos; + zconsPos[i] = tempZconsPos; } }