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 722 by tim, Tue Aug 26 20:02:29 2003 UTC vs.
Revision 782 by mmeineke, Tue Sep 23 20:34:31 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 604 | Line 602 | void SimSetup::gatherInfo(void){
602    else if (!strcasecmp(ensemble, "NPTf")){
603      ensembleCase = NPTf_ENS;
604    }
607  else if (!strcasecmp(ensemble, "NPTim")){
608    ensembleCase = NPTim_ENS;
609  }
610  else if (!strcasecmp(ensemble, "NPTfm")){
611    ensembleCase = NPTfm_ENS;
612  }
605    else{
606      sprintf(painCave.errMsg,
607              "SimSetup Warning. Unrecognized Ensemble -> %s, "
# Line 688 | Line 680 | void SimSetup::gatherInfo(void){
680        info[i].thermalTime = globals->getThermalTime();
681      }
682  
683 +    info[i].resetIntegrator = 0;
684 +    if( globals->haveResetTime() ){
685 +      info[i].resetTime = globals->getResetTime();
686 +      info[i].resetIntegrator = 1;
687 +    }
688 +
689      // check for the temperature set flag
690  
691      if (globals->haveTempSet())
# Line 1342 | Line 1340 | void SimSetup::makeIntegrator(void){
1340   void SimSetup::makeIntegrator(void){
1341    int k;
1342  
1343 +  NVE<RealIntegrator>* myNVE = NULL;
1344    NVT<RealIntegrator>* myNVT = NULL;
1345 <  NPTi<RealIntegrator>* myNPTi = NULL;
1346 <  NPTf<RealIntegrator>* myNPTf = NULL;
1347 <  NPTim<RealIntegrator>* myNPTim = NULL;
1349 <  NPTfm<RealIntegrator>* myNPTfm = NULL;
1350 <
1345 >  NPTi<NPT<RealIntegrator> >* myNPTi = NULL;
1346 >  NPTf<NPT<RealIntegrator> >* myNPTf = NULL;
1347 >  
1348    for (k = 0; k < nInfo; k++){
1349      switch (ensembleCase){
1350        case NVE_ENS:
1351          if (globals->haveZconstraints()){
1352            setupZConstraint(info[k]);
1353 <          new ZConstraint<NVE<RealIntegrator> >(&(info[k]), the_ff);
1353 >          myNVE = new ZConstraint<NVE<RealIntegrator> >(&(info[k]), the_ff);
1354          }
1355 <        else
1356 <          new NVE<RealIntegrator>(&(info[k]), the_ff);
1355 >        else{
1356 >          myNVE = new NVE<RealIntegrator>(&(info[k]), the_ff);
1357 >        }
1358 >        
1359 >        info->the_integrator = myNVE;
1360          break;
1361  
1362        case NVT_ENS:
# Line 1378 | Line 1378 | void SimSetup::makeIntegrator(void){
1378            painCave.isFatal = 1;
1379            simError();
1380          }
1381 +
1382 +        info->the_integrator = myNVT;
1383          break;
1384  
1385        case NPTi_ENS:
1386          if (globals->haveZconstraints()){
1387            setupZConstraint(info[k]);
1388 <          myNPTi = new ZConstraint<NPTi<RealIntegrator> >(&(info[k]), the_ff);
1388 >          myNPTi = new ZConstraint<NPTi<NPT <RealIntegrator> > >(&(info[k]), the_ff);
1389          }
1390          else
1391 <          myNPTi = new NPTi<RealIntegrator>(&(info[k]), the_ff);
1391 >          myNPTi = new NPTi<NPT<RealIntegrator> >(&(info[k]), the_ff);
1392  
1393          myNPTi->setTargetTemp(globals->getTargetTemp());
1394  
# Line 1419 | Line 1421 | void SimSetup::makeIntegrator(void){
1421            painCave.isFatal = 1;
1422            simError();
1423          }
1424 +
1425 +        info->the_integrator = myNPTi;
1426          break;
1427  
1428        case NPTf_ENS:
1429          if (globals->haveZconstraints()){
1430            setupZConstraint(info[k]);
1431 <          myNPTf = new ZConstraint<NPTf<RealIntegrator> >(&(info[k]), the_ff);
1431 >          myNPTf = new ZConstraint<NPTf<NPT <RealIntegrator> > >(&(info[k]), the_ff);
1432          }
1433          else
1434 <          myNPTf = new NPTf<RealIntegrator>(&(info[k]), the_ff);
1434 >          myNPTf = new NPTf<NPT <RealIntegrator> >(&(info[k]), the_ff);
1435  
1436          myNPTf->setTargetTemp(globals->getTargetTemp());
1437  
# Line 1453 | Line 1457 | void SimSetup::makeIntegrator(void){
1457  
1458          if (globals->haveTauBarostat())
1459            myNPTf->setTauBarostat(globals->getTauBarostat());
1456        else{
1457          sprintf(painCave.errMsg,
1458                  "SimSetup error: If you use an NPT\n"
1459                  "    ensemble, you must set tauBarostat.\n");
1460          painCave.isFatal = 1;
1461          simError();
1462        }
1463        break;
1464
1465      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());
1460          else{
1461            sprintf(painCave.errMsg,
1462                    "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"
1463                    "    ensemble, you must set tauBarostat.\n");
1464            painCave.isFatal = 1;
1465            simError();
1466          }
1504        break;
1467  
1468 <      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 <        }
1468 >        info->the_integrator = myNPTf;
1469          break;
1470  
1471        default:
# Line 1615 | Line 1539 | void SimSetup::setupZConstraint(SimInfo& theInfo){
1539    }
1540    theInfo.addProperty(zconsTol);
1541  
1542 <  //set Force Substraction Policy
1542 >  //set Force Subtraction Policy
1543    StringData* zconsForcePolicy = new StringData();
1544    zconsForcePolicy->setID(ZCONSFORCEPOLICY_ID);
1545  
# Line 1624 | Line 1548 | void SimSetup::setupZConstraint(SimInfo& theInfo){
1548    }
1549    else{
1550      sprintf(painCave.errMsg,
1551 <            "ZConstraint Warning: User does not set force substraction policy, "
1552 <            "average force substraction policy is used\n");
1551 >            "ZConstraint Warning: User does not set force Subtraction policy, "
1552 >            "PolicyByMass is used\n");
1553      painCave.isFatal = 0;
1554      simError();
1555 <    zconsForcePolicy->setData("BYNUMBER");
1555 >    zconsForcePolicy->setData("BYMASS");
1556    }
1557  
1558    theInfo.addProperty(zconsForcePolicy);
# Line 1666 | Line 1590 | void SimSetup::setupZConstraint(SimInfo& theInfo){
1590      zconsParaData->addItem(tempParaItem);
1591    }
1592  
1593 +  //check the uniqueness of index  
1594 +  if(!zconsParaData->isIndexUnique()){
1595 +    sprintf(painCave.errMsg,
1596 +            "ZConstraint Error: molIndex is not unique\n");
1597 +    painCave.isFatal = 1;
1598 +    simError();
1599 +  }
1600 +
1601    //sort the parameters by index of molecules
1602    zconsParaData->sortByIndex();
1603 <
1603 >  
1604    //push data into siminfo, therefore, we can retrieve later
1605    theInfo.addProperty(zconsParaData);
1606   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines