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 811 by mmeineke, Tue Oct 21 19:33:19 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 110 | Line 107 | void SimSetup::createSim(void){
107  
108    if (!isInfoArray){
109      initSystemCoords();
110 +
111 +    if( !(globals->getUseInitTime()) )
112 +      info[0].currentTime = 0.0;
113    }  
114  
115    // make the output filenames
# Line 131 | Line 131 | void SimSetup::makeMolecules(void){
131  
132  
133   void SimSetup::makeMolecules(void){
134 <  int k, l;
134 >  int k;
135    int i, j, exI, exJ, tempEx, stampID, atomOffset, excludeOffset;
136    molInit molInfo;
137    DirectionalAtom* dAtom;
# Line 553 | Line 553 | void SimSetup::gatherInfo(void){
553  
554  
555   void SimSetup::gatherInfo(void){
556 <  int i, j, k;
556 >  int i;
557  
558    ensembleCase = -1;
559    ffCase = -1;
# Line 603 | Line 603 | void SimSetup::gatherInfo(void){
603    }
604    else if (!strcasecmp(ensemble, "NPTf")){
605      ensembleCase = NPTf_ENS;
606  }
607  else if (!strcasecmp(ensemble, "NPTim")){
608    ensembleCase = NPTim_ENS;
609  }
610  else if (!strcasecmp(ensemble, "NPTfm")){
611    ensembleCase = NPTfm_ENS;
606    }
607    else{
608      sprintf(painCave.errMsg,
# Line 922 | Line 916 | void SimSetup::initSystemCoords(void){
916      if (worldRank == 0){
917   #endif //is_mpi
918        inName = globals->getInitialConfig();
925      double* tempDouble = new double[1000000];
919        fileInit = new InitializeFromFile(inName);
920   #ifdef IS_MPI
921      }
# Line 940 | Line 933 | void SimSetup::initSystemCoords(void){
933  
934      sprintf(painCave.errMsg,
935              "Cannot intialize a parallel simulation without an initial configuration file.\n");
936 <    painCave.isFatal;
936 >    painCave.isFatal = 1;;
937      simError();
938  
939   #else
# Line 1166 | Line 1159 | void SimSetup::calcSysValues(void){
1159   }
1160  
1161   void SimSetup::calcSysValues(void){
1162 <  int i, j, k;
1162 >  int i;
1163  
1164    int* molMembershipArray;
1165  
# Line 1265 | Line 1258 | void SimSetup::makeSysArrays(void){
1258  
1259  
1260   void SimSetup::makeSysArrays(void){
1261 <  int i, j, k, l;
1261 >
1262 > #ifndef IS_MPI
1263 >  int k, j;
1264 > #endif // is_mpi
1265 >  int i, l;
1266  
1267    Atom** the_atoms;
1268    Molecule* the_molecules;
# Line 1348 | Line 1345 | void SimSetup::makeIntegrator(void){
1345   void SimSetup::makeIntegrator(void){
1346    int k;
1347  
1348 +  NVE<RealIntegrator>* myNVE = NULL;
1349    NVT<RealIntegrator>* myNVT = NULL;
1350    NPTi<NPT<RealIntegrator> >* myNPTi = NULL;
1351 <  NPTf<RealIntegrator>* myNPTf = NULL;
1354 <  NPTim<RealIntegrator>* myNPTim = NULL;
1355 <  NPTfm<RealIntegrator>* myNPTfm = NULL;
1351 >  NPTf<NPT<RealIntegrator> >* myNPTf = NULL;
1352    
1353    for (k = 0; k < nInfo; k++){
1354      switch (ensembleCase){
1355        case NVE_ENS:
1356          if (globals->haveZconstraints()){
1357            setupZConstraint(info[k]);
1358 <          new ZConstraint<NVE<RealIntegrator> >(&(info[k]), the_ff);
1358 >          myNVE = new ZConstraint<NVE<RealIntegrator> >(&(info[k]), the_ff);
1359          }
1360 <        else
1361 <          new NVE<RealIntegrator>(&(info[k]), the_ff);
1360 >        else{
1361 >          myNVE = new NVE<RealIntegrator>(&(info[k]), the_ff);
1362 >        }
1363 >        
1364 >        info->the_integrator = myNVE;
1365          break;
1366  
1367        case NVT_ENS:
# Line 1384 | Line 1383 | void SimSetup::makeIntegrator(void){
1383            painCave.isFatal = 1;
1384            simError();
1385          }
1386 +
1387 +        info->the_integrator = myNVT;
1388          break;
1389  
1390        case NPTi_ENS:
# Line 1425 | Line 1426 | void SimSetup::makeIntegrator(void){
1426            painCave.isFatal = 1;
1427            simError();
1428          }
1429 +
1430 +        info->the_integrator = myNPTi;
1431          break;
1432  
1433        case NPTf_ENS:
1434          if (globals->haveZconstraints()){
1435            setupZConstraint(info[k]);
1436 <          myNPTf = new ZConstraint<NPTf<RealIntegrator> >(&(info[k]), the_ff);
1436 >          myNPTf = new ZConstraint<NPTf<NPT <RealIntegrator> > >(&(info[k]), the_ff);
1437          }
1438          else
1439 <          myNPTf = new NPTf<RealIntegrator>(&(info[k]), the_ff);
1439 >          myNPTf = new NPTf<NPT <RealIntegrator> >(&(info[k]), the_ff);
1440  
1441          myNPTf->setTargetTemp(globals->getTargetTemp());
1442  
# Line 1466 | Line 1469 | void SimSetup::makeIntegrator(void){
1469            painCave.isFatal = 1;
1470            simError();
1471          }
1469        break;
1472  
1473 <      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());
1483 <        else{
1484 <          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,
1495 <                  "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"
1506 <                  "    ensemble, you must set tauBarostat.\n");
1507 <          painCave.isFatal = 1;
1508 <          simError();
1509 <        }
1473 >        info->the_integrator = myNPTf;
1474          break;
1475  
1512      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        }
1551        break;
1552
1476        default:
1477          sprintf(painCave.errMsg,
1478                  "SimSetup Error. Unrecognized ensemble in case statement.\n");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines