ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/SimSetup.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/SimSetup.cpp (file contents):
Revision 778 by mmeineke, Fri Sep 19 20:00:27 2003 UTC vs.
Revision 787 by mmeineke, Thu Sep 25 19:27:15 2003 UTC

# Line 22 | Line 22
22   #define NVT_ENS        1
23   #define NPTi_ENS       2
24   #define NPTf_ENS       3
25 #define NPTim_ENS      4
26 #define NPTfm_ENS      5
25  
26   #define FF_DUFF 0
27   #define FF_LJ   1
# Line 92 | Line 90 | void SimSetup::createSim(void){
90   #endif // is_mpi
91  
92   void SimSetup::createSim(void){
95  int i, j, k, globalAtomIndex;
93  
94    // gather all of the information from the Bass file
95  
# Line 131 | Line 128 | void SimSetup::makeMolecules(void){
128  
129  
130   void SimSetup::makeMolecules(void){
131 <  int k, l;
131 >  int k;
132    int i, j, exI, exJ, tempEx, stampID, atomOffset, excludeOffset;
133    molInit molInfo;
134    DirectionalAtom* dAtom;
# Line 553 | Line 550 | void SimSetup::gatherInfo(void){
550  
551  
552   void SimSetup::gatherInfo(void){
553 <  int i, j, k;
553 >  int i;
554  
555    ensembleCase = -1;
556    ffCase = -1;
# Line 603 | Line 600 | void SimSetup::gatherInfo(void){
600    }
601    else if (!strcasecmp(ensemble, "NPTf")){
602      ensembleCase = NPTf_ENS;
606  }
607  else if (!strcasecmp(ensemble, "NPTim")){
608    ensembleCase = NPTim_ENS;
603    }
610  else if (!strcasecmp(ensemble, "NPTfm")){
611    ensembleCase = NPTfm_ENS;
612  }
604    else{
605      sprintf(painCave.errMsg,
606              "SimSetup Warning. Unrecognized Ensemble -> %s, "
# Line 922 | Line 913 | void SimSetup::initSystemCoords(void){
913      if (worldRank == 0){
914   #endif //is_mpi
915        inName = globals->getInitialConfig();
925      double* tempDouble = new double[1000000];
916        fileInit = new InitializeFromFile(inName);
917   #ifdef IS_MPI
918      }
# Line 940 | Line 930 | void SimSetup::initSystemCoords(void){
930  
931      sprintf(painCave.errMsg,
932              "Cannot intialize a parallel simulation without an initial configuration file.\n");
933 <    painCave.isFatal;
933 >    painCave.isFatal = 1;;
934      simError();
935  
936   #else
# Line 1166 | Line 1156 | void SimSetup::calcSysValues(void){
1156   }
1157  
1158   void SimSetup::calcSysValues(void){
1159 <  int i, j, k;
1159 >  int i;
1160  
1161    int* molMembershipArray;
1162  
# Line 1265 | Line 1255 | void SimSetup::makeSysArrays(void){
1255  
1256  
1257   void SimSetup::makeSysArrays(void){
1258 <  int i, j, k, l;
1258 >
1259 > #ifndef IS_MPI
1260 >  int k, j;
1261 > #endif // is_mpi
1262 >  int i, l;
1263  
1264    Atom** the_atoms;
1265    Molecule* the_molecules;
# Line 1348 | Line 1342 | void SimSetup::makeIntegrator(void){
1342   void SimSetup::makeIntegrator(void){
1343    int k;
1344  
1345 +  NVE<RealIntegrator>* myNVE = NULL;
1346    NVT<RealIntegrator>* myNVT = NULL;
1347    NPTi<NPT<RealIntegrator> >* myNPTi = NULL;
1348 <  NPTf<RealIntegrator>* myNPTf = NULL;
1354 <  NPTim<RealIntegrator>* myNPTim = NULL;
1355 <  NPTfm<RealIntegrator>* myNPTfm = NULL;
1348 >  NPTf<NPT<RealIntegrator> >* myNPTf = NULL;
1349    
1350    for (k = 0; k < nInfo; k++){
1351      switch (ensembleCase){
1352        case NVE_ENS:
1353          if (globals->haveZconstraints()){
1354            setupZConstraint(info[k]);
1355 <          new ZConstraint<NVE<RealIntegrator> >(&(info[k]), the_ff);
1355 >          myNVE = new ZConstraint<NVE<RealIntegrator> >(&(info[k]), the_ff);
1356          }
1357 <        else
1358 <          new NVE<RealIntegrator>(&(info[k]), the_ff);
1357 >        else{
1358 >          myNVE = new NVE<RealIntegrator>(&(info[k]), the_ff);
1359 >        }
1360 >        
1361 >        info->the_integrator = myNVE;
1362          break;
1363  
1364        case NVT_ENS:
# Line 1384 | Line 1380 | void SimSetup::makeIntegrator(void){
1380            painCave.isFatal = 1;
1381            simError();
1382          }
1383 +
1384 +        info->the_integrator = myNVT;
1385          break;
1386  
1387        case NPTi_ENS:
# Line 1425 | Line 1423 | void SimSetup::makeIntegrator(void){
1423            painCave.isFatal = 1;
1424            simError();
1425          }
1426 +
1427 +        info->the_integrator = myNPTi;
1428          break;
1429  
1430        case NPTf_ENS:
1431          if (globals->haveZconstraints()){
1432            setupZConstraint(info[k]);
1433 <          myNPTf = new ZConstraint<NPTf<RealIntegrator> >(&(info[k]), the_ff);
1433 >          myNPTf = new ZConstraint<NPTf<NPT <RealIntegrator> > >(&(info[k]), the_ff);
1434          }
1435          else
1436 <          myNPTf = new NPTf<RealIntegrator>(&(info[k]), the_ff);
1436 >          myNPTf = new NPTf<NPT <RealIntegrator> >(&(info[k]), the_ff);
1437  
1438          myNPTf->setTargetTemp(globals->getTargetTemp());
1439  
# Line 1459 | Line 1459 | void SimSetup::makeIntegrator(void){
1459  
1460          if (globals->haveTauBarostat())
1461            myNPTf->setTauBarostat(globals->getTauBarostat());
1462        else{
1463          sprintf(painCave.errMsg,
1464                  "SimSetup error: If you use an NPT\n"
1465                  "    ensemble, you must set tauBarostat.\n");
1466          painCave.isFatal = 1;
1467          simError();
1468        }
1469        break;
1470
1471      case NPTim_ENS:
1472        if (globals->haveZconstraints()){
1473          setupZConstraint(info[k]);
1474          myNPTim = new ZConstraint<NPTim<RealIntegrator> >(&(info[k]), the_ff);
1475        }
1476        else
1477          myNPTim = new NPTim<RealIntegrator>(&(info[k]), the_ff);
1478
1479        myNPTim->setTargetTemp(globals->getTargetTemp());
1480
1481        if (globals->haveTargetPressure())
1482          myNPTim->setTargetPressure(globals->getTargetPressure());
1462          else{
1463            sprintf(painCave.errMsg,
1485                  "SimSetup error: If you use a constant pressure\n"
1486                  "    ensemble, you must set targetPressure in the BASS file.\n");
1487          painCave.isFatal = 1;
1488          simError();
1489        }
1490
1491        if (globals->haveTauThermostat())
1492          myNPTim->setTauThermostat(globals->getTauThermostat());
1493        else{
1494          sprintf(painCave.errMsg,
1464                    "SimSetup error: If you use an NPT\n"
1496                  "    ensemble, you must set tauThermostat.\n");
1497          painCave.isFatal = 1;
1498          simError();
1499        }
1500
1501        if (globals->haveTauBarostat())
1502          myNPTim->setTauBarostat(globals->getTauBarostat());
1503        else{
1504          sprintf(painCave.errMsg,
1505                  "SimSetup error: If you use an NPT\n"
1465                    "    ensemble, you must set tauBarostat.\n");
1466            painCave.isFatal = 1;
1467            simError();
1468          }
1510        break;
1469  
1470 <      case NPTfm_ENS:
1513 <        if (globals->haveZconstraints()){
1514 <          setupZConstraint(info[k]);
1515 <          myNPTfm = new ZConstraint<NPTfm<RealIntegrator> >(&(info[k]), the_ff);
1516 <        }
1517 <        else
1518 <          myNPTfm = new NPTfm<RealIntegrator>(&(info[k]), the_ff);
1519 <
1520 <        myNPTfm->setTargetTemp(globals->getTargetTemp());
1521 <
1522 <        if (globals->haveTargetPressure())
1523 <          myNPTfm->setTargetPressure(globals->getTargetPressure());
1524 <        else{
1525 <          sprintf(painCave.errMsg,
1526 <                  "SimSetup error: If you use a constant pressure\n"
1527 <                  "    ensemble, you must set targetPressure in the BASS file.\n");
1528 <          painCave.isFatal = 1;
1529 <          simError();
1530 <        }
1531 <
1532 <        if (globals->haveTauThermostat())
1533 <          myNPTfm->setTauThermostat(globals->getTauThermostat());
1534 <        else{
1535 <          sprintf(painCave.errMsg,
1536 <                  "SimSetup error: If you use an NPT\n"
1537 <                  "    ensemble, you must set tauThermostat.\n");
1538 <          painCave.isFatal = 1;
1539 <          simError();
1540 <        }
1541 <
1542 <        if (globals->haveTauBarostat())
1543 <          myNPTfm->setTauBarostat(globals->getTauBarostat());
1544 <        else{
1545 <          sprintf(painCave.errMsg,
1546 <                  "SimSetup error: If you use an NPT\n"
1547 <                  "    ensemble, you must set tauBarostat.\n");
1548 <          painCave.isFatal = 1;
1549 <          simError();
1550 <        }
1470 >        info->the_integrator = myNPTf;
1471          break;
1472  
1473        default:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines