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 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;
609  }
610  else if (!strcasecmp(ensemble, "NPTfm")){
611    ensembleCase = NPTfm_ENS;
603    }
604    else{
605      sprintf(painCave.errMsg,
# Line 688 | Line 679 | void SimSetup::gatherInfo(void){
679        info[i].thermalTime = globals->getThermalTime();
680      }
681  
682 +    info[i].resetIntegrator = 0;
683 +    if( globals->haveResetTime() ){
684 +      info[i].resetTime = globals->getResetTime();
685 +      info[i].resetIntegrator = 1;
686 +    }
687 +
688      // check for the temperature set flag
689  
690      if (globals->haveTempSet())
# Line 916 | Line 913 | void SimSetup::initSystemCoords(void){
913      if (worldRank == 0){
914   #endif //is_mpi
915        inName = globals->getInitialConfig();
919      double* tempDouble = new double[1000000];
916        fileInit = new InitializeFromFile(inName);
917   #ifdef IS_MPI
918      }
# Line 934 | 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 1160 | 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 1259 | 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 1342 | 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<RealIntegrator>* myNPTi = NULL;
1348 <  NPTf<RealIntegrator>* myNPTf = NULL;
1349 <  NPTim<RealIntegrator>* myNPTim = NULL;
1349 <  NPTfm<RealIntegrator>* myNPTfm = NULL;
1350 <
1347 >  NPTi<NPT<RealIntegrator> >* myNPTi = 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 1378 | 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:
1388          if (globals->haveZconstraints()){
1389            setupZConstraint(info[k]);
1390 <          myNPTi = new ZConstraint<NPTi<RealIntegrator> >(&(info[k]), the_ff);
1390 >          myNPTi = new ZConstraint<NPTi<NPT <RealIntegrator> > >(&(info[k]), the_ff);
1391          }
1392          else
1393 <          myNPTi = new NPTi<RealIntegrator>(&(info[k]), the_ff);
1393 >          myNPTi = new NPTi<NPT<RealIntegrator> >(&(info[k]), the_ff);
1394  
1395          myNPTi->setTargetTemp(globals->getTargetTemp());
1396  
# Line 1419 | 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 1453 | Line 1459 | void SimSetup::makeIntegrator(void){
1459  
1460          if (globals->haveTauBarostat())
1461            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());
1462          else{
1463            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,
1464                    "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"
1465                    "    ensemble, you must set tauBarostat.\n");
1466            painCave.isFatal = 1;
1467            simError();
1468          }
1504        break;
1469  
1470 <      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 <        }
1470 >        info->the_integrator = myNPTf;
1471          break;
1472  
1473        default:
# Line 1615 | Line 1541 | void SimSetup::setupZConstraint(SimInfo& theInfo){
1541    }
1542    theInfo.addProperty(zconsTol);
1543  
1544 <  //set Force Substraction Policy
1544 >  //set Force Subtraction Policy
1545    StringData* zconsForcePolicy = new StringData();
1546    zconsForcePolicy->setID(ZCONSFORCEPOLICY_ID);
1547  
# Line 1624 | Line 1550 | void SimSetup::setupZConstraint(SimInfo& theInfo){
1550    }
1551    else{
1552      sprintf(painCave.errMsg,
1553 <            "ZConstraint Warning: User does not set force substraction policy, "
1554 <            "average force substraction policy is used\n");
1553 >            "ZConstraint Warning: User does not set force Subtraction policy, "
1554 >            "PolicyByMass is used\n");
1555      painCave.isFatal = 0;
1556      simError();
1557 <    zconsForcePolicy->setData("BYNUMBER");
1557 >    zconsForcePolicy->setData("BYMASS");
1558    }
1559  
1560    theInfo.addProperty(zconsForcePolicy);
# Line 1666 | Line 1592 | void SimSetup::setupZConstraint(SimInfo& theInfo){
1592      zconsParaData->addItem(tempParaItem);
1593    }
1594  
1595 +  //check the uniqueness of index  
1596 +  if(!zconsParaData->isIndexUnique()){
1597 +    sprintf(painCave.errMsg,
1598 +            "ZConstraint Error: molIndex is not unique\n");
1599 +    painCave.isFatal = 1;
1600 +    simError();
1601 +  }
1602 +
1603    //sort the parameters by index of molecules
1604    zconsParaData->sortByIndex();
1605 <
1605 >  
1606    //push data into siminfo, therefore, we can retrieve later
1607    theInfo.addProperty(zconsParaData);
1608   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines