--- trunk/OOPSE/libmdtools/DumpReader.cpp 2003/10/28 16:03:37 829 +++ trunk/OOPSE/libmdtools/DumpReader.cpp 2004/03/01 20:01:50 1074 @@ -33,7 +33,7 @@ using namespace dumpRead; using namespace dumpRead; -DumpReader :: DumpReader( char *in_name ){ +DumpReader :: DumpReader(const char *in_name ){ isScanned = false; headFP = new FilePos; @@ -226,9 +226,9 @@ void DumpReader :: readSet( int whichFrame ){ framePos = frameStart[whichFrame]->getPos(); + fsetpos(inFile, framePos); - eof_test = fgets(read_buffer, sizeof(read_buffer), inFile); if( eof_test == NULL ){ sprintf( painCave.errMsg, @@ -316,7 +316,7 @@ void DumpReader :: readSet( int whichFrame ){ haveError = 0; if (worldRank == 0) { - + fsetpos(inFile, framePos); eof_test = fgets(read_buffer, sizeof(read_buffer), inFile); if( eof_test == NULL ){ sprintf( painCave.errMsg, @@ -497,17 +497,17 @@ char* DumpReader::parseDumpLine(char* readLine, int gl // set the string tokenizer foo = strtok(readLine, " ,;\t"); - + atoms[atomIndex]->setType(foo); // check the atom name to the current atom - if( strcmp( foo, atoms[atomIndex]->getType() ) ){ - sprintf( painCave.errMsg, - "Initialize from file error. Atom %s at index %d " - "in file %s does not" - " match the BASS atom %s.\n", - foo, atomIndex, inName, atoms[atomIndex]->getType() ); - return strdup( painCave.errMsg ); - } + //if( strcmp( foo, atoms[atomIndex]->getType() ) ){ + // sprintf( painCave.errMsg, + // "Initialize from file error. Atom %s at index %d " + // "in file %s does not" + // " match the BASS atom %s.\n", + // foo, atomIndex, inName, atoms[atomIndex]->getType() ); + // return strdup( painCave.errMsg ); + //} // get the positions @@ -686,6 +686,8 @@ char* DumpReader::parseCommentLine(char* readLine, dou char *foo; // the pointer to the current string token int j; + double chi, integralOfChidt; + double eta[9]; // set the string tokenizer @@ -785,7 +787,61 @@ char* DumpReader::parseCommentLine(char* readLine, dou } boxMat[8] = atof( foo ); + return NULL; + + //get chi and integralOfChidt, they should appear by pair + foo = strtok(NULL, " ,;\t\n"); + if(foo != NULL){ + chi = atof(foo); + + foo = strtok(NULL, " ,;\t\n"); + if(foo == NULL){ + sprintf( painCave.errMsg, + "chi and integralOfChidt should appear by pair in %s\n", inName ); + return strdup( painCave.errMsg ); + } + integralOfChidt = atof( foo ); + + //push chi and integralOfChidt into SimInfo::properties which can be + //retrieved by integrator later + DoubleData* chiValue = new DoubleData(); + chiValue->setID(CHIVALUE_ID); + chiValue->setData(chi); + simnfo->addProperty(chiValue); + + DoubleData* integralOfChidtValue = new DoubleData(); + integralOfChidtValue->setID(INTEGRALOFCHIDT_ID); + integralOfChidtValue->setData(integralOfChidt); + simnfo->addProperty(integralOfChidtValue); + + } + else + return NULL; + + //get eta + for(int i = 0 ; i < 9; i++){ + foo = strtok(NULL, " ,;\t"); + if(foo == NULL){ + sprintf( painCave.errMsg, + "error in reading eta[%d] from %s\n", i, inName ); + return strdup( painCave.errMsg ); + } + eta[i] = atof( foo ); + } + + //push eta into SimInfo::properties which can be + //retrieved by integrator later + //simnfo->setBoxM( theBoxMat3 ); + DoubleArrayData* etaValue = new DoubleArrayData(); + etaValue->setID(ETAVALUE_ID); + etaValue->setData(eta, 9); + simnfo->addProperty(etaValue); + + return NULL; + + + }