]> git.treefish.org Git - phys/heatbath.git/blobdiff - sim-nonmetro.hpp
Doing the right rho overrelaxation update now.
[phys/heatbath.git] / sim-nonmetro.hpp
index 9eb818b93f1f2dd08567378252a3a25f9f9f5d36..7acab4df05de57ce0384990f30f1223038449a38 100644 (file)
@@ -53,20 +53,24 @@ void sim::updatePhi (const int& x)
   for (int nu=0; nu<4; nu++)
     V += conf[ (*nb)[x*4+nu] ].phi;
 
-#if defined(ALGORITHM_AHBMHB) || defined(ALGORITHM_AHBMOR)
+  Y = sqrt(M) * conf[x].phi - V / sqrt(M);
+
+#if defined(ALGORITHM_AHBMHB) || defined(ALGORITHM_AHBMOR) || defined(ALGORITHM_AHBM0)
   Y = polar( abs(Y), gsl_rng_uniform(rangsl) * 2*M_PI );
-#elif defined(ALGORITHM_AORMHB) || defined(ALGORITHM_AORMOR)
+#elif defined(ALGORITHM_AORMHB) || defined(ALGORITHM_AORMOR) || defined(ALGORITHM_AORM0)
   const double V2diff = pow(real(V), 2) - pow(imag(V), 2);
   const double Vprod = real(V)*imag(V);
   Y = complex<double> ( + real(Y) * V2diff + 2 * imag(Y) * Vprod,
                        - imag(Y) * V2diff + 2 * real(Y) * Vprod ) / norm(V);
 #endif
   
-#if defined(ALGORITHM_AHBMHB) || defined(ALGORITHM_AORMHB)
+#if defined(ALGORITHM_AHBMHB) || defined(ALGORITHM_AORMHB) || defined(ALGORITHM_A0MHB)
   Y = polar( magnYOfR( gsl_rng_uniform(rangsl) ), arg(Y) );
-#elif defined(ALGORITHM_AHBMOR) || defined(ALGORITHM_AORMOR)
-  Y = polar( magnYOfR( 1 - exp(-norm(Y)) ), arg(Y) ); //!!!!
+#elif defined(ALGORITHM_AHBMOR) || defined(ALGORITHM_AORMOR) || defined(ALGORITHM_A0MOR)
+  Y = polar( magnYOfR( exp( -norm(Y) ) ), arg(Y) );
 #endif
+
+  conf[x].phi = Y / sqrt(M) + V / M;
 }
 
 void sim::_makeSweep() {