}
void o815::sim::nextConfig() {
- bool readnewconfig;
- int nequileftReadConfig;
- bool skippedInEqui = false;
- bool readNoSingleConfig = true;
- bool createdNoNewConfigs = true;
-
- hypercache::readC(readnewconfig, nequileftReadConfig);
-
- if (readnewconfig) {
- nequileft = nequileftReadConfig;
- readNoSingleConfig = false;
- }
-
- /* try to find more equilibrated config-file for equilibration including excluded files */
- if ( nequileft > 0 && hypercache::CFilesLeft() > 0 ) {
- char *tmpconfig = (char*) malloc(confmemSize);
-
- while (true) {
- memcpy (tmpconfig, confMem, confmemSize);
- hypercache::readC(readnewconfig, nequileftReadConfig);
-
- if (! readnewconfig) {
- *log << "SIM: No more excluded config-files for possible equilibration available." << endl << flush;
- break;
- }
-
- if (nequileftReadConfig <= nequileft) {
- *log << "SIM: Found more equilibrated or same equilibrated excluded config-file configuration for equilibration." << endl << flush;
- nequileft = nequileftReadConfig;
- readNoSingleConfig = false;
- }
- else if (nequileftReadConfig > nequileft) {
- *log << "SIM: Excluded config-file configuration for equilibration is less equilibrated than actual config." << endl << flush;
- memcpy (confMem, tmpconfig, confmemSize);
- }
- }
- free(tmpconfig);
- }
+ bool readAtLeastOneConfig = hypercache::readC();
/* equilibrate if necessary */
- if (nequileft > 0) {
+ if (hypercache::getNEquiLeft() > 0) {
*log << "SIM: Starting equilibration." << endl << flush;
- if (nequileft != nequi)
- *log << "SIM: " << nequileft << " of " << nequi << " equilibration steps left after virtual equilibration." << endl << flush;
- progress equiProg(nequileft);
- for ( int iequi=0; iequi<nequileft; iequi++ ) {
+ if (hypercache::getNEquiLeft() != nequi)
+ *log << "SIM: " << hypercache::getNEquiLeft() << " of " << nequi << " equilibration steps left after virtual equilibration." << endl << flush;
+ progress equiProg(hypercache::getNEquiLeft());
+ for ( int iequi = 0; iequi < hypercache::getNEquiLeft(); iequi++ ) {
_makeSweep();
while( equiProg.madeStep(iequi) ) *log << "SIM: " << equiProg.done()*100 << "% of equilibration done." << endl << flush;
}
- nequileft = 0;
- skippedInEqui = true;
- createdNoNewConfigs = false;
}
- /* make skip if no config could be read */
- if ( ! skippedInEqui && readNoSingleConfig ) {
- cout << "here" << endl;
+ /* make skip if no config could be read or one skip is left after equilibration */
+ if ( (! readAtLeastOneConfig) || (hypercache::getNEquiLeft() == 0) ) {
+ cout << "SKIPPING" << endl;
for (int iskip=0; iskip<nskip; iskip++) {
_makeSweep();
- nequileft--;
}
- createdNoNewConfigs = false;
+ hypercache::writeC();
}
-
- if (! createdNoNewConfigs)
- hypercache::writeC(nequi-nequileft);
- cout << nequileft << endl;
+ cout << hypercache::getNEquiLeft() << endl;
}