# | 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 NPTim_ENS 4 |
26 | < | #define NPTfm_ENS 5 |
24 | > | #define NPTxyz_ENS 4 |
25 | ||
26 | + | |
27 | #define FF_DUFF 0 | |
28 | #define FF_LJ 1 | |
29 | #define FF_EAM 2 | |
30 | ||
31 | using namespace std; | |
32 | ||
33 | + | /** |
34 | + | * Check whether dividend is divisble by divisor or not |
35 | + | */ |
36 | + | bool isDivisible(double dividend, double divisor){ |
37 | + | double tolerance = 0.000001; |
38 | + | double quotient; |
39 | + | double diff; |
40 | + | int intQuotient; |
41 | + | |
42 | + | quotient = dividend / divisor; |
43 | + | |
44 | + | if (quotient < 0) |
45 | + | quotient = -quotient; |
46 | + | |
47 | + | intQuotient = int (quotient + tolerance); |
48 | + | |
49 | + | diff = fabs(fabs(dividend) - intQuotient * fabs(divisor)); |
50 | + | |
51 | + | if (diff <= tolerance) |
52 | + | return true; |
53 | + | else |
54 | + | return false; |
55 | + | } |
56 | + | |
57 | SimSetup::SimSetup(){ | |
58 | + | |
59 | + | initSuspend = false; |
60 | isInfoArray = 0; | |
61 | nInfo = 1; | |
62 | ||
# | Line 54 | Line 79 | void SimSetup::setSimInfo(SimInfo* the_info, int theNi | |
79 | info = the_info; | |
80 | nInfo = theNinfo; | |
81 | isInfoArray = 1; | |
82 | + | initSuspend = true; |
83 | } | |
84 | ||
85 | ||
# | Line 92 | Line 118 | void SimSetup::createSim(void){ | |
118 | #endif // is_mpi | |
119 | ||
120 | void SimSetup::createSim(void){ | |
95 | – | int i, j, k, globalAtomIndex; |
121 | ||
122 | // gather all of the information from the Bass file | |
123 | ||
# | Line 108 | Line 133 | void SimSetup::createSim(void){ | |
133 | ||
134 | // initialize the system coordinates | |
135 | ||
136 | < | if (!isInfoArray){ |
136 | > | if ( !initSuspend ){ |
137 | initSystemCoords(); | |
138 | + | |
139 | + | if( !(globals->getUseInitTime()) ) |
140 | + | info[0].currentTime = 0.0; |
141 | } | |
142 | ||
143 | // make the output filenames | |
# | Line 131 | Line 159 | void SimSetup::makeMolecules(void){ | |
159 | ||
160 | ||
161 | void SimSetup::makeMolecules(void){ | |
162 | < | int k, l; |
162 | > | int k; |
163 | int i, j, exI, exJ, tempEx, stampID, atomOffset, excludeOffset; | |
164 | molInit molInfo; | |
165 | DirectionalAtom* dAtom; | |
# | Line 553 | Line 581 | void SimSetup::gatherInfo(void){ | |
581 | ||
582 | ||
583 | void SimSetup::gatherInfo(void){ | |
584 | < | int i, j, k; |
584 | > | int i; |
585 | ||
586 | ensembleCase = -1; | |
587 | ffCase = -1; | |
# | Line 604 | Line 632 | void SimSetup::gatherInfo(void){ | |
632 | else if (!strcasecmp(ensemble, "NPTf")){ | |
633 | ensembleCase = NPTf_ENS; | |
634 | } | |
635 | < | else if (!strcasecmp(ensemble, "NPTim")){ |
636 | < | ensembleCase = NPTim_ENS; |
609 | < | } |
610 | < | else if (!strcasecmp(ensemble, "NPTfm")){ |
611 | < | ensembleCase = NPTfm_ENS; |
635 | > | else if (!strcasecmp(ensemble, "NPTxyz")){ |
636 | > | ensembleCase = NPTxyz_ENS; |
637 | } | |
638 | else{ | |
639 | sprintf(painCave.errMsg, | |
640 | < | "SimSetup Warning. Unrecognized Ensemble -> %s, " |
641 | < | "reverting to NVE for this simulation.\n", |
640 | > | "SimSetup Warning. Unrecognized Ensemble -> %s \n" |
641 | > | "\treverting to NVE for this simulation.\n", |
642 | ensemble); | |
643 | painCave.isFatal = 0; | |
644 | simError(); | |
# | Line 645 | Line 670 | void SimSetup::gatherInfo(void){ | |
670 | if (!the_components[i]->haveNMol()){ | |
671 | // we have a problem | |
672 | sprintf(painCave.errMsg, | |
673 | < | "SimSetup Error. No global NMol or component NMol" |
674 | < | " given. Cannot calculate the number of atoms.\n"); |
673 | > | "SimSetup Error. No global NMol or component NMol given.\n" |
674 | > | "\tCannot calculate the number of atoms.\n"); |
675 | painCave.isFatal = 1; | |
676 | simError(); | |
677 | } | |
# | Line 665 | Line 690 | void SimSetup::gatherInfo(void){ | |
690 | painCave.isFatal = 1; | |
691 | simError(); | |
692 | } | |
693 | + | |
694 | + | //check whether sample time, status time, thermal time and reset time are divisble by dt |
695 | + | if (!isDivisible(globals->getSampleTime(), globals->getDt())){ |
696 | + | sprintf(painCave.errMsg, |
697 | + | "Sample time is not divisible by dt.\n" |
698 | + | "\tThis will result in samples that are not uniformly\n" |
699 | + | "\tdistributed in time. If this is a problem, change\n" |
700 | + | "\tyour sampleTime variable.\n"); |
701 | + | painCave.isFatal = 0; |
702 | + | simError(); |
703 | + | } |
704 | + | |
705 | + | if (globals->haveStatusTime() && !isDivisible(globals->getSampleTime(), globals->getDt())){ |
706 | + | sprintf(painCave.errMsg, |
707 | + | "Status time is not divisible by dt.\n" |
708 | + | "\tThis will result in status reports that are not uniformly\n" |
709 | + | "\tdistributed in time. If this is a problem, change \n" |
710 | + | "\tyour statusTime variable.\n"); |
711 | + | painCave.isFatal = 0; |
712 | + | simError(); |
713 | + | } |
714 | + | |
715 | + | if (globals->haveThermalTime() && !isDivisible(globals->getThermalTime(), globals->getDt())){ |
716 | + | sprintf(painCave.errMsg, |
717 | + | "Thermal time is not divisible by dt.\n" |
718 | + | "\tThis will result in thermalizations that are not uniformly\n" |
719 | + | "\tdistributed in time. If this is a problem, change \n" |
720 | + | "\tyour thermalTime variable.\n"); |
721 | + | painCave.isFatal = 0; |
722 | + | simError(); |
723 | + | } |
724 | + | |
725 | + | if (globals->haveResetTime() && !isDivisible(globals->getResetTime(), globals->getDt())){ |
726 | + | sprintf(painCave.errMsg, |
727 | + | "Reset time is not divisible by dt.\n" |
728 | + | "\tThis will result in integrator resets that are not uniformly\n" |
729 | + | "\tdistributed in time. If this is a problem, change\n" |
730 | + | "\tyour resetTime variable.\n"); |
731 | + | painCave.isFatal = 0; |
732 | + | simError(); |
733 | + | } |
734 | ||
735 | // set the status, sample, and thermal kick times | |
736 | ||
# | Line 688 | Line 754 | void SimSetup::gatherInfo(void){ | |
754 | info[i].thermalTime = globals->getThermalTime(); | |
755 | } | |
756 | ||
757 | < | // check for the temperature set flag |
757 | > | info[i].resetIntegrator = 0; |
758 | > | if( globals->haveResetTime() ){ |
759 | > | info[i].resetTime = globals->getResetTime(); |
760 | > | info[i].resetIntegrator = 1; |
761 | > | } |
762 | ||
763 | + | // check for the temperature set flag |
764 | + | |
765 | if (globals->haveTempSet()) | |
766 | info[i].setTemp = globals->getTempSet(); | |
767 | ||
768 | < | // get some of the tricky things that may still be in the globals |
768 | > | // check for the extended State init |
769 | ||
770 | < | double boxVector[3]; |
771 | < | if (globals->haveBox()){ |
772 | < | 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]; |
712 | < | |
713 | < | info[i].setBox(boxVector); |
714 | < | } |
715 | < | 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 | < | } |
770 | > | info[i].useInitXSstate = globals->getUseInitXSstate(); |
771 | > | info[i].orthoTolerance = globals->getOrthoBoxTolerance(); |
772 | > | |
773 | } | |
774 | < | |
774 | > | |
775 | //setup seed for random number generator | |
776 | int seedValue; | |
777 | ||
# | Line 815 | Line 846 | void SimSetup::finalInfoCheck(void){ | |
846 | ||
847 | if (!globals->haveECR()){ | |
848 | sprintf(painCave.errMsg, | |
849 | < | "SimSetup Warning: using default value of 1/2 the smallest " |
850 | < | "box length for the electrostaticCutoffRadius.\n" |
851 | < | "I hope you have a very fast processor!\n"); |
849 | > | "SimSetup Warning: No value was set for electrostaticCutoffRadius.\n" |
850 | > | "\tOOPSE will use a default value of 15.0 angstroms" |
851 | > | "\tfor the electrostaticCutoffRadius.\n"); |
852 | painCave.isFatal = 0; | |
853 | simError(); | |
854 | < | double smallest; |
824 | < | smallest = info[i].boxL[0]; |
825 | < | if (info[i].boxL[1] <= smallest) |
826 | < | smallest = info[i].boxL[1]; |
827 | < | if (info[i].boxL[2] <= smallest) |
828 | < | smallest = info[i].boxL[2]; |
829 | < | theEcr = 0.5 * smallest; |
854 | > | theEcr = 15.0; |
855 | } | |
856 | else{ | |
857 | theEcr = globals->getECR(); | |
# | Line 834 | Line 859 | void SimSetup::finalInfoCheck(void){ | |
859 | ||
860 | if (!globals->haveEST()){ | |
861 | sprintf(painCave.errMsg, | |
862 | < | "SimSetup Warning: using default value of 0.05 * the " |
863 | < | "electrostaticCutoffRadius for the electrostaticSkinThickness\n"); |
862 | > | "SimSetup Warning: No value was set for electrostaticSkinThickness.\n" |
863 | > | "\tOOPSE will use a default value of\n" |
864 | > | "\t0.05 * electrostaticCutoffRadius\n" |
865 | > | "\tfor the electrostaticSkinThickness\n"); |
866 | painCave.isFatal = 0; | |
867 | simError(); | |
868 | theEst = 0.05 * theEcr; | |
# | Line 844 | Line 871 | void SimSetup::finalInfoCheck(void){ | |
871 | theEst = globals->getEST(); | |
872 | } | |
873 | ||
874 | < | info[i].setEcr(theEcr, theEst); |
874 | > | info[i].setDefaultEcr(theEcr, theEst); |
875 | ||
876 | if (!globals->haveDielectric()){ | |
877 | sprintf(painCave.errMsg, | |
878 | < | "SimSetup Error: You are trying to use Reaction Field without" |
879 | < | "setting a dielectric constant!\n"); |
878 | > | "SimSetup Error: No Dielectric constant was set.\n" |
879 | > | "\tYou are trying to use Reaction Field without" |
880 | > | "\tsetting a dielectric constant!\n"); |
881 | painCave.isFatal = 1; | |
882 | simError(); | |
883 | } | |
# | Line 859 | Line 887 | void SimSetup::finalInfoCheck(void){ | |
887 | if (usesDipoles){ | |
888 | if (!globals->haveECR()){ | |
889 | sprintf(painCave.errMsg, | |
890 | < | "SimSetup Warning: using default value of 1/2 the smallest " |
891 | < | "box length for the electrostaticCutoffRadius.\n" |
892 | < | "I hope you have a very fast processor!\n"); |
893 | < | painCave.isFatal = 0; |
894 | < | simError(); |
895 | < | double smallest; |
868 | < | smallest = info[i].boxL[0]; |
869 | < | if (info[i].boxL[1] <= smallest) |
870 | < | smallest = info[i].boxL[1]; |
871 | < | if (info[i].boxL[2] <= smallest) |
872 | < | smallest = info[i].boxL[2]; |
873 | < | theEcr = 0.5 * smallest; |
890 | > | "SimSetup Warning: No value was set for electrostaticCutoffRadius.\n" |
891 | > | "\tOOPSE will use a default value of 15.0 angstroms" |
892 | > | "\tfor the electrostaticCutoffRadius.\n"); |
893 | > | painCave.isFatal = 0; |
894 | > | simError(); |
895 | > | theEcr = 15.0; |
896 | } | |
897 | else{ | |
898 | theEcr = globals->getECR(); | |
899 | } | |
900 | < | |
900 | > | |
901 | if (!globals->haveEST()){ | |
902 | sprintf(painCave.errMsg, | |
903 | < | "SimSetup Warning: using default value of 0.05 * the " |
904 | < | "electrostaticCutoffRadius for the " |
905 | < | "electrostaticSkinThickness\n"); |
903 | > | "SimSetup Warning: No value was set for electrostaticSkinThickness.\n" |
904 | > | "\tOOPSE will use a default value of\n" |
905 | > | "\t0.05 * electrostaticCutoffRadius\n" |
906 | > | "\tfor the electrostaticSkinThickness\n"); |
907 | painCave.isFatal = 0; | |
908 | simError(); | |
909 | theEst = 0.05 * theEcr; | |
# | Line 888 | Line 911 | void SimSetup::finalInfoCheck(void){ | |
911 | else{ | |
912 | theEst = globals->getEST(); | |
913 | } | |
914 | < | |
915 | < | info[i].setEcr(theEcr, theEst); |
914 | > | |
915 | > | info[i].setDefaultEcr(theEcr, theEst); |
916 | } | |
917 | } | |
918 | } | |
896 | – | |
919 | #ifdef IS_MPI | |
920 | strcpy(checkPointMsg, "post processing checks out"); | |
921 | MPIcheckPoint(); | |
922 | #endif // is_mpi | |
923 | } | |
924 | < | |
924 | > | |
925 | void SimSetup::initSystemCoords(void){ | |
926 | int i; | |
927 | ||
# | Line 916 | Line 938 | void SimSetup::initSystemCoords(void){ | |
938 | if (worldRank == 0){ | |
939 | #endif //is_mpi | |
940 | inName = globals->getInitialConfig(); | |
919 | – | double* tempDouble = new double[1000000]; |
941 | fileInit = new InitializeFromFile(inName); | |
942 | #ifdef IS_MPI | |
943 | } | |
# | Line 928 | Line 949 | void SimSetup::initSystemCoords(void){ | |
949 | delete fileInit; | |
950 | } | |
951 | else{ | |
952 | < | #ifdef IS_MPI |
932 | < | |
952 | > | |
953 | // no init from bass | |
954 | < | |
954 | > | |
955 | sprintf(painCave.errMsg, | |
956 | < | "Cannot intialize a parallel simulation without an initial configuration file.\n"); |
957 | < | painCave.isFatal; |
956 | > | "Cannot intialize a simulation without an initial configuration file.\n"); |
957 | > | painCave.isFatal = 1;; |
958 | simError(); | |
959 | < | |
940 | < | #else |
941 | < | |
942 | < | initFromBass(); |
943 | < | |
944 | < | |
945 | < | #endif |
959 | > | |
960 | } | |
961 | ||
962 | #ifdef IS_MPI | |
# | Line 1160 | Line 1174 | void SimSetup::calcSysValues(void){ | |
1174 | } | |
1175 | ||
1176 | void SimSetup::calcSysValues(void){ | |
1177 | < | int i, j, k; |
1177 | > | int i; |
1178 | ||
1179 | int* molMembershipArray; | |
1180 | ||
# | Line 1238 | Line 1252 | void SimSetup::mpiMolDivide(void){ | |
1252 | ||
1253 | if (local_atoms != info[0].n_atoms){ | |
1254 | sprintf(painCave.errMsg, | |
1255 | < | "SimSetup error: mpiSim's localAtom (%d) and SimSetup's" |
1256 | < | " localAtom (%d) are not equal.\n", |
1255 | > | "SimSetup error: mpiSim's localAtom (%d) and SimSetup's\n" |
1256 | > | "\tlocalAtom (%d) are not equal.\n", |
1257 | info[0].n_atoms, local_atoms); | |
1258 | painCave.isFatal = 1; | |
1259 | simError(); | |
# | Line 1259 | Line 1273 | void SimSetup::makeSysArrays(void){ | |
1273 | ||
1274 | ||
1275 | void SimSetup::makeSysArrays(void){ | |
1276 | < | int i, j, k, l; |
1276 | > | |
1277 | > | #ifndef IS_MPI |
1278 | > | int k, j; |
1279 | > | #endif // is_mpi |
1280 | > | int i, l; |
1281 | ||
1282 | Atom** the_atoms; | |
1283 | Molecule* the_molecules; | |
# | Line 1342 | Line 1360 | void SimSetup::makeIntegrator(void){ | |
1360 | void SimSetup::makeIntegrator(void){ | |
1361 | int k; | |
1362 | ||
1363 | + | NVE<RealIntegrator>* myNVE = NULL; |
1364 | NVT<RealIntegrator>* myNVT = NULL; | |
1365 | < | NPTi<RealIntegrator>* myNPTi = NULL; |
1366 | < | NPTf<RealIntegrator>* myNPTf = NULL; |
1367 | < | NPTim<RealIntegrator>* myNPTim = NULL; |
1349 | < | NPTfm<RealIntegrator>* myNPTfm = NULL; |
1365 | > | NPTi<NPT<RealIntegrator> >* myNPTi = NULL; |
1366 | > | NPTf<NPT<RealIntegrator> >* myNPTf = NULL; |
1367 | > | NPTxyz<NPT<RealIntegrator> >* myNPTxyz = NULL; |
1368 | ||
1369 | for (k = 0; k < nInfo; k++){ | |
1370 | switch (ensembleCase){ | |
1371 | case NVE_ENS: | |
1372 | if (globals->haveZconstraints()){ | |
1373 | setupZConstraint(info[k]); | |
1374 | < | new ZConstraint<NVE<RealIntegrator> >(&(info[k]), the_ff); |
1374 | > | myNVE = new ZConstraint<NVE<RealIntegrator> >(&(info[k]), the_ff); |
1375 | } | |
1376 | < | else |
1377 | < | new NVE<RealIntegrator>(&(info[k]), the_ff); |
1376 | > | else{ |
1377 | > | myNVE = new NVE<RealIntegrator>(&(info[k]), the_ff); |
1378 | > | } |
1379 | > | |
1380 | > | info->the_integrator = myNVE; |
1381 | break; | |
1382 | ||
1383 | case NVT_ENS: | |
# | Line 1374 | Line 1395 | void SimSetup::makeIntegrator(void){ | |
1395 | else{ | |
1396 | sprintf(painCave.errMsg, | |
1397 | "SimSetup error: If you use the NVT\n" | |
1398 | < | " ensemble, you must set tauThermostat.\n"); |
1398 | > | "\tensemble, you must set tauThermostat.\n"); |
1399 | painCave.isFatal = 1; | |
1400 | simError(); | |
1401 | } | |
1402 | + | |
1403 | + | info->the_integrator = myNVT; |
1404 | break; | |
1405 | ||
1406 | case NPTi_ENS: | |
1407 | if (globals->haveZconstraints()){ | |
1408 | setupZConstraint(info[k]); | |
1409 | < | myNPTi = new ZConstraint<NPTi<RealIntegrator> >(&(info[k]), the_ff); |
1409 | > | myNPTi = new ZConstraint<NPTi<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1410 | } | |
1411 | else | |
1412 | < | myNPTi = new NPTi<RealIntegrator>(&(info[k]), the_ff); |
1412 | > | myNPTi = new NPTi<NPT<RealIntegrator> >(&(info[k]), the_ff); |
1413 | ||
1414 | myNPTi->setTargetTemp(globals->getTargetTemp()); | |
1415 | ||
# | Line 1395 | Line 1418 | void SimSetup::makeIntegrator(void){ | |
1418 | else{ | |
1419 | sprintf(painCave.errMsg, | |
1420 | "SimSetup error: If you use a constant pressure\n" | |
1421 | < | " ensemble, you must set targetPressure in the BASS file.\n"); |
1421 | > | "\tensemble, you must set targetPressure in the BASS file.\n"); |
1422 | painCave.isFatal = 1; | |
1423 | simError(); | |
1424 | } | |
# | Line 1405 | Line 1428 | void SimSetup::makeIntegrator(void){ | |
1428 | else{ | |
1429 | sprintf(painCave.errMsg, | |
1430 | "SimSetup error: If you use an NPT\n" | |
1431 | < | " ensemble, you must set tauThermostat.\n"); |
1431 | > | "\tensemble, you must set tauThermostat.\n"); |
1432 | painCave.isFatal = 1; | |
1433 | simError(); | |
1434 | } | |
# | Line 1415 | Line 1438 | void SimSetup::makeIntegrator(void){ | |
1438 | else{ | |
1439 | sprintf(painCave.errMsg, | |
1440 | "SimSetup error: If you use an NPT\n" | |
1441 | < | " ensemble, you must set tauBarostat.\n"); |
1441 | > | "\tensemble, you must set tauBarostat.\n"); |
1442 | painCave.isFatal = 1; | |
1443 | simError(); | |
1444 | } | |
1445 | + | |
1446 | + | info->the_integrator = myNPTi; |
1447 | break; | |
1448 | ||
1449 | case NPTf_ENS: | |
1450 | if (globals->haveZconstraints()){ | |
1451 | setupZConstraint(info[k]); | |
1452 | < | myNPTf = new ZConstraint<NPTf<RealIntegrator> >(&(info[k]), the_ff); |
1452 | > | myNPTf = new ZConstraint<NPTf<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1453 | } | |
1454 | else | |
1455 | < | myNPTf = new NPTf<RealIntegrator>(&(info[k]), the_ff); |
1455 | > | myNPTf = new NPTf<NPT <RealIntegrator> >(&(info[k]), the_ff); |
1456 | ||
1457 | myNPTf->setTargetTemp(globals->getTargetTemp()); | |
1458 | ||
# | Line 1436 | Line 1461 | void SimSetup::makeIntegrator(void){ | |
1461 | else{ | |
1462 | sprintf(painCave.errMsg, | |
1463 | "SimSetup error: If you use a constant pressure\n" | |
1464 | < | " ensemble, you must set targetPressure in the BASS file.\n"); |
1464 | > | "\tensemble, you must set targetPressure in the BASS file.\n"); |
1465 | painCave.isFatal = 1; | |
1466 | simError(); | |
1467 | } | |
1468 | ||
1469 | if (globals->haveTauThermostat()) | |
1470 | myNPTf->setTauThermostat(globals->getTauThermostat()); | |
1471 | + | |
1472 | else{ | |
1473 | sprintf(painCave.errMsg, | |
1474 | "SimSetup error: If you use an NPT\n" | |
1475 | < | " ensemble, you must set tauThermostat.\n"); |
1475 | > | "\tensemble, you must set tauThermostat.\n"); |
1476 | painCave.isFatal = 1; | |
1477 | simError(); | |
1478 | } | |
1479 | ||
1480 | if (globals->haveTauBarostat()) | |
1481 | 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; |
1482 | ||
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()); |
1483 | else{ | |
1484 | 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, |
1485 | "SimSetup error: If you use an NPT\n" | |
1486 | < | " ensemble, you must set tauThermostat.\n"); |
1486 | > | "\tensemble, you must set tauBarostat.\n"); |
1487 | painCave.isFatal = 1; | |
1488 | simError(); | |
1489 | } | |
1490 | ||
1491 | < | if (globals->haveTauBarostat()) |
1496 | < | myNPTim->setTauBarostat(globals->getTauBarostat()); |
1497 | < | else{ |
1498 | < | sprintf(painCave.errMsg, |
1499 | < | "SimSetup error: If you use an NPT\n" |
1500 | < | " ensemble, you must set tauBarostat.\n"); |
1501 | < | painCave.isFatal = 1; |
1502 | < | simError(); |
1503 | < | } |
1491 | > | info->the_integrator = myNPTf; |
1492 | break; | |
1493 | ||
1494 | < | case NPTfm_ENS: |
1494 | > | case NPTxyz_ENS: |
1495 | if (globals->haveZconstraints()){ | |
1496 | setupZConstraint(info[k]); | |
1497 | < | myNPTfm = new ZConstraint<NPTfm<RealIntegrator> >(&(info[k]), the_ff); |
1497 | > | myNPTxyz = new ZConstraint<NPTxyz<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1498 | } | |
1499 | else | |
1500 | < | myNPTfm = new NPTfm<RealIntegrator>(&(info[k]), the_ff); |
1500 | > | myNPTxyz = new NPTxyz<NPT <RealIntegrator> >(&(info[k]), the_ff); |
1501 | ||
1502 | < | myNPTfm->setTargetTemp(globals->getTargetTemp()); |
1502 | > | myNPTxyz->setTargetTemp(globals->getTargetTemp()); |
1503 | ||
1504 | if (globals->haveTargetPressure()) | |
1505 | < | myNPTfm->setTargetPressure(globals->getTargetPressure()); |
1505 | > | myNPTxyz->setTargetPressure(globals->getTargetPressure()); |
1506 | else{ | |
1507 | sprintf(painCave.errMsg, | |
1508 | "SimSetup error: If you use a constant pressure\n" | |
1509 | < | " ensemble, you must set targetPressure in the BASS file.\n"); |
1509 | > | "\tensemble, you must set targetPressure in the BASS file.\n"); |
1510 | painCave.isFatal = 1; | |
1511 | simError(); | |
1512 | < | } |
1512 | > | } |
1513 | ||
1514 | if (globals->haveTauThermostat()) | |
1515 | < | myNPTfm->setTauThermostat(globals->getTauThermostat()); |
1515 | > | myNPTxyz->setTauThermostat(globals->getTauThermostat()); |
1516 | else{ | |
1517 | sprintf(painCave.errMsg, | |
1518 | "SimSetup error: If you use an NPT\n" | |
1519 | < | " ensemble, you must set tauThermostat.\n"); |
1519 | > | "\tensemble, you must set tauThermostat.\n"); |
1520 | painCave.isFatal = 1; | |
1521 | simError(); | |
1522 | } | |
1523 | ||
1524 | if (globals->haveTauBarostat()) | |
1525 | < | myNPTfm->setTauBarostat(globals->getTauBarostat()); |
1525 | > | myNPTxyz->setTauBarostat(globals->getTauBarostat()); |
1526 | else{ | |
1527 | sprintf(painCave.errMsg, | |
1528 | "SimSetup error: If you use an NPT\n" | |
1529 | < | " ensemble, you must set tauBarostat.\n"); |
1529 | > | "\tensemble, you must set tauBarostat.\n"); |
1530 | painCave.isFatal = 1; | |
1531 | simError(); | |
1532 | } | |
1533 | + | |
1534 | + | info->the_integrator = myNPTxyz; |
1535 | break; | |
1536 | ||
1537 | default: | |
# | Line 1589 | Line 1579 | void SimSetup::setupZConstraint(SimInfo& theInfo){ | |
1579 | } | |
1580 | else{ | |
1581 | sprintf(painCave.errMsg, | |
1582 | < | "ZConstraint error: If you use an ZConstraint\n" |
1583 | < | " , you must set sample time.\n"); |
1582 | > | "ZConstraint error: If you use a ZConstraint,\n" |
1583 | > | "\tyou must set zconsTime.\n"); |
1584 | painCave.isFatal = 1; | |
1585 | simError(); | |
1586 | } | |
# | Line 1605 | Line 1595 | void SimSetup::setupZConstraint(SimInfo& theInfo){ | |
1595 | else{ | |
1596 | double defaultZConsTol = 0.01; | |
1597 | sprintf(painCave.errMsg, | |
1598 | < | "ZConstraint Waring: Tolerance for z-constraint methodl is not specified\n" |
1599 | < | " , default value %f is used.\n", |
1598 | > | "ZConstraint Warning: Tolerance for z-constraint method is not specified.\n" |
1599 | > | "\tOOPSE will use a default value of %f.\n" |
1600 | > | "\tTo set the tolerance, use the zconsTol variable.\n", |
1601 | defaultZConsTol); | |
1602 | painCave.isFatal = 0; | |
1603 | simError(); | |
# | Line 1615 | Line 1606 | void SimSetup::setupZConstraint(SimInfo& theInfo){ | |
1606 | } | |
1607 | theInfo.addProperty(zconsTol); | |
1608 | ||
1609 | < | //set Force Substraction Policy |
1609 | > | //set Force Subtraction Policy |
1610 | StringData* zconsForcePolicy = new StringData(); | |
1611 | zconsForcePolicy->setID(ZCONSFORCEPOLICY_ID); | |
1612 | ||
# | Line 1624 | Line 1615 | void SimSetup::setupZConstraint(SimInfo& theInfo){ | |
1615 | } | |
1616 | else{ | |
1617 | sprintf(painCave.errMsg, | |
1618 | < | "ZConstraint Warning: User does not set force substraction policy, " |
1619 | < | "PolicyByMass is used\n"); |
1618 | > | "ZConstraint Warning: No force subtraction policy was set.\n" |
1619 | > | "\tOOPSE will use PolicyByMass.\n" |
1620 | > | "\tTo set the policy, use the zconsForcePolicy variable.\n"); |
1621 | painCave.isFatal = 0; | |
1622 | simError(); | |
1623 | zconsForcePolicy->setData("BYMASS"); | |
# | Line 1669 | Line 1661 | void SimSetup::setupZConstraint(SimInfo& theInfo){ | |
1661 | //check the uniqueness of index | |
1662 | if(!zconsParaData->isIndexUnique()){ | |
1663 | sprintf(painCave.errMsg, | |
1664 | < | "ZConstraint Error: molIndex is not unique\n"); |
1664 | > | "ZConstraint Error: molIndex is not unique!\n"); |
1665 | painCave.isFatal = 1; | |
1666 | simError(); | |
1667 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |