-
Notifications
You must be signed in to change notification settings - Fork 4
/
avc_disc_hpe7.c
594 lines (519 loc) · 17.9 KB
/
avc_disc_hpe7.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
/****************************************************
* avc_disc_hpe7.c
*
* Wed Nov 18 11:02:41 CET 2009
*
* TODO:
* DONE:
* CHANGES:
****************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <time.h>
#ifdef MPI
# include <mpi.h>
#endif
#include "ifftw.h"
#include <getopt.h>
#define MAIN_PROGRAM
#include "cvc_complex.h"
#include "cvc_linalg.h"
#include "global.h"
#include "cvc_geometry.h"
#include "cvc_utils.h"
#include "mpi_init.h"
#include "io.h"
#include "propagator_io.h"
#include "Q_phi.h"
void usage() {
fprintf(stdout, "Code to perform quark-disconnected conserved vector current contractions\n");
fprintf(stdout, "Usage: [options]\n");
fprintf(stdout, "Options: -v verbose\n");
fprintf(stdout, " -g apply a random gauge transformation\n");
fprintf(stdout, " -f input filename [default cvc.input]\n");
#ifdef MPI
MPI_Abort(MPI_COMM_WORLD, 1);
MPI_Finalize();
#endif
exit(0);
}
int main(int argc, char **argv) {
int c, i, mu, nu;
int count = 0;
int filename_set = 0;
int dims[4] = {0,0,0,0};
int l_LX_at, l_LXstart_at;
int x0, x1, x2, x3, ix, iix;
int dxm[4], dxn[4], ixpm, ixpn;
int sid, steps[4];
double *disc = (double*)NULL;
double *work = (double*)NULL;
double q[4], fnorm;
int verbose = 0;
int do_gt = 0;
char filename[100];
double ratime, retime;
double plaq, _2kappamu, hpe3_coeff, onepmutilde2, mutilde2;
double spinor1[24], spinor2[24], spinor3[24], U_[18], U1_[18], U2_[18];
double *gauge_trafo=(double*)NULL;
complex w, w1, w2, *cp1, *cp2, *cp3;
FILE *ofs;
fftw_complex *in=(fftw_complex*)NULL;
#ifdef MPI
fftwnd_mpi_plan plan_p, plan_m;
int *status;
#else
fftwnd_plan plan_p, plan_m;
#endif
#ifdef MPI
MPI_Init(&argc, &argv);
#endif
while ((c = getopt(argc, argv, "h?vgf:")) != -1) {
switch (c) {
case 'v':
verbose = 1;
break;
case 'g':
do_gt = 1;
break;
case 'f':
strcpy(filename, optarg);
filename_set=1;
break;
case 'h':
case '?':
default:
usage();
break;
}
}
/* set the default values */
set_default_input_values();
if(filename_set==0) strcpy(filename, "cvc.input");
/* read the input file */
read_input(filename);
/* some checks on the input data */
if((T_global == 0) || (LX==0) || (LY==0) || (LZ==0)) {
if(g_proc_id==0) fprintf(stdout, "T and L's must be set\n");
usage();
}
if(g_kappa == 0.) {
if(g_proc_id==0) fprintf(stdout, "kappa should be > 0.n");
usage();
}
/* initialize MPI parameters */
mpi_init(argc, argv);
#ifdef MPI
if((status = (int*)calloc(g_nproc, sizeof(int))) == (int*)NULL) {
MPI_Abort(MPI_COMM_WORLD, 1);
MPI_Finalize();
exit(7);
}
#endif
/* initialize fftw */
dims[0]=T_global; dims[1]=LX; dims[2]=LY; dims[3]=LZ;
#ifdef MPI
plan_p = fftwnd_mpi_create_plan(g_cart_grid, 4, dims, FFTW_BACKWARD, FFTW_MEASURE);
plan_m = fftwnd_mpi_create_plan(g_cart_grid, 4, dims, FFTW_FORWARD, FFTW_MEASURE);
fftwnd_mpi_local_sizes(plan_p, &T, &Tstart, &l_LX_at, &l_LXstart_at, &FFTW_LOC_VOLUME);
#else
plan_p = fftwnd_create_plan(4, dims, FFTW_BACKWARD, FFTW_MEASURE | FFTW_IN_PLACE);
plan_m = fftwnd_create_plan(4, dims, FFTW_FORWARD, FFTW_MEASURE | FFTW_IN_PLACE);
T = T_global;
Tstart = 0;
l_LX_at = LX;
l_LXstart_at = 0;
FFTW_LOC_VOLUME = T*LX*LY*LZ;
#endif
fprintf(stdout, "# [%2d] fftw parameters:\n"\
"# [%2d] T = %3d\n"\
"# [%2d] Tstart = %3d\n"\
"# [%2d] l_LX_at = %3d\n"\
"# [%2d] l_LXstart_at = %3d\n"\
"# [%2d] FFTW_LOC_VOLUME = %3d\n",
g_cart_id, g_cart_id, T, g_cart_id, Tstart, g_cart_id, l_LX_at,
g_cart_id, l_LXstart_at, g_cart_id, FFTW_LOC_VOLUME);
#ifdef MPI
if(T==0) {
fprintf(stderr, "[%2d] local T is zero; exit\n", g_cart_id);
MPI_Abort(MPI_COMM_WORLD, 1);
MPI_Finalize();
exit(2);
}
#endif
if(init_geometry() != 0) {
fprintf(stderr, "ERROR from init_geometry\n");
#ifdef MPI
MPI_Abort(MPI_COMM_WORLD, 1);
MPI_Finalize();
#endif
exit(1);
}
geometry();
/* read the gauge field */
alloc_gauge_field(&g_gauge_field, VOLUMEPLUSRAND);
sprintf(filename, "%s.%.4d", gaugefilename_prefix, Nconf);
if(g_cart_id==0) fprintf(stdout, "reading gauge field from file %s\n", filename);
read_lime_gauge_field_doubleprec(filename);
#ifdef MPI
xchange_gauge();
#endif
/* measure the plaquette */
plaquette(&plaq);
if(g_cart_id==0) fprintf(stdout, "measured plaquette value: %25.16e\n", plaq);
if(do_gt==1) {
/***********************************
* initialize gauge transformation
***********************************/
init_gauge_trafo(&gauge_trafo, 1.);
apply_gt_gauge(gauge_trafo);
plaquette(&plaq);
if(g_cart_id==0) fprintf(stdout, "measured plaquette value after gauge trafo: %25.16e\n", plaq);
}
/****************************************
* allocate memory for the spinor fields
****************************************/
no_fields = 3;
g_spinor_field = (double**)calloc(no_fields, sizeof(double*));
for(i=0; i<no_fields; i++) alloc_spinor_field(&g_spinor_field[i], VOLUMEPLUSRAND);
/****************************************
* allocate memory for the contractions
****************************************/
disc = (double*)calloc( 8*VOLUME, sizeof(double));
if( disc == (double*)NULL ) {
fprintf(stderr, "could not allocate memory for disc\n");
# ifdef MPI
MPI_Abort(MPI_COMM_WORLD, 1);
MPI_Finalize();
# endif
exit(3);
}
for(ix=0; ix<8*VOLUME; ix++) disc[ix] = 0.;
work = (double*)calloc(48*VOLUME, sizeof(double));
if( work == (double*)NULL ) {
fprintf(stderr, "could not allocate memory for work\n");
# ifdef MPI
MPI_Abort(MPI_COMM_WORLD, 1);
MPI_Finalize();
# endif
exit(3);
}
/****************************************
* prepare Fourier transformation arrays
****************************************/
in = (fftw_complex*)malloc(FFTW_LOC_VOLUME*sizeof(fftw_complex));
if(in==(fftw_complex*)NULL) {
#ifdef MPI
MPI_Abort(MPI_COMM_WORLD, 1);
MPI_Finalize();
#endif
exit(4);
}
/************************************************
* HPE: calculate coeff. of 3rd order term
************************************************/
_2kappamu = 2. * g_kappa * g_mu;
onepmutilde2 = 1. + _2kappamu * _2kappamu;
mutilde2 = _2kappamu * _2kappamu;
hpe3_coeff = 16. * g_kappa*g_kappa*g_kappa*g_kappa * (1. + 6. * mutilde2 + mutilde2*mutilde2) / onepmutilde2 / onepmutilde2 / onepmutilde2 / onepmutilde2;
/*
hpe3_coeff = 8. * g_kappa*g_kappa*g_kappa * \
(1. + 6.*_2kappamu*_2kappamu + _2kappamu*_2kappamu*_2kappamu*_2kappamu) / (1. + _2kappamu*_2kappamu) / (1. + _2kappamu*_2kappamu) / (1. + _2kappamu*_2kappamu) / (1. + _2kappamu*_2kappamu);
*/
fprintf(stdout, "hpe3_coeff = %25.16e\n", hpe3_coeff);
/************************************************
* HPE: calculate the 3rd order plaquette terms
************************************************/
for(ix=0; ix<VOLUME; ix++) {
for(mu=0; mu<4; mu++) {
for(i=1; i<4; i++) {
nu = (mu+i)%4;
_cm_eq_cm_ti_cm(U1_, g_gauge_field+_GGI(ix,mu), g_gauge_field+_GGI(g_iup[ix][mu],nu) );
_cm_eq_cm_ti_cm(U2_, g_gauge_field+_GGI(ix,nu), g_gauge_field+_GGI(g_iup[ix][nu],mu) );
_cm_eq_cm_ti_cm_dag(U_, U1_, U2_);
_co_eq_tr_cm(&w1, U_);
iix = g_idn[ix][nu];
_cm_eq_cm_ti_cm(U1_, g_gauge_field+_GGI(iix,mu), g_gauge_field+_GGI(g_iup[iix][mu],nu) );
_cm_eq_cm_ti_cm(U2_, g_gauge_field+_GGI(iix,nu), g_gauge_field+_GGI(g_iup[iix][nu],mu) );
_cm_eq_cm_ti_cm_dag(U_, U1_, U2_);
_co_eq_tr_cm(&w2, U_);
disc[_GWI(mu,ix,VOLUME)+1] += hpe3_coeff * (w1.im - w2.im);
/*
_cm_eq_cm_ti_cm(U1_, g_gauge_field+_GGI(g_idn[ix][nu],nu), g_gauge_field+_GGI(ix,mu) );
_cm_eq_cm_ti_cm(U2_, g_gauge_field+_GGI(g_idn[ix][nu],mu), g_gauge_field+_GGI(g_iup[g_idn[ix][nu]][mu], nu) );
_cm_eq_cm_ti_cm_dag(U_, U1_, U2_);
_co_eq_tr_cm(&w2, U_);
disc[_GWI(mu,ix,VOLUME)+1] += hpe3_coeff * (w1.im + w2.im);
*/
/* fprintf(stdout, "mu=%1d, ix=%5d, nu=%1d, w1=%25.16e +i %25.16e; w2=%25.16e +i %25.16e\n",
mu, ix, nu, w1.re, w1.im, w2.re, w2.im); */
} /* of nu */
/****************************************
* - in case lattice size equals 4
* calculate additional loop term
* - _NOTE_ the possible minus sign from
* the fermionic boundary conditions
****************************************/
if(dims[mu]==4) {
wilson_loop(&w, ix, mu, dims[mu]);
fnorm = -64. * g_kappa*g_kappa*g_kappa*g_kappa / onepmutilde2 / onepmutilde2 / onepmutilde2 / onepmutilde2;
disc[_GWI(mu,ix,VOLUME)+1] += fnorm * w.im;
/* fprintf(stdout, "loop contribution: ix=%5d, mu=%2d, fnorm=%25.16e, w=%25.16e\n", ix, mu, fnorm, w.im); */
}
/*
fprintf(stdout, "-------------------------------------------\n");
fprintf(stdout, "disc[ix=%d,mu=%d] = %25.16e +i %25.16e\n", ix, mu, disc[_GWI(mu,ix,VOLUME)], disc[_GWI(mu,ix,VOLUME)+1]);
fprintf(stdout, "-------------------------------------------\n");
*/
}
}
/*
sprintf(filename, "hpe7_3rd.%.4d", Nconf);
ofs = fopen(filename, "w");
for(ix=0; ix<VOLUME; ix++) {
for(mu=0; mu<4; mu++) {
fprintf(ofs, "%6d%3d%25.16e\t%25.16e\n", ix, mu, disc[_GWI(mu,ix,VOLUME)], \
disc[_GWI(mu,ix,VOLUME)+1]);
}
}
fclose(ofs);
for(ix=0; ix<8*VOLUME; ix++) disc[ix] = 0.;
*/
/*******************************************************************
* HPE: calculate the 5th order term
*******************************************************************/
#ifdef MPI
ratime = MPI_Wtime();
#else
ratime = (double)clock() / CLOCKS_PER_SEC;
#endif
steps[0]=0; steps[1]=0; steps[2]=0; steps[3]=0;
for(ix=0; ix<VOLUME; ix++) {
for(sid=0; sid<12; sid++) {
_fv_eq_zero(spinor3);
spinor3[2*sid] = 1.;
for(mu=0; mu<4; mu++) {
_cm_eq_cm_ti_co(U_, g_gauge_field+_GGI(ix,mu), &co_phase_up[mu]);
/* fprintf(stdout, "calling Hopping_rec for forward ix=%d; mu = %d\n", ix, mu); */
steps[mu]++;
Hopping_rec(spinor1, spinor3, g_iup[ix][mu], ix, 1, 5, steps);
steps[mu]--;
_fv_eq_gamma_ti_fv(spinor2, mu, spinor1);
_fv_mi_eq_fv(spinor2, spinor1);
_fv_eq_cm_ti_fv(spinor1, U_, spinor2);
disc[_GWI(mu,ix,VOLUME) ] -= g_kappa * spinor1[2*sid ];
disc[_GWI(mu,ix,VOLUME)+1] -= g_kappa * spinor1[2*sid+1];
/* fprintf(stdout, "calling Hopping_rec for backward ix=%d; mu = %d\n", ix, mu); */
steps[mu]--;
Hopping_rec(spinor1, spinor3, ix, g_iup[ix][mu], 1, 5, steps);
steps[mu]++;
_fv_eq_gamma_ti_fv(spinor2, mu, spinor1);
_fv_pl_eq_fv(spinor2, spinor1);
_fv_eq_cm_dag_ti_fv(spinor1, U_, spinor2);
disc[_GWI(mu,ix,VOLUME) ] -= g_kappa * spinor1[2*sid ];
disc[_GWI(mu,ix,VOLUME)+1] -= g_kappa * spinor1[2*sid+1];
}
} /* of sid */
} /* of ix */
#ifdef MPI
retime = MPI_Wtime();
#else
retime = (double)clock() / CLOCKS_PER_SEC;
#endif
if(g_cart_id==0) fprintf(stdout, "time to calculate 5th order contribution: %e seconds\n", retime-ratime);
sprintf(filename, "avc_disc_hpe7_35th.%.4d", Nconf);
ofs = fopen(filename, "w");
for(ix=0; ix<VOLUME; ix++) {
for(mu=0; mu<4; mu++) {
fprintf(ofs, "%6d%3d%25.16e\t%25.16e\n", ix, mu, disc[_GWI(mu,ix,VOLUME)], \
disc[_GWI(mu,ix,VOLUME)+1]);
}
}
fclose(ofs);
/*
for(ix=0; ix<8*VOLUME; ix++) disc[ix] = 0.;
*/
/***********************************************
* From here: everything as before except for
* the change BH5 --> BH7
*
* start loop on source id.s
***********************************************/
for(sid=g_sourceid; sid<=g_sourceid2; sid++) {
/* read the new propagator */
#ifdef MPI
ratime = MPI_Wtime();
#else
ratime = (double)clock() / CLOCKS_PER_SEC;
#endif
if(format==0) {
sprintf(filename, "%s.%.4d.%.2d.inverted", filename_prefix, Nconf, sid);
if(read_lime_spinor(g_spinor_field[2], filename, 0) != 0) break;
}
else if(format==1) {
sprintf(filename, "%s.%.4d.%.5d.inverted", filename_prefix, Nconf, sid);
if(read_cmi(g_spinor_field[2], filename) != 0) break;
}
xchange_field(g_spinor_field[2]);
#ifdef MPI
retime = MPI_Wtime();
#else
retime = (double)clock() / CLOCKS_PER_SEC;
#endif
fprintf(stdout, "time to read prop.: %e seconds\n", retime-ratime);
if(do_gt==1) {
/******************************************
* gauge transform the propagators for sid
******************************************/
for(ix=0; ix<VOLUME; ix++) {
_fv_eq_cm_ti_fv(spinor1, gauge_trafo+18*ix, g_spinor_field[2]+_GSI(ix));
_fv_eq_fv(g_spinor_field[2]+_GSI(ix), spinor1);
}
xchange_field(g_spinor_field[2]);
}
count++;
/************************************************
* calculate the source: apply Q_phi_tbc
************************************************/
#ifdef MPI
ratime = MPI_Wtime();
#else
ratime = (double)clock() / CLOCKS_PER_SEC;
#endif
Q_phi_tbc(g_spinor_field[0], g_spinor_field[2]);
xchange_field(g_spinor_field[0]);
#ifdef MPI
retime = MPI_Wtime();
#else
retime = (double)clock() / CLOCKS_PER_SEC;
#endif
if(g_cart_id==0) fprintf(stdout, "time to calculate source: %e seconds\n", retime-ratime);
/************************************************
* HPE: apply BH7
************************************************/
BH7(g_spinor_field[1], g_spinor_field[2]);
/* add new contractions to (existing) disc */
# ifdef MPI
ratime = MPI_Wtime();
# else
ratime = (double)clock() / CLOCKS_PER_SEC;
# endif
for(mu=0; mu<4; mu++) { /* loop on Lorentz index of the current */
iix = _GWI(mu,0,VOLUME);
for(ix=0; ix<VOLUME; ix++) { /* loop on lattice sites */
_cm_eq_cm_ti_co(U_, &g_gauge_field[_GGI(ix, mu)], &co_phase_up[mu]);
/* first contribution */
_fv_eq_cm_ti_fv(spinor1, U_, &g_spinor_field[1][_GSI(g_iup[ix][mu])]);
_fv_eq_gamma_ti_fv(spinor2, mu, spinor1);
_fv_mi_eq_fv(spinor2, spinor1);
_co_eq_fv_dag_ti_fv(&w, &g_spinor_field[0][_GSI(ix)], spinor2);
disc[iix ] -= 0.5 * w.re;
disc[iix+1] -= 0.5 * w.im;
/* second contribution */
_fv_eq_cm_dag_ti_fv(spinor1, U_, &g_spinor_field[1][_GSI(ix)]);
_fv_eq_gamma_ti_fv(spinor2, mu, spinor1);
_fv_pl_eq_fv(spinor2, spinor1);
_co_eq_fv_dag_ti_fv(&w, &g_spinor_field[0][_GSI(g_iup[ix][mu])], spinor2);
disc[iix ] -= 0.5 * w.re;
disc[iix+1] -= 0.5 * w.im;
iix += 2;
} /* of ix */
} /* of mu */
#ifdef MPI
retime = MPI_Wtime();
#else
retime = (double)clock() / CLOCKS_PER_SEC;
#endif
if(g_cart_id==0) fprintf(stdout, "[%2d] time to contract cvc: %e seconds\n", g_cart_id, retime-ratime);
/************************************************
* save results for count = multiple of Nsave
************************************************/
if(count%Nsave == 0) {
if(g_cart_id == 0) fprintf(stdout, "save results for count = %d\n", count);
/* save the result in position space */
sprintf(filename, "cvc_hpe7_X.%.4d.%.4d", Nconf, count);
write_contraction(disc, NULL, filename, 4, 2, 0);
#ifdef MPI
ratime = MPI_Wtime();
#else
ratime = (double)clock() / CLOCKS_PER_SEC;
#endif
/* Fourier transform data, copy to work */
for(mu=0; mu<4; mu++) {
memcpy((void*)in, (void*)(disc+_GWI(mu,0,VOLUME)), 2*VOLUME*sizeof(double));
#ifdef MPI
fftwnd_mpi(plan_m, 1, in, NULL, FFTW_NORMAL_ORDER);
#else
fftwnd_one(plan_m, in, NULL);
#endif
memcpy((void*)(work+_GWI(4+mu,0,VOLUME)), (void*)in, 2*VOLUME*sizeof(double));
memcpy((void*)in, (void*)(disc+_GWI(mu,0,VOLUME)), 2*VOLUME*sizeof(double));
#ifdef MPI
fftwnd_mpi(plan_p, 1, in, NULL, FFTW_NORMAL_ORDER);
#else
fftwnd_one(plan_p, in, NULL);
#endif
memcpy((void*)(work+_GWI(mu,0,VOLUME)), (void*)in, 2*VOLUME*sizeof(double));
} /* of mu =0 ,..., 3*/
fnorm = 1. / ((double)(T_global*LX*LY*LZ) * (double)(count*count));
fprintf(stdout, "fnorm = %e\n", fnorm);
for(mu=0; mu<4; mu++) {
for(nu=0; nu<4; nu++) {
cp1 = (complex*)(work+_GWI(mu,0,VOLUME));
cp2 = (complex*)(work+_GWI(4+nu,0,VOLUME));
cp3 = (complex*)(work+_GWI(8+4*mu+nu,0,VOLUME));
for(x0=0; x0<T; x0++) {
q[0] = (double)(x0+Tstart) / (double)T_global;
for(x1=0; x1<LX; x1++) {
q[1] = (double)(x1) / (double)LX;
for(x2=0; x2<LY; x2++) {
q[2] = (double)(x2) / (double)LY;
for(x3=0; x3<LZ; x3++) {
q[3] = (double)(x3) / (double)LZ;
ix = g_ipt[x0][x1][x2][x3];
w.re = cos( M_PI * (q[mu]-q[nu]) );
w.im = sin( M_PI * (q[mu]-q[nu]) );
_co_eq_co_ti_co(&w1, cp1, cp2);
_co_eq_co_ti_co(cp3, &w1, &w);
_co_ti_eq_re(cp3, fnorm);
cp1++; cp2++; cp3++;
}
}
}
}
}
}
/* save the result in momentum space */
sprintf(filename, "cvc_hpe7_P.%.4d.%.4d", Nconf, count);
write_contraction(work+_GWI(8,0,VOLUME), NULL, filename, 16, 2, 0);
#ifdef MPI
retime = MPI_Wtime();
#else
retime = (double)clock() / CLOCKS_PER_SEC;
#endif
if(g_cart_id==0) fprintf(stdout, "time to save cvc results: %e seconds\n", retime-ratime);
} /* of count % Nsave == 0 */
} /* of loop on sid */
/***********************************************
* free the allocated memory, finalize
***********************************************/
free(g_gauge_field);
for(i=0; i<no_fields; i++) free(g_spinor_field[i]);
free(g_spinor_field);
free_geometry();
fftw_free(in);
free(disc);
free(work);
#ifdef MPI
fftwnd_mpi_destroy_plan(plan_p);
fftwnd_mpi_destroy_plan(plan_m);
free(status);
MPI_Finalize();
#else
fftwnd_destroy_plan(plan_p);
fftwnd_destroy_plan(plan_m);
#endif
return(0);
}