-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprepare.cpp
More file actions
462 lines (346 loc) · 9.71 KB
/
Copy pathprepare.cpp
File metadata and controls
462 lines (346 loc) · 9.71 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
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
#include "prepare.hpp"
const Gamma P5{.iGamma=5};
namespace tests
{
const Momentum momP{1,1,1};
const Momentum momM=-momP;
const Smear smeP{.kappa=0.4,.n=80,.mom=momP};
const Smear smeM{.kappa=0.4,.n=80,.mom=momM};
const Phase phaseP{.mom=momP};
const Phase phaseM{.mom=momM};
const Phase phase2M{.mom=2*momM};
const Phase phase2P{.mom=2*momP};
const Prop prop{.kappa=0.1394267,.mass=0.00066690,.r=1,.charge=0.0,.residue=1e-20};
}
void dir()
{
using namespace tests;
const Source eta(0);
Run run;
Contracter& dir=run.getTracer("dir");
dir.addGammas(5,5);
Line bw(phaseM*smeP*prop*smeP*phaseM*eta,"bw");
Line fw(phaseP*smeM*prop*smeM*phaseP*eta,"fw");
dir.tr(bw,fw);
run.compile();
cout<<run.printSources()<<endl;
run.debugFree=true;
run.debugContr=true;
cout<<run.printLines()<<endl;
cout<<run.printContr()<<endl;
}
void dir2()
{
using namespace tests;
const Source eta(0);
Run run;
const Oper O=smeM*phase2P*P5*smeP;
Line bw(prop*eta,"bw");
Line fw1(O*prop*O.dag()*eta,"fw1");
Line fw2(O.dag()*prop*O.dag()*eta,"fw2");
Contracter& dir=run.getTracer("dir");
dir.addGammas(0,0);
dir.tr(bw,fw1);
dir.tr(bw,fw2);
dir.tr(bw,bw);
run.compile();
cout<<run.printSources()<<endl;
run.debugFree=true;
run.debugContr=true;
cout<<run.printLines()<<endl;
cout<<run.printContr()<<endl;
}
void dir3()
{
using namespace tests;
const Source eta(0);
Run run;
const Oper OP=smeM*phaseP;
const Oper OM=smeP*phaseM;
Line bw1(OM.dag()*prop*OM*eta,"bw1");
Line bw2(OP.dag()*prop*OM*eta,"bw2");
Line fw1(OP.dag()*prop*OP*eta,"fw1");
Line fw2(OM.dag()*prop*OP*eta,"fw2");
Contracter& dir=run.getTracer("dir");
dir.addGammas(5,5);
dir.tr(bw1,fw1);
dir.tr(bw2,fw2);
dir.tr(bw1,bw1);
dir.tr(fw1,fw1);
run.compile();
cout<<run.printSources()<<endl;
run.debugFree=true;
run.debugContr=true;
cout<<run.printLines()<<endl;
cout<<run.printContr()<<endl;
}
void tri()
{
using namespace tests;
const Source eta(0);
Run run;
Contracter& tri=run.getTracer("tri");
tri.addGammas(1,5);
for(size_t t=0;t<5;t++)
tri.tr(Line(prop*smeP*phaseM*eta,"bw2"),
Line(prop.dag()*smeP*phase2M*P5*smeM*DeltaT{.t=t}*prop*smeM*phaseP*eta,std::format("fw2_{}",t)));
run.compile();
cout<<run.printSources()<<endl;
run.debugContr=true;
cout<<run.printLines()<<endl;
cout<<run.printContr()<<endl;
}
void print(Run &run)
{
// run.compile();
cout<<run.printSources()<<endl;
cout<<run.printLines()<<endl;
// cout<<describe(OP)<<endl;
// cout<<describe(OM)<<endl;
cout<<run.printContr()<<endl;
}
void testBox()
{
using namespace tests;
Run runBox;
/// Original source
const Source eta(0);
/// Defines the interpolating operator for the single pion
const Oper OP=smeM*phase2P*P5*smeP;
const Oper OM=OP.dag();
/// Defines the forward line, which contains the _| part of the corr
const auto fwA=prop*OM*DeltaT{.t=0}*prop.dag()*OP*eta;
const auto fwB=prop*OP*DeltaT{.t=0}*prop.dag()*OM*eta;
/// Gets the backward line for a given time
auto getBw=
[&](const size_t t)
{
return OM*DeltaT{.t=t}*prop*OP*DeltaT{.t=t}*prop.dag()*eta;
};
/// Gets the original line
Line bw=getBw(0);
doNotMergeLinComb=true;
for(size_t t=1;t<25;t++)
bw=Line(bw+getBw(t),std::format("bwD{}",t));
auto& boxA=runBox.getTracer("boxA");
auto& boxB=runBox.getTracer("boxB");
boxA.tr(Line(bw,"bw"),
Line(fwA,"fwA"));
boxA.addGammas(0,0);
boxB.tr(Line(bw,"bw"),
Line(fwB,"fwB"));
boxB.addGammas(0,0);
auto& boxC=runBox.getTracer("boxC");
boxC.tr(Line(eta,"So"),
Line(prop*DeltaT{.t=10}*OP.dag()*prop.dag()*DeltaT{.t=10}*OM.dag()*prop*OM*DeltaT{.t=0}*prop.dag()*OP*eta,"piece"));
boxC.addGammas(0,0);
print(runBox);
}
void comboA()
{
using namespace tests;
Source u(0);
Source d(5);
const Oper OP=P5;
Run runCombo;
auto& combo=runCombo.getTracer("Op");
combo.addGammas(0,0);
combo.tr(Line(u,"u"),
Line(OP*prop*d,"Op_d"));
combo.tr(Line(d,"d"),
Line(OP.dag()*prop.dag()*u,"Op_u"));
auto& base=runCombo.getTracer("Base");
base.addGammas(5,5);
base.tr(Line(prop*d,"straight_d"),
Line(prop*d,"straight_d"));
print(runCombo);
}
void comboB()
{
using namespace tests;
Source u(0);
Source d(5);
// const Phase phase0P{.mom={0,0,0}};
const Oper OP=phase2P*P5;
Run runCombo;
auto& combo=runCombo.getTracer("Op");
combo.addGammas(0,0);
combo.tr(Line(d,"d"),
Line(OP*prop*u,"Op_prop_u"));
combo.tr(Line(u,"u"),
Line(OP.dag()*prop.dag()*d,"Opdag_propdag_d"));
auto& base=runCombo.getTracer("Base");
base.addGammas(0,0);
base.tr(Line(OP*prop*d,"Op_prop_d"),
Line(prop*OP*d,"prop_OP_d"));
print(runCombo);
}
void localBox()
{
using Entry=
std::tuple<const char*,Momentum>;
std::vector<std::vector<Entry>> a{{std::tuple
{"PZ",Momentum{0,0,2}},
{"MZ",{0,0,-2}}},
{{"0P11",{0,2,2}},
{"0M11",{0,-2,-2}},
{"P101",{2,0,2}},
{"M101",{-2,0,-2}},
{"0M1P1",{0,-2,2}},
{"0P1M1",{0,2,-2}},
{"M10P1",{-2,0,2}},
{"P10M1",{2,0,-2}}},
{{"P111",{2,2,2}},
{"M111",{-2,-2,-2}},
{"M1P11",{-2,2,2}},
{"P1M11",{2,-2,-2}},
{"P1M1P1",{2,-2,2}},
{"M1P1M1",{-2,2,-2}},
{"M11P1",{-2,-2,2}},
{"P11M1",{2,2,-2}}},
{{"PZ2",{0,0,4}},
{"MZ2",{0,0,-4}}},
{{"P012",{0,2,4}},
{"M012",{0,-2,-4}}}};
const Source eta(0);
const Prop prop{.kappa=0.1394267,.mass=0.00066690,.r=-1,.charge=0.0,.residue=1e-20};
Run run;
auto& box=run.getTracer("box");
box.addGammas(5,5);
auto& tri=run.getTracer("tri");
for(int ig=1;ig<=3;ig++)
tri.addGammas(ig,5);
auto& triNaz=run.getTracer("triNaz");
for(int ig=1;ig<=3;ig++)
triNaz.addGammas(ig,5);
doNotMergeLinComb=true;
for(int iSo=0;iSo<5;iSo++)
for(int iRotSo=0;const auto& [nSo,momSo] : a[iSo])
{
Phase phSo{.mom=momSo};
const Line bwLine(prop.dag()*phSo.dag()*P5*DeltaT{.t=0}*prop*phSo*eta,std::format("bw{}",nSo));
tri.tr(bwLine,
Line(prop*eta,"-"));
for(int iSi=0;iSi<5;iSi++)
{
Phase phSi{.mom=std::get<Momentum>(a[iSi].front())};
auto getT=
[&prop,
&eta,
&phSi](const size_t t)
{
return prop.dag()*DeltaT{.t=t}*phSi*P5*prop*eta;
};
const size_t t0=5;
if(iSo==0 and iRotSo==0)
for(size_t t=t0;t<25;t++)
triNaz.tr(Line(prop*phSi*eta,std::format("nazBwSi{}",iSi)), ///Correct, even if on so
Line(getT(t),std::format("nazFwT{}Si{}",t,iSi)));
Line cumul=DeltaT{.t=t0}*getT(t0);
for(size_t t=t0+1;t<25;t++)
cumul=cumul+DeltaT{.t=t}*getT(t);
box.tr(bwLine,
Line(phSi.dag()*cumul,std::format("fwP{}",iSi)));
}
iRotSo++;
}
run.compile();
print(run);
}
void smeBox()
{
using Entry=
std::tuple<const char*,Momentum>;
std::vector<std::vector<Entry>> a{{std::tuple
{"PZ",Momentum{0,0,2}},
{"MZ",{0,0,-2}}},
{{"0P11",{0,2,2}},
{"0M11",{0,-2,-2}},
{"P101",{2,0,2}},
{"M101",{-2,0,-2}},
{"0M1P1",{0,-2,2}},
{"0P1M1",{0,2,-2}},
{"M10P1",{-2,0,2}},
{"P10M1",{2,0,-2}}},
{{"P111",{2,2,2}},
{"M111",{-2,-2,-2}},
{"M1P11",{-2,2,2}},
{"P1M11",{2,-2,-2}},
{"P1M1P1",{2,-2,2}},
{"M1P1M1",{-2,2,-2}},
{"M11P1",{-2,-2,2}},
{"P11M1",{2,2,-2}}},
{{"PZ2",{0,0,4}},
{"MZ2",{0,0,-4}}},
{{"P012",{0,2,4}},
{"M012",{0,-2,-4}}}};
const Source eta(0);
const Prop propSameTime{.kappa=0.1394267,.mass=0.00066690,.r=+1,.charge=0.0,.residue=1e-20};
const Prop propDiffTime{.kappa=0.1394267,.mass=0.00066690,.r=-1,.charge=0.0,.residue=1e-20};
Run run;
auto& box=run.getTracer("box");
box.addGammas(5,5);
auto& tri=run.getTracer("tri");
for(int ig=1;ig<=3;ig++)
tri.addGammas(ig,5);
auto& triNaz=run.getTracer("triNaz");
for(int ig=1;ig<=3;ig++)
triNaz.addGammas(ig,5);
doNotMergeLinComb=true;
auto getOp=
[](const Momentum& mom)
{
const Phase phPi1{.mom=mom};
const Smear smPi1q{.kappa=0.4,.n=80,.mom=mom/2.0};
const Smear smPi1qBar{.kappa=0.4,.n=80,.mom=-mom/2.0};
return smPi1qBar*phPi1*smPi1q;
};
for(int iSo=0;iSo<5;iSo++)
for(int iRotSo=0;const auto& [nSo,momSo] : a[iSo])
if(iRotSo<2)
{
const Oper pi1=getOp(momSo);
const Oper pi2=pi1.dag();
const Line bwLine(propDiffTime.dag()*pi2*P5*DeltaT{.t=0}*propSameTime.dag()*pi1*eta,std::format("bw{}",nSo));
tri.tr(bwLine,
Line(propDiffTime*eta,"sm_prop"));
for(int iSi=0;iSi<5;iSi++)
{
const Oper pi3=getOp(std::get<Momentum>(a[iSi].front()));
const Oper pi4=pi3.dag();
auto getT=
[&propSameTime,
&propDiffTime,
&eta,
&pi3](const size_t t)
{
return propSameTime*DeltaT{.t=t}*pi3*P5*propDiffTime*eta;
};
const size_t t0=5;
if(iSo==0 and iRotSo==0)
for(size_t t=t0;t<25;t++)
triNaz.tr(Line(propDiffTime*pi3*eta,std::format("nazBwSi{}",iSi)), ///Correct, even if on so
Line(getT(t),std::format("nazFwT{}Si{}",t,iSi)));
Line cumul=DeltaT{.t=t0}*getT(t0);
for(size_t t=t0+1;t<25;t++)
cumul=cumul+DeltaT{.t=t}*getT(t);
box.tr(bwLine,
Line(pi4*cumul,std::format("fwP{}",iSi)));
}
iRotSo++;
}
run.compile();
// run.debugContr=true;
// run.debugFree=true;
print(run);
}
int main()
{
// comboA();
// comboB();
//localBox();
smeBox();
//box();
//dir3();
return 0;
}