From c5e710f7c44d4a02b0e632a8940844a08f371227 Mon Sep 17 00:00:00 2001 From: Alexander Schmidt Date: Sat, 23 Nov 2013 00:30:46 +0100 Subject: [PATCH 1/1] Only computing IR and UV mode. --- obs_phip2_hist.hpp | 54 ++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/obs_phip2_hist.hpp b/obs_phip2_hist.hpp index 4373383..a239d0e 100644 --- a/obs_phip2_hist.hpp +++ b/obs_phip2_hist.hpp @@ -15,7 +15,7 @@ class obs_phip2_hist : public o815::obs { public: struct obsmem { - double *phip2; + double phip2[2]; }; obs_phip2_hist(o815 *_O815); @@ -23,49 +23,47 @@ private: void _start() {} void _meas(bool loadedobs, const int& nthmeas); void _finish() {} - obsmem OM; + 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]*_O815->comargs.lsize[1], + _O815->paraQ->getParaNames() + "nthstep:iruv:phip2absdiffequi", _O815, + sizeof(obsmem), "_hist") { - OM.phip2 = (double*)obsMem; + OM = (obsmem*)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; + for (int kpiruv=0; kpiruv<2; kpiruv++) { + double ppt = 2.*M_PI/O815->comargs.lsize[0] * ( 0 + kpiruv * O815->comargs.lsize[0]/2 ) ; + double ppx = 2.*M_PI/O815->comargs.lsize[1] * ( 0 + kpiruv * O815->comargs.lsize[1]/2 ); - OM.phip2[ kpt * O815->comargs.lsize[1] + kpx ] = 0; + OM->phip2[ kpiruv ] = 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] + 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) ) ); + 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[ kpiruv ] += 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] + kpx ] /= Sim->LSIZE2; - } + OM->phip2[ kpiruv ] /= 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; + for (int kpiruv=0; kpiruv<2; kpiruv++) { + double ppt = 2.*M_PI/O815->comargs.lsize[0] * ( 0 + kpiruv * O815->comargs.lsize[0]/2 ) ; + double ppx = 2.*M_PI/O815->comargs.lsize[1] * ( 0 + kpiruv * O815->comargs.lsize[1]/2 ); - *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] + kpx ] - 1./(ppt*ppt + ppx*ppx + Sim->m*Sim->m) << endl; - } + *out << O815->paraQ->getParaVals(); + *out << "\t" << ( Sim->nequi + (nthmeas+1)*Sim->nskip ); + *out << "\t" << kpiruv; + *out << "\t" << abs( OM->phip2[ kpiruv ] - 1./(ppt*ppt + ppx*ppx + Sim->m*Sim->m) ) << endl; + } }; #endif -- 2.39.5