From 529d936f699ce3260e09903837fbeab9159eb05f Mon Sep 17 00:00:00 2001 From: Alexander Schmidt Date: Fri, 15 Nov 2013 11:48:56 +0100 Subject: [PATCH 1/1] Implemented r algorithm. --- sim-nor.hpp | 5 ----- sim-r.hpp | 18 ++++++++++++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/sim-nor.hpp b/sim-nor.hpp index 7bb4a7c..9c1d166 100644 --- a/sim-nor.hpp +++ b/sim-nor.hpp @@ -21,15 +21,10 @@ public: private: void _makeSweep(); void _newParas(); - gsl_rng* rangsl; - neigh *nb; - int updatePhi (const int& x); - double M; - double SofPhi(const int& x, const complex& phix); double rhoPhi(const int& x, const complex& phixCandidate); }; diff --git a/sim-r.hpp b/sim-r.hpp index aa305ff..e908626 100644 --- a/sim-r.hpp +++ b/sim-r.hpp @@ -19,12 +19,10 @@ public: private: void _makeSweep(); void _newParas(); - gsl_rng* rangsl; - neigh *nb; - void updatePhi (const int& x); + double M; }; @@ -46,13 +44,25 @@ void sim::updatePhi (const int& x) { const double r = gsl_rng_uniform(rangsl); const double theta = gsl_rng_uniform(rangsl) * 2*M_PI; + complex V=0; + + for (int nu=0; nu<4; nu++) + V += conf[ (*nb)[x*4+nu] ].phi; + + conf[x].phi = sqrt(std::log( 1./(1-r) )) / sqrt(M) + * complex( cos(theta), sin(theta) ) + + V / M; } void sim::_makeSweep() { + for (int ix=0; ixparaQ)["mass"], 2 ) + 4; + *log << "SIM: Resetting fields." << endl << flush; + memset(conf, 0, sizeof(siteconf)*LSIZE2); } #endif -- 2.39.5