Skip to content

Commit 63419d6

Browse files
committed
forcefactor now applied on the level of deriv_Sb, deriv_Sb_D_psi and sw_all
1 parent 3e843d2 commit 63419d6

11 files changed

+111
-106
lines changed

cloverdet_monomial.c

+10-6
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,14 @@
5151
void cloverdet_derivative(const int id, hamiltonian_field_t * const hf) {
5252
monomial * mnl = &monomial_list[id];
5353

54-
/* This factor 2 a missing factor 2 in trace_lambda */
55-
(*mnl).forcefactor = 1.;
54+
for(int i = 0; i < VOLUME; i++) {
55+
for(int mu = 0; mu < 4; mu++) {
56+
_su3_zero(swm[i][mu]);
57+
_su3_zero(swp[i][mu]);
58+
}
59+
}
5660

57-
61+
(*mnl).forcefactor = 1.;
5862
/*********************************************************************
5963
*
6064
* even/odd version
@@ -92,13 +96,13 @@ void cloverdet_derivative(const int id, hamiltonian_field_t * const hf) {
9296
// to get the even sites of X_e
9397
H_eo_sw_inv_psi(g_spinor_field[DUM_DERI+2], g_spinor_field[DUM_DERI+1], EE, -mnl->mu);
9498
// \delta Q sandwitched by Y_o^\dagger and X_e
95-
deriv_Sb(OE, g_spinor_field[DUM_DERI], g_spinor_field[DUM_DERI+2], hf);
99+
deriv_Sb(OE, g_spinor_field[DUM_DERI], g_spinor_field[DUM_DERI+2], hf, mnl->forcefactor);
96100

97101
// to get the even sites of Y_e
98102
H_eo_sw_inv_psi(g_spinor_field[DUM_DERI+3], g_spinor_field[DUM_DERI], EE, mnl->mu);
99103
// \delta Q sandwitched by Y_e^\dagger and X_o
100104
// uses the gauge field in hf and changes the derivative fields in hf
101-
deriv_Sb(EO, g_spinor_field[DUM_DERI+3], g_spinor_field[DUM_DERI+1], hf);
105+
deriv_Sb(EO, g_spinor_field[DUM_DERI+3], g_spinor_field[DUM_DERI+1], hf, mnl->forcefactor);
102106

103107
// here comes the clover term...
104108
// computes the insertion matrices for S_eff
@@ -121,7 +125,7 @@ void cloverdet_derivative(const int id, hamiltonian_field_t * const hf) {
121125
// finally, using the insertion matrices stored in swm and swp
122126
// we compute the terms F^{det} and F^{sw} at once
123127
// uses the gaugefields in hf and changes the derivative field in hf
124-
sw_all(hf, mnl->kappa, mnl->c_sw);
128+
sw_all(hf, mnl->kappa*mnl->forcefactor, mnl->c_sw);
125129

126130
g_mu = g_mu1;
127131
g_mu3 = 0.;

cloverdetratio_monomial.c

+14-10
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include "linalg_eo.h"
3636
#include "linsolve.h"
3737
#include "deriv_Sb.h"
38-
#include "deriv_Sb_D_psi.h"
3938
#include "gamma.h"
4039
#include "tm_operators.h"
4140
#include "hybrid_update.h"
@@ -100,12 +99,12 @@ void cloverdetratio_derivative_orig(const int no, hamiltonian_field_t * const hf
10099
/* to get the even sites of X */
101100
H_eo_sw_inv_psi(g_spinor_field[DUM_DERI+2], g_spinor_field[DUM_DERI+1], EE, -mnl->mu);
102101
/* \delta Q sandwitched by Y_o^\dagger and X_e */
103-
deriv_Sb(OE, g_spinor_field[DUM_DERI], g_spinor_field[DUM_DERI+2], hf);
102+
deriv_Sb(OE, g_spinor_field[DUM_DERI], g_spinor_field[DUM_DERI+2], hf, mnl->forcefactor);
104103

105104
/* to get the even sites of Y */
106105
H_eo_sw_inv_psi(g_spinor_field[DUM_DERI+3], g_spinor_field[DUM_DERI], EE, mnl->mu);
107106
/* \delta Q sandwitched by Y_e^\dagger and X_o */
108-
deriv_Sb(EO, g_spinor_field[DUM_DERI+3], g_spinor_field[DUM_DERI+1], hf);
107+
deriv_Sb(EO, g_spinor_field[DUM_DERI+3], g_spinor_field[DUM_DERI+1], hf, mnl->forcefactor);
109108

110109
// here comes the clover term...
111110
// computes the insertion matrices for S_eff
@@ -128,12 +127,12 @@ void cloverdetratio_derivative_orig(const int no, hamiltonian_field_t * const hf
128127
/* to get the even sites of X */
129128
H_eo_sw_inv_psi(g_spinor_field[DUM_DERI+2], g_spinor_field[DUM_DERI+1], EE, -mnl->mu);
130129
/* \delta Q sandwitched by Y_o^\dagger and X_e */
131-
deriv_Sb(OE, g_spinor_field[DUM_DERI], g_spinor_field[DUM_DERI+2], hf);
130+
deriv_Sb(OE, g_spinor_field[DUM_DERI], g_spinor_field[DUM_DERI+2], hf, mnl->forcefactor);
132131

133132
/* to get the even sites of Y */
134133
H_eo_sw_inv_psi(g_spinor_field[DUM_DERI+3], g_spinor_field[DUM_DERI], EE, mnl->mu);
135134
/* \delta Q sandwitched by Y_e^\dagger and X_o */
136-
deriv_Sb(EO, g_spinor_field[DUM_DERI+3], g_spinor_field[DUM_DERI+1], hf);
135+
deriv_Sb(EO, g_spinor_field[DUM_DERI+3], g_spinor_field[DUM_DERI+1], hf, mnl->forcefactor);
137136

138137
// here comes the clover term...
139138
// computes the insertion matrices for S_eff
@@ -146,7 +145,7 @@ void cloverdetratio_derivative_orig(const int no, hamiltonian_field_t * const hf
146145
gamma5(g_spinor_field[DUM_DERI], g_spinor_field[DUM_DERI], VOLUME/2);
147146
sw_spinor(OE, g_spinor_field[DUM_DERI], g_spinor_field[DUM_DERI+1]);
148147

149-
sw_all(hf, mnl->kappa, mnl->c_sw);
148+
sw_all(hf, mnl->kappa*mnl->forcefactor, mnl->c_sw);
150149

151150
g_mu = g_mu1;
152151
g_mu3 = 0.;
@@ -159,7 +158,12 @@ void cloverdetratio_derivative_orig(const int no, hamiltonian_field_t * const hf
159158
void cloverdetratio_derivative(const int no, hamiltonian_field_t * const hf) {
160159
monomial * mnl = &monomial_list[no];
161160

162-
/* This factor 2* a missing factor 2 in trace_lambda */
161+
for(int i = 0; i < VOLUME; i++) {
162+
for(int mu = 0; mu < 4; mu++) {
163+
_su3_zero(swm[i][mu]);
164+
_su3_zero(swp[i][mu]);
165+
}
166+
}
163167
mnl->forcefactor = 1.;
164168

165169
/*********************************************************************
@@ -206,12 +210,12 @@ void cloverdetratio_derivative(const int no, hamiltonian_field_t * const hf) {
206210
/* to get the even sites of X */
207211
H_eo_sw_inv_psi(g_spinor_field[DUM_DERI+2], g_spinor_field[DUM_DERI+1], EE, -mnl->mu);
208212
/* \delta Q sandwitched by Y_o^\dagger and X_e */
209-
deriv_Sb(OE, g_spinor_field[DUM_DERI], g_spinor_field[DUM_DERI+2], hf);
213+
deriv_Sb(OE, g_spinor_field[DUM_DERI], g_spinor_field[DUM_DERI+2], hf, mnl->forcefactor);
210214

211215
/* to get the even sites of Y */
212216
H_eo_sw_inv_psi(g_spinor_field[DUM_DERI+3], g_spinor_field[DUM_DERI], EE, mnl->mu);
213217
/* \delta Q sandwitched by Y_e^\dagger and X_o */
214-
deriv_Sb(EO, g_spinor_field[DUM_DERI+3], g_spinor_field[DUM_DERI+1], hf);
218+
deriv_Sb(EO, g_spinor_field[DUM_DERI+3], g_spinor_field[DUM_DERI+1], hf, mnl->forcefactor);
215219

216220
// here comes the clover term...
217221
// computes the insertion matrices for S_eff
@@ -224,7 +228,7 @@ void cloverdetratio_derivative(const int no, hamiltonian_field_t * const hf) {
224228
gamma5(g_spinor_field[DUM_DERI], g_spinor_field[DUM_DERI], VOLUME/2);
225229
sw_spinor(OE, g_spinor_field[DUM_DERI], g_spinor_field[DUM_DERI+1]);
226230

227-
sw_all(hf, mnl->kappa, mnl->c_sw);
231+
sw_all(hf, mnl->kappa*mnl->forcefactor, mnl->c_sw);
228232

229233
g_mu = g_mu1;
230234
g_mu3 = 0.;

deriv_Sb.c

+20-20
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656

5757
#if (defined BGL && defined XLC)
5858

59-
void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_field_t * const hf) {
59+
void deriv_Sb(const int ieo, spinor * const l, spinor * const k,
60+
hamiltonian_field_t * const hf, const double factor) {
6061

6162
int ix,iy, iz;
6263
int ioff, icx, icy, icz;
@@ -150,7 +151,7 @@ void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_fie
150151
_bgl_su3_times_v(*up);
151152
/* result in r now */
152153
_bgl_complex_times_r(ka0);
153-
_bgl_trace_lambda_mul_add_assign((*ddd), 2.);
154+
_bgl_trace_lambda_mul_add_assign((*ddd), 2.*factor);
154155

155156

156157
/************** direction -0 ****************************/
@@ -185,7 +186,7 @@ void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_fie
185186

186187
/* result in r now */
187188
_bgl_complex_times_r(ka0);
188-
_bgl_trace_lambda_mul_add_assign((*ddd), 2.);
189+
_bgl_trace_lambda_mul_add_assign((*ddd), 2.*factor);
189190

190191
/*************** direction +1 **************************/
191192

@@ -218,7 +219,7 @@ void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_fie
218219
_bgl_su3_times_v(*up);
219220
/* result in r now */
220221
_bgl_complex_times_r(ka1);
221-
_bgl_trace_lambda_mul_add_assign((*ddd), 2.);
222+
_bgl_trace_lambda_mul_add_assign((*ddd), 2.*factor);
222223

223224
/**************** direction -1 *************************/
224225

@@ -251,7 +252,7 @@ void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_fie
251252
_bgl_su3_times_v(*um);
252253
/* result in r now */
253254
_bgl_complex_times_r(ka1);
254-
_bgl_trace_lambda_mul_add_assign((*ddd), 2.);
255+
_bgl_trace_lambda_mul_add_assign((*ddd), 2.*factor);
255256

256257
/*************** direction +2 **************************/
257258

@@ -284,7 +285,7 @@ void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_fie
284285
_bgl_su3_times_v(*up);
285286
/* result in r now */
286287
_bgl_complex_times_r(ka2);
287-
_bgl_trace_lambda_mul_add_assign((*ddd), 2.);
288+
_bgl_trace_lambda_mul_add_assign((*ddd), 2.*factor);
288289

289290
/***************** direction -2 ************************/
290291

@@ -317,7 +318,7 @@ void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_fie
317318
_bgl_su3_times_v(*um);
318319
/* result in r now */
319320
_bgl_complex_times_r(ka1);
320-
_bgl_trace_lambda_mul_add_assign(*ddd, 2.);
321+
_bgl_trace_lambda_mul_add_assign(*ddd, 2.*factor);
321322

322323
/****************** direction +3 ***********************/
323324

@@ -350,7 +351,7 @@ void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_fie
350351
_bgl_su3_times_v(*up);
351352
/* result in r now */
352353
_bgl_complex_times_r(ka3);
353-
_bgl_trace_lambda_mul_add_assign((*ddd), 2.);
354+
_bgl_trace_lambda_mul_add_assign((*ddd), 2.*factor);
354355

355356
/***************** direction -3 ************************/
356357

@@ -387,7 +388,7 @@ void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_fie
387388
_bgl_su3_times_v(*um);
388389
/* result in r now */
389390
_bgl_complex_times_r(ka3);
390-
_bgl_trace_lambda_mul_add_assign((*ddd), 2.);
391+
_bgl_trace_lambda_mul_add_assign((*ddd), 2.*factor);
391392

392393
/****************** end of loop ************************/
393394
}
@@ -398,9 +399,8 @@ void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_fie
398399

399400
#else
400401

401-
402-
403-
void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_field_t * const hf) {
402+
void deriv_Sb(const int ieo, spinor * const l, spinor * const k,
403+
hamiltonian_field_t * const hf, const double factor) {
404404
int ix,iy;
405405
int ioff, icx, icy;
406406
su3 * restrict up ALIGN;
@@ -469,7 +469,7 @@ void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_fie
469469
_vector_tensor_vector_add(v1, phia, psia, phib, psib);
470470
_su3_times_su3d(v2,*up,v1);
471471
_complex_times_su3(v1, ka0, v2);
472-
_trace_lambda_mul_add_assign(hf->derivative[ix][0], 2., v1);
472+
_trace_lambda_mul_add_assign(hf->derivative[ix][0], 2.*factor, v1);
473473

474474
/************** direction -0 ****************************/
475475

@@ -492,7 +492,7 @@ void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_fie
492492
_vector_tensor_vector_add(v1, psia, phia, psib, phib);
493493
_su3_times_su3d(v2,*um,v1);
494494
_complex_times_su3(v1,ka0,v2);
495-
_trace_lambda_mul_add_assign(hf->derivative[iy][0], 2., v1);
495+
_trace_lambda_mul_add_assign(hf->derivative[iy][0], 2.*factor, v1);
496496

497497
/*************** direction +1 **************************/
498498

@@ -513,7 +513,7 @@ void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_fie
513513
_vector_tensor_vector_add(v1, phia, psia, phib, psib);
514514
_su3_times_su3d(v2,*up,v1);
515515
_complex_times_su3(v1,ka1,v2);
516-
_trace_lambda_mul_add_assign(hf->derivative[ix][1], 2., v1);
516+
_trace_lambda_mul_add_assign(hf->derivative[ix][1], 2.*factor, v1);
517517

518518
/**************** direction -1 *************************/
519519

@@ -534,7 +534,7 @@ void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_fie
534534
_vector_tensor_vector_add(v1, psia, phia, psib, phib);
535535
_su3_times_su3d(v2,*um,v1);
536536
_complex_times_su3(v1,ka1,v2);
537-
_trace_lambda_mul_add_assign(hf->derivative[iy][1], 2., v1);
537+
_trace_lambda_mul_add_assign(hf->derivative[iy][1], 2.*factor, v1);
538538

539539
/*************** direction +2 **************************/
540540

@@ -555,7 +555,7 @@ void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_fie
555555
_vector_tensor_vector_add(v1, phia, psia, phib, psib);
556556
_su3_times_su3d(v2,*up,v1);
557557
_complex_times_su3(v1,ka2,v2);
558-
_trace_lambda_mul_add_assign(hf->derivative[ix][2], 2., v1);
558+
_trace_lambda_mul_add_assign(hf->derivative[ix][2], 2.*factor, v1);
559559

560560
/***************** direction -2 ************************/
561561

@@ -576,7 +576,7 @@ void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_fie
576576
_vector_tensor_vector_add(v1, psia, phia, psib, phib);
577577
_su3_times_su3d(v2,*um,v1);
578578
_complex_times_su3(v1,ka2,v2);
579-
_trace_lambda_mul_add_assign(hf->derivative[iy][2], 2., v1);
579+
_trace_lambda_mul_add_assign(hf->derivative[iy][2], 2.*factor, v1);
580580

581581
/****************** direction +3 ***********************/
582582

@@ -597,7 +597,7 @@ void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_fie
597597
_vector_tensor_vector_add(v1, phia, psia, phib, psib);
598598
_su3_times_su3d(v2,*up,v1);
599599
_complex_times_su3(v1, ka3, v2);
600-
_trace_lambda_mul_add_assign(hf->derivative[ix][3], 2., v1);
600+
_trace_lambda_mul_add_assign(hf->derivative[ix][3], 2.*factor, v1);
601601

602602
/***************** direction -3 ************************/
603603

@@ -618,7 +618,7 @@ void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_fie
618618
_vector_tensor_vector_add(v1, psia, phia, psib, phib);
619619
_su3_times_su3d(v2,*um,v1);
620620
_complex_times_su3(v1,ka3,v2);
621-
_trace_lambda_mul_add_assign(hf->derivative[iy][3], 2., v1);
621+
_trace_lambda_mul_add_assign(hf->derivative[iy][3], 2.*factor, v1);
622622

623623
/****************** end of loop ************************/
624624
}

deriv_Sb.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include "hamiltonian_field.h"
2323

24-
void deriv_Sb(const int ieo, spinor * const l, spinor * const k, hamiltonian_field_t * const hf);
24+
void deriv_Sb(const int ieo, spinor * const l, spinor * const k,
25+
hamiltonian_field_t * const hf, const double factor);
2526

2627
#endif

0 commit comments

Comments
 (0)