| 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 | 
  | 
#include "SimSetup.hpp" | 
| 31 | 
  | 
using namespace std; | 
| 32 | 
  | 
 | 
| 33 | 
  | 
SimSetup::SimSetup(){ | 
| 34 | 
+ | 
   | 
| 35 | 
+ | 
  initSuspend = false; | 
| 36 | 
  | 
  isInfoArray = 0; | 
| 37 | 
  | 
  nInfo = 1; | 
| 38 | 
  | 
 | 
| 55 | 
  | 
  info = the_info; | 
| 56 | 
  | 
  nInfo = theNinfo; | 
| 57 | 
  | 
  isInfoArray = 1; | 
| 58 | 
+ | 
  initSuspend = true; | 
| 59 | 
  | 
} | 
| 60 | 
  | 
 | 
| 61 | 
  | 
 | 
| 109 | 
  | 
 | 
| 110 | 
  | 
  // initialize the system coordinates | 
| 111 | 
  | 
 | 
| 112 | 
< | 
  if (!isInfoArray){ | 
| 112 | 
> | 
  if ( !initSuspend ){ | 
| 113 | 
  | 
    initSystemCoords(); | 
| 114 | 
  | 
 | 
| 115 | 
  | 
    if( !(globals->getUseInitTime()) ) | 
| 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 | 
| 701 | 
< | 
 | 
| 702 | 
< | 
    double boxVector[3]; | 
| 703 | 
< | 
    if (globals->haveBox()){ | 
| 704 | 
< | 
      boxVector[0] = globals->getBox(); | 
| 705 | 
< | 
      boxVector[1] = globals->getBox(); | 
| 706 | 
< | 
      boxVector[2] = globals->getBox(); | 
| 703 | 
> | 
    // check for the extended State init | 
| 704 | 
  | 
 | 
| 705 | 
< | 
      info[i].setBox(boxVector); | 
| 706 | 
< | 
    } | 
| 707 | 
< | 
    else if (globals->haveDensity()){ | 
| 711 | 
< | 
      double vol; | 
| 712 | 
< | 
      vol = (double) tot_nmol / globals->getDensity(); | 
| 713 | 
< | 
      boxVector[0] = pow(vol, (1.0 / 3.0)); | 
| 714 | 
< | 
      boxVector[1] = boxVector[0]; | 
| 715 | 
< | 
      boxVector[2] = boxVector[0]; | 
| 716 | 
< | 
 | 
| 717 | 
< | 
      info[i].setBox(boxVector); | 
| 718 | 
< | 
    } | 
| 719 | 
< | 
    else{ | 
| 720 | 
< | 
      if (!globals->haveBoxX()){ | 
| 721 | 
< | 
        sprintf(painCave.errMsg, | 
| 722 | 
< | 
                "SimSetup error, no periodic BoxX size given.\n"); | 
| 723 | 
< | 
        painCave.isFatal = 1; | 
| 724 | 
< | 
        simError(); | 
| 725 | 
< | 
      } | 
| 726 | 
< | 
      boxVector[0] = globals->getBoxX(); | 
| 727 | 
< | 
 | 
| 728 | 
< | 
      if (!globals->haveBoxY()){ | 
| 729 | 
< | 
        sprintf(painCave.errMsg, | 
| 730 | 
< | 
                "SimSetup error, no periodic BoxY size given.\n"); | 
| 731 | 
< | 
        painCave.isFatal = 1; | 
| 732 | 
< | 
        simError(); | 
| 733 | 
< | 
      } | 
| 734 | 
< | 
      boxVector[1] = globals->getBoxY(); | 
| 735 | 
< | 
 | 
| 736 | 
< | 
      if (!globals->haveBoxZ()){ | 
| 737 | 
< | 
        sprintf(painCave.errMsg, | 
| 738 | 
< | 
                "SimSetup error, no periodic BoxZ size given.\n"); | 
| 739 | 
< | 
        painCave.isFatal = 1; | 
| 740 | 
< | 
        simError(); | 
| 741 | 
< | 
      } | 
| 742 | 
< | 
      boxVector[2] = globals->getBoxZ(); | 
| 743 | 
< | 
 | 
| 744 | 
< | 
      info[i].setBox(boxVector); | 
| 745 | 
< | 
    } | 
| 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 | 
  | 
 | 
| 781 | 
  | 
 | 
| 782 | 
  | 
      if (!globals->haveECR()){ | 
| 783 | 
  | 
        sprintf(painCave.errMsg, | 
| 784 | 
< | 
                "SimSetup Warning: using default value of 1/2 the smallest " | 
| 785 | 
< | 
                "box length for the electrostaticCutoffRadius.\n" | 
| 824 | 
< | 
                "I hope you have a very fast processor!\n"); | 
| 784 | 
> | 
                "SimSetup Warning: using default value of 15.0 angstroms" | 
| 785 | 
> | 
                "box length for the electrostaticCutoffRadius.\n"); | 
| 786 | 
  | 
        painCave.isFatal = 0; | 
| 787 | 
  | 
        simError(); | 
| 788 | 
< | 
        double smallest; | 
| 828 | 
< | 
        smallest = info[i].boxL[0]; | 
| 829 | 
< | 
        if (info[i].boxL[1] <= smallest) | 
| 830 | 
< | 
          smallest = info[i].boxL[1]; | 
| 831 | 
< | 
        if (info[i].boxL[2] <= smallest) | 
| 832 | 
< | 
          smallest = info[i].boxL[2]; | 
| 833 | 
< | 
        theEcr = 0.5 * smallest; | 
| 788 | 
> | 
        theEcr = 15.0; | 
| 789 | 
  | 
      } | 
| 790 | 
  | 
      else{ | 
| 791 | 
  | 
        theEcr = globals->getECR(); | 
| 803 | 
  | 
        theEst = globals->getEST(); | 
| 804 | 
  | 
      } | 
| 805 | 
  | 
 | 
| 806 | 
< | 
      info[i].setEcr(theEcr, theEst); | 
| 806 | 
> | 
      info[i].setDefaultEcr(theEcr, theEst); | 
| 807 | 
  | 
 | 
| 808 | 
  | 
      if (!globals->haveDielectric()){ | 
| 809 | 
  | 
        sprintf(painCave.errMsg, | 
| 818 | 
  | 
      if (usesDipoles){ | 
| 819 | 
  | 
        if (!globals->haveECR()){ | 
| 820 | 
  | 
          sprintf(painCave.errMsg, | 
| 821 | 
< | 
                  "SimSetup Warning: using default value of 1/2 the smallest " | 
| 822 | 
< | 
                  "box length for the electrostaticCutoffRadius.\n" | 
| 823 | 
< | 
                  "I hope you have a very fast processor!\n"); | 
| 824 | 
< | 
          painCave.isFatal = 0; | 
| 825 | 
< | 
          simError(); | 
| 871 | 
< | 
          double smallest; | 
| 872 | 
< | 
          smallest = info[i].boxL[0]; | 
| 873 | 
< | 
          if (info[i].boxL[1] <= smallest) | 
| 874 | 
< | 
            smallest = info[i].boxL[1]; | 
| 875 | 
< | 
          if (info[i].boxL[2] <= smallest) | 
| 876 | 
< | 
            smallest = info[i].boxL[2]; | 
| 877 | 
< | 
          theEcr = 0.5 * smallest; | 
| 821 | 
> | 
                  "SimSetup Warning: using default value of 15.0 angstroms" | 
| 822 | 
> | 
                  "box length for the electrostaticCutoffRadius.\n"); | 
| 823 | 
> | 
          painCave.isFatal = 0; | 
| 824 | 
> | 
          simError(); | 
| 825 | 
> | 
          theEcr = 15.0; | 
| 826 | 
  | 
        } | 
| 827 | 
  | 
        else{ | 
| 828 | 
  | 
          theEcr = globals->getECR(); | 
| 829 | 
  | 
        } | 
| 830 | 
< | 
 | 
| 830 | 
> | 
         | 
| 831 | 
  | 
        if (!globals->haveEST()){ | 
| 832 | 
  | 
          sprintf(painCave.errMsg, | 
| 833 | 
  | 
                  "SimSetup Warning: using default value of 0.05 * the " | 
| 840 | 
  | 
        else{ | 
| 841 | 
  | 
          theEst = globals->getEST(); | 
| 842 | 
  | 
        } | 
| 843 | 
< | 
 | 
| 844 | 
< | 
        info[i].setEcr(theEcr, theEst); | 
| 843 | 
> | 
         | 
| 844 | 
> | 
        info[i].setDefaultEcr(theEcr, theEst); | 
| 845 | 
  | 
      } | 
| 846 | 
  | 
    } | 
| 847 | 
  | 
  } | 
| 900 | 
– | 
 | 
| 848 | 
  | 
#ifdef IS_MPI | 
| 849 | 
  | 
  strcpy(checkPointMsg, "post processing checks out"); | 
| 850 | 
  | 
  MPIcheckPoint(); | 
| 851 | 
  | 
#endif // is_mpi | 
| 852 | 
  | 
} | 
| 853 | 
< | 
 | 
| 853 | 
> | 
   | 
| 854 | 
  | 
void SimSetup::initSystemCoords(void){ | 
| 855 | 
  | 
  int i; | 
| 856 | 
  | 
 | 
| 878 | 
  | 
    delete fileInit; | 
| 879 | 
  | 
  } | 
| 880 | 
  | 
  else{ | 
| 881 | 
< | 
#ifdef IS_MPI  | 
| 935 | 
< | 
 | 
| 881 | 
> | 
     | 
| 882 | 
  | 
    // no init from bass | 
| 883 | 
< | 
 | 
| 883 | 
> | 
     | 
| 884 | 
  | 
    sprintf(painCave.errMsg, | 
| 885 | 
< | 
            "Cannot intialize a parallel simulation without an initial configuration file.\n"); | 
| 885 | 
> | 
            "Cannot intialize a simulation without an initial configuration file.\n"); | 
| 886 | 
  | 
    painCave.isFatal = 1;; | 
| 887 | 
  | 
    simError(); | 
| 888 | 
< | 
 | 
| 943 | 
< | 
#else | 
| 944 | 
< | 
 | 
| 945 | 
< | 
    initFromBass(); | 
| 946 | 
< | 
 | 
| 947 | 
< | 
 | 
| 948 | 
< | 
#endif | 
| 888 | 
> | 
     | 
| 889 | 
  | 
  } | 
| 890 | 
  | 
 | 
| 891 | 
  | 
#ifdef IS_MPI | 
| 1397 | 
  | 
 | 
| 1398 | 
  | 
        if (globals->haveTauThermostat()) | 
| 1399 | 
  | 
          myNPTf->setTauThermostat(globals->getTauThermostat()); | 
| 1400 | 
+ | 
 | 
| 1401 | 
  | 
        else{ | 
| 1402 | 
  | 
          sprintf(painCave.errMsg, | 
| 1403 | 
  | 
                  "SimSetup error: If you use an NPT\n" | 
| 1408 | 
  | 
 | 
| 1409 | 
  | 
        if (globals->haveTauBarostat()) | 
| 1410 | 
  | 
          myNPTf->setTauBarostat(globals->getTauBarostat()); | 
| 1411 | 
+ | 
 | 
| 1412 | 
  | 
        else{ | 
| 1413 | 
  | 
          sprintf(painCave.errMsg, | 
| 1414 | 
  | 
                  "SimSetup error: If you use an NPT\n" |