]> git.treefish.org Git - phys/heatbath.git/commitdiff
Switched to 2d and added multiple sim-algorithm compilation.
authorAlexander Schmidt <alex@treefish.org>
Thu, 14 Nov 2013 16:49:02 +0000 (17:49 +0100)
committerAlexander Schmidt <alex@treefish.org>
Thu, 14 Nov 2013 16:49:02 +0000 (17:49 +0100)
.gitignore
CMakeLists.txt
heatbath.cpp
obs_phi2.hpp
sim-heatless.hpp [new file with mode: 0644]
sim-relaxedheat.hpp [new file with mode: 0644]
sim-usualheat.hpp [new file with mode: 0644]
sim.hpp [deleted file]

index 3bdf24fbe97bd266be985bc3a04faf054c6bfeca..abf17c14d1e687afa97506ef0f004826db74b014 100644 (file)
@@ -5,3 +5,6 @@ Makefile
 CMakeCache.txt
 CMakeFiles
 data
+heatbath-heatless
+heatbath-relaxedheat
+heatbath-usualheat
index bedfec9e0bfb21906179b9a6263865f46d9fef54..c90e8c9f399cca71796c1e925bbf648f8cb45f3d 100644 (file)
@@ -11,6 +11,14 @@ SET(CMAKE_BUILD_TYPE Release)
 
 add_subdirectory(latlib)
 
-add_executable(heatbath heatbath.cpp)
-#set_target_properties(phi4iso-local PROPERTIES COMPILE_DEFINITIONS "LOCAL_UPDATE_ALGORITHM")
-target_link_libraries(heatbath o815 gsl gslcblas lat_neigh)
+add_executable(heatbath-heatless heatbath.cpp)
+set_target_properties(heatbath-heatless PROPERTIES COMPILE_DEFINITIONS "HEATLESS_ALGORITHM")
+target_link_libraries(heatbath-heatless o815 gsl gslcblas lat_neigh)
+
+add_executable(heatbath-usualheat heatbath.cpp)
+set_target_properties(heatbath-usualheat PROPERTIES COMPILE_DEFINITIONS "USUALHEAT_ALGORITHM")
+target_link_libraries(heatbath-usualheat o815 gsl gslcblas lat_neigh)
+
+add_executable(heatbath-relaxedheat heatbath.cpp)
+set_target_properties(heatbath-relaxedheat PROPERTIES COMPILE_DEFINITIONS "RELAXEDHEAT_ALGORITHM")
+target_link_libraries(heatbath-relaxedheat o815 gsl gslcblas lat_neigh)
index de996508e0a5fc6adb056364a0030ea6716fc151..e6a7803c3c93ab828170f99df2e12fbc160d9ef9 100644 (file)
@@ -1,12 +1,27 @@
+#include <complex>
+
 #include "latlib/o815/o815.h"
 
-#include "sim.hpp"
+#ifdef HEATLESS_ALGORITHM
+#define ALGORITHM "heatless"
+#include "sim-heatless.hpp"
+#elif USUALHEAT_ALGORITHM
+#define ALGORITHM "usualheat"
+#include "sim-usualheat.hpp"
+#elif RELAXEDHEAT_ALGORITHM
+#define ALGORITHM "relaxedheat"
+#include "sim-relaxedheat.hpp"
+#else
+#error NO UPDATE-ALGORITHM DEFINED!
+#endif
 
 #include "obs_phi2.hpp"
 
 o815 *O815;
 sim *Sim;
 
+const complex<double> _i_ = complex<double>(0.0,1.0);
+
 o815::comoption specOps[] = {
   { "mass", required_argument, NULL, 'm', "set mass", "min:max:inc" },
   { "", 0, NULL, 0, "", "" }
@@ -23,8 +38,8 @@ void parseSpecOps()
 }
 
 void helpHeader() 
-{
-  cout << "Usage: ./heatbath [OPTIONS] [obs1] ... [obsN]" << endl << endl;
+{ 
+  cout << "Usage: ./heatbath-"ALGORITHM" [OPTIONS] [obs1] ... [obsN]" << endl << endl;
 }
 
 void parseLonelyArgs()
@@ -39,7 +54,7 @@ void parseLonelyArgs()
 
 int main (int argc, char *argv[])
 {
-  O815 = new o815(argc, argv, "heatbath", specOps, &helpHeader);
+  O815 = new o815(argc, argv, "heatbath-"ALGORITHM, specOps, &helpHeader);
 
   O815->addPara("mass", 1);
 
@@ -50,7 +65,7 @@ int main (int argc, char *argv[])
   O815->Sim = new sim(O815);
 
   parseLonelyArgs();
-
+  
   O815->mainLoop();
 
   delete O815;
index 23a84e4ecee96f79a41456d81aaba0422172528f..227444211307bf9007feb4594862c3cbba052d9c 100644 (file)
@@ -57,7 +57,7 @@ void obs_phi2::_finish() {
   int compid_phi2, compid_phi2sus;
 
   compid_phi2 = oPhi2.computeEasy();
-  compid_phi2sus = oPhi2.computeJack(obs_phi2::phi2Sus, &(Sim->LSIZE4));
+  compid_phi2sus = oPhi2.computeJack(obs_phi2::phi2Sus, &(Sim->LSIZE2));
 
   *out << "\t" << oPhi2.getMean(compid_phi2) << "\t" << oPhi2.getErr(compid_phi2);
   *out << "\t" << oPhi2.getMean(compid_phi2sus) << "\t" << oPhi2.getErr(compid_phi2sus);
@@ -71,10 +71,10 @@ void obs_phi2::phi2Compute()
 {
   OM->phi2 = 0;
 
-  for (int ix = 0; ix < Sim->LSIZE4; ix++)
+  for (int ix = 0; ix < Sim->LSIZE2; ix++)
     OM->phi2 += norm( Sim->conf[ix].phi );
 
-  OM->phi2 /= Sim->LSIZE4;
+  OM->phi2 /= Sim->LSIZE2;
 }
 
 double obs_phi2::phi2Sus(vector< vector<double> > *vals, void *para) {
diff --git a/sim-heatless.hpp b/sim-heatless.hpp
new file mode 100644 (file)
index 0000000..aa305ff
--- /dev/null
@@ -0,0 +1,58 @@
+#ifndef SIM_HPP
+#define SIM_HPP
+
+#include <gsl/gsl_rng.h>
+#include <complex>
+#include <math.h>
+
+#include "latlib/neigh.h"
+
+class sim : public o815::sim {
+public:
+  struct siteconf {
+    complex<double> phi;
+  };
+  sim(o815 *_O815);
+  siteconf* conf;
+  unsigned int LSIZE2;
+
+private:
+  void _makeSweep();
+  void _newParas();
+
+  gsl_rng* rangsl;
+
+  neigh *nb;
+
+  void updatePhi (const int& x);
+};
+
+
+
+sim::sim(o815 *_O815) : o815::sim( _O815, 
+                                  sizeof(siteconf)*
+                                  (_O815->comargs.lsize[0]*_O815->comargs.lsize[1]) ) {
+  conf = (siteconf*)confMem;
+
+  rangsl = gsl_rng_alloc(gsl_rng_ranlxs0);
+  gsl_rng_set(rangsl, time(NULL));
+
+  LSIZE2 = _O815->comargs.lsize[0] * _O815->comargs.lsize[1];
+
+  nb = new neigh(2, _O815->comargs.lsize[0], _O815->comargs.lsize[1]);
+}
+
+void sim::updatePhi (const int& x) 
+{
+  const double r = gsl_rng_uniform(rangsl);
+  const double theta = gsl_rng_uniform(rangsl) * 2*M_PI;
+}
+
+void sim::_makeSweep() {  
+}
+
+void sim::_newParas() {
+  /* reset variables */
+}
+
+#endif
diff --git a/sim-relaxedheat.hpp b/sim-relaxedheat.hpp
new file mode 100644 (file)
index 0000000..aa305ff
--- /dev/null
@@ -0,0 +1,58 @@
+#ifndef SIM_HPP
+#define SIM_HPP
+
+#include <gsl/gsl_rng.h>
+#include <complex>
+#include <math.h>
+
+#include "latlib/neigh.h"
+
+class sim : public o815::sim {
+public:
+  struct siteconf {
+    complex<double> phi;
+  };
+  sim(o815 *_O815);
+  siteconf* conf;
+  unsigned int LSIZE2;
+
+private:
+  void _makeSweep();
+  void _newParas();
+
+  gsl_rng* rangsl;
+
+  neigh *nb;
+
+  void updatePhi (const int& x);
+};
+
+
+
+sim::sim(o815 *_O815) : o815::sim( _O815, 
+                                  sizeof(siteconf)*
+                                  (_O815->comargs.lsize[0]*_O815->comargs.lsize[1]) ) {
+  conf = (siteconf*)confMem;
+
+  rangsl = gsl_rng_alloc(gsl_rng_ranlxs0);
+  gsl_rng_set(rangsl, time(NULL));
+
+  LSIZE2 = _O815->comargs.lsize[0] * _O815->comargs.lsize[1];
+
+  nb = new neigh(2, _O815->comargs.lsize[0], _O815->comargs.lsize[1]);
+}
+
+void sim::updatePhi (const int& x) 
+{
+  const double r = gsl_rng_uniform(rangsl);
+  const double theta = gsl_rng_uniform(rangsl) * 2*M_PI;
+}
+
+void sim::_makeSweep() {  
+}
+
+void sim::_newParas() {
+  /* reset variables */
+}
+
+#endif
diff --git a/sim-usualheat.hpp b/sim-usualheat.hpp
new file mode 100644 (file)
index 0000000..aa305ff
--- /dev/null
@@ -0,0 +1,58 @@
+#ifndef SIM_HPP
+#define SIM_HPP
+
+#include <gsl/gsl_rng.h>
+#include <complex>
+#include <math.h>
+
+#include "latlib/neigh.h"
+
+class sim : public o815::sim {
+public:
+  struct siteconf {
+    complex<double> phi;
+  };
+  sim(o815 *_O815);
+  siteconf* conf;
+  unsigned int LSIZE2;
+
+private:
+  void _makeSweep();
+  void _newParas();
+
+  gsl_rng* rangsl;
+
+  neigh *nb;
+
+  void updatePhi (const int& x);
+};
+
+
+
+sim::sim(o815 *_O815) : o815::sim( _O815, 
+                                  sizeof(siteconf)*
+                                  (_O815->comargs.lsize[0]*_O815->comargs.lsize[1]) ) {
+  conf = (siteconf*)confMem;
+
+  rangsl = gsl_rng_alloc(gsl_rng_ranlxs0);
+  gsl_rng_set(rangsl, time(NULL));
+
+  LSIZE2 = _O815->comargs.lsize[0] * _O815->comargs.lsize[1];
+
+  nb = new neigh(2, _O815->comargs.lsize[0], _O815->comargs.lsize[1]);
+}
+
+void sim::updatePhi (const int& x) 
+{
+  const double r = gsl_rng_uniform(rangsl);
+  const double theta = gsl_rng_uniform(rangsl) * 2*M_PI;
+}
+
+void sim::_makeSweep() {  
+}
+
+void sim::_newParas() {
+  /* reset variables */
+}
+
+#endif
diff --git a/sim.hpp b/sim.hpp
deleted file mode 100644 (file)
index 2e9a6b8..0000000
--- a/sim.hpp
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef SIM_HPP
-#define SIM_HPP
-
-#include <gsl/gsl_rng.h>
-#include <complex>
-
-#include "latlib/neigh.h"
-
-class sim : public o815::sim {
-public:
-  struct siteconf {
-    complex<double> phi;
-  };
-  sim(o815 *_O815);
-  siteconf* conf;
-  int LSIZE4;
-
-private:
-  void _makeSweep();
-  void _newParas();
-
-  gsl_rng* rangsl;
-
-  neigh *nb;
-};
-
-sim::sim(o815 *_O815) : o815::sim( _O815, 
-                                  sizeof(siteconf)*
-                                  (_O815->comargs.lsize[0]*_O815->comargs.lsize[0]*_O815->comargs.lsize[0]*_O815->comargs.lsize[1]) ) {
-  conf = (siteconf*)confMem;
-  LSIZE4 = _O815->comargs.lsize[0] * _O815->comargs.lsize[0] * _O815->comargs.lsize[0] * _O815->comargs.lsize[1];
-
-  rangsl = gsl_rng_alloc(gsl_rng_ranlxs0);
-  gsl_rng_set(rangsl, time(NULL));
-
-  nb = new neigh(4, _O815->comargs.lsize[0], _O815->comargs.lsize[0], _O815->comargs.lsize[0], _O815->comargs.lsize[1]);
-}
-
-void sim::_makeSweep() {  
-}
-
-void sim::_newParas() {
-  /* reset variables */
-}
-
-#endif