57 |
|
return false; |
58 |
|
} |
59 |
|
|
60 |
+ |
string getPrefix(const string& str ){ |
61 |
+ |
string prefix; |
62 |
+ |
string suffix; |
63 |
+ |
int pos; |
64 |
+ |
|
65 |
+ |
pos = str.rfind("."); |
66 |
+ |
|
67 |
+ |
if (pos >= 0) { |
68 |
+ |
prefix = str.substr(0, pos); |
69 |
+ |
suffix = str.substr(pos, str.size()); |
70 |
+ |
|
71 |
+ |
// leave .bass there in case we've reverted to old habits |
72 |
+ |
if (LowerCase(suffix) == ".md" || LowerCase(suffix) == ".bass") |
73 |
+ |
return prefix; |
74 |
+ |
else |
75 |
+ |
return str; |
76 |
+ |
|
77 |
+ |
} else |
78 |
+ |
return str; |
79 |
+ |
}; |
80 |
+ |
|
81 |
+ |
|
82 |
|
SimSetup::SimSetup(){ |
83 |
|
|
84 |
|
initSuspend = false; |
96 |
|
} |
97 |
|
|
98 |
|
SimSetup::~SimSetup(){ |
99 |
+ |
// clean up the forcefield |
100 |
+ |
the_ff->cleanMe(); |
101 |
+ |
|
102 |
|
delete stamps; |
103 |
|
delete globals; |
104 |
|
} |
117 |
|
#endif // is_mpi |
118 |
|
|
119 |
|
inFileName = fileName; |
120 |
+ |
|
121 |
+ |
globals->initalize(); |
122 |
|
set_interface_stamps(stamps, globals); |
123 |
|
|
124 |
|
#ifdef IS_MPI |
149 |
|
|
150 |
|
void SimSetup::createSim(void){ |
151 |
|
|
152 |
< |
// gather all of the information from the Bass file |
152 |
> |
// gather all of the information from the meta-data file |
153 |
|
|
154 |
|
gatherInfo(); |
155 |
|
|
672 |
|
#endif // is_mpi |
673 |
|
|
674 |
|
} |
648 |
– |
|
649 |
– |
void SimSetup::initFromBass(void){ |
650 |
– |
int i, j, k; |
651 |
– |
int n_cells; |
652 |
– |
double cellx, celly, cellz; |
653 |
– |
double temp1, temp2, temp3; |
654 |
– |
int n_per_extra; |
655 |
– |
int n_extra; |
656 |
– |
int have_extra, done; |
657 |
– |
|
658 |
– |
double vel[3]; |
659 |
– |
vel[0] = 0.0; |
660 |
– |
vel[1] = 0.0; |
661 |
– |
vel[2] = 0.0; |
662 |
– |
|
663 |
– |
temp1 = (double) tot_nmol / 4.0; |
664 |
– |
temp2 = pow(temp1, (1.0 / 3.0)); |
665 |
– |
temp3 = ceil(temp2); |
675 |
|
|
667 |
– |
have_extra = 0; |
668 |
– |
if (temp2 < temp3){ |
669 |
– |
// we have a non-complete lattice |
670 |
– |
have_extra = 1; |
671 |
– |
|
672 |
– |
n_cells = (int) temp3 - 1; |
673 |
– |
cellx = info[0].boxL[0] / temp3; |
674 |
– |
celly = info[0].boxL[1] / temp3; |
675 |
– |
cellz = info[0].boxL[2] / temp3; |
676 |
– |
n_extra = tot_nmol - (4 * n_cells * n_cells * n_cells); |
677 |
– |
temp1 = ((double) n_extra) / (pow(temp3, 3.0) - pow(n_cells, 3.0)); |
678 |
– |
n_per_extra = (int) ceil(temp1); |
679 |
– |
|
680 |
– |
if (n_per_extra > 4){ |
681 |
– |
sprintf(painCave.errMsg, |
682 |
– |
"SimSetup error. There has been an error in constructing" |
683 |
– |
" the non-complete lattice.\n"); |
684 |
– |
painCave.isFatal = 1; |
685 |
– |
simError(); |
686 |
– |
} |
687 |
– |
} |
688 |
– |
else{ |
689 |
– |
n_cells = (int) temp3; |
690 |
– |
cellx = info[0].boxL[0] / temp3; |
691 |
– |
celly = info[0].boxL[1] / temp3; |
692 |
– |
cellz = info[0].boxL[2] / temp3; |
693 |
– |
} |
694 |
– |
|
695 |
– |
current_mol = 0; |
696 |
– |
current_comp_mol = 0; |
697 |
– |
current_comp = 0; |
698 |
– |
current_atom_ndx = 0; |
699 |
– |
|
700 |
– |
for (i = 0; i < n_cells ; i++){ |
701 |
– |
for (j = 0; j < n_cells; j++){ |
702 |
– |
for (k = 0; k < n_cells; k++){ |
703 |
– |
makeElement(i * cellx, j * celly, k * cellz); |
704 |
– |
|
705 |
– |
makeElement(i * cellx + 0.5 * cellx, j * celly + 0.5 * celly, k * cellz); |
706 |
– |
|
707 |
– |
makeElement(i * cellx, j * celly + 0.5 * celly, k * cellz + 0.5 * cellz); |
708 |
– |
|
709 |
– |
makeElement(i * cellx + 0.5 * cellx, j * celly, k * cellz + 0.5 * cellz); |
710 |
– |
} |
711 |
– |
} |
712 |
– |
} |
713 |
– |
|
714 |
– |
if (have_extra){ |
715 |
– |
done = 0; |
716 |
– |
|
717 |
– |
int start_ndx; |
718 |
– |
for (i = 0; i < (n_cells + 1) && !done; i++){ |
719 |
– |
for (j = 0; j < (n_cells + 1) && !done; j++){ |
720 |
– |
if (i < n_cells){ |
721 |
– |
if (j < n_cells){ |
722 |
– |
start_ndx = n_cells; |
723 |
– |
} |
724 |
– |
else |
725 |
– |
start_ndx = 0; |
726 |
– |
} |
727 |
– |
else |
728 |
– |
start_ndx = 0; |
729 |
– |
|
730 |
– |
for (k = start_ndx; k < (n_cells + 1) && !done; k++){ |
731 |
– |
makeElement(i * cellx, j * celly, k * cellz); |
732 |
– |
done = (current_mol >= tot_nmol); |
733 |
– |
|
734 |
– |
if (!done && n_per_extra > 1){ |
735 |
– |
makeElement(i * cellx + 0.5 * cellx, j * celly + 0.5 * celly, |
736 |
– |
k * cellz); |
737 |
– |
done = (current_mol >= tot_nmol); |
738 |
– |
} |
739 |
– |
|
740 |
– |
if (!done && n_per_extra > 2){ |
741 |
– |
makeElement(i * cellx, j * celly + 0.5 * celly, |
742 |
– |
k * cellz + 0.5 * cellz); |
743 |
– |
done = (current_mol >= tot_nmol); |
744 |
– |
} |
745 |
– |
|
746 |
– |
if (!done && n_per_extra > 3){ |
747 |
– |
makeElement(i * cellx + 0.5 * cellx, j * celly, |
748 |
– |
k * cellz + 0.5 * cellz); |
749 |
– |
done = (current_mol >= tot_nmol); |
750 |
– |
} |
751 |
– |
} |
752 |
– |
} |
753 |
– |
} |
754 |
– |
} |
755 |
– |
|
756 |
– |
for (i = 0; i < info[0].n_atoms; i++){ |
757 |
– |
info[0].atoms[i]->setVel(vel); |
758 |
– |
} |
759 |
– |
} |
760 |
– |
|
761 |
– |
void SimSetup::makeElement(double x, double y, double z){ |
762 |
– |
int k; |
763 |
– |
AtomStamp* current_atom; |
764 |
– |
DirectionalAtom* dAtom; |
765 |
– |
double rotMat[3][3]; |
766 |
– |
double pos[3]; |
767 |
– |
|
768 |
– |
for (k = 0; k < comp_stamps[current_comp]->getNAtoms(); k++){ |
769 |
– |
current_atom = comp_stamps[current_comp]->getAtom(k); |
770 |
– |
if (!current_atom->havePosition()){ |
771 |
– |
sprintf(painCave.errMsg, |
772 |
– |
"SimSetup:initFromBass error.\n" |
773 |
– |
"\tComponent %s, atom %s does not have a position specified.\n" |
774 |
– |
"\tThe initialization routine is unable to give a start" |
775 |
– |
" position.\n", |
776 |
– |
comp_stamps[current_comp]->getID(), current_atom->getType()); |
777 |
– |
painCave.isFatal = 1; |
778 |
– |
simError(); |
779 |
– |
} |
780 |
– |
|
781 |
– |
pos[0] = x + current_atom->getPosX(); |
782 |
– |
pos[1] = y + current_atom->getPosY(); |
783 |
– |
pos[2] = z + current_atom->getPosZ(); |
784 |
– |
|
785 |
– |
info[0].atoms[current_atom_ndx]->setPos(pos); |
786 |
– |
|
787 |
– |
if (info[0].atoms[current_atom_ndx]->isDirectional()){ |
788 |
– |
dAtom = (DirectionalAtom *) info[0].atoms[current_atom_ndx]; |
789 |
– |
|
790 |
– |
rotMat[0][0] = 1.0; |
791 |
– |
rotMat[0][1] = 0.0; |
792 |
– |
rotMat[0][2] = 0.0; |
793 |
– |
|
794 |
– |
rotMat[1][0] = 0.0; |
795 |
– |
rotMat[1][1] = 1.0; |
796 |
– |
rotMat[1][2] = 0.0; |
797 |
– |
|
798 |
– |
rotMat[2][0] = 0.0; |
799 |
– |
rotMat[2][1] = 0.0; |
800 |
– |
rotMat[2][2] = 1.0; |
801 |
– |
|
802 |
– |
dAtom->setA(rotMat); |
803 |
– |
} |
804 |
– |
|
805 |
– |
current_atom_ndx++; |
806 |
– |
} |
807 |
– |
|
808 |
– |
current_mol++; |
809 |
– |
current_comp_mol++; |
810 |
– |
|
811 |
– |
if (current_comp_mol >= components_nmol[current_comp]){ |
812 |
– |
current_comp_mol = 0; |
813 |
– |
current_comp++; |
814 |
– |
} |
815 |
– |
} |
816 |
– |
|
817 |
– |
|
676 |
|
void SimSetup::gatherInfo(void){ |
677 |
|
int i; |
678 |
|
|
682 |
|
// set the easy ones first |
683 |
|
|
684 |
|
for (i = 0; i < nInfo; i++){ |
685 |
< |
info[i].target_temp = globals->getTargetTemp(); |
686 |
< |
info[i].dt = globals->getDt(); |
687 |
< |
info[i].run_time = globals->getRunTime(); |
688 |
< |
} |
685 |
> |
if (globals->haveTargetTemp()) { |
686 |
> |
info[i].target_temp = globals->getTargetTemp(); |
687 |
> |
info[i].have_target_temp = 1; |
688 |
> |
} else { |
689 |
> |
info[i].have_target_temp = 0; |
690 |
> |
} |
691 |
> |
if (globals->haveDt()) { |
692 |
> |
info[i].dt = globals->getDt(); |
693 |
> |
} |
694 |
> |
if (globals->haveRunTime()) { |
695 |
> |
info[i].run_time = globals->getRunTime(); |
696 |
> |
} |
697 |
> |
} |
698 |
|
n_components = globals->getNComponents(); |
699 |
|
|
700 |
|
|
727 |
|
|
728 |
|
// get the ensemble |
729 |
|
|
863 |
– |
strcpy(ensemble, globals->getEnsemble()); |
730 |
|
|
731 |
< |
if (!strcasecmp(ensemble, "NVE")){ |
732 |
< |
ensembleCase = NVE_ENS; |
733 |
< |
} |
734 |
< |
else if (!strcasecmp(ensemble, "NVT")){ |
735 |
< |
ensembleCase = NVT_ENS; |
736 |
< |
} |
737 |
< |
else if (!strcasecmp(ensemble, "NPTi") || !strcasecmp(ensemble, "NPT")){ |
738 |
< |
ensembleCase = NPTi_ENS; |
739 |
< |
} |
740 |
< |
else if (!strcasecmp(ensemble, "NPTf")){ |
741 |
< |
ensembleCase = NPTf_ENS; |
742 |
< |
} |
743 |
< |
else if (!strcasecmp(ensemble, "NPTxyz")){ |
744 |
< |
ensembleCase = NPTxyz_ENS; |
745 |
< |
} |
746 |
< |
else{ |
747 |
< |
sprintf(painCave.errMsg, |
748 |
< |
"SimSetup Warning. Unrecognized Ensemble -> %s \n" |
749 |
< |
"\treverting to NVE for this simulation.\n", |
750 |
< |
ensemble); |
751 |
< |
painCave.isFatal = 0; |
752 |
< |
simError(); |
753 |
< |
strcpy(ensemble, "NVE"); |
754 |
< |
ensembleCase = NVE_ENS; |
755 |
< |
} |
731 |
> |
if (globals->haveEnsemble()) { |
732 |
> |
|
733 |
> |
strcpy(ensemble, globals->getEnsemble()); |
734 |
> |
|
735 |
> |
if (!strcasecmp(ensemble, "NVE")){ |
736 |
> |
ensembleCase = NVE_ENS; |
737 |
> |
} |
738 |
> |
else if (!strcasecmp(ensemble, "NVT")){ |
739 |
> |
ensembleCase = NVT_ENS; |
740 |
> |
} |
741 |
> |
else if (!strcasecmp(ensemble, "NPTi") || !strcasecmp(ensemble, "NPT")){ |
742 |
> |
ensembleCase = NPTi_ENS; |
743 |
> |
} |
744 |
> |
else if (!strcasecmp(ensemble, "NPTf")){ |
745 |
> |
ensembleCase = NPTf_ENS; |
746 |
> |
} |
747 |
> |
else if (!strcasecmp(ensemble, "NPTxyz")){ |
748 |
> |
ensembleCase = NPTxyz_ENS; |
749 |
> |
} |
750 |
> |
else{ |
751 |
> |
sprintf(painCave.errMsg, |
752 |
> |
"SimSetup Warning. Unrecognized Ensemble -> %s \n" |
753 |
> |
"\treverting to NVE for this simulation.\n", |
754 |
> |
ensemble); |
755 |
> |
painCave.isFatal = 0; |
756 |
> |
simError(); |
757 |
> |
strcpy(ensemble, "NVE"); |
758 |
> |
ensembleCase = NVE_ENS; |
759 |
> |
} |
760 |
> |
|
761 |
> |
for (i = 0; i < nInfo; i++) |
762 |
> |
strcpy(info[i].ensemble, ensemble); |
763 |
> |
|
764 |
> |
|
765 |
> |
//check whether sample time, status time, thermal time and reset time are divisble by dt |
766 |
> |
if (globals->haveSampleTime() && !isDivisible(globals->getSampleTime(), globals->getDt())){ |
767 |
> |
sprintf(painCave.errMsg, |
768 |
> |
"Sample time is not divisible by dt.\n" |
769 |
> |
"\tThis will result in samples that are not uniformly\n" |
770 |
> |
"\tdistributed in time. If this is a problem, change\n" |
771 |
> |
"\tyour sampleTime variable.\n"); |
772 |
> |
painCave.isFatal = 0; |
773 |
> |
simError(); |
774 |
> |
} |
775 |
> |
|
776 |
> |
if (globals->haveStatusTime() && !isDivisible(globals->getStatusTime(), globals->getDt())){ |
777 |
> |
sprintf(painCave.errMsg, |
778 |
> |
"Status time is not divisible by dt.\n" |
779 |
> |
"\tThis will result in status reports that are not uniformly\n" |
780 |
> |
"\tdistributed in time. If this is a problem, change \n" |
781 |
> |
"\tyour statusTime variable.\n"); |
782 |
> |
painCave.isFatal = 0; |
783 |
> |
simError(); |
784 |
> |
} |
785 |
> |
|
786 |
> |
if (globals->haveThermalTime() && !isDivisible(globals->getThermalTime(), globals->getDt())){ |
787 |
> |
sprintf(painCave.errMsg, |
788 |
> |
"Thermal time is not divisible by dt.\n" |
789 |
> |
"\tThis will result in thermalizations that are not uniformly\n" |
790 |
> |
"\tdistributed in time. If this is a problem, change \n" |
791 |
> |
"\tyour thermalTime variable.\n"); |
792 |
> |
painCave.isFatal = 0; |
793 |
> |
simError(); |
794 |
> |
} |
795 |
> |
|
796 |
> |
if (globals->haveResetTime() && !isDivisible(globals->getResetTime(), globals->getDt())){ |
797 |
> |
sprintf(painCave.errMsg, |
798 |
> |
"Reset time is not divisible by dt.\n" |
799 |
> |
"\tThis will result in integrator resets that are not uniformly\n" |
800 |
> |
"\tdistributed in time. If this is a problem, change\n" |
801 |
> |
"\tyour resetTime variable.\n"); |
802 |
> |
painCave.isFatal = 0; |
803 |
> |
simError(); |
804 |
> |
} |
805 |
> |
|
806 |
> |
// set the status, sample, and thermal kick times |
807 |
> |
|
808 |
> |
for (i = 0; i < nInfo; i++){ |
809 |
> |
if (globals->haveSampleTime()){ |
810 |
> |
info[i].sampleTime = globals->getSampleTime(); |
811 |
> |
info[i].statusTime = info[i].sampleTime; |
812 |
> |
} |
813 |
> |
else{ |
814 |
> |
info[i].sampleTime = globals->getRunTime(); |
815 |
> |
info[i].statusTime = info[i].sampleTime; |
816 |
> |
} |
817 |
> |
|
818 |
> |
if (globals->haveStatusTime()){ |
819 |
> |
info[i].statusTime = globals->getStatusTime(); |
820 |
> |
} |
821 |
> |
|
822 |
> |
if (globals->haveThermalTime()){ |
823 |
> |
info[i].thermalTime = globals->getThermalTime(); |
824 |
> |
} else { |
825 |
> |
info[i].thermalTime = globals->getRunTime(); |
826 |
> |
} |
827 |
> |
|
828 |
> |
info[i].resetIntegrator = 0; |
829 |
> |
if( globals->haveResetTime() ){ |
830 |
> |
info[i].resetTime = globals->getResetTime(); |
831 |
> |
info[i].resetIntegrator = 1; |
832 |
> |
} |
833 |
> |
} |
834 |
|
|
835 |
< |
for (i = 0; i < nInfo; i++){ |
836 |
< |
strcpy(info[i].ensemble, ensemble); |
837 |
< |
|
835 |
> |
|
836 |
> |
for (i=0; i < nInfo; i++) { |
837 |
> |
|
838 |
> |
// check for the temperature set flag |
839 |
> |
|
840 |
> |
if (globals->haveTempSet()) |
841 |
> |
info[i].setTemp = globals->getTempSet(); |
842 |
> |
|
843 |
> |
// check for the extended State init |
844 |
> |
|
845 |
> |
info[i].useInitXSstate = globals->getUseInitXSstate(); |
846 |
> |
info[i].orthoTolerance = globals->getOrthoBoxTolerance(); |
847 |
> |
|
848 |
> |
// check for thermodynamic integration |
849 |
> |
if (globals->getUseSolidThermInt() && !globals->getUseLiquidThermInt()) { |
850 |
> |
if (globals->haveThermIntLambda() && globals->haveThermIntK()) { |
851 |
> |
info[i].useSolidThermInt = globals->getUseSolidThermInt(); |
852 |
> |
info[i].thermIntLambda = globals->getThermIntLambda(); |
853 |
> |
info[i].thermIntK = globals->getThermIntK(); |
854 |
> |
|
855 |
> |
Restraints *myRestraint = new Restraints(tot_nmol, info[i].thermIntLambda, info[i].thermIntK); |
856 |
> |
info[i].restraint = myRestraint; |
857 |
> |
} |
858 |
> |
else { |
859 |
> |
sprintf(painCave.errMsg, |
860 |
> |
"SimSetup Error:\n" |
861 |
> |
"\tKeyword useSolidThermInt was set to 'true' but\n" |
862 |
> |
"\tthermodynamicIntegrationLambda (and/or\n" |
863 |
> |
"\tthermodynamicIntegrationK) was not specified.\n" |
864 |
> |
"\tPlease provide a lambda value and k value in your meta-data file.\n"); |
865 |
> |
painCave.isFatal = 1; |
866 |
> |
simError(); |
867 |
> |
} |
868 |
> |
} |
869 |
> |
else if(globals->getUseLiquidThermInt()) { |
870 |
> |
if (globals->getUseSolidThermInt()) { |
871 |
> |
sprintf( painCave.errMsg, |
872 |
> |
"SimSetup Warning: It appears that you have both solid and\n" |
873 |
> |
"\tliquid thermodynamic integration activated in your meta-data\n" |
874 |
> |
"\tfile. To avoid confusion, specify only one technique in\n" |
875 |
> |
"\tyour meta-data file. Liquid-state thermodynamic integration\n" |
876 |
> |
"\twill be assumed for the current simulation. If this is not\n" |
877 |
> |
"\twhat you desire, set useSolidThermInt to 'true' and\n" |
878 |
> |
"\tuseLiquidThermInt to 'false' in your meta-data file.\n"); |
879 |
> |
painCave.isFatal = 0; |
880 |
> |
simError(); |
881 |
> |
} |
882 |
> |
if (globals->haveThermIntLambda() && globals->haveThermIntK()) { |
883 |
> |
info[i].useLiquidThermInt = globals->getUseLiquidThermInt(); |
884 |
> |
info[i].thermIntLambda = globals->getThermIntLambda(); |
885 |
> |
info[i].thermIntK = globals->getThermIntK(); |
886 |
> |
} |
887 |
> |
else { |
888 |
> |
sprintf(painCave.errMsg, |
889 |
> |
"SimSetup Error:\n" |
890 |
> |
"\tKeyword useLiquidThermInt was set to 'true' but\n" |
891 |
> |
"\tthermodynamicIntegrationLambda (and/or\n" |
892 |
> |
"\tthermodynamicIntegrationK) was not specified.\n" |
893 |
> |
"\tPlease provide a lambda value and k value in your meta-data file.\n"); |
894 |
> |
painCave.isFatal = 1; |
895 |
> |
simError(); |
896 |
> |
} |
897 |
> |
} |
898 |
> |
else if(globals->haveThermIntLambda() || globals->haveThermIntK()){ |
899 |
> |
sprintf(painCave.errMsg, |
900 |
> |
"SimSetup Warning: If you want to use Thermodynamic\n" |
901 |
> |
"\tIntegration, set useSolidThermInt or useLiquidThermInt to\n" |
902 |
> |
"\t'true' in your meta-data file. These keywords are set to\n" |
903 |
> |
"\t'false' by default, so your lambda and/or k values are\n" |
904 |
> |
"\tbeing ignored.\n"); |
905 |
> |
painCave.isFatal = 0; |
906 |
> |
simError(); |
907 |
> |
} |
908 |
> |
} |
909 |
> |
} |
910 |
> |
|
911 |
> |
for (i = 0; i < nInfo; i++) { |
912 |
|
// get the mixing rule |
913 |
< |
|
913 |
> |
|
914 |
|
strcpy(info[i].mixingRule, globals->getMixingRule()); |
915 |
|
info[i].usePBC = globals->getPBC(); |
916 |
|
} |
917 |
< |
|
917 |
> |
|
918 |
|
// get the components and calculate the tot_nMol and indvidual n_mol |
919 |
< |
|
919 |
> |
|
920 |
|
the_components = globals->getComponents(); |
921 |
|
components_nmol = new int[n_components]; |
922 |
< |
|
905 |
< |
|
922 |
> |
|
923 |
|
if (!globals->haveNMol()){ |
924 |
|
// we don't have the total number of molecules, so we assume it is |
925 |
|
// given in each component |
949 |
|
painCave.isFatal = 1; |
950 |
|
simError(); |
951 |
|
} |
952 |
+ |
|
953 |
|
|
936 |
– |
//check whether sample time, status time, thermal time and reset time are divisble by dt |
937 |
– |
if (globals->haveSampleTime() && !isDivisible(globals->getSampleTime(), globals->getDt())){ |
938 |
– |
sprintf(painCave.errMsg, |
939 |
– |
"Sample time is not divisible by dt.\n" |
940 |
– |
"\tThis will result in samples that are not uniformly\n" |
941 |
– |
"\tdistributed in time. If this is a problem, change\n" |
942 |
– |
"\tyour sampleTime variable.\n"); |
943 |
– |
painCave.isFatal = 0; |
944 |
– |
simError(); |
945 |
– |
} |
954 |
|
|
947 |
– |
if (globals->haveStatusTime() && !isDivisible(globals->getStatusTime(), globals->getDt())){ |
948 |
– |
sprintf(painCave.errMsg, |
949 |
– |
"Status time is not divisible by dt.\n" |
950 |
– |
"\tThis will result in status reports that are not uniformly\n" |
951 |
– |
"\tdistributed in time. If this is a problem, change \n" |
952 |
– |
"\tyour statusTime variable.\n"); |
953 |
– |
painCave.isFatal = 0; |
954 |
– |
simError(); |
955 |
– |
} |
956 |
– |
|
957 |
– |
if (globals->haveThermalTime() && !isDivisible(globals->getThermalTime(), globals->getDt())){ |
958 |
– |
sprintf(painCave.errMsg, |
959 |
– |
"Thermal time is not divisible by dt.\n" |
960 |
– |
"\tThis will result in thermalizations that are not uniformly\n" |
961 |
– |
"\tdistributed in time. If this is a problem, change \n" |
962 |
– |
"\tyour thermalTime variable.\n"); |
963 |
– |
painCave.isFatal = 0; |
964 |
– |
simError(); |
965 |
– |
} |
966 |
– |
|
967 |
– |
if (globals->haveResetTime() && !isDivisible(globals->getResetTime(), globals->getDt())){ |
968 |
– |
sprintf(painCave.errMsg, |
969 |
– |
"Reset time is not divisible by dt.\n" |
970 |
– |
"\tThis will result in integrator resets that are not uniformly\n" |
971 |
– |
"\tdistributed in time. If this is a problem, change\n" |
972 |
– |
"\tyour resetTime variable.\n"); |
973 |
– |
painCave.isFatal = 0; |
974 |
– |
simError(); |
975 |
– |
} |
976 |
– |
|
977 |
– |
// set the status, sample, and thermal kick times |
978 |
– |
|
979 |
– |
for (i = 0; i < nInfo; i++){ |
980 |
– |
if (globals->haveSampleTime()){ |
981 |
– |
info[i].sampleTime = globals->getSampleTime(); |
982 |
– |
info[i].statusTime = info[i].sampleTime; |
983 |
– |
} |
984 |
– |
else{ |
985 |
– |
info[i].sampleTime = globals->getRunTime(); |
986 |
– |
info[i].statusTime = info[i].sampleTime; |
987 |
– |
} |
988 |
– |
|
989 |
– |
if (globals->haveStatusTime()){ |
990 |
– |
info[i].statusTime = globals->getStatusTime(); |
991 |
– |
} |
992 |
– |
|
993 |
– |
if (globals->haveThermalTime()){ |
994 |
– |
info[i].thermalTime = globals->getThermalTime(); |
995 |
– |
} else { |
996 |
– |
info[i].thermalTime = globals->getRunTime(); |
997 |
– |
} |
998 |
– |
|
999 |
– |
info[i].resetIntegrator = 0; |
1000 |
– |
if( globals->haveResetTime() ){ |
1001 |
– |
info[i].resetTime = globals->getResetTime(); |
1002 |
– |
info[i].resetIntegrator = 1; |
1003 |
– |
} |
1004 |
– |
|
1005 |
– |
// check for the temperature set flag |
1006 |
– |
|
1007 |
– |
if (globals->haveTempSet()) |
1008 |
– |
info[i].setTemp = globals->getTempSet(); |
1009 |
– |
|
1010 |
– |
// check for the extended State init |
1011 |
– |
|
1012 |
– |
info[i].useInitXSstate = globals->getUseInitXSstate(); |
1013 |
– |
info[i].orthoTolerance = globals->getOrthoBoxTolerance(); |
1014 |
– |
|
1015 |
– |
// check for thermodynamic integration |
1016 |
– |
if (globals->getUseSolidThermInt() && !globals->getUseLiquidThermInt()) { |
1017 |
– |
if (globals->haveThermIntLambda() && globals->haveThermIntK()) { |
1018 |
– |
info[i].useSolidThermInt = globals->getUseSolidThermInt(); |
1019 |
– |
info[i].thermIntLambda = globals->getThermIntLambda(); |
1020 |
– |
info[i].thermIntK = globals->getThermIntK(); |
1021 |
– |
|
1022 |
– |
Restraints *myRestraint = new Restraints(tot_nmol, info[i].thermIntLambda, info[i].thermIntK); |
1023 |
– |
info[i].restraint = myRestraint; |
1024 |
– |
} |
1025 |
– |
else { |
1026 |
– |
sprintf(painCave.errMsg, |
1027 |
– |
"SimSetup Error:\n" |
1028 |
– |
"\tKeyword useSolidThermInt was set to 'true' but\n" |
1029 |
– |
"\tthermodynamicIntegrationLambda (and/or\n" |
1030 |
– |
"\tthermodynamicIntegrationK) was not specified.\n" |
1031 |
– |
"\tPlease provide a lambda value and k value in your .bass file.\n"); |
1032 |
– |
painCave.isFatal = 1; |
1033 |
– |
simError(); |
1034 |
– |
} |
1035 |
– |
} |
1036 |
– |
else if(globals->getUseLiquidThermInt()) { |
1037 |
– |
if (globals->getUseSolidThermInt()) { |
1038 |
– |
sprintf( painCave.errMsg, |
1039 |
– |
"SimSetup Warning: It appears that you have both solid and\n" |
1040 |
– |
"\tliquid thermodynamic integration activated in your .bass\n" |
1041 |
– |
"\tfile. To avoid confusion, specify only one technique in\n" |
1042 |
– |
"\tyour .bass file. Liquid-state thermodynamic integration\n" |
1043 |
– |
"\twill be assumed for the current simulation. If this is not\n" |
1044 |
– |
"\twhat you desire, set useSolidThermInt to 'true' and\n" |
1045 |
– |
"\tuseLiquidThermInt to 'false' in your .bass file.\n"); |
1046 |
– |
painCave.isFatal = 0; |
1047 |
– |
simError(); |
1048 |
– |
} |
1049 |
– |
if (globals->haveThermIntLambda() && globals->haveThermIntK()) { |
1050 |
– |
info[i].useLiquidThermInt = globals->getUseLiquidThermInt(); |
1051 |
– |
info[i].thermIntLambda = globals->getThermIntLambda(); |
1052 |
– |
info[i].thermIntK = globals->getThermIntK(); |
1053 |
– |
} |
1054 |
– |
else { |
1055 |
– |
sprintf(painCave.errMsg, |
1056 |
– |
"SimSetup Error:\n" |
1057 |
– |
"\tKeyword useLiquidThermInt was set to 'true' but\n" |
1058 |
– |
"\tthermodynamicIntegrationLambda (and/or\n" |
1059 |
– |
"\tthermodynamicIntegrationK) was not specified.\n" |
1060 |
– |
"\tPlease provide a lambda value and k value in your .bass file.\n"); |
1061 |
– |
painCave.isFatal = 1; |
1062 |
– |
simError(); |
1063 |
– |
} |
1064 |
– |
} |
1065 |
– |
else if(globals->haveThermIntLambda() || globals->haveThermIntK()){ |
1066 |
– |
sprintf(painCave.errMsg, |
1067 |
– |
"SimSetup Warning: If you want to use Thermodynamic\n" |
1068 |
– |
"\tIntegration, set useSolidThermInt or useLiquidThermInt to\n" |
1069 |
– |
"\t'true' in your .bass file. These keywords are set to\n" |
1070 |
– |
"\t'false' by default, so your lambda and/or k values are\n" |
1071 |
– |
"\tbeing ignored.\n"); |
1072 |
– |
painCave.isFatal = 0; |
1073 |
– |
simError(); |
1074 |
– |
} |
1075 |
– |
} |
955 |
|
|
956 |
|
//setup seed for random number generator |
957 |
|
int seedValue; |
994 |
|
} |
995 |
|
|
996 |
|
#ifdef IS_MPI |
997 |
< |
strcpy(checkPointMsg, "Successfully gathered all information from Bass\n"); |
997 |
> |
strcpy(checkPointMsg, "Successfully gathered all information from meta-data file\n"); |
998 |
|
MPIcheckPoint(); |
999 |
|
#endif // is_mpi |
1000 |
|
} |
1131 |
|
MPIcheckPoint(); |
1132 |
|
#endif // is_mpi |
1133 |
|
|
1255 |
– |
// clean up the forcefield |
1256 |
– |
the_ff->cleanMe(); |
1134 |
|
} |
1135 |
|
|
1136 |
|
void SimSetup::initSystemCoords(void){ |
1161 |
|
} |
1162 |
|
else{ |
1163 |
|
|
1164 |
< |
// no init from bass |
1164 |
> |
// no init from md file |
1165 |
|
|
1166 |
|
sprintf(painCave.errMsg, |
1167 |
|
"Cannot intialize a simulation without an initial configuration file.\n"); |
1179 |
|
|
1180 |
|
void SimSetup::makeOutNames(void){ |
1181 |
|
int k; |
1182 |
+ |
string prefix; |
1183 |
|
|
1306 |
– |
|
1184 |
|
for (k = 0; k < nInfo; k++){ |
1185 |
|
#ifdef IS_MPI |
1186 |
|
if (worldRank == 0){ |
1187 |
|
#endif // is_mpi |
1188 |
< |
|
1189 |
< |
if (globals->haveFinalConfig()){ |
1190 |
< |
strcpy(info[k].finalName, globals->getFinalConfig()); |
1191 |
< |
} |
1192 |
< |
else{ |
1316 |
< |
strcpy(info[k].finalName, inFileName); |
1317 |
< |
char* endTest; |
1318 |
< |
int nameLength = strlen(info[k].finalName); |
1319 |
< |
endTest = &(info[k].finalName[nameLength - 5]); |
1320 |
< |
if (!strcmp(endTest, ".bass")){ |
1321 |
< |
strcpy(endTest, ".eor"); |
1322 |
< |
} |
1323 |
< |
else if (!strcmp(endTest, ".BASS")){ |
1324 |
< |
strcpy(endTest, ".eor"); |
1325 |
< |
} |
1326 |
< |
else{ |
1327 |
< |
endTest = &(info[k].finalName[nameLength - 4]); |
1328 |
< |
if (!strcmp(endTest, ".bss")){ |
1329 |
< |
strcpy(endTest, ".eor"); |
1330 |
< |
} |
1331 |
< |
else if (!strcmp(endTest, ".mdl")){ |
1332 |
< |
strcpy(endTest, ".eor"); |
1333 |
< |
} |
1334 |
< |
else{ |
1335 |
< |
strcat(info[k].finalName, ".eor"); |
1336 |
< |
} |
1337 |
< |
} |
1338 |
< |
} |
1188 |
> |
|
1189 |
> |
if(globals->haveFinalConfig()) |
1190 |
> |
prefix = getPrefix(globals->getFinalConfig()); |
1191 |
> |
else |
1192 |
> |
prefix = getPrefix(inFileName); |
1193 |
|
|
1194 |
< |
// make the sample and status out names |
1195 |
< |
|
1196 |
< |
strcpy(info[k].sampleName, inFileName); |
1343 |
< |
char* endTest; |
1344 |
< |
int nameLength = strlen(info[k].sampleName); |
1345 |
< |
endTest = &(info[k].sampleName[nameLength - 5]); |
1346 |
< |
if (!strcmp(endTest, ".bass")){ |
1347 |
< |
strcpy(endTest, ".dump"); |
1348 |
< |
} |
1349 |
< |
else if (!strcmp(endTest, ".BASS")){ |
1350 |
< |
strcpy(endTest, ".dump"); |
1351 |
< |
} |
1352 |
< |
else{ |
1353 |
< |
endTest = &(info[k].sampleName[nameLength - 4]); |
1354 |
< |
if (!strcmp(endTest, ".bss")){ |
1355 |
< |
strcpy(endTest, ".dump"); |
1356 |
< |
} |
1357 |
< |
else if (!strcmp(endTest, ".mdl")){ |
1358 |
< |
strcpy(endTest, ".dump"); |
1359 |
< |
} |
1360 |
< |
else{ |
1361 |
< |
strcat(info[k].sampleName, ".dump"); |
1362 |
< |
} |
1363 |
< |
} |
1364 |
< |
|
1365 |
< |
strcpy(info[k].statusName, inFileName); |
1366 |
< |
nameLength = strlen(info[k].statusName); |
1367 |
< |
endTest = &(info[k].statusName[nameLength - 5]); |
1368 |
< |
if (!strcmp(endTest, ".bass")){ |
1369 |
< |
strcpy(endTest, ".stat"); |
1370 |
< |
} |
1371 |
< |
else if (!strcmp(endTest, ".BASS")){ |
1372 |
< |
strcpy(endTest, ".stat"); |
1373 |
< |
} |
1374 |
< |
else{ |
1375 |
< |
endTest = &(info[k].statusName[nameLength - 4]); |
1376 |
< |
if (!strcmp(endTest, ".bss")){ |
1377 |
< |
strcpy(endTest, ".stat"); |
1378 |
< |
} |
1379 |
< |
else if (!strcmp(endTest, ".mdl")){ |
1380 |
< |
strcpy(endTest, ".stat"); |
1381 |
< |
} |
1382 |
< |
else{ |
1383 |
< |
strcat(info[k].statusName, ".stat"); |
1384 |
< |
} |
1385 |
< |
} |
1386 |
< |
|
1387 |
< |
strcpy(info[k].rawPotName, inFileName); |
1388 |
< |
nameLength = strlen(info[k].rawPotName); |
1389 |
< |
endTest = &(info[k].rawPotName[nameLength - 5]); |
1390 |
< |
if (!strcmp(endTest, ".bass")){ |
1391 |
< |
strcpy(endTest, ".raw"); |
1392 |
< |
} |
1393 |
< |
else if (!strcmp(endTest, ".BASS")){ |
1394 |
< |
strcpy(endTest, ".raw"); |
1395 |
< |
} |
1396 |
< |
else{ |
1397 |
< |
endTest = &(info[k].rawPotName[nameLength - 4]); |
1398 |
< |
if (!strcmp(endTest, ".bss")){ |
1399 |
< |
strcpy(endTest, ".raw"); |
1400 |
< |
} |
1401 |
< |
else if (!strcmp(endTest, ".mdl")){ |
1402 |
< |
strcpy(endTest, ".raw"); |
1403 |
< |
} |
1404 |
< |
else{ |
1405 |
< |
strcat(info[k].rawPotName, ".raw"); |
1406 |
< |
} |
1407 |
< |
} |
1194 |
> |
info[k].finalName = prefix + ".eor"; |
1195 |
> |
info[k].sampleName = prefix + ".dump"; |
1196 |
> |
info[k].statusName = prefix + ".stat"; |
1197 |
|
|
1198 |
|
#ifdef IS_MPI |
1199 |
|
|
1574 |
|
else |
1575 |
|
myNVT = new NVT<RealIntegrator>(&(info[k]), the_ff); |
1576 |
|
|
1577 |
< |
myNVT->setTargetTemp(globals->getTargetTemp()); |
1577 |
> |
|
1578 |
> |
if (globals->haveTargetTemp()) |
1579 |
> |
myNVT->setTargetTemp(globals->getTargetTemp()); |
1580 |
> |
else{ |
1581 |
> |
sprintf(painCave.errMsg, |
1582 |
> |
"SimSetup error: If you use the NVT\n" |
1583 |
> |
"\tensemble, you must set targetTemp.\n"); |
1584 |
> |
painCave.isFatal = 1; |
1585 |
> |
simError(); |
1586 |
> |
} |
1587 |
|
|
1588 |
|
if (globals->haveTauThermostat()) |
1589 |
|
myNVT->setTauThermostat(globals->getTauThermostat()); |
1606 |
|
else |
1607 |
|
myNPTi = new NPTi<NPT<RealIntegrator> >(&(info[k]), the_ff); |
1608 |
|
|
1609 |
< |
myNPTi->setTargetTemp(globals->getTargetTemp()); |
1609 |
> |
if (globals->haveTargetTemp()) |
1610 |
> |
myNPTi->setTargetTemp(globals->getTargetTemp()); |
1611 |
> |
else{ |
1612 |
> |
sprintf(painCave.errMsg, |
1613 |
> |
"SimSetup error: If you use a constant pressure\n" |
1614 |
> |
"\tensemble, you must set targetTemp.\n"); |
1615 |
> |
painCave.isFatal = 1; |
1616 |
> |
simError(); |
1617 |
> |
} |
1618 |
|
|
1619 |
|
if (globals->haveTargetPressure()) |
1620 |
|
myNPTi->setTargetPressure(globals->getTargetPressure()); |
1621 |
|
else{ |
1622 |
|
sprintf(painCave.errMsg, |
1623 |
|
"SimSetup error: If you use a constant pressure\n" |
1624 |
< |
"\tensemble, you must set targetPressure in the BASS file.\n"); |
1624 |
> |
"\tensemble, you must set targetPressure in the meta-data file.\n"); |
1625 |
|
painCave.isFatal = 1; |
1626 |
|
simError(); |
1627 |
|
} |
1657 |
|
else |
1658 |
|
myNPTf = new NPTf<NPT <RealIntegrator> >(&(info[k]), the_ff); |
1659 |
|
|
1660 |
< |
myNPTf->setTargetTemp(globals->getTargetTemp()); |
1660 |
> |
if (globals->haveTargetTemp()) |
1661 |
> |
myNPTf->setTargetTemp(globals->getTargetTemp()); |
1662 |
> |
else{ |
1663 |
> |
sprintf(painCave.errMsg, |
1664 |
> |
"SimSetup error: If you use a constant pressure\n" |
1665 |
> |
"\tensemble, you must set targetTemp.\n"); |
1666 |
> |
painCave.isFatal = 1; |
1667 |
> |
simError(); |
1668 |
> |
} |
1669 |
|
|
1670 |
|
if (globals->haveTargetPressure()) |
1671 |
|
myNPTf->setTargetPressure(globals->getTargetPressure()); |
1672 |
|
else{ |
1673 |
|
sprintf(painCave.errMsg, |
1674 |
|
"SimSetup error: If you use a constant pressure\n" |
1675 |
< |
"\tensemble, you must set targetPressure in the BASS file.\n"); |
1675 |
> |
"\tensemble, you must set targetPressure in the meta-data file.\n"); |
1676 |
|
painCave.isFatal = 1; |
1677 |
|
simError(); |
1678 |
|
} |
1710 |
|
else |
1711 |
|
myNPTxyz = new NPTxyz<NPT <RealIntegrator> >(&(info[k]), the_ff); |
1712 |
|
|
1713 |
< |
myNPTxyz->setTargetTemp(globals->getTargetTemp()); |
1713 |
> |
if (globals->haveTargetTemp()) |
1714 |
> |
myNPTxyz->setTargetTemp(globals->getTargetTemp()); |
1715 |
> |
else{ |
1716 |
> |
sprintf(painCave.errMsg, |
1717 |
> |
"SimSetup error: If you use a constant pressure\n" |
1718 |
> |
"\tensemble, you must set targetTemp.\n"); |
1719 |
> |
painCave.isFatal = 1; |
1720 |
> |
simError(); |
1721 |
> |
} |
1722 |
|
|
1723 |
|
if (globals->haveTargetPressure()) |
1724 |
|
myNPTxyz->setTargetPressure(globals->getTargetPressure()); |
1725 |
|
else{ |
1726 |
|
sprintf(painCave.errMsg, |
1727 |
|
"SimSetup error: If you use a constant pressure\n" |
1728 |
< |
"\tensemble, you must set targetPressure in the BASS file.\n"); |
1728 |
> |
"\tensemble, you must set targetPressure in the meta-data file.\n"); |
1729 |
|
painCave.isFatal = 1; |
1730 |
|
simError(); |
1731 |
|
} |