forked from etmc/tmLQCD
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Nondegenerate_Matrix.c
933 lines (705 loc) · 30.9 KB
/
Nondegenerate_Matrix.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
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
/***********************************************************************
*
* Copyright (C) 2006,2007,2008 Karl Jansen, Thomas Chiarappa,
* 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/>.
*
* This file contains operators for twisted mass Wilson QCD
* to construct a multiplication with a non-degenerate
* flavour matrix
*
*
***********************************************************************/
#ifdef HAVE_CONFIG_H
# include<config.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "global.h"
#include "su3.h"
#include "Hopping_Matrix.h"
#include "phmc.h"
#include "gamma.h"
#include "linsolve.h"
#include "linalg_eo.h"
#include "Nondegenerate_Matrix.h"
void mul_one_minus_imubar(spinor * const l, spinor * const k);
/******************************************
* mul_one_plus_imubar_inv computes
* l = [(1-i\mubar\gamma_5) * l
*
*/
void mul_one_plus_imubar(spinor * const l, spinor * const k);
/******************************************
* mul_one_plus_imubar_inv computes
* l = [(1+i\mubar\gamma_5) * l
*
*/
void Qtm_pm_psi(spinor *l,spinor *k);
/* external functions */
/******************************************
*
* This is the implementation of
*
* Qhat(2x2) = gamma_5 * [ M_oo - M_oe M_ee^-1 M_eo ]
*
* see documentation for details
* k_charm and k_strange are the input fields
* l_* the output fields
*
* it acts only on the odd part or only
* on a half spinor
******************************************/
void QNon_degenerate(spinor * const l_strange, spinor * const l_charm,
spinor * const k_strange, spinor * const k_charm){
double nrm = 1./(1.+g_mubar*g_mubar-g_epsbar*g_epsbar);
/* Here the M_oe Mee^-1 M_eo implementation */
Hopping_Matrix(EO, g_spinor_field[DUM_MATRIX], k_strange);
Hopping_Matrix(EO, g_spinor_field[DUM_MATRIX+1], k_charm);
mul_one_minus_imubar(g_spinor_field[DUM_MATRIX+4], g_spinor_field[DUM_MATRIX]);
mul_one_plus_imubar(g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX+1]);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+4], g_spinor_field[DUM_MATRIX+1], g_epsbar, VOLUME/2);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX], g_epsbar, VOLUME/2);
mul_r(g_spinor_field[DUM_MATRIX+4], nrm, g_spinor_field[DUM_MATRIX+4], VOLUME/2);
mul_r(g_spinor_field[DUM_MATRIX+3], nrm, g_spinor_field[DUM_MATRIX+3], VOLUME/2);
/* where nrm (= 1/(1+mu^2 -eps^2)) has been defined at the beginning of
the subroutine */
Hopping_Matrix(OE, l_strange, g_spinor_field[DUM_MATRIX+4]);
Hopping_Matrix(OE, l_charm, g_spinor_field[DUM_MATRIX+3]);
/* Here the M_oo implementation */
mul_one_plus_imubar(g_spinor_field[DUM_MATRIX], k_strange);
mul_one_minus_imubar(g_spinor_field[DUM_MATRIX+1], k_charm);
assign_add_mul_r(g_spinor_field[DUM_MATRIX], k_charm, -g_epsbar, VOLUME/2);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+1], k_strange, -g_epsbar, VOLUME/2);
diff(l_strange, g_spinor_field[DUM_MATRIX], l_strange, VOLUME/2);
diff(l_charm, g_spinor_field[DUM_MATRIX+1], l_charm, VOLUME/2);
/* and finally the gamma_5 multiplication */
gamma5(l_strange, l_strange, VOLUME/2);
gamma5(l_charm, l_charm, VOLUME/2);
/* At the end, the normalisation by the max. eigenvalue */
mul_r(l_strange, phmc_invmaxev, l_strange, VOLUME/2);
mul_r(l_charm, phmc_invmaxev, l_charm, VOLUME/2);
}
/******************************************
*
* This is the implementation of
*
* Qhat(2x2)^dagger = tau_1 Qhat(2x2) tau_1 =
*
* = Qhat(2x2) with g_mubar -> - g_mubar
*
* With respect to QNon_degenerate the role of charme and strange fields
* are interchenged, since Qdagger=tau_1 Q tau_1
* see documentation for details
* k_charm and k_strange are the input fields
* l_* the output fields
*
* it acts only on the odd part or only
* on a half spinor
******************************************/
void QdaggerNon_degenerate(spinor * const l_strange, spinor * const l_charm,
spinor * const k_strange, spinor * const k_charm){
double nrm = 1./(1.+g_mubar*g_mubar-g_epsbar*g_epsbar);
/* Here the M_oe Mee^-1 M_eo implementation */
Hopping_Matrix(EO, g_spinor_field[DUM_MATRIX], k_charm);
Hopping_Matrix(EO, g_spinor_field[DUM_MATRIX+1], k_strange);
mul_one_minus_imubar(g_spinor_field[DUM_MATRIX+2], g_spinor_field[DUM_MATRIX]);
mul_one_plus_imubar(g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX+1]);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+2], g_spinor_field[DUM_MATRIX+1], g_epsbar, VOLUME/2);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX], g_epsbar, VOLUME/2);
mul_r(g_spinor_field[DUM_MATRIX+2], nrm, g_spinor_field[DUM_MATRIX+2], VOLUME/2);
mul_r(g_spinor_field[DUM_MATRIX+3], nrm, g_spinor_field[DUM_MATRIX+3], VOLUME/2);
/* where nrm (= 1/(1+mu^2 -eps^2)) has been defined at the beginning of
the subroutine */
Hopping_Matrix(OE, g_spinor_field[DUM_MATRIX], g_spinor_field[DUM_MATRIX+2]);
Hopping_Matrix(OE, g_spinor_field[DUM_MATRIX+1], g_spinor_field[DUM_MATRIX+3]);
/* Here the M_oo implementation */
mul_one_plus_imubar(g_spinor_field[DUM_MATRIX+2], k_charm);
mul_one_minus_imubar(g_spinor_field[DUM_MATRIX+3], k_strange);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+2], k_strange, -g_epsbar, VOLUME/2);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+3], k_charm, -g_epsbar, VOLUME/2);
diff(l_charm, g_spinor_field[DUM_MATRIX+2], g_spinor_field[DUM_MATRIX], VOLUME/2);
diff(l_strange, g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX+1], VOLUME/2);
/* and finally the gamma_5 multiplication */
gamma5(l_charm, l_charm, VOLUME/2);
gamma5(l_strange, l_strange, VOLUME/2);
/* At the end, the normalisation by the max. eigenvalue */
mul_r(l_charm, phmc_invmaxev, l_charm, VOLUME/2);
mul_r(l_strange, phmc_invmaxev, l_strange, VOLUME/2);
}
/******************************************
*
* This is the implementation of
*
* Qhat(2x2) Qhat(2x2)^dagger
*
*
* For details, see documentation and comments of the
* above mentioned routines
*
* k_charm and k_strange are the input fields
* l_* the output fields
*
* it acts only on the odd part or only
* on a half spinor
******************************************/
void Q_Qdagger_ND(spinor * const l_strange, spinor * const l_charm,
spinor * const k_strange, spinor * const k_charm){
double nrm = 1./(1.+g_mubar*g_mubar-g_epsbar*g_epsbar);
/* FIRST THE Qhat(2x2)^dagger PART*/
/* Here the M_oe Mee^-1 M_eo implementation */
Hopping_Matrix(EO, g_spinor_field[DUM_MATRIX], k_charm);
Hopping_Matrix(EO, g_spinor_field[DUM_MATRIX+1], k_strange);
mul_one_minus_imubar(g_spinor_field[DUM_MATRIX+2], g_spinor_field[DUM_MATRIX]);
mul_one_plus_imubar(g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX+1]);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+2], g_spinor_field[DUM_MATRIX+1], g_epsbar, VOLUME/2);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX], g_epsbar, VOLUME/2);
mul_r(g_spinor_field[DUM_MATRIX+2], nrm, g_spinor_field[DUM_MATRIX+2], VOLUME/2);
mul_r(g_spinor_field[DUM_MATRIX+3], nrm, g_spinor_field[DUM_MATRIX+3], VOLUME/2);
Hopping_Matrix(OE, g_spinor_field[DUM_MATRIX], g_spinor_field[DUM_MATRIX+2]);
Hopping_Matrix(OE, g_spinor_field[DUM_MATRIX+1], g_spinor_field[DUM_MATRIX+3]);
/* Here the M_oo implementation */
mul_one_plus_imubar(g_spinor_field[DUM_MATRIX+2], k_charm);
mul_one_minus_imubar(g_spinor_field[DUM_MATRIX+3], k_strange);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+2], k_strange, -g_epsbar, VOLUME/2);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+3], k_charm, -g_epsbar, VOLUME/2);
diff(g_spinor_field[DUM_MATRIX+4], g_spinor_field[DUM_MATRIX+2], g_spinor_field[DUM_MATRIX], VOLUME/2);
diff(g_spinor_field[DUM_MATRIX+5], g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX+1], VOLUME/2);
/* and finally the gamma_5 multiplication */
gamma5(g_spinor_field[DUM_MATRIX+2], g_spinor_field[DUM_MATRIX+4], VOLUME/2);
gamma5(g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX+5], VOLUME/2);
/* The normalisation by the max. eigenvalue is done twice at the end */
/* We have to reassigin as follows to avoid overwriting */
/* Recall in fact that Q^hat = tau_1 Q tau_1 , hence */
/* ABOVE: dum_matrix+2 is l_charm goes to dum_matrix+6 :BELOW */
/* ABOVE: dum_matrix+3 is l_strange goes to dum_matrix+7 :BELOW */
assign(g_spinor_field[DUM_MATRIX+6], g_spinor_field[DUM_MATRIX+2], VOLUME/2);
assign(g_spinor_field[DUM_MATRIX+7], g_spinor_field[DUM_MATRIX+3], VOLUME/2);
/* AND THEN THE Qhat(2x2) PART */
/* Here the M_oe Mee^-1 M_eo implementation */
Hopping_Matrix(EO, g_spinor_field[DUM_MATRIX], g_spinor_field[DUM_MATRIX+7]);
Hopping_Matrix(EO, g_spinor_field[DUM_MATRIX+1], g_spinor_field[DUM_MATRIX+6]);
mul_one_minus_imubar(g_spinor_field[DUM_MATRIX+2], g_spinor_field[DUM_MATRIX]);
mul_one_plus_imubar(g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX+1]);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+2], g_spinor_field[DUM_MATRIX+1], g_epsbar, VOLUME/2);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX], g_epsbar, VOLUME/2);
mul_r(g_spinor_field[DUM_MATRIX+2], nrm, g_spinor_field[DUM_MATRIX+2], VOLUME/2);
mul_r(g_spinor_field[DUM_MATRIX+3], nrm, g_spinor_field[DUM_MATRIX+3], VOLUME/2);
Hopping_Matrix(OE, l_strange, g_spinor_field[DUM_MATRIX+2]);
Hopping_Matrix(OE, l_charm, g_spinor_field[DUM_MATRIX+3]);
/* Here the M_oo implementation */
mul_one_plus_imubar(g_spinor_field[DUM_MATRIX], g_spinor_field[DUM_MATRIX+7]);
mul_one_minus_imubar(g_spinor_field[DUM_MATRIX+1], g_spinor_field[DUM_MATRIX+6]);
assign_add_mul_r(g_spinor_field[DUM_MATRIX], g_spinor_field[DUM_MATRIX+6], -g_epsbar, VOLUME/2);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+1], g_spinor_field[DUM_MATRIX+7], -g_epsbar, VOLUME/2);
diff(l_strange, g_spinor_field[DUM_MATRIX], l_strange, VOLUME/2);
diff(l_charm, g_spinor_field[DUM_MATRIX+1], l_charm, VOLUME/2);
/* and finally the gamma_5 multiplication */
gamma5(l_strange, l_strange, VOLUME/2);
gamma5(l_charm, l_charm, VOLUME/2);
/* At the end, the normalisation by the max. eigenvalue */
/* Twice phmc_invmaxev since we consider here D Ddag !!! */
mul_r(l_charm, phmc_invmaxev*phmc_invmaxev, l_charm, VOLUME/2);
mul_r(l_strange, phmc_invmaxev*phmc_invmaxev, l_strange, VOLUME/2);
return;
}
/******************************************
*
* This is the implementation of
*
* Q_tau1_min_cconst_ND = M - z_k
*
* with M = Qhat(2x2) tau_1 and z_k \in Complex
*
*
* needed in the evaluation of the forces when
* the Polynomial approximation is used
*
*
* For details, see documentation and comments of the
* above mentioned routines
*
* k_charm and k_strange are the input fields
* l_* the output fields
*
* it acts only on the odd part or only
* on a half spinor
******************************************/
void Q_tau1_min_cconst_ND(spinor * const l_strange, spinor * const l_charm,
spinor * const k_strange, spinor * const k_charm, const _Complex double z){
int ix;
spinor *r, *s;
su3_vector ALIGN phi1;
double nrm = 1./(1.+g_mubar*g_mubar-g_epsbar*g_epsbar);
/* tau_1 inverts the k_charm <-> k_strange spinors */
/* Apply first Qhat(2x2) and finally substract the constant */
/* Here the M_oe Mee^-1 M_eo implementation */
Hopping_Matrix(EO, g_spinor_field[DUM_MATRIX], k_charm);
Hopping_Matrix(EO, g_spinor_field[DUM_MATRIX+1], k_strange);
mul_one_minus_imubar(g_spinor_field[DUM_MATRIX+4], g_spinor_field[DUM_MATRIX]);
mul_one_plus_imubar(g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX+1]);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+4], g_spinor_field[DUM_MATRIX+1], g_epsbar, VOLUME/2);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX], g_epsbar, VOLUME/2);
mul_r(g_spinor_field[DUM_MATRIX+4], nrm, g_spinor_field[DUM_MATRIX+4], VOLUME/2);
mul_r(g_spinor_field[DUM_MATRIX+3], nrm, g_spinor_field[DUM_MATRIX+3], VOLUME/2);
/* where nrm (= 1/(1+mu^2 -eps^2)) has been defined at the beginning of
the subroutine */
Hopping_Matrix(OE, l_strange, g_spinor_field[DUM_MATRIX+4]);
Hopping_Matrix(OE, l_charm, g_spinor_field[DUM_MATRIX+3]);
/* Here the M_oo implementation */
mul_one_plus_imubar(g_spinor_field[DUM_MATRIX], k_charm);
mul_one_minus_imubar(g_spinor_field[DUM_MATRIX+1], k_strange);
assign_add_mul_r(g_spinor_field[DUM_MATRIX], k_strange, -g_epsbar, VOLUME/2);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+1], k_charm, -g_epsbar, VOLUME/2);
diff(l_strange, g_spinor_field[DUM_MATRIX], l_strange, VOLUME/2);
diff(l_charm, g_spinor_field[DUM_MATRIX+1], l_charm, VOLUME/2);
/* and finally the gamma_5 multiplication */
gamma5(l_strange, l_strange, VOLUME/2);
gamma5(l_charm, l_charm, VOLUME/2);
/* At the end, the normalisation by the max. eigenvalue */
mul_r(l_strange, phmc_invmaxev, l_strange, VOLUME/2);
mul_r(l_charm, phmc_invmaxev, l_charm, VOLUME/2);
/*
printf(" IN UP: %f %f \n", l_strange[0].creal(s2.c1), l_strange[0].cimag(s2.c1));
printf(" IN DN: %f %f \n", l_charm[0].creal(s2.c1), l_charm[0].cimag(s2.c1));
*/
/* AND FINALLY WE SUBSTRACT THE C-CONSTANT */
/************ loop over all lattice sites ************/
#ifdef OMP
#pragma omp parallel for private(r) private(s) private(phi1) private(ix)
#endif
for(ix = 0; ix < (VOLUME/2); ix++){
r=l_strange + ix;
s=k_strange + ix;
_complex_times_vector(phi1, z, s->s0);
_vector_sub_assign(r->s0, phi1);
_complex_times_vector(phi1, z, s->s1);
_vector_sub_assign(r->s1, phi1);
_complex_times_vector(phi1, z, s->s2);
_vector_sub_assign(r->s2, phi1);
_complex_times_vector(phi1, z, s->s3);
_vector_sub_assign(r->s3, phi1);
r=l_charm + ix;
s=k_charm + ix;
_complex_times_vector(phi1, z, s->s0);
_vector_sub_assign(r->s0, phi1);
_complex_times_vector(phi1, z, s->s1);
_vector_sub_assign(r->s1, phi1);
_complex_times_vector(phi1, z, s->s2);
_vector_sub_assign(r->s2, phi1);
_complex_times_vector(phi1, z, s->s3);
_vector_sub_assign(r->s3, phi1);
}
/* Finally, we multiply by the constant phmc_Cpol */
/* which renders the polynomial in monomials */
/* identical to the polynomial a la clenshaw */;
mul_r(l_strange, phmc_Cpol, l_strange, VOLUME/2);
mul_r(l_charm, phmc_Cpol, l_charm, VOLUME/2);
}
/******************************************
*
* This is the same implementation as above of
*
* Qhat(2x2) Qhat(2x2)^dagger
*
*
* but now input and output are bispinors !!!!
*
* For details, see documentation and comments of the
* above mentioned routines
*
* k_charm and k_strange are the input fields
* l_* the output fields
*
* it acts only on the odd part or only
* on a half spinor
******************************************/
void Q_Qdagger_ND_BI(bispinor * const bisp_l, bispinor * const bisp_k){
double nrm = 1./(1.+g_mubar*g_mubar-g_epsbar*g_epsbar);
static int memalloc = 0;
static spinor *k_strange, *k_charm;
static spinor *l_strange, *l_charm;
#if ( defined SSE || defined SSE2 || defined SSE3)
static spinor *k_strange_, *k_charm_;
static spinor *l_strange_, *l_charm_;
if(memalloc == 0) {
memalloc = 1;
k_strange_ = (spinor*)calloc(VOLUMEPLUSRAND/2+1, sizeof(spinor));
k_strange = (spinor *)(((unsigned long int)(k_strange_)+ALIGN_BASE)&~ALIGN_BASE);
k_charm_ = (spinor*)calloc(VOLUMEPLUSRAND/2+1, sizeof(spinor));
k_charm = (spinor *)(((unsigned long int)(k_charm_)+ALIGN_BASE)&~ALIGN_BASE);
l_strange_ = (spinor*)calloc(VOLUMEPLUSRAND/2+1, sizeof(spinor));
l_strange = (spinor *)(((unsigned long int)(l_strange_)+ALIGN_BASE)&~ALIGN_BASE);
l_charm_ = (spinor*)calloc(VOLUMEPLUSRAND/2+1, sizeof(spinor));
l_charm = (spinor *)(((unsigned long int)(l_charm_)+ALIGN_BASE)&~ALIGN_BASE);
}
#else
if(memalloc == 0) {
memalloc = 1;
k_strange = (spinor*)calloc(VOLUMEPLUSRAND/2, sizeof(spinor));
k_charm = (spinor*)calloc(VOLUMEPLUSRAND/2, sizeof(spinor));
l_strange = (spinor*)calloc(VOLUMEPLUSRAND/2, sizeof(spinor));
l_charm = (spinor*)calloc(VOLUMEPLUSRAND/2, sizeof(spinor));
}
#endif
/* CREATE 2 SPINORS OUT OF 1 (INPUT) BISPINOR */
decompact(k_strange, k_charm, bisp_k);
/* FIRST THE Qhat(2x2)^dagger PART*/
/* Here the M_oe Mee^-1 M_eo implementation */
Hopping_Matrix(EO, g_spinor_field[DUM_MATRIX], k_charm);
Hopping_Matrix(EO, g_spinor_field[DUM_MATRIX+1], k_strange);
mul_one_minus_imubar(g_spinor_field[DUM_MATRIX+2], g_spinor_field[DUM_MATRIX]);
mul_one_plus_imubar(g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX+1]);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+2], g_spinor_field[DUM_MATRIX+1], g_epsbar, VOLUME/2);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX], g_epsbar, VOLUME/2);
mul_r(g_spinor_field[DUM_MATRIX+2], nrm, g_spinor_field[DUM_MATRIX+2], VOLUME/2);
mul_r(g_spinor_field[DUM_MATRIX+3], nrm, g_spinor_field[DUM_MATRIX+3], VOLUME/2);
/* where nrm (= 1/(1+mu^2 -eps^2)) has been defined at the beginning of
the subroutine */
Hopping_Matrix(OE, g_spinor_field[DUM_MATRIX], g_spinor_field[DUM_MATRIX+2]);
Hopping_Matrix(OE, g_spinor_field[DUM_MATRIX+1], g_spinor_field[DUM_MATRIX+3]);
/* Here the M_oo implementation */
mul_one_plus_imubar(g_spinor_field[DUM_MATRIX+2], k_charm);
mul_one_minus_imubar(g_spinor_field[DUM_MATRIX+3], k_strange);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+2], k_strange, -g_epsbar, VOLUME/2);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+3], k_charm, -g_epsbar, VOLUME/2);
diff(g_spinor_field[DUM_MATRIX+4], g_spinor_field[DUM_MATRIX+2], g_spinor_field[DUM_MATRIX], VOLUME/2);
diff(g_spinor_field[DUM_MATRIX+5], g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX+1], VOLUME/2);
/* and finally the gamma_5 multiplication */
gamma5(g_spinor_field[DUM_MATRIX+2], g_spinor_field[DUM_MATRIX+4], VOLUME/2);
gamma5(g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX+5], VOLUME/2);
/* The normalisation by the max. eigenvalue is done twice at the end */
/* We have to reassigin as follows to avoid overwriting */
/* Recall in fact that Q^hat = tau_1 Q tau_1 , hence */
/* ABOVE: dum_matrix+2 is l_charm goes to dum_matrix+6 :BELOW */
/* ABOVE: dum_matrix+3 is l_strange goes to dum_matrix+7 :BELOW */
assign(g_spinor_field[DUM_MATRIX+6], g_spinor_field[DUM_MATRIX+2], VOLUME/2);
assign(g_spinor_field[DUM_MATRIX+7], g_spinor_field[DUM_MATRIX+3], VOLUME/2);
/* AND THEN THE Qhat(2x2) PART */
/* Here the M_oe Mee^-1 M_eo implementation */
Hopping_Matrix(EO, g_spinor_field[DUM_MATRIX], g_spinor_field[DUM_MATRIX+7]);
Hopping_Matrix(EO, g_spinor_field[DUM_MATRIX+1], g_spinor_field[DUM_MATRIX+6]);
mul_one_minus_imubar(g_spinor_field[DUM_MATRIX+2], g_spinor_field[DUM_MATRIX]);
mul_one_plus_imubar(g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX+1]);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+2], g_spinor_field[DUM_MATRIX+1], g_epsbar, VOLUME/2);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX], g_epsbar, VOLUME/2);
mul_r(g_spinor_field[DUM_MATRIX+2], nrm, g_spinor_field[DUM_MATRIX+2], VOLUME/2);
mul_r(g_spinor_field[DUM_MATRIX+3], nrm, g_spinor_field[DUM_MATRIX+3], VOLUME/2);
/* where nrm (= 1/(1+mu^2 -eps^2)) has been defined at the beginning of
the subroutine */
Hopping_Matrix(OE, l_strange, g_spinor_field[DUM_MATRIX+2]);
Hopping_Matrix(OE, l_charm, g_spinor_field[DUM_MATRIX+3]);
/* Here the M_oo implementation */
mul_one_plus_imubar(g_spinor_field[DUM_MATRIX], g_spinor_field[DUM_MATRIX+7]);
mul_one_minus_imubar(g_spinor_field[DUM_MATRIX+1], g_spinor_field[DUM_MATRIX+6]);
assign_add_mul_r(g_spinor_field[DUM_MATRIX], g_spinor_field[DUM_MATRIX+6], -g_epsbar, VOLUME/2);
assign_add_mul_r(g_spinor_field[DUM_MATRIX+1], g_spinor_field[DUM_MATRIX+7], -g_epsbar, VOLUME/2);
diff(l_strange, g_spinor_field[DUM_MATRIX], l_strange, VOLUME/2);
diff(l_charm, g_spinor_field[DUM_MATRIX+1], l_charm, VOLUME/2);
/* and finally the gamma_5 multiplication */
gamma5(l_strange, l_strange, VOLUME/2);
gamma5(l_charm, l_charm, VOLUME/2);
/* At the end, the normalisation by the max. eigenvalue */
/* Twice phmc_invmaxev since we consider here D Ddag !!! */
mul_r(l_charm, phmc_invmaxev*phmc_invmaxev, l_charm, VOLUME/2);
mul_r(l_strange, phmc_invmaxev*phmc_invmaxev, l_strange, VOLUME/2);
/* CREATE 1 (OUTPUT) BISPINOR OUT OF 2 SPINORS */
compact(bisp_l, l_strange, l_charm);
}
/******************************************
*
* This is the implementation of
*
* (M_{ee}^\pm)^{-1}M_{eo}
*
* see documentation for details
* k is the number of the input field
* l is the number of the output field
*
* it acts only on the odd part or only
* on a half spinor
******************************************/
void H_eo_ND(spinor * const l_strange, spinor * const l_charm,
spinor * const k_strange, spinor * const k_charm,
const int ieo) {
double nrm = 1./(1.+g_mubar*g_mubar-g_epsbar*g_epsbar);
/* recall: strange <-> up while charm <-> dn */
Hopping_Matrix(ieo, g_spinor_field[DUM_MATRIX], k_strange);
Hopping_Matrix(ieo, g_spinor_field[DUM_MATRIX+1], k_charm);
mul_one_minus_imubar(l_strange, g_spinor_field[DUM_MATRIX+1]);
mul_one_plus_imubar(l_charm, g_spinor_field[DUM_MATRIX]);
assign_add_mul_r(l_strange, g_spinor_field[DUM_MATRIX], g_epsbar, VOLUME/2);
assign_add_mul_r(l_charm, g_spinor_field[DUM_MATRIX+1], g_epsbar, VOLUME/2);
mul_r(l_strange, nrm, l_strange, VOLUME/2);
mul_r(l_charm, nrm, l_charm, VOLUME/2);
}
void M_ee_inv_ND(spinor * const l_strange, spinor * const l_charm,
spinor * const k_strange, spinor * const k_charm) {
double nrm = 1./(1.+g_mubar*g_mubar-g_epsbar*g_epsbar);
/* recall: strange <-> up while charm <-> dn */
mul_one_minus_imubar(l_strange, k_strange);
mul_one_plus_imubar(l_charm, k_charm);
assign_add_mul_r(l_strange, k_charm, g_epsbar, VOLUME/2);
assign_add_mul_r(l_charm, k_strange, g_epsbar, VOLUME/2);
mul_r(l_strange, nrm, l_strange, VOLUME/2);
mul_r(l_charm, nrm, l_charm, VOLUME/2);
}
void Q_test_epsilon(spinor * const l_strange, spinor * const l_charm,
spinor * const k_strange, spinor * const k_charm){
double nrm = 1./(1.+g_mubar*g_mubar-g_epsbar*g_epsbar);
/* Here the M_oe Mee^-1 M_eo implementation */
Hopping_Matrix(EO, g_spinor_field[DUM_MATRIX], k_strange);
Hopping_Matrix(EO, g_spinor_field[DUM_MATRIX+1], k_charm);
Hopping_Matrix(OE, g_spinor_field[DUM_MATRIX+2], g_spinor_field[DUM_MATRIX]);
Hopping_Matrix(OE, g_spinor_field[DUM_MATRIX+3], g_spinor_field[DUM_MATRIX+1]);
assign_add_mul_r(k_strange, g_spinor_field[DUM_MATRIX+2], nrm, VOLUME/2);
assign_add_mul_r(k_charm, g_spinor_field[DUM_MATRIX+3], nrm, VOLUME/2);
mul_r(l_strange, -2, k_strange, VOLUME/2);
mul_r(l_charm, -2, k_charm, VOLUME/2);
/* and finally the gamma_5 multiplication */
gamma5(l_strange, l_strange, VOLUME/2);
gamma5(l_charm, l_charm, VOLUME/2);
/* At the end, the normalisation by the max. eigenvalue */
mul_r(l_charm, phmc_invmaxev, l_charm, VOLUME/2);
mul_r(l_strange, phmc_invmaxev, l_strange, VOLUME/2);
return;
}
void mul_one_pm_itau2(spinor * const p, spinor * const q,
spinor * const r, spinor * const s,
const double sign, const int N) {
double fac = 1./sqrt(2.);
if(sign > 0) {
add(p, r, s, N);
diff(q, s, r, N);
}
else {
diff(p, r, s, N);
add(q, r, s, N);
}
mul_r(p, fac, p, N);
mul_r(q, fac, q, N);
}
void mul_one_minus_imubar(spinor * const l, spinor * const k) {
#ifdef OMP
#pragma omp parallel
{
#endif
spinor *r, *s;
su3_vector ALIGN phi1;
/************ loop over all lattice sites ************/
#ifdef OMP
#pragma omp for
#endif
for(int ix = 0; ix < (VOLUME/2); ++ix){
r=l + ix;
s=k + ix;
/* Multiply the spinorfield with the inverse of 1+imu\gamma_5 */
_complex_times_vector(phi1, (1. - g_mubar * I), s->s0);
_vector_assign(r->s0, phi1);
_complex_times_vector(phi1, (1. - g_mubar * I), s->s1);
_vector_assign(r->s1, phi1);
_complex_times_vector(phi1, (1. + g_mubar * I), s->s2);
_vector_assign(r->s2, phi1);
_complex_times_vector(phi1, (1. + g_mubar * I), s->s3);
_vector_assign(r->s3, phi1);
}
#ifdef OMP
} /* OpenMP closing brace */
#endif
}
void mul_one_plus_imubar(spinor * const l, spinor * const k){
#ifdef OMP
#pragma omp parallel
{
#endif
spinor *r, *s;
su3_vector ALIGN phi1;
/************ loop over all lattice sites ************/
#ifdef OMP
#pragma omp for
#endif
for(int ix = 0; ix < (VOLUME/2); ++ix){
r=l + ix;
s=k + ix;
/* Multiply the spinorfield with the inverse of 1+imu\gamma_5 */
_complex_times_vector(phi1, (1. + g_mubar * I), s->s0);
_vector_assign(r->s0, phi1);
_complex_times_vector(phi1, (1. + g_mubar * I), s->s1);
_vector_assign(r->s1, phi1);
_complex_times_vector(phi1, (1. - g_mubar * I), s->s2);
_vector_assign(r->s2, phi1);
_complex_times_vector(phi1, (1. - g_mubar * I), s->s3);
_vector_assign(r->s3, phi1);
}
#ifdef OMP
} /* OpenMP closing brace */
#endif
return;
}
/* calculates P(Q Q^dagger) for the nondegenerate case */
void P_ND(spinor * const l_strange, spinor * const l_charm,
spinor * const k_strange, spinor * const k_charm){
int j;
spinor *dum_up,*dum_dn;
dum_up=g_chi_up_spinor_field[DUM_MATRIX];
dum_dn=g_chi_dn_spinor_field[DUM_MATRIX];
assign(dum_up,k_strange,VOLUME/2);
assign(dum_dn,k_charm,VOLUME/2);
for(j=0; j<(2*phmc_dop_n_cheby -2); j++){
if(j>0) {
assign(dum_up,l_strange,VOLUME/2);
assign(dum_dn,l_charm,VOLUME/2);
}
Q_tau1_min_cconst_ND(l_strange, l_charm,
dum_up, dum_dn,
phmc_root[j]);
}
return;
}
/* calculates Q * \tau^1 for the nondegenerate case */
void Qtau1_P_ND(spinor * const l_strange, spinor * const l_charm,
spinor * const k_strange, spinor * const k_charm){
spinor * dum_up,* dum_dn;
dum_up=g_chi_up_spinor_field[DUM_MATRIX+1];
dum_dn=g_chi_dn_spinor_field[DUM_MATRIX+1];
P_ND(l_strange, l_charm,k_strange,k_charm);
assign(dum_up,l_strange,VOLUME/2);
assign(dum_dn,l_charm,VOLUME/2);
QNon_degenerate(l_strange,l_charm,dum_dn,dum_up);
return;
}
/* this is neccessary for the calculation of the polynomial */
void Qtm_pm_min_cconst_nrm(spinor * const l, spinor * const k,
const _Complex double z){
su3_vector ALIGN phi1;
spinor *r,*s;
int ix;
Qtm_pm_psi(l,k);
mul_r(l, phmc_invmaxev, l, VOLUME/2);
/* AND FINALLY WE SUBSTRACT THE C-CONSTANT */
/************ loop over all lattice sites ************/
#ifdef OMP
#pragma omp parallel for private(ix) private(r) private(s) private(phi1)
#endif
for(ix = 0; ix < (VOLUME/2); ix++){
r=l + ix;
s=k + ix;
_complex_times_vector(phi1, z, s->s0);
_vector_sub_assign(r->s0, phi1);
_complex_times_vector(phi1, z, s->s1);
_vector_sub_assign(r->s1, phi1);
_complex_times_vector(phi1, z, s->s2);
_vector_sub_assign(r->s2, phi1);
_complex_times_vector(phi1, z, s->s3);
_vector_sub_assign(r->s3, phi1);
}
mul_r(l, phmc_Cpol, l, VOLUME/2);
return;
}
/* calculate a polynomial in (Q+)*(Q-) */
void Ptm_pm_psi(spinor * const l, spinor * const k){
int j;
spinor *spinDum;
spinDum=g_spinor_field[DUM_MATRIX+2];
assign(spinDum,k,VOLUME/2);
for(j=0; j<(2*phmc_dop_n_cheby -2); j++){
if(j>0) {
assign(spinDum,l,VOLUME/2);
}
Qtm_pm_min_cconst_nrm(l,spinDum,phmc_root[j]);
}
return;
}
/* **********************************************
* Qpm * P(Qpm)
* this operator is neccessary for the inverter
************************************************/
void Qtm_pm_Ptm_pm_psi(spinor * const l, spinor * const k){
spinor * spinDum;
spinDum=g_spinor_field[DUM_MATRIX+3];
Ptm_pm_psi(l,k);
assign(spinDum,l,VOLUME/2);
Qtm_pm_psi(l,spinDum);
return;
}
/* ************************************************
* for noise reduction
* this implements
* a = B^dagger H b
*
* with Hopping matrix H and
*
* B = (1-i\g5\tau^1\musigma-\tau^3\mudelta)/c
* where
* c = 1+\musigma^2-\mudelta^2
*
* so it is in the convention of hep-lat/0606011
* not in the internal one, see documentation
*
**************************************************/
void red_noise_nd(spinor * const lse, spinor * const lso,
spinor * const lce, spinor * const lco)
{
double nrm0 = (1.-g_epsbar)/(1+g_mubar*g_mubar-g_epsbar*g_epsbar);
double nrm1 = (1.+g_epsbar)/(1+g_mubar*g_mubar-g_epsbar*g_epsbar);
_Complex double z;
int ix, i;
su3_vector ALIGN phi;
spinor * r, * s;
/* need B^\dagger, so change sign of g_mubar */
z = (g_mubar / (1 + g_mubar * g_mubar - g_epsbar * g_epsbar)) * I;
/* first multiply with Hopping matrix */
Hopping_Matrix(EO, g_spinor_field[DUM_MATRIX], lso);
Hopping_Matrix(OE, g_spinor_field[DUM_MATRIX+1], lse);
Hopping_Matrix(EO, g_spinor_field[DUM_MATRIX+2], lco);
Hopping_Matrix(OE, g_spinor_field[DUM_MATRIX+3], lce);
/* now with A^{-1}*/
mul_r(lse, nrm0, g_spinor_field[DUM_MATRIX], VOLUME/2);
mul_r(lso, nrm0, g_spinor_field[DUM_MATRIX+1], VOLUME/2);
mul_r(lce, nrm1, g_spinor_field[DUM_MATRIX+2], VOLUME/2);
mul_r(lco, nrm1, g_spinor_field[DUM_MATRIX+3], VOLUME/2);
/************ loop over all lattice sites ************/
for(i = 0; i < 4; i++) {
if(i == 0) {
r = lse, s = g_spinor_field[DUM_MATRIX];
}
else if(i == 1) {
r = lso, s = g_spinor_field[DUM_MATRIX+1];
}
else if(i == 2) {
r = lce, s = g_spinor_field[DUM_MATRIX+2];
}
else {
r = lco, s = g_spinor_field[DUM_MATRIX+3];
}
for(ix = 0; ix < (VOLUME/2); ix++){
/* Multiply the spinorfield with (i epsbar \gamma_5)/c */
/* and add it to */
_complex_times_vector(phi, z, s->s0);
_vector_add_assign(r->s0, phi);
_complex_times_vector(phi, z, s->s1);
_vector_add_assign(r->s1, phi);
_complex_times_vector(phi, -z, s->s2);
_vector_add_assign(r->s2, phi);
_complex_times_vector(phi, -z, s->s3);
_vector_add_assign(r->s3, phi);
r++; s++;
}
}
return;
}