CHROMA
t_spprod.cc
Go to the documentation of this file.
1 
2 #include <iostream>
3 #include <cstdio>
4 
5 #include "chroma.h"
6 
7 using namespace Chroma;
8 
9 
10 int main(int argc, char **argv)
11 {
12  // Put the machine into a known state
13  Chroma::initialize(&argc, &argv);
14 
15  // Setup the layout
16  const int foo[] = {2,2,2,2};
17  multi1d<int> nrow(Nd);
18  nrow = foo; // Use only Nd elements
19  Layout::setLattSize(nrow);
20  Layout::create();
21 
22  XMLFileWriter xml("t_spprod.xml");
23  push(xml,"t_spprod");
24 
25  write(xml,"Nd", Nd);
26  write(xml,"Nc", Nc);
27  write(xml,"Ns", Ns);
28  write(xml,"nrow", nrow);
29 
30  LatticeFermion fpsi;
31  LatticeFermion fchi;
32  LatticeFermion fa1;
33  LatticePropagator ppsi;
34  LatticePropagator pchi;
35  LatticePropagator pa1;
36 
37  /* Test 1 */
38  printf("Fill fermions with gaussians and spprod\n");
39  gaussian(fpsi);
40  gaussian(fchi);
41 
42  push(xml,"here_is_psi");
43  write(xml, "fpsi", fpsi);
44  pop(xml);
45 
46  /* fa1 = (gamma(n))*psi */
47  for(int n = 0; n < Ns*Ns; ++n)
48  {
49  fa1 = zero;
50  fa1[rb[0]] = Gamma(n) * fpsi;
51 
52  printf("print the fa1 fields in direction n= %d\n", n);
53  push(xml,"Basis");
54  write(xml, "n", n);
55  pop(xml);
56  push(xml,"fa1_is_spin");
57  write(xml, "fa1", fa1);
58  pop(xml);
59  }
60 
61 
62  /* Test 2 */
63  printf("Fill fermions with gaussians and spprod/trace\n");
64  gaussian(fpsi);
65  gaussian(fchi);
66 
67  /* fa1 = (gamma(n))*psi */
68  for(int n = 0; n < Ns*Ns; ++n)
69  {
70  DComplex dcsum = innerProduct(fchi, Gamma(n) * fpsi);
71 
72  printf("print the fa1 fields in direction n= %d\n", n);
73  push(xml,"Fermion_inner_product");
74  write(xml, "n", n);
75  write(xml, "dcsum", dcsum);
76  pop(xml);
77  }
78 
79 
80  /* Test 3 */
81  printf("Fill propagators with gaussians and spprod/trace\n");
82  gaussian(ppsi);
83  gaussian(pchi);
84 
85  /* pa1 = (gamma(n))*psi */
86  for(int n = 0; n < Ns*Ns; ++n)
87  {
88  DComplex dcsum = innerProduct(pchi, Gamma(n) * ppsi);
89 
90  printf("print the pa1 fields in direction n= %d\n", n);
91  push(xml,"Propagator_inner_product");
92  write(xml, "n", n);
93  write(xml, "dcsum", dcsum);
94  pop(xml);
95  }
96 
97  pop(xml);
98 
99  // Time to bolt
101 
102  exit(0);
103 }
Primary include file for CHROMA in application codes.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
unsigned n
Definition: ldumul_w.cc:36
Nd
Definition: meslate.cc:74
BinaryReturn< C1, C2, FnInnerProduct >::Type_t innerProduct(const QDPSubType< T1, C1 > &s1, const QDPType< T2, C2 > &s2)
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
gaussian(aux)
push(xml_out,"Condensates")
void initialize(int *argc, char ***argv)
Chroma initialisation routine.
Definition: chroma_init.cc:114
void finalize(void)
Chroma finalization routine.
Definition: chroma_init.cc:308
pop(xml_out)
Double zero
Definition: invbicg.cc:106
DComplex dcsum
Definition: pade_trln_w.cc:118
int main(int argc, char **argv)
Definition: t_spprod.cc:10