| 5 | 
  | 
#include <string> | 
| 6 | 
  | 
 | 
| 7 | 
  | 
#include "SimSetup.hpp" | 
| 8 | 
+ | 
#include "ReadWrite.hpp" | 
| 9 | 
  | 
#include "parse_me.h" | 
| 10 | 
  | 
#include "Integrator.hpp" | 
| 11 | 
  | 
#include "simError.h" | 
| 23 | 
  | 
#define NPTf_ENS       3 | 
| 24 | 
  | 
#define NPTim_ENS      4 | 
| 25 | 
  | 
#define NPTfm_ENS      5 | 
| 25 | 
– | 
#define NVEZCONS_ENS   6 | 
| 26 | 
– | 
#define NVTZCONS_ENS   7 | 
| 27 | 
– | 
#define NPTiZCONS_ENS  8 | 
| 28 | 
– | 
#define NPTfZCONS_ENS  9 | 
| 29 | 
– | 
#define NPTimZCONS_ENS 10 | 
| 30 | 
– | 
#define NPTfmZCONS_ENS 11 | 
| 26 | 
  | 
 | 
| 27 | 
  | 
#define FF_DUFF 0 | 
| 28 | 
  | 
#define FF_LJ   1 | 
| 97 | 
  | 
  int i, j, k, globalAtomIndex; | 
| 98 | 
  | 
   | 
| 99 | 
  | 
  // gather all of the information from the Bass file | 
| 100 | 
< | 
   | 
| 100 | 
> | 
 | 
| 101 | 
  | 
  gatherInfo(); | 
| 102 | 
  | 
 | 
| 103 | 
  | 
  // creation of complex system objects | 
| 105 | 
  | 
  sysObjectsCreation(); | 
| 106 | 
  | 
 | 
| 107 | 
  | 
  // check on the post processing info | 
| 108 | 
< | 
   | 
| 108 | 
> | 
 | 
| 109 | 
  | 
  finalInfoCheck(); | 
| 110 | 
  | 
 | 
| 111 | 
  | 
  // initialize the system coordinates | 
| 634 | 
  | 
  else if( !strcasecmp( ensemble, "NPTf" )) ensembleCase = NPTf_ENS; | 
| 635 | 
  | 
  else if( !strcasecmp( ensemble, "NPTim" )) ensembleCase = NPTim_ENS; | 
| 636 | 
  | 
  else if( !strcasecmp( ensemble, "NPTfm" )) ensembleCase = NPTfm_ENS; | 
| 642 | 
– | 
 | 
| 643 | 
– | 
  else if( !strcasecmp( ensemble, "NVEZCONS")) ensembleCase = NVEZCONS_ENS; | 
| 644 | 
– | 
  else if( !strcasecmp( ensemble, "NVTZCONS"))  ensembleCase = NVTZCONS_ENS; | 
| 645 | 
– | 
  else if( !strcasecmp( ensemble, "NPTiZCONS") || !strcasecmp( ensemble, "NPTZCONS")) | 
| 646 | 
– | 
    ensembleCase = NPTiZCONS_ENS; | 
| 647 | 
– | 
  else if( !strcasecmp( ensemble, "NPTfZCONS"))  ensembleCase = NPTfZCONS_ENS; | 
| 648 | 
– | 
  else if( !strcasecmp( ensemble, "NPTimZCONS"))  ensembleCase = NPTimZCONS_ENS; | 
| 649 | 
– | 
  else if( !strcasecmp( ensemble, "NPTfmZCONS"))  ensembleCase = NPTfmZCONS_ENS; | 
| 650 | 
– | 
   | 
| 637 | 
  | 
  else{ | 
| 638 | 
  | 
    sprintf( painCave.errMsg, | 
| 639 | 
  | 
             "SimSetup Warning. Unrecognized Ensemble -> %s, " | 
| 889 | 
  | 
void SimSetup::initSystemCoords( void ){ | 
| 890 | 
  | 
  int i; | 
| 891 | 
  | 
   | 
| 892 | 
< | 
  std::cerr << "Setting atom Coords\n"; | 
| 892 | 
> | 
  char* inName; | 
| 893 | 
> | 
 | 
| 894 | 
  | 
 | 
| 895 | 
  | 
  (info[0].getConfiguration())->createArrays( info[0].n_atoms ); | 
| 896 | 
  | 
   | 
| 902 | 
  | 
#ifdef IS_MPI // is_mpi | 
| 903 | 
  | 
    if( worldRank == 0 ){ | 
| 904 | 
  | 
#endif //is_mpi | 
| 905 | 
< | 
      fileInit = new InitializeFromFile( globals->getInitialConfig() ); | 
| 905 | 
> | 
      inName = globals->getInitialConfig(); | 
| 906 | 
> | 
      fileInit = new InitializeFromFile( inName ); | 
| 907 | 
  | 
#ifdef IS_MPI | 
| 908 | 
  | 
    }else fileInit = new InitializeFromFile( NULL ); | 
| 909 | 
  | 
#endif | 
| 1036 | 
  | 
  int i,k; | 
| 1037 | 
  | 
   | 
| 1038 | 
  | 
  // create the forceField | 
| 1039 | 
< | 
   | 
| 1039 | 
> | 
 | 
| 1040 | 
  | 
  createFF(); | 
| 1041 | 
  | 
 | 
| 1042 | 
  | 
  // extract componentList | 
| 1054 | 
  | 
#endif //is_mpi | 
| 1055 | 
  | 
   | 
| 1056 | 
  | 
  // create the atom and SRI arrays. Also initialize Molecule Stamp ID's | 
| 1057 | 
< | 
   | 
| 1057 | 
> | 
  | 
| 1058 | 
  | 
  makeSysArrays(); | 
| 1059 | 
  | 
 | 
| 1060 | 
  | 
  // make and initialize the molecules (all but atomic coordinates) | 
| 1061 | 
< | 
   | 
| 1061 | 
> | 
  | 
| 1062 | 
  | 
  makeMolecules(); | 
| 1063 | 
  | 
   | 
| 1064 | 
  | 
  for(k=0; k<nInfo; k++){ | 
| 1355 | 
  | 
  NPTf<RealIntegrator>* myNPTf = NULL; | 
| 1356 | 
  | 
  NPTim<RealIntegrator>* myNPTim = NULL; | 
| 1357 | 
  | 
  NPTfm<RealIntegrator>* myNPTfm = NULL; | 
| 1370 | 
– | 
  ZConstraint<NVE<RealIntegrator> >* myNVEZCons = NULL; | 
| 1371 | 
– | 
  ZConstraint<NVT<RealIntegrator> >* myNVTZCons = NULL; | 
| 1372 | 
– | 
  ZConstraint<NPTi<RealIntegrator> >* myNPTiZCons = NULL; | 
| 1373 | 
– | 
  ZConstraint<NPTf<RealIntegrator> >* myNPTfZCons = NULL; | 
| 1374 | 
– | 
  ZConstraint<NPTim<RealIntegrator> >* myNPTimZCons = NULL; | 
| 1375 | 
– | 
  ZConstraint<NPTfm<RealIntegrator> >* myNPTfmZCons = NULL; | 
| 1358 | 
  | 
         | 
| 1359 | 
  | 
  for(k=0; k<nInfo; k++){ | 
| 1360 | 
  | 
     | 
| 1361 | 
  | 
    switch( ensembleCase ){ | 
| 1362 | 
  | 
       | 
| 1363 | 
  | 
    case NVE_ENS: | 
| 1364 | 
< | 
      new NVE<RealIntegrator>( &(info[k]), the_ff ); | 
| 1364 | 
> | 
        if (globals->haveZconstraints()){ | 
| 1365 | 
> | 
         setupZConstraint(info[k]); | 
| 1366 | 
> | 
           new ZConstraint<NVE<RealIntegrator> >( &(info[k]), the_ff ); | 
| 1367 | 
> | 
        } | 
| 1368 | 
> | 
 | 
| 1369 | 
> | 
        else | 
| 1370 | 
> | 
        new NVE<RealIntegrator>( &(info[k]), the_ff ); | 
| 1371 | 
  | 
      break; | 
| 1372 | 
  | 
       | 
| 1373 | 
  | 
    case NVT_ENS: | 
| 1374 | 
< | 
      myNVT = new NVT<RealIntegrator>( &(info[k]), the_ff ); | 
| 1374 | 
> | 
        if (globals->haveZconstraints()){ | 
| 1375 | 
> | 
         setupZConstraint(info[k]); | 
| 1376 | 
> | 
           myNVT = new ZConstraint<NVT<RealIntegrator> >( &(info[k]), the_ff ); | 
| 1377 | 
> | 
        } | 
| 1378 | 
> | 
        else | 
| 1379 | 
> | 
        myNVT = new NVT<RealIntegrator>( &(info[k]), the_ff ); | 
| 1380 | 
> | 
 | 
| 1381 | 
  | 
      myNVT->setTargetTemp(globals->getTargetTemp()); | 
| 1382 | 
  | 
       | 
| 1383 | 
  | 
      if (globals->haveTauThermostat())  | 
| 1393 | 
  | 
      break; | 
| 1394 | 
  | 
       | 
| 1395 | 
  | 
    case NPTi_ENS: | 
| 1396 | 
< | 
      myNPTi = new NPTi<RealIntegrator>( &(info[k]), the_ff ); | 
| 1397 | 
< | 
      myNPTi->setTargetTemp( globals->getTargetTemp() ); | 
| 1396 | 
> | 
        if (globals->haveZconstraints()){ | 
| 1397 | 
> | 
         setupZConstraint(info[k]); | 
| 1398 | 
> | 
           myNPTi = new ZConstraint<NPTi<RealIntegrator> >( &(info[k]), the_ff ); | 
| 1399 | 
> | 
        } | 
| 1400 | 
> | 
        else | 
| 1401 | 
> | 
        myNPTi = new NPTi<RealIntegrator>( &(info[k]), the_ff ); | 
| 1402 | 
> | 
 | 
| 1403 | 
> | 
        myNPTi->setTargetTemp( globals->getTargetTemp() ); | 
| 1404 | 
  | 
       | 
| 1405 | 
  | 
      if (globals->haveTargetPressure()) | 
| 1406 | 
  | 
        myNPTi->setTargetPressure(globals->getTargetPressure()); | 
| 1434 | 
  | 
      break; | 
| 1435 | 
  | 
       | 
| 1436 | 
  | 
    case NPTf_ENS: | 
| 1437 | 
< | 
      myNPTf = new NPTf<RealIntegrator>( &(info[k]), the_ff ); | 
| 1437 | 
> | 
        if (globals->haveZconstraints()){ | 
| 1438 | 
> | 
         setupZConstraint(info[k]); | 
| 1439 | 
> | 
           myNPTf = new ZConstraint<NPTf<RealIntegrator> >( &(info[k]), the_ff ); | 
| 1440 | 
> | 
        } | 
| 1441 | 
> | 
        else | 
| 1442 | 
> | 
        myNPTf = new NPTf<RealIntegrator>( &(info[k]), the_ff ); | 
| 1443 | 
> | 
 | 
| 1444 | 
  | 
      myNPTf->setTargetTemp( globals->getTargetTemp()); | 
| 1445 | 
  | 
       | 
| 1446 | 
  | 
      if (globals->haveTargetPressure()) | 
| 1475 | 
  | 
      break; | 
| 1476 | 
  | 
       | 
| 1477 | 
  | 
    case NPTim_ENS: | 
| 1478 | 
< | 
      myNPTim = new NPTim<RealIntegrator>( &(info[k]), the_ff ); | 
| 1479 | 
< | 
      myNPTim->setTargetTemp( globals->getTargetTemp()); | 
| 1478 | 
> | 
        if (globals->haveZconstraints()){ | 
| 1479 | 
> | 
         setupZConstraint(info[k]); | 
| 1480 | 
> | 
           myNPTim = new ZConstraint<NPTim<RealIntegrator> >( &(info[k]), the_ff ); | 
| 1481 | 
> | 
        } | 
| 1482 | 
> | 
        else | 
| 1483 | 
> | 
        myNPTim = new NPTim<RealIntegrator>( &(info[k]), the_ff ); | 
| 1484 | 
> | 
 | 
| 1485 | 
> | 
        myNPTim->setTargetTemp( globals->getTargetTemp()); | 
| 1486 | 
  | 
       | 
| 1487 | 
  | 
      if (globals->haveTargetPressure()) | 
| 1488 | 
  | 
        myNPTim->setTargetPressure(globals->getTargetPressure()); | 
| 1516 | 
  | 
      break; | 
| 1517 | 
  | 
       | 
| 1518 | 
  | 
    case NPTfm_ENS: | 
| 1519 | 
< | 
      myNPTfm = new NPTfm<RealIntegrator>( &(info[k]), the_ff ); | 
| 1520 | 
< | 
      myNPTfm->setTargetTemp( globals->getTargetTemp()); | 
| 1519 | 
> | 
        if (globals->haveZconstraints()){ | 
| 1520 | 
> | 
         setupZConstraint(info[k]); | 
| 1521 | 
> | 
           myNPTfm = new ZConstraint<NPTfm<RealIntegrator> >( &(info[k]), the_ff ); | 
| 1522 | 
> | 
        } | 
| 1523 | 
> | 
        else | 
| 1524 | 
> | 
        myNPTfm = new NPTfm<RealIntegrator>( &(info[k]), the_ff ); | 
| 1525 | 
> | 
 | 
| 1526 | 
> | 
        myNPTfm->setTargetTemp( globals->getTargetTemp()); | 
| 1527 | 
  | 
       | 
| 1528 | 
  | 
      if (globals->haveTargetPressure()) | 
| 1529 | 
  | 
        myNPTfm->setTargetPressure(globals->getTargetPressure()); | 
| 1551 | 
  | 
        sprintf( painCave.errMsg, | 
| 1552 | 
  | 
                 "SimSetup error: If you use an NPT\n" | 
| 1553 | 
  | 
                 "    ensemble, you must set tauBarostat.\n"); | 
| 1536 | 
– | 
        painCave.isFatal = 1; | 
| 1537 | 
– | 
        simError(); | 
| 1538 | 
– | 
      } | 
| 1539 | 
– | 
      break; | 
| 1540 | 
– | 
       | 
| 1541 | 
– | 
    case NVEZCONS_ENS: | 
| 1542 | 
– | 
       | 
| 1543 | 
– | 
       | 
| 1544 | 
– | 
      //setup index of z-constraint molecules, z-constraint sampel time | 
| 1545 | 
– | 
      //and z-constraint force output name. These parameter should be known  | 
| 1546 | 
– | 
      //before constructing the z-constraint integrator  | 
| 1547 | 
– | 
      setupZConstraint(); | 
| 1548 | 
– | 
       | 
| 1549 | 
– | 
      myNVEZCons = new ZConstraint<NVE<RealIntegrator> >( &(info[k]), the_ff ); | 
| 1550 | 
– | 
       | 
| 1551 | 
– | 
      break; | 
| 1552 | 
– | 
       | 
| 1553 | 
– | 
       | 
| 1554 | 
– | 
    case NVTZCONS_ENS: | 
| 1555 | 
– | 
       | 
| 1556 | 
– | 
      setupZConstraint(); | 
| 1557 | 
– | 
       | 
| 1558 | 
– | 
      myNVTZCons = new ZConstraint<NVT<RealIntegrator> >( &(info[k]), the_ff ); | 
| 1559 | 
– | 
      myNVTZCons->setTargetTemp(globals->getTargetTemp()); | 
| 1560 | 
– | 
       | 
| 1561 | 
– | 
      if (globals->haveTauThermostat())  | 
| 1562 | 
– | 
        myNVTZCons->setTauThermostat(globals->getTauThermostat()); | 
| 1563 | 
– | 
       | 
| 1564 | 
– | 
      else { | 
| 1565 | 
– | 
        sprintf( painCave.errMsg, | 
| 1566 | 
– | 
                 "SimSetup error: If you use the NVT\n" | 
| 1567 | 
– | 
                 "    ensemble, you must set tauThermostat.\n"); | 
| 1554 | 
  | 
        painCave.isFatal = 1; | 
| 1555 | 
  | 
        simError(); | 
| 1570 | 
– | 
      }     | 
| 1571 | 
– | 
      break;     | 
| 1572 | 
– | 
       | 
| 1573 | 
– | 
    case NPTiZCONS_ENS: | 
| 1574 | 
– | 
       | 
| 1575 | 
– | 
      setupZConstraint(); | 
| 1576 | 
– | 
       | 
| 1577 | 
– | 
      myNPTiZCons = new ZConstraint<NPTi<RealIntegrator> >( &(info[k]), the_ff ); | 
| 1578 | 
– | 
      myNPTiZCons->setTargetTemp( globals->getTargetTemp() ); | 
| 1579 | 
– | 
       | 
| 1580 | 
– | 
      if (globals->haveTargetPressure()) | 
| 1581 | 
– | 
        myNPTiZCons->setTargetPressure(globals->getTargetPressure()); | 
| 1582 | 
– | 
      else { | 
| 1583 | 
– | 
        sprintf( painCave.errMsg, | 
| 1584 | 
– | 
                 "SimSetup error: If you use a constant pressure\n" | 
| 1585 | 
– | 
                 "    ensemble, you must set targetPressure in the BASS file.\n"); | 
| 1586 | 
– | 
        painCave.isFatal = 1; | 
| 1587 | 
– | 
        simError(); | 
| 1556 | 
  | 
      } | 
| 1589 | 
– | 
       | 
| 1590 | 
– | 
      if( globals->haveTauThermostat() ) | 
| 1591 | 
– | 
        myNPTiZCons->setTauThermostat( globals->getTauThermostat() ); | 
| 1592 | 
– | 
      else{ | 
| 1593 | 
– | 
        sprintf( painCave.errMsg, | 
| 1594 | 
– | 
                 "SimSetup error: If you use an NPT\n" | 
| 1595 | 
– | 
                 "    ensemble, you must set tauThermostat.\n"); | 
| 1596 | 
– | 
        painCave.isFatal = 1; | 
| 1597 | 
– | 
        simError(); | 
| 1598 | 
– | 
      } | 
| 1599 | 
– | 
       | 
| 1600 | 
– | 
      if( globals->haveTauBarostat() ) | 
| 1601 | 
– | 
        myNPTiZCons->setTauBarostat( globals->getTauBarostat() ); | 
| 1602 | 
– | 
      else{ | 
| 1603 | 
– | 
        sprintf( painCave.errMsg, | 
| 1604 | 
– | 
                 "SimSetup error: If you use an NPT\n" | 
| 1605 | 
– | 
                 "    ensemble, you must set tauBarostat.\n"); | 
| 1606 | 
– | 
        painCave.isFatal = 1; | 
| 1607 | 
– | 
        simError(); | 
| 1608 | 
– | 
      }    | 
| 1609 | 
– | 
       | 
| 1557 | 
  | 
      break; | 
| 1558 | 
  | 
       | 
| 1612 | 
– | 
    case NPTfZCONS_ENS: | 
| 1613 | 
– | 
       | 
| 1614 | 
– | 
      setupZConstraint(); | 
| 1615 | 
– | 
       | 
| 1616 | 
– | 
      myNPTfZCons = new ZConstraint<NPTf<RealIntegrator> >( &(info[k]), the_ff ); | 
| 1617 | 
– | 
      myNPTfZCons->setTargetTemp( globals->getTargetTemp()); | 
| 1618 | 
– | 
       | 
| 1619 | 
– | 
      if (globals->haveTargetPressure()) | 
| 1620 | 
– | 
        myNPTfZCons->setTargetPressure(globals->getTargetPressure()); | 
| 1621 | 
– | 
      else { | 
| 1622 | 
– | 
        sprintf( painCave.errMsg, | 
| 1623 | 
– | 
                 "SimSetup error: If you use a constant pressure\n" | 
| 1624 | 
– | 
                 "    ensemble, you must set targetPressure in the BASS file.\n"); | 
| 1625 | 
– | 
        painCave.isFatal = 1; | 
| 1626 | 
– | 
        simError(); | 
| 1627 | 
– | 
      }     | 
| 1628 | 
– | 
       | 
| 1629 | 
– | 
      if( globals->haveTauThermostat() ) | 
| 1630 | 
– | 
        myNPTfZCons->setTauThermostat( globals->getTauThermostat() ); | 
| 1631 | 
– | 
      else{ | 
| 1632 | 
– | 
        sprintf( painCave.errMsg, | 
| 1633 | 
– | 
                 "SimSetup error: If you use an NPT\n" | 
| 1634 | 
– | 
                 "    ensemble, you must set tauThermostat.\n"); | 
| 1635 | 
– | 
        painCave.isFatal = 1; | 
| 1636 | 
– | 
        simError(); | 
| 1637 | 
– | 
      } | 
| 1638 | 
– | 
       | 
| 1639 | 
– | 
      if( globals->haveTauBarostat() ) | 
| 1640 | 
– | 
        myNPTfZCons->setTauBarostat( globals->getTauBarostat() ); | 
| 1641 | 
– | 
      else{ | 
| 1642 | 
– | 
        sprintf( painCave.errMsg, | 
| 1643 | 
– | 
                 "SimSetup error: If you use an NPT\n" | 
| 1644 | 
– | 
                 "    ensemble, you must set tauBarostat.\n"); | 
| 1645 | 
– | 
        painCave.isFatal = 1; | 
| 1646 | 
– | 
        simError(); | 
| 1647 | 
– | 
      }    | 
| 1648 | 
– | 
       | 
| 1649 | 
– | 
      break;   | 
| 1650 | 
– | 
       | 
| 1651 | 
– | 
    case NPTimZCONS_ENS: | 
| 1652 | 
– | 
       | 
| 1653 | 
– | 
      setupZConstraint(); | 
| 1654 | 
– | 
       | 
| 1655 | 
– | 
      myNPTimZCons = new ZConstraint<NPTim<RealIntegrator> >( &(info[k]), the_ff ); | 
| 1656 | 
– | 
      myNPTimZCons->setTargetTemp( globals->getTargetTemp()); | 
| 1657 | 
– | 
       | 
| 1658 | 
– | 
      if (globals->haveTargetPressure()) | 
| 1659 | 
– | 
        myNPTimZCons->setTargetPressure(globals->getTargetPressure()); | 
| 1660 | 
– | 
      else { | 
| 1661 | 
– | 
        sprintf( painCave.errMsg, | 
| 1662 | 
– | 
                 "SimSetup error: If you use a constant pressure\n" | 
| 1663 | 
– | 
                 "    ensemble, you must set targetPressure in the BASS file.\n"); | 
| 1664 | 
– | 
        painCave.isFatal = 1; | 
| 1665 | 
– | 
        simError(); | 
| 1666 | 
– | 
      } | 
| 1667 | 
– | 
       | 
| 1668 | 
– | 
      if( globals->haveTauThermostat() ) | 
| 1669 | 
– | 
        myNPTimZCons->setTauThermostat( globals->getTauThermostat() ); | 
| 1670 | 
– | 
      else{ | 
| 1671 | 
– | 
        sprintf( painCave.errMsg, | 
| 1672 | 
– | 
                 "SimSetup error: If you use an NPT\n" | 
| 1673 | 
– | 
                 "    ensemble, you must set tauThermostat.\n"); | 
| 1674 | 
– | 
        painCave.isFatal = 1; | 
| 1675 | 
– | 
        simError(); | 
| 1676 | 
– | 
      } | 
| 1677 | 
– | 
       | 
| 1678 | 
– | 
      if( globals->haveTauBarostat() ) | 
| 1679 | 
– | 
        myNPTimZCons->setTauBarostat( globals->getTauBarostat() ); | 
| 1680 | 
– | 
      else{ | 
| 1681 | 
– | 
        sprintf( painCave.errMsg, | 
| 1682 | 
– | 
                 "SimSetup error: If you use an NPT\n" | 
| 1683 | 
– | 
                 "    ensemble, you must set tauBarostat.\n"); | 
| 1684 | 
– | 
        painCave.isFatal = 1; | 
| 1685 | 
– | 
        simError(); | 
| 1686 | 
– | 
      }    | 
| 1687 | 
– | 
       | 
| 1688 | 
– | 
      break; | 
| 1689 | 
– | 
       | 
| 1690 | 
– | 
    case NPTfmZCONS_ENS: | 
| 1691 | 
– | 
       | 
| 1692 | 
– | 
      setupZConstraint(); | 
| 1693 | 
– | 
       | 
| 1694 | 
– | 
      myNPTfmZCons = new ZConstraint<NPTfm<RealIntegrator> >( &(info[k]), the_ff ); | 
| 1695 | 
– | 
      myNPTfmZCons->setTargetTemp( globals->getTargetTemp()); | 
| 1696 | 
– | 
       | 
| 1697 | 
– | 
      if (globals->haveTargetPressure()) | 
| 1698 | 
– | 
        myNPTfmZCons->setTargetPressure(globals->getTargetPressure()); | 
| 1699 | 
– | 
      else { | 
| 1700 | 
– | 
        sprintf( painCave.errMsg, | 
| 1701 | 
– | 
                 "SimSetup error: If you use a constant pressure\n" | 
| 1702 | 
– | 
                 "    ensemble, you must set targetPressure in the BASS file.\n"); | 
| 1703 | 
– | 
        painCave.isFatal = 1; | 
| 1704 | 
– | 
        simError(); | 
| 1705 | 
– | 
      } | 
| 1706 | 
– | 
       | 
| 1707 | 
– | 
      if( globals->haveTauThermostat() ) | 
| 1708 | 
– | 
        myNPTfmZCons->setTauThermostat( globals->getTauThermostat() ); | 
| 1709 | 
– | 
      else{ | 
| 1710 | 
– | 
        sprintf( painCave.errMsg, | 
| 1711 | 
– | 
                 "SimSetup error: If you use an NPT\n" | 
| 1712 | 
– | 
                 "    ensemble, you must set tauThermostat.\n"); | 
| 1713 | 
– | 
        painCave.isFatal = 1; | 
| 1714 | 
– | 
        simError(); | 
| 1715 | 
– | 
      } | 
| 1716 | 
– | 
       | 
| 1717 | 
– | 
      if( globals->haveTauBarostat() ) | 
| 1718 | 
– | 
        myNPTfmZCons->setTauBarostat( globals->getTauBarostat() ); | 
| 1719 | 
– | 
      else{ | 
| 1720 | 
– | 
        sprintf( painCave.errMsg, | 
| 1721 | 
– | 
                 "SimSetup error: If you use an NPT\n" | 
| 1722 | 
– | 
                 "    ensemble, you must set tauBarostat.\n"); | 
| 1723 | 
– | 
        painCave.isFatal = 1; | 
| 1724 | 
– | 
        simError(); | 
| 1725 | 
– | 
      }     | 
| 1726 | 
– | 
      break;        | 
| 1727 | 
– | 
       | 
| 1728 | 
– | 
       | 
| 1729 | 
– | 
       | 
| 1559 | 
  | 
    default: | 
| 1560 | 
  | 
      sprintf( painCave.errMsg, | 
| 1561 | 
  | 
               "SimSetup Error. Unrecognized ensemble in case statement.\n"); | 
| 1592 | 
  | 
 | 
| 1593 | 
  | 
} | 
| 1594 | 
  | 
 | 
| 1595 | 
< | 
void SimSetup::setupZConstraint() | 
| 1595 | 
> | 
void SimSetup::setupZConstraint(SimInfo& theInfo) | 
| 1596 | 
  | 
{ | 
| 1597 | 
< | 
  int k; | 
| 1598 | 
< | 
 | 
| 1599 | 
< | 
  for(k=0; k<nInfo; k++){ | 
| 1600 | 
< | 
     | 
| 1772 | 
< | 
    if(globals->haveZConsTime()){    | 
| 1597 | 
> | 
    int nZConstraints; | 
| 1598 | 
> | 
    ZconStamp** zconStamp; | 
| 1599 | 
> | 
         | 
| 1600 | 
> | 
    if(globals->haveZconstraintTime()){    | 
| 1601 | 
  | 
       | 
| 1602 | 
  | 
      //add sample time of z-constraint  into SimInfo's property list                     | 
| 1603 | 
  | 
      DoubleData* zconsTimeProp = new DoubleData(); | 
| 1604 | 
< | 
      zconsTimeProp->setID("zconstime"); | 
| 1605 | 
< | 
      zconsTimeProp->setData(globals->getZConsTime()); | 
| 1606 | 
< | 
      info[k].addProperty(zconsTimeProp); | 
| 1604 | 
> | 
      zconsTimeProp->setID(ZCONSTIME_ID); | 
| 1605 | 
> | 
      zconsTimeProp->setData(globals->getZconsTime()); | 
| 1606 | 
> | 
      theInfo.addProperty(zconsTimeProp); | 
| 1607 | 
  | 
    } | 
| 1608 | 
  | 
    else{ | 
| 1609 | 
  | 
      sprintf( painCave.errMsg, | 
| 1612 | 
  | 
      painCave.isFatal = 1; | 
| 1613 | 
  | 
      simError();       | 
| 1614 | 
  | 
    } | 
| 1615 | 
< | 
     | 
| 1616 | 
< | 
    if(globals->haveIndexOfAllZConsMols()){ | 
| 1617 | 
< | 
  | 
| 1618 | 
< | 
      //add index of z-constraint molecules into SimInfo's property list | 
| 1619 | 
< | 
      vector<int> tempIndex = globals->getIndexOfAllZConsMols(); | 
| 1620 | 
< | 
       | 
| 1621 | 
< | 
      //sort the index | 
| 1622 | 
< | 
      sort(tempIndex.begin(), tempIndex.end()); | 
| 1623 | 
< | 
       | 
| 1624 | 
< | 
      IndexData* zconsIndex = new IndexData(); | 
| 1625 | 
< | 
      zconsIndex->setID("zconsindex"); | 
| 1626 | 
< | 
      zconsIndex->setIndexData(tempIndex); | 
| 1627 | 
< | 
      info[k].addProperty(zconsIndex); | 
| 1615 | 
> | 
 | 
| 1616 | 
> | 
    // | 
| 1617 | 
> | 
    nZConstraints = globals->getNzConstraints(); | 
| 1618 | 
> | 
    zconStamp = globals->getZconStamp(); | 
| 1619 | 
> | 
    ZConsParaItem tempParaItem; | 
| 1620 | 
> | 
 | 
| 1621 | 
> | 
    ZConsParaData* zconsParaData = new ZConsParaData(); | 
| 1622 | 
> | 
    zconsParaData->setID(ZCONSPARADATA_ID); | 
| 1623 | 
> | 
    | 
| 1624 | 
> | 
    for(int i = 0; i < nZConstraints; i++){ | 
| 1625 | 
> | 
    tempParaItem.havingZPos = zconStamp[i]->haveZpos(); | 
| 1626 | 
> | 
    tempParaItem.zPos = zconStamp[i]->getZpos(); | 
| 1627 | 
> | 
    tempParaItem.zconsIndex = zconStamp[i]->getMolIndex(); | 
| 1628 | 
> | 
    tempParaItem.kRatio = zconStamp[i]->getKratio(); | 
| 1629 | 
> | 
 | 
| 1630 | 
> | 
    zconsParaData->addItem(tempParaItem); | 
| 1631 | 
  | 
    } | 
| 1632 | 
< | 
    else{ | 
| 1633 | 
< | 
      sprintf( painCave.errMsg, | 
| 1634 | 
< | 
               "SimSetup error: If you use an ZConstraint\n" | 
| 1635 | 
< | 
               " , you must set index of z-constraint molecules.\n"); | 
| 1636 | 
< | 
      painCave.isFatal = 1; | 
| 1637 | 
< | 
      simError();      | 
| 1638 | 
< | 
       | 
| 1632 | 
> | 
 | 
| 1633 | 
> | 
    //sort the parameters by index of molecules | 
| 1634 | 
> | 
    zconsParaData->sortByIndex(); | 
| 1635 | 
> | 
         | 
| 1636 | 
> | 
    //push data into siminfo, therefore, we can retrieve later | 
| 1637 | 
> | 
    theInfo.addProperty(zconsParaData); | 
| 1638 | 
> | 
 | 
| 1639 | 
> | 
    //push zconsTol into siminfo, if user does not specify | 
| 1640 | 
> | 
    //value for zconsTol, a default value will be used | 
| 1641 | 
> | 
    DoubleData* zconsTol = new DoubleData(); | 
| 1642 | 
> | 
    zconsTol->setID(ZCONSTOL_ID); | 
| 1643 | 
> | 
    if(globals->haveZconsTol()){ | 
| 1644 | 
> | 
      zconsTol->setData(globals->getZconsTol()); | 
| 1645 | 
  | 
    } | 
| 1646 | 
< | 
     | 
| 1646 | 
> | 
         else{ | 
| 1647 | 
> | 
                double defaultZConsTol = 1E-6; | 
| 1648 | 
> | 
      sprintf( painCave.errMsg, | 
| 1649 | 
> | 
               "ZConstraint Waring: Tolerance for z-constraint methodl is not specified\n" | 
| 1650 | 
> | 
               " , default value %f is used.\n", defaultZConsTol); | 
| 1651 | 
> | 
      painCave.isFatal = 0; | 
| 1652 | 
> | 
      simError();       | 
| 1653 | 
> | 
 | 
| 1654 | 
> | 
      zconsTol->setData(defaultZConsTol); | 
| 1655 | 
> | 
         } | 
| 1656 | 
> | 
    theInfo.addProperty(zconsTol); | 
| 1657 | 
> | 
          | 
| 1658 | 
  | 
    //Determine the name of ouput file and add it into SimInfo's property list  | 
| 1659 | 
  | 
    //Be careful, do not use inFileName, since it is a pointer which | 
| 1660 | 
  | 
    //point to a string at master node, and slave nodes do not contain that string | 
| 1661 | 
  | 
     | 
| 1662 | 
< | 
    string zconsOutput(info[k].finalName); | 
| 1662 | 
> | 
    string zconsOutput(theInfo.finalName); | 
| 1663 | 
  | 
     | 
| 1664 | 
  | 
    zconsOutput = zconsOutput.substr(0, zconsOutput.rfind(".")) + ".fz"; | 
| 1665 | 
  | 
     | 
| 1666 | 
  | 
    StringData* zconsFilename = new StringData(); | 
| 1667 | 
< | 
    zconsFilename->setID("zconsfilename"); | 
| 1667 | 
> | 
    zconsFilename->setID(ZCONSFILENAME_ID); | 
| 1668 | 
  | 
    zconsFilename->setData(zconsOutput); | 
| 1669 | 
  | 
     | 
| 1670 | 
< | 
    info[k].addProperty(zconsFilename);       | 
| 1823 | 
< | 
  } | 
| 1670 | 
> | 
    theInfo.addProperty(zconsFilename);       | 
| 1671 | 
  | 
} |