Skip to content

Commit b8a4b99

Browse files
committed
add reproducable random numbers to z2_noise generator for the inverter
remove z2 noise generator for arbitrary volumes move generator of gaussian momenta into start.c add repro parameter to Check_approximation in P_M_eta.[c,h] and solver/mode_number.[c,h]
1 parent 18c7844 commit b8a4b99

8 files changed

+181
-159
lines changed

P_M_eta.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ void X_over_sqrt_X_sqr(spinor * const R, double * const c,
359359
}
360360

361361

362-
void Check_Approximation(double const mstar) {
362+
void Check_Approximation(double const mstar, const int repro) {
363363

364364
if(g_proc_id == 0) {
365365
printf("Checking the approximation of X/sqrt(X^2) in the mode number: \n");
@@ -391,7 +391,7 @@ void Check_Approximation(double const mstar) {
391391
Sin =calloc(VOLUMEPLUSRAND, sizeof(spinor));
392392
#endif
393393

394-
random_spinor_field_lexic(Sin, 0);
394+
random_spinor_field_lexic(Sin, repro);
395395

396396
s_ = calloc(4*VOLUMEPLUSRAND+1, sizeof(spinor));
397397
s = calloc(4, sizeof(spinor*));

P_M_eta.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void h_X_eta(spinor * const R,spinor * const S, double const mstar);
3838

3939
void h_X_4_eta(spinor * const R1, spinor * const R2, spinor * const S, double const mstar);
4040

41-
void Check_Approximation(double const mstar);
41+
void Check_Approximation(double const mstar, const int repro);
4242

4343
#endif
4444

hybrid_update.c

-111
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@
4747
#include "phmc.h"
4848
#include "hybrid_update.h"
4949

50-
51-
52-
5350
/*----------------------------------------------------------------------------*/
5451

5552
/*******************************************
@@ -94,111 +91,3 @@ double moment_energy(su3adj ** const momenta) {
9491
#endif
9592
}
9693

97-
/*----------------------------------------------------------------------------*/
98-
99-
/**************************************
100-
*
101-
* Initialises the momenta
102-
* with the gaussian distribution
103-
*
104-
**************************************/
105-
double init_momenta(const int repro, su3adj ** const momenta) {
106-
107-
su3adj *xm;
108-
int i, mu, t0, x, y, z, X, Y, Z, t, id = 0;
109-
int coords[4];
110-
#ifdef MPI
111-
int k;
112-
int rlxd_state[105];
113-
#endif
114-
double ALIGN yy[8];
115-
double ALIGN tt, tr, ts, kc = 0., ks = 0., sum;
116-
117-
if(repro) {
118-
#ifdef MPI
119-
if(g_proc_id == 0) {
120-
rlxd_get(rlxd_state);
121-
}
122-
MPI_Bcast(rlxd_state, 105, MPI_INT, 0, MPI_COMM_WORLD);
123-
rlxd_reset(rlxd_state);
124-
#endif
125-
for(t0 = 0; t0 < g_nproc_t*T; t0++) {
126-
t = t0 - T*g_proc_coords[0];
127-
coords[0] = t0 / T;
128-
for(x = 0; x < g_nproc_x*LX; x++) {
129-
X = x - g_proc_coords[1]*LX;
130-
coords[1] = x / LX;
131-
for(y = 0; y < g_nproc_y*LY; y++) {
132-
Y = y - g_proc_coords[2]*LY;
133-
coords[2] = y / LY;
134-
for(z = 0; z < g_nproc_z*LZ; z++) {
135-
Z = z - g_proc_coords[3]*LZ;
136-
coords[3] = z / LZ;
137-
#ifdef MPI
138-
MPI_Cart_rank(g_cart_grid, coords, &id);
139-
#endif
140-
if(g_cart_id == id) i = g_ipt[t][X][Y][Z];
141-
for(mu = 0; mu < 4; mu++) {
142-
gauss_vector(yy,8);
143-
if(g_cart_id == id) {
144-
sum = 0.;
145-
xm = &momenta[i][mu];
146-
(*xm).d1 = 1.4142135623731*yy[0];
147-
(*xm).d2 = 1.4142135623731*yy[1];
148-
sum += (*xm).d1*(*xm).d1+(*xm).d2*(*xm).d2;
149-
(*xm).d3 = 1.4142135623731*yy[2];
150-
(*xm).d4 = 1.4142135623731*yy[3];
151-
sum += (*xm).d3*(*xm).d3+(*xm).d4*(*xm).d4;
152-
(*xm).d5 = 1.4142135623731*yy[4];
153-
(*xm).d6 = 1.4142135623731*yy[5];
154-
sum += (*xm).d5*(*xm).d5+(*xm).d6*(*xm).d6;
155-
(*xm).d7 = 1.4142135623731*yy[6];
156-
(*xm).d8 = 1.4142135623731*yy[7];
157-
sum += (*xm).d7*(*xm).d7+(*xm).d8*(*xm).d8;
158-
tr = sum+kc;
159-
ts = tr+ks;
160-
tt = ts-ks;
161-
ks = ts;
162-
kc = tr-tt;
163-
}
164-
}
165-
}
166-
}
167-
}
168-
}
169-
kc=0.5*(ks+kc);
170-
}
171-
else {
172-
for(i = 0; i < VOLUME; i++) {
173-
for(mu = 0; mu < 4; mu++) {
174-
sum=0.;
175-
xm=&momenta[i][mu];
176-
gauss_vector(yy,8);
177-
(*xm).d1=1.4142135623731*yy[0];
178-
(*xm).d2=1.4142135623731*yy[1];
179-
sum+=(*xm).d1*(*xm).d1+(*xm).d2*(*xm).d2;
180-
(*xm).d3=1.4142135623731*yy[2];
181-
(*xm).d4=1.4142135623731*yy[3];
182-
sum+=(*xm).d3*(*xm).d3+(*xm).d4*(*xm).d4;
183-
(*xm).d5=1.4142135623731*yy[4];
184-
(*xm).d6=1.4142135623731*yy[5];
185-
sum+=(*xm).d5*(*xm).d5+(*xm).d6*(*xm).d6;
186-
(*xm).d7=1.4142135623731*yy[6];
187-
(*xm).d8=1.4142135623731*yy[7];
188-
sum+=(*xm).d7*(*xm).d7+(*xm).d8*(*xm).d8;
189-
tr=sum+kc;
190-
ts=tr+ks;
191-
tt=ts-ks;
192-
ks=ts;
193-
kc=tr-tt;
194-
}
195-
}
196-
kc=0.5*(ks+kc);
197-
}
198-
#ifdef MPI
199-
MPI_Allreduce(&kc, &ks, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
200-
return ks;
201-
#endif
202-
return kc;
203-
}
204-

invert.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ int main(int argc, char *argv[])
403403
s[i] = s_+i*VOLUMEPLUSRAND;
404404
#endif
405405

406-
z2_random_spinor_field(s[i], VOLUME);
406+
z2_random_spinor_field_lexic(s[i], reproduce_randomnumber_flag);
407407

408408
/* what is this here needed for?? */
409409
/* spinor *aux_,*aux; */

solver/mode_number.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ extern double * x_cheby_coef;
66

77
void mode_number(spinor * const, double const mstar);
88

9-
void Check_Approximation(double const mstar);
9+
void Check_Approximation(double const mstar, const int repro);
1010

1111

0 commit comments

Comments
 (0)