]> git.treefish.org Git - phys/latlib.git/blobdiff - o815/sim.cpp
disabled warnings for unknown command line options.
[phys/latlib.git] / o815 / sim.cpp
index 2e68ae21e8c1388c27447134d02138f78936fde3..1b81dda4401b4bd042750763445c5dac4cd5adad 100644 (file)
@@ -3,20 +3,41 @@
 #include "latlib/hypercache.h"
 #include "latlib/progress.h"
 
 #include "latlib/hypercache.h"
 #include "latlib/progress.h"
 
-o815::sim::sim(o815 *_O815, const int& confmemSize) {
+o815::sim::sim(o815 *_O815, const int& _confmemSize) {
   O815 = _O815;
   log = O815->out->log;
   O815 = _O815;
   log = O815->out->log;
-  hypercache::initC(O815->programid, O815->comargs.nequi, O815->comargs.nskip, O815->comargs.confcache.first, &confMem, confmemSize, O815->comargs.confcache.second, log);
+  hypercache::initC(O815->programid, O815->comargs.nequi, O815->comargs.nskip, O815->comargs.confcache.first, &confMem, _confmemSize, O815->comargs.confcache.second, log);
   toEquilibrate = true;
   nequi = O815->comargs.nequi;
   nskip = O815->comargs.nskip;
   toEquilibrate = true;
   nequi = O815->comargs.nequi;
   nskip = O815->comargs.nskip;
+  confmemSize = confmemSize;
 }
 
 void o815::sim::nextConfig() {
   int nequileft = hypercache::readC();
 
   if ( nequileft != -1 ) {
 }
 
 void o815::sim::nextConfig() {
   int nequileft = hypercache::readC();
 
   if ( nequileft != -1 ) {
-    if(toEquilibrate) {
+    /* try to use excluded config-file for equilibration */
+    if (toEquilibrate && hypercache::CFilesLeft() > 0) {
+      int exnequileft;
+      char *tmpconfig = (char*) malloc(confmemSize);
+
+      memcpy (tmpconfig, confMem, confmemSize);
+      exnequileft = hypercache::read1CForEqui();
+
+      if (exnequileft < nequileft) {
+       *log << "SIM: Found suitable excluded config-file configuration for equilibration." << endl << flush;
+       nequileft = exnequileft;
+      }
+      else {
+       *log << "SIM: Could not find suitable excluded config-file configuration for equilibration." << endl << flush;
+       memcpy (confMem, tmpconfig, confmemSize);
+      }
+
+      free(tmpconfig);
+    }
+
+    if(toEquilibrate && nequileft > 0) {
       _reset();
       *log << "SIM: Starting equilibration." << endl << flush;
       if (nequileft != nequi)
       _reset();
       *log << "SIM: Starting equilibration." << endl << flush;
       if (nequileft != nequi)
@@ -26,7 +47,8 @@ void o815::sim::nextConfig() {
        _makeSweep(1);
        while( equiProg.madeStep(iequi) ) *log << "SIM: " << equiProg.done()*100 << "% of equilibration done." << endl << flush;
       }
        _makeSweep(1);
        while( equiProg.madeStep(iequi) ) *log << "SIM: " << equiProg.done()*100 << "% of equilibration done." << endl << flush;
       }
-    }  
+    }
+       
     _makeSweep(nskip);
     hypercache::writeC();
   }
     _makeSweep(nskip);
     hypercache::writeC();
   }