]> git.treefish.org Git - phys/heatbath.git/blobdiff - obs_phip2_hist.hpp
Corrected possible k values.
[phys/heatbath.git] / obs_phip2_hist.hpp
index 64b82e8435032e6ec7ff70b259ce4aafe786e9ff..437338338d582db34e6019e213783748ee5aa1d9 100644 (file)
@@ -29,7 +29,7 @@ private:
 
 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)
+                                                       sizeof(double)*_O815->comargs.lsize[0]*_O815->comargs.lsize[1]
                                                        "_hist") {
   OM.phip2 = (double*)obsMem;
   Sim = (sim*)O815->Sim;
@@ -37,22 +37,22 @@ obs_phip2_hist::obs_phip2_hist(o815 *_O815) : o815::obs("phip2",
 
 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++) {
+    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;
+       OM.phip2[ kpt * O815->comargs.lsize[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] + 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;
+       OM.phip2[ kpt * O815->comargs.lsize[1] + kpx ] /= Sim->LSIZE2;
       }
   }
   
@@ -64,7 +64,7 @@ void obs_phip2_hist::_meas(bool loadedobs, const int& nthmeas) {
       *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;
+      *out << "\t" << OM.phip2[ kpt * O815->comargs.lsize[1] + kpx ] - 1./(ppt*ppt + ppx*ppx + Sim->m*Sim->m) << endl;
     }
 };