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 811 by mmeineke, Tue Oct 21 19:33:19 2003 UTC vs.
Revision 855 by mmeineke, Thu Nov 6 22:01:37 2003 UTC

# Line 1 | Line 1
1   #include <algorithm>
2 < #include <cstdlib>
2 > #include <stdlib.h>
3   #include <iostream>
4 < #include <cmath>
4 > #include <math.h>
5   #include <string>
6   #include <sprng.h>
7
7   #include "SimSetup.hpp"
8   #include "ReadWrite.hpp"
9   #include "parse_me.h"
# Line 22 | Line 21
21   #define NVT_ENS        1
22   #define NPTi_ENS       2
23   #define NPTf_ENS       3
24 + #define NPTxyz_ENS     4
25  
26 +
27   #define FF_DUFF 0
28   #define FF_LJ   1
29   #define FF_EAM  2
# Line 30 | Line 31 | SimSetup::SimSetup(){
31   using namespace std;
32  
33   SimSetup::SimSetup(){
34 +  
35 +  initSuspend = false;
36    isInfoArray = 0;
37    nInfo = 1;
38  
# Line 52 | Line 55 | void SimSetup::setSimInfo(SimInfo* the_info, int theNi
55    info = the_info;
56    nInfo = theNinfo;
57    isInfoArray = 1;
58 +  initSuspend = true;
59   }
60  
61  
# Line 99 | Line 103 | void SimSetup::createSim(void){
103  
104    sysObjectsCreation();
105  
102  // check on the post processing info
103
104  finalInfoCheck();
105
106    // initialize the system coordinates
107  
108 <  if (!isInfoArray){
108 >  if ( !initSuspend ){
109      initSystemCoords();
110  
111      if( !(globals->getUseInitTime()) )
112        info[0].currentTime = 0.0;
113    }  
114 +
115 +  // check on the post processing info
116 +
117 +  finalInfoCheck();
118  
119    // make the output filenames
120  
# Line 604 | Line 608 | void SimSetup::gatherInfo(void){
608    else if (!strcasecmp(ensemble, "NPTf")){
609      ensembleCase = NPTf_ENS;
610    }
611 +  else if (!strcasecmp(ensemble, "NPTxyz")){
612 +    ensembleCase = NPTxyz_ENS;
613 +  }
614    else{
615      sprintf(painCave.errMsg,
616              "SimSetup Warning. Unrecognized Ensemble -> %s, "
# Line 689 | Line 696 | void SimSetup::gatherInfo(void){
696      }
697  
698      // check for the temperature set flag
699 <
699 >    
700      if (globals->haveTempSet())
701        info[i].setTemp = globals->getTempSet();
702  
703 <    // get some of the tricky things that may still be in the globals
697 <
698 <    double boxVector[3];
699 <    if (globals->haveBox()){
700 <      boxVector[0] = globals->getBox();
701 <      boxVector[1] = globals->getBox();
702 <      boxVector[2] = globals->getBox();
703 <
704 <      info[i].setBox(boxVector);
705 <    }
706 <    else if (globals->haveDensity()){
707 <      double vol;
708 <      vol = (double) tot_nmol / globals->getDensity();
709 <      boxVector[0] = pow(vol, (1.0 / 3.0));
710 <      boxVector[1] = boxVector[0];
711 <      boxVector[2] = boxVector[0];
703 >    // check for the extended State init
704  
705 <      info[i].setBox(boxVector);
706 <    }
707 <    else{
716 <      if (!globals->haveBoxX()){
717 <        sprintf(painCave.errMsg,
718 <                "SimSetup error, no periodic BoxX size given.\n");
719 <        painCave.isFatal = 1;
720 <        simError();
721 <      }
722 <      boxVector[0] = globals->getBoxX();
723 <
724 <      if (!globals->haveBoxY()){
725 <        sprintf(painCave.errMsg,
726 <                "SimSetup error, no periodic BoxY size given.\n");
727 <        painCave.isFatal = 1;
728 <        simError();
729 <      }
730 <      boxVector[1] = globals->getBoxY();
731 <
732 <      if (!globals->haveBoxZ()){
733 <        sprintf(painCave.errMsg,
734 <                "SimSetup error, no periodic BoxZ size given.\n");
735 <        painCave.isFatal = 1;
736 <        simError();
737 <      }
738 <      boxVector[2] = globals->getBoxZ();
739 <
740 <      info[i].setBox(boxVector);
741 <    }
705 >    info[i].useInitXSstate = globals->getUseInitXSstate();
706 >    info[i].orthoTolerance = globals->getOrthoBoxTolerance();
707 >    
708    }
709 <
709 >  
710    //setup seed for random number generator
711    int seedValue;
712  
# Line 844 | Line 810 | void SimSetup::finalInfoCheck(void){
810          theEst = globals->getEST();
811        }
812  
813 <      info[i].setEcr(theEcr, theEst);
813 >      info[i].setDefaultEcr(theEcr, theEst);
814  
815        if (!globals->haveDielectric()){
816          sprintf(painCave.errMsg,
# Line 889 | Line 855 | void SimSetup::finalInfoCheck(void){
855            theEst = globals->getEST();
856          }
857  
858 <        info[i].setEcr(theEcr, theEst);
858 >        info[i].setDefaultEcr(theEcr, theEst);
859        }
860      }
861 +
862 +    if( !initSuspend )
863 +      info[i].checkCutOffs();
864    }
865  
866   #ifdef IS_MPI
# Line 1349 | Line 1318 | void SimSetup::makeIntegrator(void){
1318    NVT<RealIntegrator>* myNVT = NULL;
1319    NPTi<NPT<RealIntegrator> >* myNPTi = NULL;
1320    NPTf<NPT<RealIntegrator> >* myNPTf = NULL;
1321 +  NPTxyz<NPT<RealIntegrator> >* myNPTxyz = NULL;
1322    
1323    for (k = 0; k < nInfo; k++){
1324      switch (ensembleCase){
# Line 1452 | Line 1422 | void SimSetup::makeIntegrator(void){
1422  
1423          if (globals->haveTauThermostat())
1424            myNPTf->setTauThermostat(globals->getTauThermostat());
1425 +
1426          else{
1427            sprintf(painCave.errMsg,
1428                    "SimSetup error: If you use an NPT\n"
# Line 1462 | Line 1433 | void SimSetup::makeIntegrator(void){
1433  
1434          if (globals->haveTauBarostat())
1435            myNPTf->setTauBarostat(globals->getTauBarostat());
1436 +
1437          else{
1438            sprintf(painCave.errMsg,
1439                    "SimSetup error: If you use an NPT\n"
# Line 1473 | Line 1445 | void SimSetup::makeIntegrator(void){
1445          info->the_integrator = myNPTf;
1446          break;
1447  
1448 +      case NPTxyz_ENS:
1449 +        if (globals->haveZconstraints()){
1450 +          setupZConstraint(info[k]);
1451 +          myNPTxyz = new ZConstraint<NPTxyz<NPT <RealIntegrator> > >(&(info[k]), the_ff);
1452 +        }
1453 +        else
1454 +          myNPTxyz = new NPTxyz<NPT <RealIntegrator> >(&(info[k]), the_ff);
1455 +
1456 +        myNPTxyz->setTargetTemp(globals->getTargetTemp());
1457 +
1458 +        if (globals->haveTargetPressure())
1459 +          myNPTxyz->setTargetPressure(globals->getTargetPressure());
1460 +        else{
1461 +          sprintf(painCave.errMsg,
1462 +                  "SimSetup error: If you use a constant pressure\n"
1463 +                  "    ensemble, you must set targetPressure in the BASS file.\n");
1464 +          painCave.isFatal = 1;
1465 +          simError();
1466 +        }    
1467 +
1468 +        if (globals->haveTauThermostat())
1469 +          myNPTxyz->setTauThermostat(globals->getTauThermostat());
1470 +        else{
1471 +          sprintf(painCave.errMsg,
1472 +                  "SimSetup error: If you use an NPT\n"
1473 +                  "    ensemble, you must set tauThermostat.\n");
1474 +          painCave.isFatal = 1;
1475 +          simError();
1476 +        }
1477 +
1478 +        if (globals->haveTauBarostat())
1479 +          myNPTxyz->setTauBarostat(globals->getTauBarostat());
1480 +        else{
1481 +          sprintf(painCave.errMsg,
1482 +                  "SimSetup error: If you use an NPT\n"
1483 +                  "    ensemble, you must set tauBarostat.\n");
1484 +          painCave.isFatal = 1;
1485 +          simError();
1486 +        }
1487 +
1488 +        info->the_integrator = myNPTxyz;
1489 +        break;
1490 +
1491        default:
1492          sprintf(painCave.errMsg,
1493                  "SimSetup Error. Unrecognized ensemble in case statement.\n");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines