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 787 by mmeineke, Thu Sep 25 19:27:15 2003 UTC vs.
Revision 841 by mmeineke, Wed Oct 29 17:55:28 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  
121    makeOutNames();
# Line 600 | Line 607 | void SimSetup::gatherInfo(void){
607    }
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,
# Line 686 | 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 <
693 <    // get some of the tricky things that may still be in the globals
694 <
695 <    double boxVector[3];
696 <    if (globals->haveBox()){
697 <      boxVector[0] = globals->getBox();
698 <      boxVector[1] = globals->getBox();
699 <      boxVector[2] = globals->getBox();
700 <
701 <      info[i].setBox(boxVector);
702 <    }
703 <    else if (globals->haveDensity()){
704 <      double vol;
705 <      vol = (double) tot_nmol / globals->getDensity();
706 <      boxVector[0] = pow(vol, (1.0 / 3.0));
707 <      boxVector[1] = boxVector[0];
708 <      boxVector[2] = boxVector[0];
709 <
710 <      info[i].setBox(boxVector);
711 <    }
712 <    else{
713 <      if (!globals->haveBoxX()){
714 <        sprintf(painCave.errMsg,
715 <                "SimSetup error, no periodic BoxX size given.\n");
716 <        painCave.isFatal = 1;
717 <        simError();
718 <      }
719 <      boxVector[0] = globals->getBoxX();
720 <
721 <      if (!globals->haveBoxY()){
722 <        sprintf(painCave.errMsg,
723 <                "SimSetup error, no periodic BoxY size given.\n");
724 <        painCave.isFatal = 1;
725 <        simError();
726 <      }
727 <      boxVector[1] = globals->getBoxY();
728 <
729 <      if (!globals->haveBoxZ()){
730 <        sprintf(painCave.errMsg,
731 <                "SimSetup error, no periodic BoxZ size given.\n");
732 <        painCave.isFatal = 1;
733 <        simError();
734 <      }
735 <      boxVector[2] = globals->getBoxZ();
736 <
737 <      info[i].setBox(boxVector);
738 <    }
702 >    
703    }
704 <
704 >  
705    //setup seed for random number generator
706    int seedValue;
707  
# Line 841 | Line 805 | void SimSetup::finalInfoCheck(void){
805          theEst = globals->getEST();
806        }
807  
808 <      info[i].setEcr(theEcr, theEst);
808 >      info[i].setDefaultEcr(theEcr, theEst);
809  
810        if (!globals->haveDielectric()){
811          sprintf(painCave.errMsg,
# Line 886 | Line 850 | void SimSetup::finalInfoCheck(void){
850            theEst = globals->getEST();
851          }
852  
853 <        info[i].setEcr(theEcr, theEst);
853 >        info[i].setDefaultEcr(theEcr, theEst);
854        }
855      }
856    }
# Line 1346 | Line 1310 | void SimSetup::makeIntegrator(void){
1310    NVT<RealIntegrator>* myNVT = NULL;
1311    NPTi<NPT<RealIntegrator> >* myNPTi = NULL;
1312    NPTf<NPT<RealIntegrator> >* myNPTf = NULL;
1313 +  NPTxyz<NPT<RealIntegrator> >* myNPTxyz = NULL;
1314    
1315    for (k = 0; k < nInfo; k++){
1316      switch (ensembleCase){
# Line 1470 | Line 1435 | void SimSetup::makeIntegrator(void){
1435          info->the_integrator = myNPTf;
1436          break;
1437  
1438 +      case NPTxyz_ENS:
1439 +        if (globals->haveZconstraints()){
1440 +          setupZConstraint(info[k]);
1441 +          myNPTxyz = new ZConstraint<NPTxyz<NPT <RealIntegrator> > >(&(info[k]), the_ff);
1442 +        }
1443 +        else
1444 +          myNPTxyz = new NPTxyz<NPT <RealIntegrator> >(&(info[k]), the_ff);
1445 +
1446 +        myNPTxyz->setTargetTemp(globals->getTargetTemp());
1447 +
1448 +        if (globals->haveTargetPressure())
1449 +          myNPTxyz->setTargetPressure(globals->getTargetPressure());
1450 +        else{
1451 +          sprintf(painCave.errMsg,
1452 +                  "SimSetup error: If you use a constant pressure\n"
1453 +                  "    ensemble, you must set targetPressure in the BASS file.\n");
1454 +          painCave.isFatal = 1;
1455 +          simError();
1456 +        }    
1457 +
1458 +        if (globals->haveTauThermostat())
1459 +          myNPTxyz->setTauThermostat(globals->getTauThermostat());
1460 +        else{
1461 +          sprintf(painCave.errMsg,
1462 +                  "SimSetup error: If you use an NPT\n"
1463 +                  "    ensemble, you must set tauThermostat.\n");
1464 +          painCave.isFatal = 1;
1465 +          simError();
1466 +        }
1467 +
1468 +        if (globals->haveTauBarostat())
1469 +          myNPTxyz->setTauBarostat(globals->getTauBarostat());
1470 +        else{
1471 +          sprintf(painCave.errMsg,
1472 +                  "SimSetup error: If you use an NPT\n"
1473 +                  "    ensemble, you must set tauBarostat.\n");
1474 +          painCave.isFatal = 1;
1475 +          simError();
1476 +        }
1477 +
1478 +        info->the_integrator = myNPTxyz;
1479 +        break;
1480 +
1481        default:
1482          sprintf(painCave.errMsg,
1483                  "SimSetup Error. Unrecognized ensemble in case statement.\n");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines