]> git.treefish.org Git - phys/heatbath.git/commitdiff
Added observable phip2.
authorAlexander Schmidt <alex@treefish.org>
Fri, 22 Nov 2013 20:39:25 +0000 (21:39 +0100)
committerAlexander Schmidt <alex@treefish.org>
Fri, 22 Nov 2013 20:39:25 +0000 (21:39 +0100)
heatbath.cpp
obs_phi2_hist.hpp
obs_phip2_hist.hpp [new file with mode: 0644]
sim-1mr.hpp
sim-nor.hpp
sim-r.hpp

index 13b6f5114ae42dcc6a2bd2d63a14b5e168a83b3b..c95ecf56b8a3da6ec84739cc916def552001dd26 100644 (file)
 #error NO UPDATE-ALGORITHM DEFINED!
 #endif
 
-#include "obs_phi2.hpp"
-#include "obs_phi2_hist.hpp"
-
 o815 *O815;
 sim *Sim;
 
 const complex<double> _i_ = complex<double>(0.0,1.0);
 
+#include "obs_phi2.hpp"
+#include "obs_phi2_hist.hpp"
+#include "obs_phip2_hist.hpp"
+
 o815::comoption specOps[] = {
   { "mass", required_argument, NULL, 'm', "set mass", "min:max:inc" },
   { "", 0, NULL, 0, "", "" }
@@ -54,6 +55,10 @@ void parseLonelyArgs()
       *O815->out->log << "MASTER: registered observable: phi2_hist" << endl << flush;
       O815->observables.push_back(new obs_phi2_hist(O815));
     }
+    else if ( strcmp(*lonit, "phip2_hist") == 0 ) {
+      *O815->out->log << "MASTER: registered observable: phi2p_hist" << endl << flush;
+      O815->observables.push_back(new obs_phip2_hist(O815));
+    }
   }
 }
 
@@ -70,6 +75,8 @@ int main (int argc, char *argv[])
   O815->Sim = new sim(O815);
 
   parseLonelyArgs();
+
+  cout << "here" << endl;
   
   O815->mainLoop();
 
index b97d38c3145d0f96ba3050b9acff755fac2899cc..63e83add83a7f21804e9f78c7760ac5589f851f4 100644 (file)
@@ -29,7 +29,7 @@ private:
 };
 
 obs_phi2_hist::obs_phi2_hist(o815 *_O815) : o815::obs("phi2", 
-                                                     _O815->paraQ->getParaNames() + "nthstep:phi2:phi2_err", 
+                                                     _O815->paraQ->getParaNames() + "nthstep:phi2", 
                                                      _O815, sizeof(obsmem), "_hist") {
   OM = (obsmem*)obsMem;
   Sim = (sim*)O815->Sim;
diff --git a/obs_phip2_hist.hpp b/obs_phip2_hist.hpp
new file mode 100644 (file)
index 0000000..64b82e8
--- /dev/null
@@ -0,0 +1,71 @@
+#ifndef OBS_PHIP2_HIST_HPP
+#define OBS_PHIP2_HIST_HPP
+
+#include "latlib/o815/o815.h"
+
+#include "latlib/writeout.h"
+
+#include "latlib/obstat.hpp"
+
+#include <iostream>
+
+using namespace std;
+
+class obs_phip2_hist : public o815::obs {
+
+public:
+  struct obsmem {
+    double *phip2;
+  };
+  obs_phip2_hist(o815 *_O815);
+  
+private:
+  void _start() {}
+  void _meas(bool loadedobs, const int& nthmeas);
+  void _finish() {}
+  obsmem OM;
+  sim *Sim;
+};
+
+obs_phip2_hist::obs_phip2_hist(o815 *_O815) : o815::obs("phip2", 
+                                                       _O815->paraQ->getParaNames() + "nthstep:kpt:kpx:phip2", _O815, 
+                                                       sizeof(double)*(_O815->comargs.lsize[0]+1)*(_O815->comargs.lsize[1]+1), 
+                                                       "_hist") {
+  OM.phip2 = (double*)obsMem;
+  Sim = (sim*)O815->Sim;
+}
+
+void obs_phip2_hist::_meas(bool loadedobs, const int& nthmeas) {
+  if (!loadedobs) {
+    for (int kpt = 0; kpt <= O815->comargs.lsize[0]; kpt++)
+      for (int kpx = 0; kpx <= O815->comargs.lsize[1]; kpx++) {
+       double ppt = 2.*M_PI/O815->comargs.lsize[0] * kpt;
+       double ppx = 2.*M_PI/O815->comargs.lsize[1] * kpx;
+
+       OM.phip2[ kpt * ( O815->comargs.lsize[1] + 1 ) + kpx ] = 0;
+       
+       for (int ixt = 0; ixt < O815->comargs.lsize[0]; ixt++)
+         for (int ixx = 0; ixx < O815->comargs.lsize[1]; ixx++)
+           for (int ixpt = 0; ixpt < O815->comargs.lsize[0]; ixpt++)
+             for (int ixpx = 0; ixpx < O815->comargs.lsize[1]; ixpx++)
+               OM.phip2[ kpt * ( O815->comargs.lsize[1] + 1 ) + kpx ] += real( conj( Sim->conf[ ixt*O815->comargs.lsize[1] + ixx ].phi )
+                                                                               * Sim->conf[ ixpt*O815->comargs.lsize[1] + ixpx ].phi
+                                                                               * exp ( _i_*(double)ppx*(double)(ixx-ixpx) + _i_*(double)ppt*(double)(ixt-ixpt) ) );
+       
+       OM.phip2[ kpt * ( O815->comargs.lsize[1] + 1 ) + kpx ] /= Sim->LSIZE2;
+      }
+  }
+  
+  for (int kpt = 0; kpt <= O815->comargs.lsize[0]; kpt++)
+    for (int kpx = 0; kpx <= O815->comargs.lsize[1]; kpx++) {
+      double ppt = 2.*M_PI/O815->comargs.lsize[0] * kpt;
+      double ppx = 2.*M_PI/O815->comargs.lsize[1] * kpx;
+
+      *out << O815->paraQ->getParaVals();
+      *out << "\t" << ( Sim->nequi + (nthmeas+1)*Sim->nskip );
+      *out << "\t" << kpt << "\t" << kpx;
+      *out << "\t" << OM.phip2[ kpt * ( O815->comargs.lsize[1] + 1 ) + kpx ] - 1./(ppt*ppt + ppx*ppx + Sim->m*Sim->m) << endl;
+    }
+};
+
+#endif
index 556570008a34f3a51de17d27603076fd564f1f74..beadd7d55bdcc626f735110277899a05c6d15761 100644 (file)
@@ -15,14 +15,15 @@ public:
   sim(o815 *_O815);
   siteconf* conf;
   unsigned int LSIZE2;
+  double M;
+  double m;
+  neigh *nb;
 
 private:
   void _makeSweep();
   void _newParas();
   gsl_rng* rangsl;
-  neigh *nb;
   void updatePhi (const int& x);
-  double M;
 };
 
 
@@ -65,6 +66,7 @@ void sim::_makeSweep() {
 }
 
 void sim::_newParas() {
+  m = (*O815->paraQ)["mass"];
   M = pow( (*O815->paraQ)["mass"], 2 ) + 4;
   *log << "SIM: Resetting fields." << endl << flush;
 
index a15547b911415d8a2e64961e1f0e5258db5e20cb..b67f8a783b5d2c4e1b7f33107ddfcadcbb245d8e 100644 (file)
@@ -17,14 +17,15 @@ public:
   sim(o815 *_O815);
   siteconf* conf;
   unsigned int LSIZE2;
+  double M;
+  double m;
+  neigh *nb;
 
 private:
   void _makeSweep();
   void _newParas();
   gsl_rng* rangsl;
-  neigh *nb;
   int updatePhi (const int& x);
-  double M;
   double SofPhi(const int& x, const complex<double>& phix);
   double rhoPhi(const int& x, const complex<double>& phixCandidate);
 };
@@ -52,6 +53,7 @@ void sim::_makeSweep() {
 }
 
 void sim::_newParas() {
+  m = (*O815->paraQ)["mass"];
   M = pow( (*O815->paraQ)["mass"], 2 ) + 4;
   *log << "SIM: Resetting fields." << endl << flush;
 
index c49f736ad386214a78fbbc0db6fc6d95c8b5ffa0..0cbce5ec4dba439fac5b031785e15c26a4430699 100644 (file)
--- a/sim-r.hpp
+++ b/sim-r.hpp
@@ -15,14 +15,15 @@ public:
   sim(o815 *_O815);
   siteconf* conf;
   unsigned int LSIZE2;
+  double M;
+  double m;
+  neigh *nb;
 
 private:
   void _makeSweep();
   void _newParas();
   gsl_rng* rangsl;
-  neigh *nb;
   void updatePhi (const int& x);
-  double M;
 };
 
 
@@ -62,6 +63,7 @@ void sim::_makeSweep() {
 }
 
 void sim::_newParas() {
+  m = (*O815->paraQ)["mass"];
   M = pow( (*O815->paraQ)["mass"], 2 ) + 4;
   *log << "SIM: Resetting fields." << endl << flush;