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 733 by tim, Wed Aug 27 19:23:29 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 604 | Line 604 | void SimSetup::gatherInfo(void){
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;
612  }
607    else{
608      sprintf(painCave.errMsg,
609              "SimSetup Warning. Unrecognized Ensemble -> %s, "
# Line 688 | Line 682 | void SimSetup::gatherInfo(void){
682        info[i].thermalTime = globals->getThermalTime();
683      }
684  
685 +    info[i].resetIntegrator = 0;
686 +    if( globals->haveResetTime() ){
687 +      info[i].resetTime = globals->getResetTime();
688 +      info[i].resetIntegrator = 1;
689 +    }
690 +
691      // check for the temperature set flag
692  
693      if (globals->haveTempSet())
# Line 916 | Line 916 | void SimSetup::initSystemCoords(void){
916      if (worldRank == 0){
917   #endif //is_mpi
918        inName = globals->getInitialConfig();
919      double* tempDouble = new double[1000000];
919        fileInit = new InitializeFromFile(inName);
920   #ifdef IS_MPI
921      }
# Line 934 | 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 1160 | 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 1259 | 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 1342 | 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<RealIntegrator>* myNPTi = NULL;
1351 <  NPTf<RealIntegrator>* myNPTf = NULL;
1348 <  NPTim<RealIntegrator>* myNPTim = NULL;
1349 <  NPTfm<RealIntegrator>* myNPTfm = NULL;
1350 >  NPTi<NPT<RealIntegrator> >* myNPTi = 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 1378 | 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:
1391          if (globals->haveZconstraints()){
1392            setupZConstraint(info[k]);
1393 <          myNPTi = new ZConstraint<NPTi<RealIntegrator> >(&(info[k]), the_ff);
1393 >          myNPTi = new ZConstraint<NPTi<NPT <RealIntegrator> > >(&(info[k]), the_ff);
1394          }
1395          else
1396 <          myNPTi = new NPTi<RealIntegrator>(&(info[k]), the_ff);
1396 >          myNPTi = new NPTi<NPT<RealIntegrator> >(&(info[k]), the_ff);
1397  
1398          myNPTi->setTargetTemp(globals->getTargetTemp());
1399  
# Line 1419 | 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 1460 | Line 1469 | void SimSetup::makeIntegrator(void){
1469            painCave.isFatal = 1;
1470            simError();
1471          }
1463        break;
1472  
1473 <      case NPTim_ENS:
1466 <        if (globals->haveZconstraints()){
1467 <          setupZConstraint(info[k]);
1468 <          myNPTim = new ZConstraint<NPTim<RealIntegrator> >(&(info[k]), the_ff);
1469 <        }
1470 <        else
1471 <          myNPTim = new NPTim<RealIntegrator>(&(info[k]), the_ff);
1472 <
1473 <        myNPTim->setTargetTemp(globals->getTargetTemp());
1474 <
1475 <        if (globals->haveTargetPressure())
1476 <          myNPTim->setTargetPressure(globals->getTargetPressure());
1477 <        else{
1478 <          sprintf(painCave.errMsg,
1479 <                  "SimSetup error: If you use a constant pressure\n"
1480 <                  "    ensemble, you must set targetPressure in the BASS file.\n");
1481 <          painCave.isFatal = 1;
1482 <          simError();
1483 <        }
1484 <
1485 <        if (globals->haveTauThermostat())
1486 <          myNPTim->setTauThermostat(globals->getTauThermostat());
1487 <        else{
1488 <          sprintf(painCave.errMsg,
1489 <                  "SimSetup error: If you use an NPT\n"
1490 <                  "    ensemble, you must set tauThermostat.\n");
1491 <          painCave.isFatal = 1;
1492 <          simError();
1493 <        }
1494 <
1495 <        if (globals->haveTauBarostat())
1496 <          myNPTim->setTauBarostat(globals->getTauBarostat());
1497 <        else{
1498 <          sprintf(painCave.errMsg,
1499 <                  "SimSetup error: If you use an NPT\n"
1500 <                  "    ensemble, you must set tauBarostat.\n");
1501 <          painCave.isFatal = 1;
1502 <          simError();
1503 <        }
1473 >        info->the_integrator = myNPTf;
1474          break;
1475  
1506      case NPTfm_ENS:
1507        if (globals->haveZconstraints()){
1508          setupZConstraint(info[k]);
1509          myNPTfm = new ZConstraint<NPTfm<RealIntegrator> >(&(info[k]), the_ff);
1510        }
1511        else
1512          myNPTfm = new NPTfm<RealIntegrator>(&(info[k]), the_ff);
1513
1514        myNPTfm->setTargetTemp(globals->getTargetTemp());
1515
1516        if (globals->haveTargetPressure())
1517          myNPTfm->setTargetPressure(globals->getTargetPressure());
1518        else{
1519          sprintf(painCave.errMsg,
1520                  "SimSetup error: If you use a constant pressure\n"
1521                  "    ensemble, you must set targetPressure in the BASS file.\n");
1522          painCave.isFatal = 1;
1523          simError();
1524        }
1525
1526        if (globals->haveTauThermostat())
1527          myNPTfm->setTauThermostat(globals->getTauThermostat());
1528        else{
1529          sprintf(painCave.errMsg,
1530                  "SimSetup error: If you use an NPT\n"
1531                  "    ensemble, you must set tauThermostat.\n");
1532          painCave.isFatal = 1;
1533          simError();
1534        }
1535
1536        if (globals->haveTauBarostat())
1537          myNPTfm->setTauBarostat(globals->getTauBarostat());
1538        else{
1539          sprintf(painCave.errMsg,
1540                  "SimSetup error: If you use an NPT\n"
1541                  "    ensemble, you must set tauBarostat.\n");
1542          painCave.isFatal = 1;
1543          simError();
1544        }
1545        break;
1546
1476        default:
1477          sprintf(painCave.errMsg,
1478                  "SimSetup Error. Unrecognized ensemble in case statement.\n");
# Line 1615 | Line 1544 | void SimSetup::setupZConstraint(SimInfo& theInfo){
1544    }
1545    theInfo.addProperty(zconsTol);
1546  
1547 <  //set Force Substraction Policy
1547 >  //set Force Subtraction Policy
1548    StringData* zconsForcePolicy = new StringData();
1549    zconsForcePolicy->setID(ZCONSFORCEPOLICY_ID);
1550  
# Line 1624 | Line 1553 | void SimSetup::setupZConstraint(SimInfo& theInfo){
1553    }
1554    else{
1555      sprintf(painCave.errMsg,
1556 <            "ZConstraint Warning: User does not set force substraction policy, "
1557 <            "average force substraction policy is used\n");
1556 >            "ZConstraint Warning: User does not set force Subtraction policy, "
1557 >            "PolicyByMass is used\n");
1558      painCave.isFatal = 0;
1559      simError();
1560 <    zconsForcePolicy->setData("BYNUMBER");
1560 >    zconsForcePolicy->setData("BYMASS");
1561    }
1562  
1563    theInfo.addProperty(zconsForcePolicy);
# Line 1666 | Line 1595 | void SimSetup::setupZConstraint(SimInfo& theInfo){
1595      zconsParaData->addItem(tempParaItem);
1596    }
1597  
1598 +  //check the uniqueness of index  
1599 +  if(!zconsParaData->isIndexUnique()){
1600 +    sprintf(painCave.errMsg,
1601 +            "ZConstraint Error: molIndex is not unique\n");
1602 +    painCave.isFatal = 1;
1603 +    simError();
1604 +  }
1605 +
1606    //sort the parameters by index of molecules
1607    zconsParaData->sortByIndex();
1608 <
1608 >  
1609    //push data into siminfo, therefore, we can retrieve later
1610    theInfo.addProperty(zconsParaData);
1611   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines