--- trunk/OOPSE-1.0/libmdtools/SimSetup.cpp 2004/07/16 18:58:03 1334 +++ trunk/OOPSE-1.0/libmdtools/SimSetup.cpp 2004/08/09 14:50:35 1451 @@ -57,6 +57,28 @@ bool isDivisible(double dividend, double divisor){ return false; } +string getPrefix(const string& str ){ + string prefix; + string suffix; + int pos; + + pos = str.rfind("."); + + if (pos >= 0) { + prefix = str.substr(0, pos); + suffix = str.substr(pos, str.size()); + + // leave .bass there in case we've reverted to old habits + if (LowerCase(suffix) == ".md" || LowerCase(suffix) == ".bass") + return prefix; + else + return str; + + } else + return str; +}; + + SimSetup::SimSetup(){ initSuspend = false; @@ -74,6 +96,9 @@ SimSetup::~SimSetup(){ } SimSetup::~SimSetup(){ + // clean up the forcefield + the_ff->cleanMe(); + delete stamps; delete globals; } @@ -92,6 +117,8 @@ void SimSetup::parseFile(char* fileName){ #endif // is_mpi inFileName = fileName; + + globals->initalize(); set_interface_stamps(stamps, globals); #ifdef IS_MPI @@ -122,7 +149,7 @@ void SimSetup::createSim(void){ void SimSetup::createSim(void){ - // gather all of the information from the Bass file + // gather all of the information from the meta-data file gatherInfo(); @@ -643,178 +670,9 @@ void SimSetup::makeMolecules(void){ sprintf(checkPointMsg, "all molecules initialized succesfully"); MPIcheckPoint(); #endif // is_mpi - -} - -void SimSetup::initFromBass(void){ - int i, j, k; - int n_cells; - double cellx, celly, cellz; - double temp1, temp2, temp3; - int n_per_extra; - int n_extra; - int have_extra, done; - - double vel[3]; - vel[0] = 0.0; - vel[1] = 0.0; - vel[2] = 0.0; - - temp1 = (double) tot_nmol / 4.0; - temp2 = pow(temp1, (1.0 / 3.0)); - temp3 = ceil(temp2); - - have_extra = 0; - if (temp2 < temp3){ - // we have a non-complete lattice - have_extra = 1; - - n_cells = (int) temp3 - 1; - cellx = info[0].boxL[0] / temp3; - celly = info[0].boxL[1] / temp3; - cellz = info[0].boxL[2] / 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); - - if (n_per_extra > 4){ - sprintf(painCave.errMsg, - "SimSetup error. There has been an error in constructing" - " the non-complete lattice.\n"); - painCave.isFatal = 1; - simError(); - } - } - else{ - n_cells = (int) temp3; - cellx = info[0].boxL[0] / temp3; - celly = info[0].boxL[1] / temp3; - cellz = info[0].boxL[2] / temp3; - } - - current_mol = 0; - current_comp_mol = 0; - current_comp = 0; - current_atom_ndx = 0; - - for (i = 0; i < n_cells ; i++){ - for (j = 0; j < n_cells; j++){ - for (k = 0; k < n_cells; k++){ - makeElement(i * cellx, j * celly, k * cellz); - - makeElement(i * cellx + 0.5 * cellx, j * celly + 0.5 * celly, k * cellz); - - makeElement(i * cellx, j * celly + 0.5 * celly, k * cellz + 0.5 * cellz); - - makeElement(i * cellx + 0.5 * cellx, j * celly, k * cellz + 0.5 * cellz); - } - } - } - - if (have_extra){ - done = 0; - - int start_ndx; - for (i = 0; i < (n_cells + 1) && !done; i++){ - for (j = 0; j < (n_cells + 1) && !done; j++){ - if (i < n_cells){ - if (j < n_cells){ - start_ndx = n_cells; - } - else - start_ndx = 0; - } - else - start_ndx = 0; - - for (k = start_ndx; k < (n_cells + 1) && !done; k++){ - makeElement(i * cellx, j * celly, k * cellz); - done = (current_mol >= tot_nmol); - - if (!done && n_per_extra > 1){ - makeElement(i * cellx + 0.5 * cellx, j * celly + 0.5 * celly, - k * cellz); - done = (current_mol >= tot_nmol); - } - - if (!done && n_per_extra > 2){ - makeElement(i * cellx, j * celly + 0.5 * celly, - k * cellz + 0.5 * cellz); - done = (current_mol >= tot_nmol); - } - - if (!done && n_per_extra > 3){ - makeElement(i * cellx + 0.5 * cellx, j * celly, - k * cellz + 0.5 * cellz); - done = (current_mol >= tot_nmol); - } - } - } - } - } - - for (i = 0; i < info[0].n_atoms; i++){ - info[0].atoms[i]->setVel(vel); - } -} - -void SimSetup::makeElement(double x, double y, double z){ - int k; - AtomStamp* current_atom; - DirectionalAtom* dAtom; - double rotMat[3][3]; - double pos[3]; - - for (k = 0; k < comp_stamps[current_comp]->getNAtoms(); k++){ - current_atom = comp_stamps[current_comp]->getAtom(k); - if (!current_atom->havePosition()){ - sprintf(painCave.errMsg, - "SimSetup:initFromBass error.\n" - "\tComponent %s, atom %s does not have a position specified.\n" - "\tThe initialization routine is unable to give a start" - " position.\n", - comp_stamps[current_comp]->getID(), current_atom->getType()); - painCave.isFatal = 1; - simError(); - } - - pos[0] = x + current_atom->getPosX(); - pos[1] = y + current_atom->getPosY(); - pos[2] = z + current_atom->getPosZ(); - - info[0].atoms[current_atom_ndx]->setPos(pos); - - if (info[0].atoms[current_atom_ndx]->isDirectional()){ - dAtom = (DirectionalAtom *) info[0].atoms[current_atom_ndx]; - - rotMat[0][0] = 1.0; - rotMat[0][1] = 0.0; - rotMat[0][2] = 0.0; - - rotMat[1][0] = 0.0; - rotMat[1][1] = 1.0; - rotMat[1][2] = 0.0; - - rotMat[2][0] = 0.0; - rotMat[2][1] = 0.0; - rotMat[2][2] = 1.0; - - dAtom->setA(rotMat); - } - current_atom_ndx++; - } - - current_mol++; - current_comp_mol++; - - if (current_comp_mol >= components_nmol[current_comp]){ - current_comp_mol = 0; - current_comp++; - } } - void SimSetup::gatherInfo(void){ int i; @@ -824,10 +682,19 @@ void SimSetup::gatherInfo(void){ // set the easy ones first for (i = 0; i < nInfo; i++){ - info[i].target_temp = globals->getTargetTemp(); - info[i].dt = globals->getDt(); - info[i].run_time = globals->getRunTime(); - } + if (globals->haveTargetTemp()) { + info[i].target_temp = globals->getTargetTemp(); + info[i].have_target_temp = 1; + } else { + info[i].have_target_temp = 0; + } + if (globals->haveDt()) { + info[i].dt = globals->getDt(); + } + if (globals->haveRunTime()) { + info[i].run_time = globals->getRunTime(); + } + } n_components = globals->getNComponents(); @@ -860,49 +727,198 @@ void SimSetup::gatherInfo(void){ // get the ensemble - strcpy(ensemble, globals->getEnsemble()); - if (!strcasecmp(ensemble, "NVE")){ - ensembleCase = NVE_ENS; - } - else if (!strcasecmp(ensemble, "NVT")){ - ensembleCase = NVT_ENS; - } - else if (!strcasecmp(ensemble, "NPTi") || !strcasecmp(ensemble, "NPT")){ - ensembleCase = NPTi_ENS; - } - else if (!strcasecmp(ensemble, "NPTf")){ - ensembleCase = NPTf_ENS; - } - else if (!strcasecmp(ensemble, "NPTxyz")){ - ensembleCase = NPTxyz_ENS; - } - else{ - sprintf(painCave.errMsg, - "SimSetup Warning. Unrecognized Ensemble -> %s \n" - "\treverting to NVE for this simulation.\n", - ensemble); - painCave.isFatal = 0; - simError(); - strcpy(ensemble, "NVE"); - ensembleCase = NVE_ENS; - } + if (globals->haveEnsemble()) { + + strcpy(ensemble, globals->getEnsemble()); + + if (!strcasecmp(ensemble, "NVE")){ + ensembleCase = NVE_ENS; + } + else if (!strcasecmp(ensemble, "NVT")){ + ensembleCase = NVT_ENS; + } + else if (!strcasecmp(ensemble, "NPTi") || !strcasecmp(ensemble, "NPT")){ + ensembleCase = NPTi_ENS; + } + else if (!strcasecmp(ensemble, "NPTf")){ + ensembleCase = NPTf_ENS; + } + else if (!strcasecmp(ensemble, "NPTxyz")){ + ensembleCase = NPTxyz_ENS; + } + else{ + sprintf(painCave.errMsg, + "SimSetup Warning. Unrecognized Ensemble -> %s \n" + "\treverting to NVE for this simulation.\n", + ensemble); + painCave.isFatal = 0; + simError(); + strcpy(ensemble, "NVE"); + ensembleCase = NVE_ENS; + } + + for (i = 0; i < nInfo; i++) + strcpy(info[i].ensemble, ensemble); + + + //check whether sample time, status time, thermal time and reset time are divisble by dt + if (globals->haveSampleTime() && !isDivisible(globals->getSampleTime(), globals->getDt())){ + sprintf(painCave.errMsg, + "Sample time is not divisible by dt.\n" + "\tThis will result in samples that are not uniformly\n" + "\tdistributed in time. If this is a problem, change\n" + "\tyour sampleTime variable.\n"); + painCave.isFatal = 0; + simError(); + } + + if (globals->haveStatusTime() && !isDivisible(globals->getStatusTime(), globals->getDt())){ + sprintf(painCave.errMsg, + "Status time is not divisible by dt.\n" + "\tThis will result in status reports that are not uniformly\n" + "\tdistributed in time. If this is a problem, change \n" + "\tyour statusTime variable.\n"); + painCave.isFatal = 0; + simError(); + } + + if (globals->haveThermalTime() && !isDivisible(globals->getThermalTime(), globals->getDt())){ + sprintf(painCave.errMsg, + "Thermal time is not divisible by dt.\n" + "\tThis will result in thermalizations that are not uniformly\n" + "\tdistributed in time. If this is a problem, change \n" + "\tyour thermalTime variable.\n"); + painCave.isFatal = 0; + simError(); + } + + if (globals->haveResetTime() && !isDivisible(globals->getResetTime(), globals->getDt())){ + sprintf(painCave.errMsg, + "Reset time is not divisible by dt.\n" + "\tThis will result in integrator resets that are not uniformly\n" + "\tdistributed in time. If this is a problem, change\n" + "\tyour resetTime variable.\n"); + painCave.isFatal = 0; + simError(); + } + + // set the status, sample, and thermal kick times + + for (i = 0; i < nInfo; i++){ + if (globals->haveSampleTime()){ + info[i].sampleTime = globals->getSampleTime(); + info[i].statusTime = info[i].sampleTime; + } + else{ + info[i].sampleTime = globals->getRunTime(); + info[i].statusTime = info[i].sampleTime; + } + + if (globals->haveStatusTime()){ + info[i].statusTime = globals->getStatusTime(); + } + + if (globals->haveThermalTime()){ + info[i].thermalTime = globals->getThermalTime(); + } else { + info[i].thermalTime = globals->getRunTime(); + } + + info[i].resetIntegrator = 0; + if( globals->haveResetTime() ){ + info[i].resetTime = globals->getResetTime(); + info[i].resetIntegrator = 1; + } + } - for (i = 0; i < nInfo; i++){ - strcpy(info[i].ensemble, ensemble); - + for (i=0; i < nInfo; i++) { + + // check for the temperature set flag + + if (globals->haveTempSet()) + info[i].setTemp = globals->getTempSet(); + + // check for the extended State init + + info[i].useInitXSstate = globals->getUseInitXSstate(); + info[i].orthoTolerance = globals->getOrthoBoxTolerance(); + + // check for thermodynamic integration + if (globals->getUseSolidThermInt() && !globals->getUseLiquidThermInt()) { + if (globals->haveThermIntLambda() && globals->haveThermIntK()) { + info[i].useSolidThermInt = globals->getUseSolidThermInt(); + info[i].thermIntLambda = globals->getThermIntLambda(); + info[i].thermIntK = globals->getThermIntK(); + + Restraints *myRestraint = new Restraints(info[i].thermIntLambda, info[i].thermIntK); + info[i].restraint = myRestraint; + } + else { + sprintf(painCave.errMsg, + "SimSetup Error:\n" + "\tKeyword useSolidThermInt was set to 'true' but\n" + "\tthermodynamicIntegrationLambda (and/or\n" + "\tthermodynamicIntegrationK) was not specified.\n" + "\tPlease provide a lambda value and k value in your meta-data file.\n"); + painCave.isFatal = 1; + simError(); + } + } + else if(globals->getUseLiquidThermInt()) { + if (globals->getUseSolidThermInt()) { + sprintf( painCave.errMsg, + "SimSetup Warning: It appears that you have both solid and\n" + "\tliquid thermodynamic integration activated in your meta-data\n" + "\tfile. To avoid confusion, specify only one technique in\n" + "\tyour meta-data file. Liquid-state thermodynamic integration\n" + "\twill be assumed for the current simulation. If this is not\n" + "\twhat you desire, set useSolidThermInt to 'true' and\n" + "\tuseLiquidThermInt to 'false' in your meta-data file.\n"); + painCave.isFatal = 0; + simError(); + } + if (globals->haveThermIntLambda() && globals->haveThermIntK()) { + info[i].useLiquidThermInt = globals->getUseLiquidThermInt(); + info[i].thermIntLambda = globals->getThermIntLambda(); + info[i].thermIntK = globals->getThermIntK(); + } + else { + sprintf(painCave.errMsg, + "SimSetup Error:\n" + "\tKeyword useLiquidThermInt was set to 'true' but\n" + "\tthermodynamicIntegrationLambda (and/or\n" + "\tthermodynamicIntegrationK) was not specified.\n" + "\tPlease provide a lambda value and k value in your meta-data file.\n"); + painCave.isFatal = 1; + simError(); + } + } + else if(globals->haveThermIntLambda() || globals->haveThermIntK()){ + sprintf(painCave.errMsg, + "SimSetup Warning: If you want to use Thermodynamic\n" + "\tIntegration, set useSolidThermInt or useLiquidThermInt to\n" + "\t'true' in your meta-data file. These keywords are set to\n" + "\t'false' by default, so your lambda and/or k values are\n" + "\tbeing ignored.\n"); + painCave.isFatal = 0; + simError(); + } + } + } + + for (i = 0; i < nInfo; i++) { // get the mixing rule - + strcpy(info[i].mixingRule, globals->getMixingRule()); info[i].usePBC = globals->getPBC(); } - + // get the components and calculate the tot_nMol and indvidual n_mol - + the_components = globals->getComponents(); components_nmol = new int[n_components]; - - + if (!globals->haveNMol()){ // we don't have the total number of molecules, so we assume it is // given in each component @@ -932,147 +948,9 @@ void SimSetup::gatherInfo(void){ painCave.isFatal = 1; simError(); } + - //check whether sample time, status time, thermal time and reset time are divisble by dt - if (globals->haveSampleTime() && !isDivisible(globals->getSampleTime(), globals->getDt())){ - sprintf(painCave.errMsg, - "Sample time is not divisible by dt.\n" - "\tThis will result in samples that are not uniformly\n" - "\tdistributed in time. If this is a problem, change\n" - "\tyour sampleTime variable.\n"); - painCave.isFatal = 0; - simError(); - } - if (globals->haveStatusTime() && !isDivisible(globals->getStatusTime(), globals->getDt())){ - sprintf(painCave.errMsg, - "Status time is not divisible by dt.\n" - "\tThis will result in status reports that are not uniformly\n" - "\tdistributed in time. If this is a problem, change \n" - "\tyour statusTime variable.\n"); - painCave.isFatal = 0; - simError(); - } - - if (globals->haveThermalTime() && !isDivisible(globals->getThermalTime(), globals->getDt())){ - sprintf(painCave.errMsg, - "Thermal time is not divisible by dt.\n" - "\tThis will result in thermalizations that are not uniformly\n" - "\tdistributed in time. If this is a problem, change \n" - "\tyour thermalTime variable.\n"); - painCave.isFatal = 0; - simError(); - } - - if (globals->haveResetTime() && !isDivisible(globals->getResetTime(), globals->getDt())){ - sprintf(painCave.errMsg, - "Reset time is not divisible by dt.\n" - "\tThis will result in integrator resets that are not uniformly\n" - "\tdistributed in time. If this is a problem, change\n" - "\tyour resetTime variable.\n"); - painCave.isFatal = 0; - simError(); - } - - // set the status, sample, and thermal kick times - - for (i = 0; i < nInfo; i++){ - if (globals->haveSampleTime()){ - info[i].sampleTime = globals->getSampleTime(); - info[i].statusTime = info[i].sampleTime; - } - else{ - info[i].sampleTime = globals->getRunTime(); - info[i].statusTime = info[i].sampleTime; - } - - if (globals->haveStatusTime()){ - info[i].statusTime = globals->getStatusTime(); - } - - if (globals->haveThermalTime()){ - info[i].thermalTime = globals->getThermalTime(); - } else { - info[i].thermalTime = globals->getRunTime(); - } - - info[i].resetIntegrator = 0; - if( globals->haveResetTime() ){ - info[i].resetTime = globals->getResetTime(); - info[i].resetIntegrator = 1; - } - - // check for the temperature set flag - - if (globals->haveTempSet()) - info[i].setTemp = globals->getTempSet(); - - // check for the extended State init - - info[i].useInitXSstate = globals->getUseInitXSstate(); - info[i].orthoTolerance = globals->getOrthoBoxTolerance(); - - // check for thermodynamic integration - if (globals->getUseSolidThermInt() && !globals->getUseLiquidThermInt()) { - if (globals->haveThermIntLambda() && globals->haveThermIntK()) { - info[i].useSolidThermInt = globals->getUseSolidThermInt(); - info[i].thermIntLambda = globals->getThermIntLambda(); - info[i].thermIntK = globals->getThermIntK(); - - Restraints *myRestraint = new Restraints(tot_nmol, info[i].thermIntLambda, info[i].thermIntK); - info[i].restraint = myRestraint; - } - else { - sprintf(painCave.errMsg, - "SimSetup Error:\n" - "\tKeyword useSolidThermInt was set to 'true' but\n" - "\tthermodynamicIntegrationLambda (and/or\n" - "\tthermodynamicIntegrationK) was not specified.\n" - "\tPlease provide a lambda value and k value in your .bass file.\n"); - painCave.isFatal = 1; - simError(); - } - } - else if(globals->getUseLiquidThermInt()) { - if (globals->getUseSolidThermInt()) { - sprintf( painCave.errMsg, - "SimSetup Warning: It appears that you have both solid and\n" - "\tliquid thermodynamic integration activated in your .bass\n" - "\tfile. To avoid confusion, specify only one technique in\n" - "\tyour .bass file. Liquid-state thermodynamic integration\n" - "\twill be assumed for the current simulation. If this is not\n" - "\twhat you desire, set useSolidThermInt to 'true' and\n" - "\tuseLiquidThermInt to 'false' in your .bass file.\n"); - painCave.isFatal = 0; - simError(); - } - if (globals->haveThermIntLambda() && globals->haveThermIntK()) { - info[i].useLiquidThermInt = globals->getUseLiquidThermInt(); - info[i].thermIntLambda = globals->getThermIntLambda(); - info[i].thermIntK = globals->getThermIntK(); - } - else { - sprintf(painCave.errMsg, - "SimSetup Error:\n" - "\tKeyword useLiquidThermInt was set to 'true' but\n" - "\tthermodynamicIntegrationLambda (and/or\n" - "\tthermodynamicIntegrationK) was not specified.\n" - "\tPlease provide a lambda value and k value in your .bass file.\n"); - painCave.isFatal = 1; - simError(); - } - } - else if(globals->haveThermIntLambda() || globals->haveThermIntK()){ - sprintf(painCave.errMsg, - "SimSetup Warning: If you want to use Thermodynamic\n" - "\tIntegration, set useSolidThermInt or useLiquidThermInt to\n" - "\t'true' in your .bass file. These keywords are set to\n" - "\t'false' by default, so your lambda and/or k values are\n" - "\tbeing ignored.\n"); - painCave.isFatal = 0; - simError(); - } - } //setup seed for random number generator int seedValue; @@ -1115,7 +993,7 @@ void SimSetup::gatherInfo(void){ } #ifdef IS_MPI - strcpy(checkPointMsg, "Successfully gathered all information from Bass\n"); + strcpy(checkPointMsg, "Successfully gathered all information from meta-data file\n"); MPIcheckPoint(); #endif // is_mpi } @@ -1252,8 +1130,6 @@ void SimSetup::finalInfoCheck(void){ MPIcheckPoint(); #endif // is_mpi - // clean up the forcefield - the_ff->cleanMe(); } void SimSetup::initSystemCoords(void){ @@ -1284,7 +1160,7 @@ void SimSetup::initSystemCoords(void){ } else{ - // no init from bass + // no init from md file sprintf(painCave.errMsg, "Cannot intialize a simulation without an initial configuration file.\n"); @@ -1302,109 +1178,21 @@ void SimSetup::makeOutNames(void){ void SimSetup::makeOutNames(void){ int k; + string prefix; - for (k = 0; k < nInfo; k++){ #ifdef IS_MPI if (worldRank == 0){ #endif // is_mpi - - if (globals->haveFinalConfig()){ - strcpy(info[k].finalName, globals->getFinalConfig()); - } - else{ - strcpy(info[k].finalName, inFileName); - char* endTest; - int nameLength = strlen(info[k].finalName); - endTest = &(info[k].finalName[nameLength - 5]); - if (!strcmp(endTest, ".bass")){ - strcpy(endTest, ".eor"); - } - else if (!strcmp(endTest, ".BASS")){ - strcpy(endTest, ".eor"); - } - else{ - endTest = &(info[k].finalName[nameLength - 4]); - if (!strcmp(endTest, ".bss")){ - strcpy(endTest, ".eor"); - } - else if (!strcmp(endTest, ".mdl")){ - strcpy(endTest, ".eor"); - } - else{ - strcat(info[k].finalName, ".eor"); - } - } - } + + if(globals->haveFinalConfig()) + prefix = getPrefix(globals->getFinalConfig()); + else + prefix = getPrefix(inFileName); - // make the sample and status out names - - strcpy(info[k].sampleName, inFileName); - char* endTest; - int nameLength = strlen(info[k].sampleName); - endTest = &(info[k].sampleName[nameLength - 5]); - if (!strcmp(endTest, ".bass")){ - strcpy(endTest, ".dump"); - } - else if (!strcmp(endTest, ".BASS")){ - strcpy(endTest, ".dump"); - } - else{ - endTest = &(info[k].sampleName[nameLength - 4]); - if (!strcmp(endTest, ".bss")){ - strcpy(endTest, ".dump"); - } - else if (!strcmp(endTest, ".mdl")){ - strcpy(endTest, ".dump"); - } - else{ - strcat(info[k].sampleName, ".dump"); - } - } - - strcpy(info[k].statusName, inFileName); - nameLength = strlen(info[k].statusName); - endTest = &(info[k].statusName[nameLength - 5]); - if (!strcmp(endTest, ".bass")){ - strcpy(endTest, ".stat"); - } - else if (!strcmp(endTest, ".BASS")){ - strcpy(endTest, ".stat"); - } - else{ - endTest = &(info[k].statusName[nameLength - 4]); - if (!strcmp(endTest, ".bss")){ - strcpy(endTest, ".stat"); - } - else if (!strcmp(endTest, ".mdl")){ - strcpy(endTest, ".stat"); - } - else{ - strcat(info[k].statusName, ".stat"); - } - } - - strcpy(info[k].rawPotName, inFileName); - nameLength = strlen(info[k].rawPotName); - endTest = &(info[k].rawPotName[nameLength - 5]); - if (!strcmp(endTest, ".bass")){ - strcpy(endTest, ".raw"); - } - else if (!strcmp(endTest, ".BASS")){ - strcpy(endTest, ".raw"); - } - else{ - endTest = &(info[k].rawPotName[nameLength - 4]); - if (!strcmp(endTest, ".bss")){ - strcpy(endTest, ".raw"); - } - else if (!strcmp(endTest, ".mdl")){ - strcpy(endTest, ".raw"); - } - else{ - strcat(info[k].rawPotName, ".raw"); - } - } + info[k].finalName = prefix + ".eor"; + info[k].sampleName = prefix + ".dump"; + info[k].statusName = prefix + ".stat"; #ifdef IS_MPI @@ -1785,7 +1573,16 @@ void SimSetup::makeIntegrator(void){ else myNVT = new NVT(&(info[k]), the_ff); - myNVT->setTargetTemp(globals->getTargetTemp()); + + if (globals->haveTargetTemp()) + myNVT->setTargetTemp(globals->getTargetTemp()); + else{ + sprintf(painCave.errMsg, + "SimSetup error: If you use the NVT\n" + "\tensemble, you must set targetTemp.\n"); + painCave.isFatal = 1; + simError(); + } if (globals->haveTauThermostat()) myNVT->setTauThermostat(globals->getTauThermostat()); @@ -1808,14 +1605,22 @@ void SimSetup::makeIntegrator(void){ else myNPTi = new NPTi >(&(info[k]), the_ff); - myNPTi->setTargetTemp(globals->getTargetTemp()); + if (globals->haveTargetTemp()) + myNPTi->setTargetTemp(globals->getTargetTemp()); + else{ + sprintf(painCave.errMsg, + "SimSetup error: If you use a constant pressure\n" + "\tensemble, you must set targetTemp.\n"); + painCave.isFatal = 1; + simError(); + } if (globals->haveTargetPressure()) myNPTi->setTargetPressure(globals->getTargetPressure()); else{ sprintf(painCave.errMsg, "SimSetup error: If you use a constant pressure\n" - "\tensemble, you must set targetPressure in the BASS file.\n"); + "\tensemble, you must set targetPressure in the meta-data file.\n"); painCave.isFatal = 1; simError(); } @@ -1851,14 +1656,22 @@ void SimSetup::makeIntegrator(void){ else myNPTf = new NPTf >(&(info[k]), the_ff); - myNPTf->setTargetTemp(globals->getTargetTemp()); + if (globals->haveTargetTemp()) + myNPTf->setTargetTemp(globals->getTargetTemp()); + else{ + sprintf(painCave.errMsg, + "SimSetup error: If you use a constant pressure\n" + "\tensemble, you must set targetTemp.\n"); + painCave.isFatal = 1; + simError(); + } if (globals->haveTargetPressure()) myNPTf->setTargetPressure(globals->getTargetPressure()); else{ sprintf(painCave.errMsg, "SimSetup error: If you use a constant pressure\n" - "\tensemble, you must set targetPressure in the BASS file.\n"); + "\tensemble, you must set targetPressure in the meta-data file.\n"); painCave.isFatal = 1; simError(); } @@ -1896,14 +1709,22 @@ void SimSetup::makeIntegrator(void){ else myNPTxyz = new NPTxyz >(&(info[k]), the_ff); - myNPTxyz->setTargetTemp(globals->getTargetTemp()); + if (globals->haveTargetTemp()) + myNPTxyz->setTargetTemp(globals->getTargetTemp()); + else{ + sprintf(painCave.errMsg, + "SimSetup error: If you use a constant pressure\n" + "\tensemble, you must set targetTemp.\n"); + painCave.isFatal = 1; + simError(); + } if (globals->haveTargetPressure()) myNPTxyz->setTargetPressure(globals->getTargetPressure()); else{ sprintf(painCave.errMsg, "SimSetup error: If you use a constant pressure\n" - "\tensemble, you must set targetPressure in the BASS file.\n"); + "\tensemble, you must set targetPressure in the meta-data file.\n"); painCave.isFatal = 1; simError(); }