-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathderiv_Sb.c
More file actions
298 lines (247 loc) · 8.31 KB
/
deriv_Sb.c
File metadata and controls
298 lines (247 loc) · 8.31 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
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
/***********************************************************************
*
* Copyright (C) 2001 Martin Hasenbusch
*
* some changes to initial version by Carsten Urbach
*
* BG version Copyright (C) 2006, 2007 Carsten Urbach
*
* This file is part of tmLQCD.
*
* tmLQCD is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* tmLQCD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with tmLQCD. If not, see <http://www.gnu.org/licenses/>.
*
* deriv_Sb: function to compute the derivative
* of the phi^{\dag} Q psi with respect
* to the generators of the gauge group.
* without the clover part.
*
* Author: Martin Hasenbusch <Martin.Hasenbusch@desy.de>
* Date: Fri Oct 26 15:06:27 MEST 2001
*
* both l and k are input
* for ieo = 0
* l resides on even lattice points and k on odd lattice points
* for ieo = 1
* l resides on odd lattice points and k on even lattice points
* the output is a su3adj field that is written to df0[][]
*
************************************************************************/
#ifdef HAVE_CONFIG_H
#include <tmlqcd_config.h>
#endif
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "boundary.h"
#include "deriv_Sb.h"
#include "gettime.h"
#include "global.h"
#include "hamiltonian_field.h"
#include "su3.h"
#include "update_backward_gauge.h"
#include "xchange/xchange.h"
void deriv_Sb(const int ieo, spinor* const l, spinor* const k, hamiltonian_field_t* const hf,
const double factor) {
tm_stopwatch_push(&g_timers, __func__, "");
#ifdef _GAUGE_COPY
if (g_update_gauge_copy) {
update_backward_gauge(hf->gaugefield);
}
#endif
/* for parallelization */
#ifdef TM_USE_MPI
xchange_2fields(k, l, ieo);
#endif
#ifdef TM_USE_OMP
#define static
#pragma omp parallel
{
#endif
int ix, iy;
int ioff, icx, icy;
su3* restrict up ALIGN;
su3* restrict um ALIGN;
static su3 v1, v2;
static su3_vector psia, psib, phia, phib;
static spinor rr;
spinor* restrict sp ALIGN;
spinor* restrict sm ALIGN;
#ifdef TM_USE_OMP
#undef static
#endif
#ifdef _KOJAK_INST
#pragma pomp inst begin(derivSb)
#endif
if (ieo == 0) {
ioff = 0;
} else {
ioff = (VOLUME + RAND) / 2;
}
/************** loop over all lattice sites ****************/
#ifdef TM_USE_OMP
#pragma omp for
#endif
for (icx = ioff; icx < (VOLUME / 2 + ioff); icx++) {
ix = g_eo2lexic[icx];
rr = (*(l + (icx - ioff)));
/* rr=g_spinor_field[l][icx-ioff]; */
/*multiply the left vector with gamma5*/
_vector_minus_assign(rr.s2, rr.s2);
_vector_minus_assign(rr.s3, rr.s3);
/*********************** direction +0 ********************/
iy = g_iup[ix][0];
icy = g_lexic2eosub[iy];
sp = k + icy;
#if (defined _GAUGE_COPY && !defined _USE_HALFSPINOR)
up = &g_gauge_field_copy[icx][0];
#else
up = &hf->gaugefield[ix][0];
#endif
_vector_add(psia, sp->s0, sp->s2);
_vector_add(psib, sp->s1, sp->s3);
_vector_add(phia, rr.s0, rr.s2);
_vector_add(phib, rr.s1, rr.s3);
_vector_tensor_vector_add(v1, phia, psia, phib, psib);
_su3_times_su3d(v2, *up, v1);
_complex_times_su3(v1, ka0, v2);
_trace_lambda_mul_add_assign_nonlocal(hf->derivative[ix][0], 2. * factor, v1);
/************** direction -0 ****************************/
iy = g_idn[ix][0];
icy = g_lexic2eosub[iy];
sm = k + icy;
#if (defined _GAUGE_COPY && !defined _USE_HALFSPINOR)
um = up + 1;
#else
um = &hf->gaugefield[iy][0];
#endif
_vector_sub(psia, sm->s0, sm->s2);
_vector_sub(psib, sm->s1, sm->s3);
_vector_sub(phia, rr.s0, rr.s2);
_vector_sub(phib, rr.s1, rr.s3);
_vector_tensor_vector_add(v1, psia, phia, psib, phib);
_su3_times_su3d(v2, *um, v1);
_complex_times_su3(v1, ka0, v2);
_trace_lambda_mul_add_assign_nonlocal(hf->derivative[iy][0], 2. * factor, v1);
/*************** direction +1 **************************/
iy = g_iup[ix][1];
icy = g_lexic2eosub[iy];
sp = k + icy;
#if (defined _GAUGE_COPY && !defined _USE_HALFSPINOR)
up = um + 1;
#else
up = &hf->gaugefield[ix][1];
#endif
_vector_i_add(psia, sp->s0, sp->s3);
_vector_i_add(psib, sp->s1, sp->s2);
_vector_i_add(phia, rr.s0, rr.s3);
_vector_i_add(phib, rr.s1, rr.s2);
_vector_tensor_vector_add(v1, phia, psia, phib, psib);
_su3_times_su3d(v2, *up, v1);
_complex_times_su3(v1, ka1, v2);
_trace_lambda_mul_add_assign_nonlocal(hf->derivative[ix][1], 2. * factor, v1);
/**************** direction -1 *************************/
iy = g_idn[ix][1];
icy = g_lexic2eosub[iy];
sm = k + icy;
#if (defined _GAUGE_COPY && !defined _USE_HALFSPINOR)
um = up + 1;
#else
um = &hf->gaugefield[iy][1];
#endif
_vector_i_sub(psia, sm->s0, sm->s3);
_vector_i_sub(psib, sm->s1, sm->s2);
_vector_i_sub(phia, rr.s0, rr.s3);
_vector_i_sub(phib, rr.s1, rr.s2);
_vector_tensor_vector_add(v1, psia, phia, psib, phib);
_su3_times_su3d(v2, *um, v1);
_complex_times_su3(v1, ka1, v2);
_trace_lambda_mul_add_assign_nonlocal(hf->derivative[iy][1], 2. * factor, v1);
/*************** direction +2 **************************/
iy = g_iup[ix][2];
icy = g_lexic2eosub[iy];
sp = k + icy;
#if (defined _GAUGE_COPY && !defined _USE_HALFSPINOR)
up = um + 1;
#else
up = &hf->gaugefield[ix][2];
#endif
_vector_add(psia, sp->s0, sp->s3);
_vector_sub(psib, sp->s1, sp->s2);
_vector_add(phia, rr.s0, rr.s3);
_vector_sub(phib, rr.s1, rr.s2);
_vector_tensor_vector_add(v1, phia, psia, phib, psib);
_su3_times_su3d(v2, *up, v1);
_complex_times_su3(v1, ka2, v2);
_trace_lambda_mul_add_assign_nonlocal(hf->derivative[ix][2], 2. * factor, v1);
/***************** direction -2 ************************/
iy = g_idn[ix][2];
icy = g_lexic2eosub[iy];
sm = k + icy;
#if (defined _GAUGE_COPY && !defined _USE_HALFSPINOR)
um = up + 1;
#else
um = &hf->gaugefield[iy][2];
#endif
_vector_sub(psia, sm->s0, sm->s3);
_vector_add(psib, sm->s1, sm->s2);
_vector_sub(phia, rr.s0, rr.s3);
_vector_add(phib, rr.s1, rr.s2);
_vector_tensor_vector_add(v1, psia, phia, psib, phib);
_su3_times_su3d(v2, *um, v1);
_complex_times_su3(v1, ka2, v2);
_trace_lambda_mul_add_assign_nonlocal(hf->derivative[iy][2], 2. * factor, v1);
/****************** direction +3 ***********************/
iy = g_iup[ix][3];
icy = g_lexic2eosub[iy];
sp = k + icy;
#if (defined _GAUGE_COPY && !defined _USE_HALFSPINOR)
up = um + 1;
#else
up = &hf->gaugefield[ix][3];
#endif
_vector_i_add(psia, sp->s0, sp->s2);
_vector_i_sub(psib, sp->s1, sp->s3);
_vector_i_add(phia, rr.s0, rr.s2);
_vector_i_sub(phib, rr.s1, rr.s3);
_vector_tensor_vector_add(v1, phia, psia, phib, psib);
_su3_times_su3d(v2, *up, v1);
_complex_times_su3(v1, ka3, v2);
_trace_lambda_mul_add_assign_nonlocal(hf->derivative[ix][3], 2. * factor, v1);
/***************** direction -3 ************************/
iy = g_idn[ix][3];
icy = g_lexic2eosub[iy];
sm = k + icy;
#if (defined _GAUGE_COPY && !defined _USE_HALFSPINOR)
um = up + 1;
#else
um = &hf->gaugefield[iy][3];
#endif
_vector_i_sub(psia, sm->s0, sm->s2);
_vector_i_add(psib, sm->s1, sm->s3);
_vector_i_sub(phia, rr.s0, rr.s2);
_vector_i_add(phib, rr.s1, rr.s3);
_vector_tensor_vector_add(v1, psia, phia, psib, phib);
_su3_times_su3d(v2, *um, v1);
_complex_times_su3(v1, ka3, v2);
_trace_lambda_mul_add_assign_nonlocal(hf->derivative[iy][3], 2. * factor, v1);
/****************** end of loop ************************/
}
#ifdef TM_USE_OMP
} /* OpenMP closing brace */
#endif
tm_stopwatch_pop(&g_timers, 0, 1, "");
#ifdef _KOJAK_INST
#pragma pomp inst end(derivSb)
#endif
}