--- trunk/OOPSE/libmdtools/InitializeFromFile.cpp 2004/01/07 19:26:12 905 +++ trunk/OOPSE/libmdtools/InitializeFromFile.cpp 2004/04/12 20:32:20 1097 @@ -327,7 +327,7 @@ char* InitializeFromFile::parseDumpLine(char* readLine double pos[3]; // position place holders double vel[3]; // velocity placeholders double q[4]; // the quaternions - double jx, jy, jz; // angular velocity placeholders; + double ji[3]; // angular velocity placeholders; double qSqr, qLength; // needed to normalize the quaternion vector. Atom **atoms = simnfo->atoms; @@ -490,7 +490,7 @@ char* InitializeFromFile::parseDumpLine(char* readLine c_in_name, n_atoms, atomIndex ); return strdup( painCave.errMsg ); } - jx = atof( foo ); + ji[0] = atof( foo ); foo = strtok(NULL, " ,;\t"); if(foo == NULL){ @@ -500,7 +500,7 @@ char* InitializeFromFile::parseDumpLine(char* readLine c_in_name, n_atoms, atomIndex ); return strdup( painCave.errMsg ); } - jy = atof(foo ); + ji[1] = atof(foo ); foo = strtok(NULL, " ,;\t"); if(foo == NULL){ @@ -510,7 +510,7 @@ char* InitializeFromFile::parseDumpLine(char* readLine c_in_name, n_atoms, atomIndex ); return strdup( painCave.errMsg ); } - jz = atof( foo ); + ji[2] = atof( foo ); dAtom = ( DirectionalAtom* )atoms[atomIndex]; @@ -528,9 +528,7 @@ char* InitializeFromFile::parseDumpLine(char* readLine // add the angular velocities - dAtom->setJx( jx ); - dAtom->setJy( jy ); - dAtom->setJz( jz ); + dAtom->setJ( ji ); } // add the positions and velocities to the atom @@ -587,54 +585,63 @@ char* InitializeFromFile::parseCommentLine(char* readL entry_plug->setBoxM( theBoxMat3 ); //get chi and integralOfChidt, they should appear by pair - foo = strtok(NULL, " ,;\t\n"); - if(foo != NULL){ - chi = atof(foo); + if( entry_plug->useInitXSstate ){ foo = strtok(NULL, " ,;\t\n"); - if(foo == NULL){ - sprintf( painCave.errMsg, - "chi and integralOfChidt should appear by pair in %s\n", c_in_name ); - return strdup( painCave.errMsg ); + 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", c_in_name ); + 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); + entry_plug->addProperty(chiValue); + + DoubleData* integralOfChidtValue = new DoubleData(); + integralOfChidtValue->setID(INTEGRALOFCHIDT_ID); + integralOfChidtValue->setData(integralOfChidt); + entry_plug->addProperty(integralOfChidtValue); + } - integralOfChidt = atof( foo ); - - //push chi and integralOfChidt into SimInfo::properties which can be + else + return NULL; + + //get eta + foo = strtok(NULL, " ,;\t\n"); + if(foo != NULL ){ + + for(int i = 0 ; i < 9; i++){ + + if(foo == NULL){ + sprintf( painCave.errMsg, + "error in reading eta[%d] from %s\n", i, c_in_name ); + return strdup( painCave.errMsg ); + } + eta[i] = atof( foo ); + foo = strtok(NULL, " ,;\t\n"); + } + } + else + return NULL; + + //push eta into SimInfo::properties which can be //retrieved by integrator later - DoubleData* chiValue = new DoubleData(); - chiValue->setID(CHIVALUE_ID); - chiValue->setData(chi); - entry_plug->addProperty(chiValue); - - DoubleData* integralOfChidtValue = new DoubleData(); - integralOfChidtValue->setID(INTEGRALOFCHIDT_ID); - integralOfChidtValue->setData(integralOfChidt); - entry_plug->addProperty(integralOfChidtValue); - + //entry_plug->setBoxM( theBoxMat3 ); + DoubleArrayData* etaValue = new DoubleArrayData(); + etaValue->setID(ETAVALUE_ID); + etaValue->setData(eta, 9); + entry_plug->addProperty(etaValue); } - 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, c_in_name ); - return strdup( painCave.errMsg ); - } - eta[i] = atof( foo ); - } - - //push eta into SimInfo::properties which can be - //retrieved by integrator later - //entry_plug->setBoxM( theBoxMat3 ); - DoubleArrayData* etaValue = new DoubleArrayData(); - etaValue->setID(ETAVALUE_ID); - etaValue->setData(eta, 9); - entry_plug->addProperty(etaValue); - - return NULL; }