--- trunk/OOPSE/libmdtools/SimSetup.cpp 2003/06/25 21:12:14 567 +++ trunk/OOPSE/libmdtools/SimSetup.cpp 2003/07/09 13:56:36 580 @@ -16,7 +16,8 @@ #define NVE_ENS 0 #define NVT_ENS 1 -#define NPT_ENS 2 +#define NPTi_ENS 2 +#define NPTf_ENS 3 #define FF_DUFF 0 #define FF_LJ 1 @@ -112,7 +113,9 @@ void SimSetup::createSim( void ){ if( !strcasecmp( ensemble, "NVE" )) ensembleCase = NVE_ENS; else if( !strcasecmp( ensemble, "NVT" )) ensembleCase = NVT_ENS; - else if( !strcasecmp( ensemble, "NPT" )) ensembleCase = NPT_ENS; + else if( !strcasecmp( ensemble, "NPTi" ) || !strcasecmp( ensemble, "NPT") ) + ensembleCase = NPTi_ENS; + else if( !strcasecmp( ensemble, "NPTf" )) ensembleCase = NPTf_ENS; else{ sprintf( painCave.errMsg, "SimSetup Warning. Unrecognized Ensemble -> %s, " @@ -479,19 +482,23 @@ void SimSetup::createSim( void ){ // get some of the tricky things that may still be in the globals - + double boxVector[3]; if( the_globals->haveBox() ){ - simnfo->box_x = the_globals->getBox(); - simnfo->box_y = the_globals->getBox(); - simnfo->box_z = the_globals->getBox(); + boxVector[0] = the_globals->getBox(); + boxVector[1] = the_globals->getBox(); + boxVector[2] = the_globals->getBox(); + + simnfo->setBox( boxVector ); } else if( the_globals->haveDensity() ){ double vol; vol = (double)tot_nmol / the_globals->getDensity(); - simnfo->box_x = pow( vol, ( 1.0 / 3.0 ) ); - simnfo->box_y = simnfo->box_x; - simnfo->box_z = simnfo->box_x; + boxVector[0] = pow( vol, ( 1.0 / 3.0 ) ); + boxVector[1] = boxVector[0]; + boxVector[2] = boxVector[0]; + + simnfo->setBox( boxVector ); } else{ if( !the_globals->haveBoxX() ){ @@ -500,7 +507,7 @@ void SimSetup::createSim( void ){ painCave.isFatal = 1; simError(); } - simnfo->box_x = the_globals->getBoxX(); + boxVector[0] = the_globals->getBoxX(); if( !the_globals->haveBoxY() ){ sprintf( painCave.errMsg, @@ -508,7 +515,7 @@ void SimSetup::createSim( void ){ painCave.isFatal = 1; simError(); } - simnfo->box_y = the_globals->getBoxY(); + boxVector[1] = the_globals->getBoxY(); if( !the_globals->haveBoxZ() ){ sprintf( painCave.errMsg, @@ -516,7 +523,9 @@ void SimSetup::createSim( void ){ painCave.isFatal = 1; simError(); } - simnfo->box_z = the_globals->getBoxZ(); + boxVector[2] = the_globals->getBoxZ(); + + simnfo->setBox( boxVector ); } #ifdef IS_MPI @@ -546,9 +555,9 @@ void SimSetup::createSim( void ){ painCave.isFatal = 0; simError(); double smallest; - smallest = simnfo->box_x; - if (simnfo->box_y <= smallest) smallest = simnfo->box_y; - if (simnfo->box_z <= smallest) smallest = simnfo->box_z; + smallest = simnfo->boxLx; + if (simnfo->boxLy <= smallest) smallest = simnfo->boxLy; + if (simnfo->boxLz <= smallest) smallest = simnfo->boxLz; simnfo->ecr = 0.5 * smallest; } else { simnfo->ecr = the_globals->getECR(); @@ -586,9 +595,9 @@ void SimSetup::createSim( void ){ painCave.isFatal = 0; simError(); double smallest; - smallest = simnfo->box_x; - if (simnfo->box_y <= smallest) smallest = simnfo->box_y; - if (simnfo->box_z <= smallest) smallest = simnfo->box_z; + smallest = simnfo->boxLx; + if (simnfo->boxLy <= smallest) smallest = simnfo->boxLy; + if (simnfo->boxLz <= smallest) smallest = simnfo->boxLz; simnfo->ecr = 0.5 * smallest; } else { simnfo->ecr = the_globals->getECR(); @@ -1115,9 +1124,9 @@ void SimSetup::initFromBass( void ){ have_extra =1; n_cells = (int)temp3 - 1; - cellx = simnfo->box_x / temp3; - celly = simnfo->box_y / temp3; - cellz = simnfo->box_z / temp3; + cellx = simnfo->boxLx / temp3; + celly = simnfo->boxLy / temp3; + cellz = simnfo->boxLz / temp3; n_extra = tot_nmol - ( 4 * n_cells * n_cells * n_cells ); temp1 = ((double)n_extra) / ( pow( temp3, 3.0 ) - pow( n_cells, 3.0 ) ); n_per_extra = (int)ceil( temp1 ); @@ -1132,9 +1141,9 @@ void SimSetup::initFromBass( void ){ } else{ n_cells = (int)temp3; - cellx = simnfo->box_x / temp3; - celly = simnfo->box_y / temp3; - cellz = simnfo->box_z / temp3; + cellx = simnfo->boxLx / temp3; + celly = simnfo->boxLy / temp3; + cellz = simnfo->boxLz / temp3; } current_mol = 0;