forked from marcuspetschlies/cvc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprepare_propagator.c
More file actions
166 lines (139 loc) · 5.45 KB
/
prepare_propagator.c
File metadata and controls
166 lines (139 loc) · 5.45 KB
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
/************************************************
* prepare_propagator.c
*
* Wed Feb 5 16:32:16 EET 2014
*
* PURPOSE:
* - build propagator points
************************************************/
namespace cvc {
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <getopt.h>
#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"
#include "read_input_parser.h"
#include "ranlxd.h"
#include "smearing_techniques.h"
#include "fuzz.h"
#ifndef _NON_ZERO
# define _NON_ZERO (5.e-14)
#endif
/************************************************************
* prepare_seqprop_point_from_stochastic_oneend
* prepare propagator point from stochastic propagators
* output --- fp_out
* input --- phi (stochastic, up), chi (stochastic, dn), prop (point source propagator),
* idsource, idsink (gamma matrix id at source and sink),
* ncol number of colors for the stochastic propagator
* momontum (sink momentum $\kvec_f$)
* N - number of sites
* - NOTE that n_s = 4, n_c must be 3
************************************************************/
int prepare_seqprop_point_from_stochastic_oneend (double**fp_out, double **phi, double **chi,
double **prop, const int idsource, int idsink, int ncol, double*phase_field, unsigned int N) {
int n_s = 4;
int n_c = 3; // number of colors for the point propagator
int psource[4], isimag, mu, c, ia, iprop;
unsigned int ix;
double ssource[4], spinor1[24], spinor2[24];
complex w, w1, w2, ctmp;
psource[0] = gamma_permutation[idsource][ 0] / 6;
psource[1] = gamma_permutation[idsource][ 6] / 6;
psource[2] = gamma_permutation[idsource][12] / 6;
psource[3] = gamma_permutation[idsource][18] / 6;
isimag = gamma_permutation[idsource][ 0] % 2;
/* sign from the source gamma matrix; the minus sign
* in the lower two lines is the action of gamma_5 */
ssource[0] = gamma_sign[idsource][ 0] * gamma_sign[5][gamma_permutation[idsource][ 0]];
ssource[1] = gamma_sign[idsource][ 6] * gamma_sign[5][gamma_permutation[idsource][ 6]];
ssource[2] = gamma_sign[idsource][12] * gamma_sign[5][gamma_permutation[idsource][12]];
ssource[3] = gamma_sign[idsource][18] * gamma_sign[5][gamma_permutation[idsource][18]];
for(iprop=0; iprop<n_s*n_c; iprop++) { // loop on spinor index of point source propagator
for(mu=0; mu<4; mu++) { // loop on spinor index of stochastic propagators
for(c=0; c<ncol; c++) { // loop on color index of stochastic propagators
// chi[psource[mu]]^dagger x exp(i k_f z_f) g5 x g_sink x prop[iprop]
ctmp.re = 0.;
ctmp.im = 0.;
for(ix=0; ix<N; ix++) {
_fv_eq_gamma_ti_fv(spinor1, idsink, prop[iprop]+_GSI(ix));
_fv_eq_gamma_ti_fv(spinor2, 5, spinor1);
_co_eq_fv_dag_ti_fv(&w, chi[psource[mu]*ncol+c]+_GSI(ix), spinor2);
w1.re = sin(phase_field[ix]);
w1.im = cos(phase_field[ix]);
_co_eq_co_ti_co(&w2, &w, &w1);
ctmp.re += w2.re;
ctmp.im += w2.im;
}
for(ix=0; ix<N; ix++) {
for(ia=0; ia<n_c*n_s; ia++) {
w.re = phi[mu*n_c+c][_GSI(ix) + 2*ia ];
w.im = phi[mu*n_c+c][_GSI(ix) + 2*ia+1];
_co_eq_co_ti_co(&w1, &w, &ctmp);
if( !isimag ) {
fp_out[iprop][_GSI(ix) + 2*ia ] += ssource[mu] * w1.re;
fp_out[iprop][_GSI(ix) + 2*ia+1] += ssource[mu] * w1.im;
} else {
fp_out[iprop][_GSI(ix) + 2*ia ] += -ssource[mu] * w1.im;
fp_out[iprop][_GSI(ix) + 2*ia+1] += ssource[mu] * w1.re;
}
}
} // of loop on ix
} // of loop on colors for stochastic propagator
} // of loop on spin for stochastic propagator
} // of loop on iprop
return(0);
} // end of prepare_seqprop_point_from_stochastic_oneend
/************************************************************
* prepare_prop_point_from_stochastic
* prepare propagator point from stochastic sources
* and propagators
* - fp_out = phi chi^dagger
* - phi - propagator
* - chi - source
* - NOTE this is without spin or color dilution
************************************************************/
int prepare_prop_point_from_stochastic (double**fp_out, double*phi, double*chi,
double**prop, int idsink, double*phase_field, unsigned int N) {
int n_s = 4;
int n_c = 3;
int ia, iprop;
unsigned int ix;
double spinor1[24];
complex w, w1, w2, ctmp;
for(iprop=0; iprop<12; iprop++) {
// chi[psource[mu]]^dagger x exp(i k_f z_f) g5 x g_sink x prop[iprop]
ctmp.re = 0.;
ctmp.im = 0.;
for(ix=0; ix<N; ix++) {
_fv_eq_gamma_ti_fv(spinor1, idsink, prop[iprop]+_GSI(ix));
_co_eq_fv_dag_ti_fv(&w, chi+_GSI(ix), spinor1);
w1.re = sin(phase_field[ix]);
w1.im = cos(phase_field[ix]);
_co_eq_co_ti_co(&w2, &w, &w1);
ctmp.re += w2.re;
ctmp.im += w2.im;
}
for(ix=0; ix<N; ix++) {
for(ia=0; ia<n_s*n_c; ia++) {
w.re = phi[_GSI(ix) + 2*ia ];
w.im = phi[_GSI(ix) + 2*ia+1];
_co_eq_co_ti_co(&w1, &w, &ctmp);
fp_out[iprop][2*ia ] += w1.re;
fp_out[iprop][2*ia+1] += w1.im;
}
} // of loop on sites
} // of loop on iprop
return(0);
} // end of prepare_prop_point_from_stochastic
}