3 #include "latlib/hypercache.h"
4 #include "latlib/progress.h"
6 o815::sim::sim(o815 *_O815, const int& _confmemSize) {
9 hypercache::initC(O815->programid, O815->comargs.nequi, O815->comargs.nskip, O815->comargs.confcache.first, &confMem, _confmemSize, O815->comargs.confcache.second, log);
10 nequi = O815->comargs.nequi;
11 nskip = O815->comargs.nskip;
12 confmemSize = confmemSize;
15 void o815::sim::nextConfig() {
17 int nequileftReadConfig;
18 bool skippedInEqui = false;
19 bool readNoSingleConfig = true;
20 bool createdNoNewConfigs = true;
22 hypercache::readC(readnewconfig, nequileftReadConfig);
25 nequileft = nequileftReadConfig;
26 readNoSingleConfig = false;
29 /* try to find more equilibrated config-file for equilibration including excluded files */
30 if ( nequileft > 0 && hypercache::CFilesLeft() > 0 ) {
31 char *tmpconfig = (char*) malloc(confmemSize);
34 memcpy (tmpconfig, confMem, confmemSize);
35 hypercache::readC(readnewconfig, nequileftReadConfig);
37 if (! readnewconfig) {
38 *log << "SIM: No more excluded config-files for possible equilibration available." << endl << flush;
42 if (nequileftReadConfig <= nequileft) {
43 *log << "SIM: Found more equilibrated or same equilibrated excluded config-file configuration for equilibration." << endl << flush;
44 nequileft = nequileftReadConfig;
45 readNoSingleConfig = false;
47 else if (nequileftReadConfig > nequileft) {
48 *log << "SIM: Excluded config-file configuration for equilibration is less equilibrated than actual config." << endl << flush;
49 memcpy (confMem, tmpconfig, confmemSize);
55 /* equilibrate if necessary */
57 *log << "SIM: Starting equilibration." << endl << flush;
58 if (nequileft != nequi)
59 *log << "SIM: " << nequileft << " of " << nequi << " equilibration steps left after virtual equilibration." << endl << flush;
60 progress equiProg(nequileft);
61 for ( int iequi=0; iequi<nequileft; iequi++ ) {
63 while( equiProg.madeStep(iequi) ) *log << "SIM: " << equiProg.done()*100 << "% of equilibration done." << endl << flush;
67 createdNoNewConfigs = false;
70 /* make skip if no config could be read */
71 if ( ! skippedInEqui && readNoSingleConfig ) {
72 cout << "here" << endl;
73 for (int iskip=0; iskip<nskip; iskip++) {
77 createdNoNewConfigs = false;
80 if (! createdNoNewConfigs)
81 hypercache::writeC(nequi-nequileft);
83 cout << nequileft << endl;