1 #ifndef OBS_PHIP2_HIST_HPP
2 #define OBS_PHIP2_HIST_HPP
4 #include "latlib/o815/o815.h"
6 #include "latlib/writeout.h"
8 #include "latlib/obstat.hpp"
14 class obs_phip2_hist : public o815::obs {
20 obs_phip2_hist(o815 *_O815);
24 void _meas(bool loadedobs, const int& nthmeas);
30 obs_phip2_hist::obs_phip2_hist(o815 *_O815) : o815::obs("phip2",
31 _O815->paraQ->getParaNames() + "nthstep:kpt:kpx:phip2", _O815,
32 sizeof(double)*(_O815->comargs.lsize[0]+1)*(_O815->comargs.lsize[1]+1),
34 OM.phip2 = (double*)obsMem;
35 Sim = (sim*)O815->Sim;
38 void obs_phip2_hist::_meas(bool loadedobs, const int& nthmeas) {
40 for (int kpt = 0; kpt <= O815->comargs.lsize[0]; kpt++)
41 for (int kpx = 0; kpx <= O815->comargs.lsize[1]; kpx++) {
42 double ppt = 2.*M_PI/O815->comargs.lsize[0] * kpt;
43 double ppx = 2.*M_PI/O815->comargs.lsize[1] * kpx;
45 OM.phip2[ kpt * ( O815->comargs.lsize[1] + 1 ) + kpx ] = 0;
47 for (int ixt = 0; ixt < O815->comargs.lsize[0]; ixt++)
48 for (int ixx = 0; ixx < O815->comargs.lsize[1]; ixx++)
49 for (int ixpt = 0; ixpt < O815->comargs.lsize[0]; ixpt++)
50 for (int ixpx = 0; ixpx < O815->comargs.lsize[1]; ixpx++)
51 OM.phip2[ kpt * ( O815->comargs.lsize[1] + 1 ) + kpx ] += real( conj( Sim->conf[ ixt*O815->comargs.lsize[1] + ixx ].phi )
52 * Sim->conf[ ixpt*O815->comargs.lsize[1] + ixpx ].phi
53 * exp ( _i_*(double)ppx*(double)(ixx-ixpx) + _i_*(double)ppt*(double)(ixt-ixpt) ) );
55 OM.phip2[ kpt * ( O815->comargs.lsize[1] + 1 ) + kpx ] /= Sim->LSIZE2;
59 for (int kpt = 0; kpt <= O815->comargs.lsize[0]; kpt++)
60 for (int kpx = 0; kpx <= O815->comargs.lsize[1]; kpx++) {
61 double ppt = 2.*M_PI/O815->comargs.lsize[0] * kpt;
62 double ppx = 2.*M_PI/O815->comargs.lsize[1] * kpx;
64 *out << O815->paraQ->getParaVals();
65 *out << "\t" << ( Sim->nequi + (nthmeas+1)*Sim->nskip );
66 *out << "\t" << kpt << "\t" << kpx;
67 *out << "\t" << OM.phip2[ kpt * ( O815->comargs.lsize[1] + 1 ) + kpx ] - 1./(ppt*ppt + ppx*ppx + Sim->m*Sim->m) << endl;