Skip to content

Commit 20081dc

Browse files
committed
initialization of sources and propagator spinores + inversion + even-odd lexic conversione
1 parent f11e8da commit 20081dc

File tree

1 file changed

+132
-52
lines changed

1 file changed

+132
-52
lines changed

meas/correlators.c

Lines changed: 132 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -260,26 +260,15 @@ void light_correlators_measurement(const int traj, const int id, const int ieo)
260260
*current), <S,S>, <S,P>, <P,P> for all the choices of h1 and h2 (see eq. 18 and 20 of
261261
*https://arxiv.org/pdf/1005.2042.pdf)
262262
*
263-
* i1, i2 = source and sink operator indices from the list of the operators in the input file.
263+
* i1, i2 = operator indices from the list of the operators in the input file.
264264
*
265265
*
266266
******************************************************/
267267
void heavy_quarks_correlators_measurement(const int traj, const int t0, const int ieo, const int i1,
268268
const int i2) {
269269
tm_stopwatch_push(&g_timers, __func__, ""); // timer for profiling
270-
int i, j, t, tt, t0; // dummy indices
271-
double *Cpp = NULL; // array of the values of the correlator C(t)
272-
double res = 0.; // result of the accumulation of MPI partial sums
273-
float tmp; // dummy variable
274-
operator* optr1; // pointer to the operator (see some lines later)
275-
#ifdef TM_USE_MPI
276-
double mpi_res = 0., mpi_respa = 0., mpi_resp4 = 0.;
277-
// send buffer for MPI_Gather
278-
double *sCpp = NULL; //, *sCpa = NULL, *sCp4 = NULL;
279-
#endif
280-
FILE *ofs; // output file stream
281-
char filename[TM_OMEAS_FILENAME_LENGTH]; // file path
282-
spinor phi; // full spinor of 4 components (we use the spin dilution)
270+
271+
/* building the stichastic propagator spinors needed for the correlators */
283272

284273
init_operators(); // initialize the operators in the action (if not already done)
285274
if (no_operators < 1) {
@@ -294,7 +283,8 @@ void heavy_quarks_correlators_measurement(const int traj, const int t0, const in
294283
}
295284

296285
// selecting the operators i1 and i2 from the list of operators initialized before
297-
optr1 = &operator_list[i1];
286+
operator* optr1 = &operator_list[i1];
287+
operator* optr2 = &operator_list[i2];
298288

299289
bool b1 = (optr1->type != DBTMWILSON && optr1->type != DBCLOVER);
300290
if (b1) {
@@ -345,6 +335,129 @@ void heavy_quarks_correlators_measurement(const int traj, const int t0, const in
345335
optr1->kappa, optr1->mubar, optr1->epsbar);
346336
}
347337

338+
339+
// even-odd spinor fields for the light and heavy doublet correlators
340+
// source+propagator, even-odd, 2 flavors
341+
// psi = psi[(s,p)][eo][f][x][alpha][c]
342+
// Note: propagator in th sense that it is D^{-1}*source after the inversion
343+
init_spinor_field(VOLUMEPLUSRAND / 2, 1); // initialize g_spinor_field so that I can copy it
344+
spinor ****l_eo_spinor_field = (spinor ****)malloc(8 * VOLUME / 2);
345+
spinor ****h_eo_spinor_field = (spinor ****)malloc(8 * VOLUME / 2);
346+
// initalize to zero the source spinor fields (necessary??? isn't it enough to use the source
347+
// generator?)
348+
for (size_t i_sp = 0; i_sp < 2; i_sp++) { // source or propagator
349+
350+
for (size_t i_eo = 0; i_eo < 2; i_eo++) { // even-odd
351+
for (size_t i_f = 0; i_f < 2; i++) { // up-down flavor
352+
assign(l_eo_spinor_field[0][i_eo][i_f], g_spinor_field[0], VOLUME / 2);
353+
assign(h_eo_spinor_field[0][i_eo][i_f], g_spinor_field[0], VOLUME / 2);
354+
}
355+
}
356+
}
357+
358+
// initalize the random sources
359+
// one source for each --> spin dilution
360+
for (size_t i_f = 0; i_f < 2; i_f++) {
361+
for (size_t src_d = 0; src_d < 4; src_d++) {
362+
const unsigned int seed_i = src_d + measurement_list[id].seed;
363+
// light doublet
364+
eo_source_spinor_field_spin_diluted_oet_ts(l_eo_spinor_field[0][0][i_f],
365+
l_eo_spinor_field[0][1][i_f], t0, src_d,
366+
sample, traj, seed_i);
367+
// heavy doublet
368+
eo_source_spinor_field_spin_diluted_oet_ts(h_eo_spinor_field[0][0][i_f],
369+
h_eo_spinor_field[0][1][i_f], t0, src_d,
370+
sample, traj, seed_i);
371+
}
372+
}
373+
374+
// heavy doublet: for each even-odd block, I multiply by (1 + i*tau_2)
375+
// the basis for the inversion should be the same as for the light
376+
// --> I will multiply later by the inverse, namely at the end of the inversion
377+
for (size_t i_eo = 0; i_eo < 2; i_eo++) {
378+
for (size_t i_f = 0; i_f < 2; i_f++) {
379+
// (u,d) --> [(1+i*tau_2)/sqrt(2)] * (u,d) , stored at temporarely in the propagator spinors (used as dummy spinors)
380+
mul_one_pm_itau2(h_eo_spinor_field[1][i_eo][i_f], h_eo_spinor_field[1][i_eo][i_f+1],
381+
h_eo_spinor_field[0][i_eo][i_f], h_eo_spinor_field[0][i_eo][i_f+1], +1.0, VOLUME / 2);
382+
// assigning the result to the first components (the sources).
383+
// The propagators will be overwritten with the inversion
384+
assign(h_eo_spinor_field[0][i_eo][i_f], h_eo_spinor_field[1][i_eo][i_f], VOLUME / 2);
385+
}
386+
}
387+
388+
/*
389+
assign the sources and propagator pointes for the operators
390+
these need to be know when calling the inverter() method
391+
*/
392+
393+
// light doublet
394+
optr1->sr0 = l_eo_spinor_field[0][0][0];
395+
optr1->sr1 = l_eo_spinor_field[0][0][1];
396+
optr1->sr2 = l_eo_spinor_field[0][1][0];
397+
optr1->sr3 = l_eo_spinor_field[0][1][1];
398+
399+
optr1->prop0 = l_eo_spinor_field[1][0][0];
400+
optr1->prop1 = l_eo_spinor_field[1][0][1];
401+
optr1->prop2 = l_eo_spinor_field[1][1][0];
402+
optr1->prop3 = l_eo_spinor_field[1][1][1];
403+
404+
// heavy doublet
405+
optr2->sr0 = h_eo_spinor_field[0][0][0];
406+
optr2->sr1 = h_eo_spinor_field[0][0][1];
407+
optr2->sr2 = h_eo_spinor_field[0][1][0];
408+
optr2->sr3 = h_eo_spinor_field[0][1][1];
409+
410+
optr2->prop0 = h_eo_spinor_field[1][0][0];
411+
optr2->prop1 = h_eo_spinor_field[1][0][1];
412+
optr2->prop2 = h_eo_spinor_field[1][1][0];
413+
optr2->prop3 = h_eo_spinor_field[1][1][1];
414+
415+
// inverting the Dirac operators for the light and heavy doublet
416+
// op_id = i1 or i2, index_start = 0, write_prop = 0
417+
optr1->inverter(i1, 0, 0);
418+
optr2->inverter(i2, 0, 0);
419+
420+
// conclude the change of basis for the heavy doublet
421+
for (size_t i_eo = 0; i_eo < 2; i_eo++) {
422+
for (size_t i_f = 0; i_f < 2; i_f++) {
423+
// (u,d) --> [(1+i*tau_2)/sqrt(2)] * (u,d) , stored at temporarely in the propagator spinors (used as dummy spinors)
424+
mul_one_pm_itau2(h_eo_spinor_field[1][i_eo][i_f], h_eo_spinor_field[1][i_eo][i_f+1],
425+
h_eo_spinor_field[0][i_eo][i_f], h_eo_spinor_field[0][i_eo][i_f+1], -1.0, VOLUME / 2);
426+
// assigning the result to the first components (the sources).
427+
// The propagators will be overwritten with the inversion
428+
assign(h_eo_spinor_field[0][i_eo][i_f], h_eo_spinor_field[1][i_eo][i_f], VOLUME / 2);
429+
}
430+
}
431+
432+
// now we switch from even-odd representation to standard
433+
// propagator, 2 flavors : psi = psi[f][x][alpha][c]
434+
spinor ***l_propagator = (spinor ****)malloc(2 * VOLUME);
435+
spinor ***h_propagator = (spinor ****)malloc(2 * VOLUME);
436+
for (size_t i_f = 0; i_f < 2; i_f++) {
437+
convert_eo_to_lexic(l_propagator[i_f], l_spinor_field[1][0][i_f], l_spinor_field[1][1][i_f]);
438+
convert_eo_to_lexic(h_propagator[i_f], h_spinor_field[1][0][i_f], h_spinor_field[1][1][i_f]);
439+
}
440+
441+
/*
442+
Now that I have all the propagators (all in the basis of
443+
https://arxiv.org/pdf/1005.2042.pdf) I can build the correlators of eq. 20
444+
*/
445+
446+
spinor phi; // dummy spinor
447+
448+
// light-light
449+
450+
int i, j, t, tt, t0; // dummy indices
451+
double *Cpp = NULL; // array of the values of the correlator C(t)
452+
double res = 0.; // result of the accumulation of MPI partial sums
453+
float tmp; // dummy variable
454+
#ifdef TM_USE_MPI
455+
double mpi_res = 0., mpi_respa = 0., mpi_resp4 = 0.;
456+
// send buffer for MPI_Gather
457+
double *sCpp = NULL; //, *sCpa = NULL, *sCp4 = NULL;
458+
#endif
459+
FILE *ofs; // output file stream
460+
char filename[TM_OMEAS_FILENAME_LENGTH]; // file path
348461
#ifdef TM_USE_MPI
349462
sCpp = (double *)calloc(T, sizeof(double));
350463
// sCpa = (double*) calloc(T, sizeof(double));
@@ -357,46 +470,13 @@ void heavy_quarks_correlators_measurement(const int traj, const int t0, const in
357470
#else
358471
Cpp = (double *)calloc(T, sizeof(double));
359472
// Cpa = (double*) calloc(T, sizeof(double));
360-
// Cp4 = (double*) calloc(T, sizeof(double));
361-
#endif
362-
// /// ??? what to use here
363-
// source_generation_pion_only(g_spinor_field[0], g_spinor_field[1], t0, sample, traj,
364-
// measurement_list[id].seed);
365-
// initialize the random sources
366-
for (size_t srd_d = 0; srd_d < 2; srd_d++) {
367-
full_source_spinor_field_spin_diluted_oet_ts(g_bispinor_field[i1][src_d], t0, src_d, sample, traj,
368-
measurement_list[id].seed);
369-
}
473+
// Cp4 = (double*) calloc(T, sizeof(double));// INIT SOME SPINOR FIELD FOR THE LIGHT
370474

371-
// ??? not sure how to use g_bispinor
372-
spinor *up_spinors = &g_bispinor_field[i1][0][0];
373-
spinor *down_spinors = &g_bispinor_field[0][1];
374-
// sources
375-
optr1->sr0 = g_bispinor_field[i1][0][0];
376-
optr1->sr1 = g_bispinor_field[i1][0][1];
377-
optr1->sr2 = down_spinors[0];
378-
optr1->sr3 = down_spinors[1];
379-
// propagators, i.e. D^{-1}*eta (eta = stochastic vector for the inversion)
380-
optr1->prop0 = g_bispinor_field[i1][0][2];
381-
optr1->prop1 = g_bispinor_field[i1][0][3];
382-
optr1->prop2 = down_spinors[2];
383-
optr1->prop3 = down_spinors[3];
384-
385-
// even-odd sites for the down
386-
// sources
387-
optr1->sr2 = g_bispinor_field[1][0];
388-
optr1->sr3 = g_bispinor_field[1][1];
389-
// propagators, i.e. D^{-1}*eta (eta = stochastic vector for the inversion)
390-
optr1->prop2 = g_bispinor_field[1][2];
391-
optr1->prop3 = g_bispinor_field[1][3];
475+
#endif
392476

393-
// op_id = 0, index_start = 0, write_prop = 0
394-
optr1->inverter(i1, 0, 0);
477+
// heavy-light
395478

396-
/* now we bring it to normal format */
397-
/* here we use implicitly DUM_MATRIX and DUM_MATRIX+1 */
398-
convert_eo_to_lexic(down_spinors[DUM_MATRIX], down_spinors[2], down_spinors[3]);
399-
convert_eo_to_lexic(down_spinors[DUM_MATRIX], down_spinors[2], down_spinors[3]);
479+
400480

401481
/* now we sum only over local space for every t */
402482
for (t = 0; t < T; t++) {

0 commit comments

Comments
 (0)