CHROMA
t_overbu.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[] = {4,4,4,4};
17  multi1d<int> nrow(Nd);
18  nrow = foo; // Use only Nd elements
19  Layout::setLattSize(nrow);
20  Layout::create();
21 
22  //! Test out overbu
23  multi1d<LatticeColorMatrix> u(Nd);
24  for(int m=0; m < u.size(); ++m)
25  {
26 // gaussian(u[m]);
27  u[m] = 1.0;
28  }
29 
30  // Reunitarize the gauge field
31  for(int m=0; m < u.size(); ++m)
32  reunit(u[m]);
33 
34  LatticeFermion psi, chi;
35  random(psi);
36  gaussian(chi);
37 
38  XMLFileWriter xml("t_overbu.xml");
39  push(xml,"t_overbu");
40 
41  write(xml,"Nd", Nd);
42  write(xml,"Nc", Nc);
43  write(xml,"Ns", Ns);
44  write(xml,"nrow", nrow);
45  write(xml,"psi", psi);
46  write(xml,"chi", chi);
47 
48  Real OverMass = 1.5;
49  Real m_q = 0.2;
50 
51  OverlapBULinOp over(u,OverMass,m_q);
52 
53  Real RsdCG = 1.0e-5;
54  int MaxCG = 1000;
55  int n_count;
56 
57  // Solve D^dag.D*psi = D^dag*chi
58  LatticeFermion chi_tmp;
59  over(chi_tmp, chi, MINUS);
60  InvCG2(over, chi_tmp, psi, RsdCG, MaxCG, n_count);
61 
62  // Check solution
63  LatticeFermion tmp;
64  over(tmp, psi, PLUS);
65  Double solnorm = sqrt(norm2(tmp-chi));
66  Double ratio = solnorm / sqrt(norm2(chi));
67  QDPIO::cout << "|solution| / |source| = " << ratio << std::endl;
68 
69  pop(xml);
70 
71  // Time to bolt
73 
74  exit(0);
75 }
Primary include file for CHROMA in application codes.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
SystemSolverResults_t InvCG2(const LinearOperator< LatticeFermionF > &M, const LatticeFermionF &chi, LatticeFermionF &psi, const Real &RsdCG, int MaxCG)
Conjugate-Gradient (CGNE) algorithm for a generic Linear Operator.
Definition: invcg2.cc:240
static int m[4]
Definition: make_seeds.cc:16
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
gaussian(aux)
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > const multi1d< Real > enum InvType invType const multi1d< Real > & RsdCG
Definition: pbg5p_w.cc:30
static multi1d< LatticeColorMatrix > u
int n_count
Definition: invbicg.cc:78
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > const multi1d< Real > enum InvType invType const multi1d< Real > int MaxCG
Definition: pbg5p_w.cc:32
void initialize(int *argc, char ***argv)
Chroma initialisation routine.
Definition: chroma_init.cc:114
@ MINUS
Definition: chromabase.h:45
@ PLUS
Definition: chromabase.h:45
void finalize(void)
Chroma finalization routine.
Definition: chroma_init.cc:308
multi1d< LatticeFermion > chi(Ncb)
void reunit(LatticeColorMatrixF3 &xa)
Definition: reunit.cc:467
LatticeFermion psi
Definition: mespbg5p_w.cc:35
pop(xml_out)
FloatingPoint< double > Double
Definition: gtest.h:7351
int main(int argc, char **argv)
Definition: t_overbu.cc:10