CHROMA
t_stagg_baryon.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Main code for staggered charmed baryons
3  *
4  * This code is a wrapper for the calculation of staggered charmed
5  * baryons.
6  *
7  */
8 
9 #include <iostream>
10 #include <cstdio>
11 
12 #define MAIN
13 
14 // Include everything...
15 #include "chroma.h"
16 
19 
20 #include "io/xml_group_reader.h"
21 #include "meas/hadron/baryon_s.h"
22 
23 
26 
27 
28 /*
29  * Here we have various temporary definitions
30  */
31 
32 using namespace Chroma;
33 
34 
35 
36 /*
37  * Input
38  */
39 
40 
41 // Parameters which must be determined from the XML input
42 // and written to the XML output
43 struct Param_t
44 {
45 
46  CfgType cfg_type; // storage order for stored gauge configuration
47 
48  SysSolverCGParams invParam;
49 
50  GroupXML_t fermact;
52 
53  bool gauge_trans ;
56 
57  multi1d<int> nrow;
58  multi1d<int> boundary;
59  int t_srce;
60 };
61 
62 
63 
64 struct Propagator_input_t
65 {
66  Param_t param;
67  Cfg_t cfg;
68 };
69 
70 
71 
72 
73 // Reader for input parameters
74 void read(XMLReader& xml, const std::string& path, Propagator_input_t& input)
75 {
76  XMLReader inputtop(xml, path);
77 
78 
79  // First, read the input parameter version. Then, if this version
80  // includes 'Nc' and 'Nd', verify they agree with values compiled
81  // into QDP++
82 
83  // Read in the IO_version
84  int version;
85  try
86  {
87  read(inputtop, "IO_version/version", version);
88  }
89  catch (const std::string& e)
90  {
91  QDPIO::cerr << "Error reading data: " << e << std::endl;
92  throw;
93  }
94 
95 
96  // Currently, in the supported IO versions, there is only a small difference
97  // in the inputs. So, to make code simpler, extract the common bits
98 
99  // Read the uncommon bits first
100  try
101  {
102  XMLReader paramtop(inputtop, "param"); // push into 'param' group
103 
104  switch (version)
105  {
106  /**************************************************************************/
107  case 2 :
108  /**************************************************************************/
109  break;
110 
111  default :
112  /**************************************************************************/
113 
114  QDPIO::cerr << "Input parameter version " << version << " unsupported." << std::endl;
115  QDP_abort(1);
116  }
117  }
118  catch (const std::string& e)
119  {
120  QDPIO::cerr << "Error reading data: " << e << std::endl;
121  throw;
122  }
123 
124  QDPIO::cout << "Propagator for Staggered fermions" << std::endl;
125  // Read the common bits
126  try
127  {
128  XMLReader paramtop(inputtop, "param"); // push into 'param' group
129 
130  // This is a Group XML structure which has 2 members
131  // One is the 'id' which will be found in the "FermAct" sub-tag
132  // One is the root tag of the Group in this case "FermionAction"
133  input.param.fermact = readXMLGroup(paramtop, "FermionAction", "FermAct");
134  input.param.fermact_A = readXMLGroup(paramtop, "FermionAction_A", "FermAct_A");
135 
136  read(paramtop, "RsdCG", input.param.invParam.RsdCG);
137  read(paramtop, "MaxCG", input.param.invParam.MaxCG);
138  read(paramtop, "MinCG", input.param.invParam.MinCG);
139 
140  read(paramtop, "gauge_trans", input.param.gauge_trans);
141  read(paramtop, "src_type", input.param.src_type_str);
142 
143  if( input.param.src_type_str.compare("LOCAL") == 0 )
144  {
145  input.param.src_type = local_s ;
146  }
147  else if( input.param.src_type_str.compare("WALL") == 0 )
148  {
149  input.param.src_type = wall_s ;
150  }
151  else if( input.param.src_type_str.compare("WALL_Q") == 0 )
152  {
153  input.param.src_type = wall_q ;
154  }
155  else if( input.param.src_type_str.compare("LOCAL_Q") == 0 )
156  {
157  input.param.src_type = local_q ;
158  }
159  else
160  {
161  QDPIO::cerr << "Input src = " << input.param.src_type_str << " unknown." << std::endl;
162  QDP_abort(1);
163  }
164 
165 
166 
167  read(paramtop, "nrow", input.param.nrow);
168  read(paramtop, "t_srce", input.param.t_srce);
169  }
170  catch (const std::string& e)
171  {
172  QDPIO::cerr << "Error reading data: " << e << std::endl;
173  throw;
174  }
175 
176 
177  // Read in the gauge configuration file name
178  try
179  {
180  read(inputtop, "Cfg", input.cfg);
181  }
182  catch (const std::string& e)
183  {
184  QDPIO::cerr << "Error reading data: " << e << std::endl;
185  throw;
186  }
187  }
188 
189 
190  bool linkageHack(void)
191 {
192  bool foo = true;
193 
194  // Inline Measurements
197  foo &= GaugeInitEnv::registerAll();
198 
199  return foo;
200 }
201 
202 
203 
204 #include "qdp_util.h"
205 
206 void dump_text_src(LatticeStaggeredFermion psi, multi1d<int> nrow)
207 {
208 
209  QDPIO::cout << "Dump of source " << std::endl;
210  StaggeredFermion psi_local ;
211  ColorVector psi_color ;
212  multi1d<int> coords ;
213  Complex z ;
214 
215  for(int site=0; site < Layout::vol(); ++site)
216  {
217  multi1d<int> coord = crtesn(site, Layout::lattSize());
218  printf("[%d,%d,%d,%d] \n",
219  coord[0],coord[1],coord[2],coord[3] ) ;
220  psi_local = peekSite(psi,coord) ;
221  psi_color = peekSpin(psi_local,0) ;
222  for(int i=0 ; i < Nc ; ++i)
223  {
224  z = peekColor(psi_color,i) ;
225  QDPIO::cout << i << " " << z << std::endl;
226  }
227 
228  }
229 
230 
231 
232 }
233 
234 
235 //
236 // Staggered wall source from Gupta paper
237 // This is known as an even source
238 // This is a copy of the routine in the MILC code.
239 //
240 
241 void walfil_q(LatticeStaggeredFermion& a, int slice, int mu, int color_index)
242 {
243  START_CODE();
244 
245  if (color_index >= Nc || color_index < 0)
246  QDP_error_exit("invalid color index", color_index);
247 
248  int spin_index = 0 ;
249 
250  // Write ONE to all field
251  Real nnn = -1/4.0 ;
252  Complex sitecomp = cmplx(nnn,0);
253  ColorVector sitecolor = zero;
254  StaggeredFermion sitefield = zero;
255 
256  pokeSpin(sitefield,
257  pokeColor(sitecolor,sitecomp,color_index),
258  spin_index);
259 
260  // Narrow the context to the desired slice.
261  LatticeStaggeredFermion tmp;
262  tmp = sitefield; // QDP (not installed version) now supports construct OLattice = OScalar
263 
264  // Auxiliary: Coordinates to use in "where" clauses
265  multi1d<LatticeInteger> x(Nd);
266  // Fill x with lattice coordinates
267  for( int sigma = 0; sigma < Nd; sigma++) {
268  x[ sigma ] = Layout::latticeCoordinate(sigma);
269  }
270 
271  a = where(Layout::latticeCoordinate(mu) == slice &&
272  (x[0]+x[1]+x[2] ) % 2 == 0,
273  tmp, LatticeStaggeredFermion(zero));
274 
275 
276  END_CODE();
277 }
278 
279 
280 
281 //
282 // Staggered wall source from Gupta paper
283 // This is known as an odd source
284 //
285 void walfil_o(LatticeStaggeredFermion& a, int slice, int mu, int color_index)
286 {
287  START_CODE();
288 
289  if (color_index >= Nc || color_index < 0)
290  QDP_error_exit("invalid color index", color_index);
291 
292  int spin_index = 0 ;
293 
294  // Write ONE to all field
295  Real nnn = -1/4.0 ;
296  Complex sitecomp = cmplx(nnn,0);
297  ColorVector sitecolor = zero;
298  StaggeredFermion sitefield = zero;
299 
300  pokeSpin(sitefield,
301  pokeColor(sitecolor,sitecomp,color_index),
302  spin_index);
303 
304  // Narrow the context to the desired slice.
305  LatticeStaggeredFermion tmp;
306  tmp = sitefield; // QDP (not installed version) now supports construct OLattice = OScalar
307 
308  // Auxiliary: Coordinates to use in "where" clauses
309  multi1d<LatticeInteger> x(Nd);
310  // Fill x with lattice coordinates
311  for( int sigma = 0; sigma < Nd; sigma++) {
312  x[ sigma ] = Layout::latticeCoordinate(sigma);
313  }
314 
315  a = where(Layout::latticeCoordinate(mu) == slice &&
316  (x[0]+x[1]+x[2] ) % 2 == 1 ,
317  tmp, LatticeStaggeredFermion(zero));
318 
319  END_CODE();
320 }
321 
322 //
323 // Putt all 1's in the main hypercube
324 //
325 
326 void srcfil_local_o(LatticeStaggeredFermion& a, int slice, int mu,
327  int color_index)
328 {
329 
330  Real one = -1;
331  Complex sitecomp = cmplx(one,0);
332  ColorVector sitecolor = zero;
333  StaggeredFermion sitefield = zero;
334 
335  a = zero ;
336 
337  const int spin_index = 0 ;
338  multi1d<int> coord(4) ;
339 
340  coord[3] = slice ;
341 
342 
343  coord[0] = 1 ; coord[1] = 0 ; coord[2] = 0 ;
344  sitecolor = zero; sitefield = zero;
345  pokeSite(a, pokeSpin(sitefield,
346  pokeColor(sitecolor,sitecomp,color_index),
347  spin_index), coord);
348 
349  coord[0] = 0 ; coord[1] = 1 ; coord[2] = 0 ;
350  sitecolor = zero; sitefield = zero;
351  pokeSite(a, pokeSpin(sitefield,
352  pokeColor(sitecolor,sitecomp,color_index),
353  spin_index), coord);
354 
355  coord[0] = 0 ; coord[1] = 0 ; coord[2] = 1 ;
356  sitecolor = zero; sitefield = zero;
357  pokeSite(a, pokeSpin(sitefield,
358  pokeColor(sitecolor,sitecomp,color_index),
359  spin_index), coord);
360 
361  coord[0] = 1 ; coord[1] = 1 ; coord[2] = 1 ;
362  sitecolor = zero; sitefield = zero;
363  pokeSite(a, pokeSpin(sitefield,
364  pokeColor(sitecolor,sitecomp,color_index),
365  spin_index), coord);
366 
367 }
368 
369 
370 
371 
372 
373 //
374 // Local even source
375 //
376 
377 void srcfil_local_q(LatticeStaggeredFermion& a, int slice, int mu,
378  int color_index)
379 {
380  Real one = -1;
381  Complex sitecomp = cmplx(one,0);
382 
383  a = zero ;
384 
385  ColorVector sitecolor = zero;
386  StaggeredFermion sitefield = zero;
387 
388  const int spin_index = 0 ;
389  multi1d<int> coord(4) ;
390 
391  coord[3] = slice ;
392 
393  coord[0] = 0 ; coord[1] = 0 ; coord[2] = 0 ;
394  sitecolor = zero; sitefield = zero;
395  pokeSite(a, pokeSpin(sitefield,
396  pokeColor(sitecolor,sitecomp,color_index),
397  spin_index), coord);
398 
399 
400  coord[0] = 1 ; coord[1] = 1 ; coord[2] = 0 ;
401  sitecolor = zero; sitefield = zero;
402  pokeSite(a, pokeSpin(sitefield,
403  pokeColor(sitecolor,sitecomp,color_index),
404  spin_index), coord);
405 
406 
407  coord[0] = 1 ; coord[1] = 0 ; coord[2] = 1 ;
408  sitecolor = zero; sitefield = zero;
409  pokeSite(a, pokeSpin(sitefield,
410  pokeColor(sitecolor,sitecomp,color_index),
411  spin_index), coord);
412 
413  coord[0] = 0 ; coord[1] = 1 ; coord[2] = 1 ;
414  sitecolor = zero; sitefield = zero;
415  pokeSite(a, pokeSpin(sitefield,
416  pokeColor(sitecolor,sitecomp,color_index),
417  spin_index), coord);
418 
419 }
420 
421 
422 void create_stagg_source(LatticeStaggeredFermion & q_source,
423  staggered_src_type src_type,
424  int color_source, int j_decay, int t_source)
425 {
426 
427  multi1d<int> coord(4) ;
428  coord[0] = 0 ;
429  coord[1] = 0 ;
430  coord[2] = 0 ;
431  coord[j_decay] = t_source ;
432 
433  q_source = zero ;
434  if( src_type == local_s )
435  {
436  // Use a point source
437  srcfil(q_source, coord, color_source);
438  }
439  else if( src_type == wall_s )
440  {
441  int src_index = 0 ;
442  walfil(q_source, t_source, j_decay, color_source, src_index);
443  }
444  else if( src_type == wall_q )
445  {
446  LatticeStaggeredFermion q_source_a , q_source_b ;
447  walfil_o(q_source_a, t_source, j_decay, color_source);
448  walfil_q(q_source_b, t_source, j_decay, color_source);
449  q_source = q_source_a + q_source_b ;
450  }
451  else if( src_type == local_q )
452  {
453  LatticeStaggeredFermion q_source_a , q_source_b ;
454  srcfil_local_q(q_source_a, t_source, j_decay, color_source);
455  srcfil_local_o(q_source_b, t_source, j_decay, color_source);
456  q_source = q_source_a + q_source_b ;
457  }
458  else
459  {
460  QDPIO::cerr << "Error, src_type " << src_type << " out of range" << std::endl;
461  exit(0) ;
462  }
463 
464 
465 }
466 
467 
468 
469 // ! Propagator generation
470  /*! \defgroup t_propagator_s Propagator generation
471  * \ingroup testsmain
472  *
473  * Main program for propagator generation.
474  */
475 
476  int main(int argc, char **argv)
477  {
478  // Put the machine into a known state
479  Chroma::initialize(&argc, &argv);
480 
481  linkageHack();
482  // Input parameter structure
483  Propagator_input_t input;
484 
485  // Instantiate xml reader for DATA
486  XMLReader xml_in ;
488  try
489  {
490  xml_in.open(in_name);
491  }
492  catch (...)
493  {
494  QDPIO::cerr << "Error reading input file " << in_name << std::endl;
495  QDPIO::cerr << "The input file name can be passed via the -i flag " << std::endl;
496  QDPIO::cerr << "The default name is ./DATA" << std::endl;
497  throw;
498  }
499 
500 
501  // Read the input file
502  try
503  {
504  read(xml_in, "/propagator", input);
505  }
506  catch (...)
507  {
508  QDPIO::cerr << "Error parsing the input file " << in_name << std::endl;
509  throw;
510  }
511  // Specify lattice size, shape, etc.
512  Layout::setLattSize(input.param.nrow);
513  Layout::create();
514 
515  // Read in the configuration along with relevant information.
516  multi1d<LatticeColorMatrix> u(Nd);
517 
518  XMLReader gauge_file_xml, gauge_xml;
519  gaugeStartup(gauge_file_xml, gauge_xml, u, input.cfg);
520 
521  if( input.param.gauge_trans )
522  {
523  QDPIO::cout << "DOING GAUGE TRANSFORM " << std::endl;
524  rgauge(u);
525  QDPIO::cout << "Random gauge transform on gauge fields done." << std::endl;
526 
527 
528  }
529 
530 
531  // Instantiate XML writer for the output file
532  XMLFileWriter& xml_out = Chroma::getXMLOutputInstance();
533  push(xml_out, "hadron_corr");
534 
535  // Write out the input
536  write(xml_out, "Input", xml_in);
537 
538  // Write out the config header
539  write(xml_out, "Config_info", gauge_xml);
540 
541  // Check if the gauge field configuration is unitarized
542  unitarityCheck(u);
543 
544  // Calculate some gauge invariant observables just for info.
545  MesPlq(xml_out, "Gauge_Observables", u);
546  xml_out.flush();
547 
548  // Fix to the coulomb gauge
549  int n_gf;
550  int j_decay = Nd-1;
551 
552  // Typedefs to save typing
553  typedef LatticeStaggeredFermion T;
554  typedef multi1d<LatticeColorMatrix> P;
555  typedef multi1d<LatticeColorMatrix> Q;
556 
557  //
558  // Initialize fermion action
559  //
560 
561  XMLReader fermact_reader ;
562  // Make a memory 'input stream' out of the XML, so we can open an
563  // XML Reader on it.
564  try{
565  std::istringstream is(input.param.fermact.xml);
566 
567  // Open a reader on the memory stream.
568  // XMLReader fermact_reader(is);
569  fermact_reader.open(is);
570  }
571  catch (...)
572  {
573  QDPIO::cerr << "Error reading first action name " << std::endl;
574  throw;
575  }
576 
577 
578  XMLReader fermact_reader_A ;
579  // Make a memory 'input stream' out of the XML, so we can open an
580  // XML Reader on it.
581  try{
582  std::istringstream is(input.param.fermact_A.xml);
583 
584  // Open a reader on the memory stream.
585  // XMLReader fermact_reader(is);
586  fermact_reader_A.open(is);
587  }
588  catch (...)
589  {
590  QDPIO::cerr << "Error reading first action name " << std::endl;
591  throw;
592  }
593 
594 
595  Handle< StaggeredTypeFermAct< T,P,Q> > fermact(TheStagTypeFermActFactory::Instance().createObject(input.param.fermact.id, fermact_reader, input.param.fermact.path));
596 
597  Handle< StaggeredTypeFermAct< T,P,Q> > fermact_A(TheStagTypeFermActFactory::Instance().createObject(input.param.fermact_A.id, fermact_reader_A, input.param.fermact_A.path));
598 
599  // Cast of a pointer to a reference?
600  StaggeredTypeFermAct<T,P,Q>& S_f = *(fermact);
601  StaggeredTypeFermAct<T,P,Q>& S_f_A = *(fermact_A);
602 
603  Real Mass = S_f.getQuarkMass() ;
604  Real Mass_A = S_f_A.getQuarkMass() ;
605 
606  LatticeStaggeredPropagator quark_propagator;
607  LatticeStaggeredPropagator quark_propagator_A;
608 
609  XMLBufferWriter xml_buf;
610  int ncg_had = 0;
611  int n_count;
612  int t_length = input.param.nrow[3];
613 
614  LatticeStaggeredFermion q_source, psi;
615 
616 
617  GroupXML_t inv_param;
618  {
619  XMLBufferWriter xml_buf;
620  write(xml_buf, "InvertParam", input.param.invParam);
621  XMLReader xml_in(xml_buf);
622  inv_param = readXMLGroup(xml_in, "/InvertParam", "invType");
623  }
624 
625  Handle< FermState<T,P,Q> > state(S_f.createState(u));
626  Handle< SystemSolver<LatticeStaggeredFermion> > qprop(S_f.qprop(state,inv_param));
627 
628  Handle< FermState<T,P,Q> > state_A(S_f_A.createState(u));
629  Handle< SystemSolver<LatticeStaggeredFermion> > qprop_A(S_f_A.qprop(state,inv_param));
630 
631 
632  /** do inversions **************************/
633  multi1d<int> coord(4) ;
634  coord[0] = 0 ;
635  coord[1] = 0 ;
636  coord[2] = 0 ;
637  coord[j_decay] = input.param.t_srce ;
638  int t_source = input.param.t_srce ;
639  QDPIO::cout << "Source time slice = " << input.param.t_srce << std::endl;
640 
641  psi = zero; // note this is ``zero'' and not 0
642 
643  //
644  // Loop over the source color, creating the source
645  // and calling the relevant propagator routines.
646  //
647 
648  push(xml_out, "first_inversion");
649 
650  push(xml_out,"Inverter_properties");
651  write(xml_out, "Type_of_source",input.param.src_type_str);
652  write(xml_out, "Mass" , Mass);
653  write(xml_out, "RsdCG", input.param.invParam.RsdCG);
654  write(xml_out, "SrcType", input.param.src_type_str);
655  pop(xml_out);
656 
657  for(int color_source = 0; color_source < Nc; ++color_source) {
658  QDPIO::cout << "Inversion[A] for Color = " << color_source << std::endl;
659 
660  create_stagg_source(q_source,input.param.src_type,
661  color_source, j_decay, t_source) ;
662 
663  // Use the last initial guess as the current guess
664 
665  // Compute the propagator for given source color/spin
666  SystemSolverResults_t res = (*qprop)(psi, q_source);
667  ncg_had += res.n_count;
668 
669  push(xml_out,"Inverter_performance");
670  write(xml_out, "color", color_source);
671  write(xml_out, "iterations", res.n_count);
672  write(xml_out, "Final_RsdCG", res.resid);
673  pop(xml_out);
674 
675  /*
676  * Move the solution to the appropriate components
677  * of quark propagator.
678  */
679  FermToProp(psi, quark_propagator, color_source);
680  } //color_source, first inversion
681 
682  pop(xml_out); // inversion information
683 
684  push(xml_out, "second_inversion");
685 
686  push(xml_out,"Inverter_properties");
687  write(xml_out, "Type_of_source", input.param.src_type_str);
688  write(xml_out, "Mass" , Mass);
689  write(xml_out, "RsdCG", input.param.invParam.RsdCG);
690  write(xml_out, "SrcType", input.param.src_type_str);
691  pop(xml_out);
692 
693  for(int color_source = 0; color_source < Nc; ++color_source) {
694  QDPIO::cout << "Inversion[B] for Color = " << color_source << std::endl;
695 
696  create_stagg_source(q_source,input.param.src_type,
697  color_source, j_decay, t_source) ;
698 
699 
700  /**DEBUG ** dump_text_src(q_source,input.param.nrow) ; exit(0) ; **/
701 
702  // Use the last initial guess as the current guess
703 
704  // Compute the propagator for given source color/spin
705  SystemSolverResults_t res = (*qprop_A)(psi, q_source);
706  ncg_had += res.n_count;
707 
708  push(xml_out,"Inverter_performance");
709  write(xml_out, "color", color_source);
710  write(xml_out, "iterations", res.n_count);
711  write(xml_out, "Final_RsdCG", res.resid);
712  pop(xml_out);
713 
714  /*
715  * Move the solution to the appropriate components
716  * of quark propagator.
717  */
718  FermToProp(psi, quark_propagator_A, color_source);
719  } //color_source, first inversion
720 
721  pop(xml_out); // second inversion information
722 
723  int Bc_spec = 0; // perhaps 1 or -1
724 
725 
726 
727 
728  {
729  push(xml_out, "Hadron_A") ;
730  write(xml_out, "source_time", t_source);
731  write(xml_out, "Mass_A" , Mass_A);
732 
733  staggered_local_pion pion(t_length,u) ;
734  pion.compute(quark_propagator_A,quark_propagator_A,j_decay) ;
735  pion.dump(t_source,xml_out) ;
736 
737  multi1d<Complex> barprop(t_length);
738 
739  // call the baryon_s function in baryon_s.cc
740  baryon_s(quark_propagator_A,quark_propagator_A,
741  quark_propagator_A,
742  barprop,coord, j_decay,Bc_spec) ;
743  write(xml_out, "baryon_corr", barprop) ;
744 
745  pop(xml_out); // Hadrons
746  }
747 
748 
749  {
750  push(xml_out, "Hadron_B") ;
751  write(xml_out, "source_time", t_source);
752  write(xml_out, "Mass" , Mass);
753 
754  staggered_local_pion pion(t_length,u) ;
755  pion.compute(quark_propagator,quark_propagator,j_decay) ;
756  pion.dump(t_source,xml_out) ;
757 
758  multi1d<Complex> barprop(t_length);
759 
760  // call the baryon_s function in baryon_s.cc
761  baryon_s(quark_propagator,quark_propagator,quark_propagator,
762  barprop,coord, j_decay,Bc_spec) ;
763  write(xml_out, "baryon_corr", barprop) ;
764 
765  pop(xml_out); // Hadrons
766  }
767 
768 
769  {
770  push(xml_out, "Hadron_ABB") ;
771  write(xml_out, "source_time", t_source);
772  write(xml_out, "Mass_A" , Mass_A);
773  write(xml_out, "Mass_B" , Mass);
774 
775  multi1d<Complex> barprop(t_length);
776 
777  // call the baryon_s function in baryon_s.cc
778  baryon_s(quark_propagator_A,quark_propagator,quark_propagator,
779  barprop,coord, j_decay,Bc_spec) ;
780  write(xml_out, "baryon_corr", barprop) ;
781 
782  pop(xml_out); // Hadrons
783  }
784 
785 
786  {
787  push(xml_out, "Hadron_AAB") ;
788  write(xml_out, "source_time", t_source);
789  write(xml_out, "Mass_A" , Mass_A);
790  write(xml_out, "Mass_B" , Mass);
791 
792  multi1d<Complex> barprop(t_length);
793 
794  // call the baryon_s function in baryon_s.cc
795  baryon_s(quark_propagator_A,quark_propagator_A,
796  quark_propagator,barprop,coord, j_decay,Bc_spec) ;
797  write(xml_out, "baryon_corr", barprop) ;
798 
799  pop(xml_out); // Hadrons
800  }
801 
802  //
803  // spin 3/2 baryons
804  //
805 
806  bool do_spin3by_2 = false ;
807  if( input.param.src_type == local_q ||
808  input.param.src_type == wall_q )
809  { do_spin3by_2 = true ; }
810 
811 
812 
813  // **************************************************
814  // Class 4 operator
815  // **************************************************
816 
817 
818  if( do_spin3by_2 )
819  {
820  push(xml_out, "Hadron_class4_AAB") ;
821  write(xml_out, "source_time", t_source);
822  write(xml_out, "Mass_A" , Mass_A);
823  write(xml_out, "Mass_B" , Mass);
824 
825  multi1d<Complex> barprop(t_length);
826 
827  // call the baryon_s function in baryon_s.cc
828  baryon_class4_s(quark_propagator_A,
829  quark_propagator_A,
830  quark_propagator,
831  barprop,coord, j_decay,Bc_spec) ;
832  write(xml_out, "baryon_corr", barprop) ;
833 
834  pop(xml_out); // Hadrons
835  }
836 
837 
838 
839  if( do_spin3by_2 )
840  {
841  push(xml_out, "Hadron_class4_ABB") ;
842  write(xml_out, "source_time", t_source);
843  write(xml_out, "Mass_A" , Mass_A);
844  write(xml_out, "Mass_B" , Mass);
845 
846  multi1d<Complex> barprop(t_length);
847 
848  // call the baryon_s function in baryon_s.cc
849  baryon_class4_s(quark_propagator_A,
850  quark_propagator,
851  quark_propagator,
852  barprop,coord, j_decay,Bc_spec) ;
853  write(xml_out, "baryon_corr", barprop) ;
854 
855  pop(xml_out); // Hadrons
856  }
857 
858 
859 
860  if( do_spin3by_2 )
861  {
862  push(xml_out, "Hadron_class4_BBB") ;
863  write(xml_out, "source_time", t_source);
864  write(xml_out, "Mass_B" , Mass);
865 
866  multi1d<Complex> barprop(t_length);
867 
868  // call the baryon_s function in baryon_s.cc
869  baryon_class4_s(quark_propagator,
870  quark_propagator,
871  quark_propagator,
872  barprop,coord, j_decay,Bc_spec) ;
873  write(xml_out, "baryon_corr", barprop) ;
874 
875  pop(xml_out); // Hadrons
876  }
877 
878 
879 
880 
881 
882  if( do_spin3by_2 )
883  {
884  push(xml_out, "Hadron_class4_AAA") ;
885  write(xml_out, "source_time", t_source);
886  write(xml_out, "Mass_A" , Mass_A);
887 
888  multi1d<Complex> barprop(t_length);
889 
890  // call the baryon_s function in baryon_s.cc
891  baryon_class4_s(quark_propagator_A,quark_propagator_A,
892  quark_propagator_A,barprop,coord, j_decay,Bc_spec) ;
893  write(xml_out, "baryon_corr", barprop) ;
894 
895  pop(xml_out); // Hadrons
896  }
897 
898 
899 
900  // **************************************************
901  // Class 7 operator
902  // **************************************************
903 
904 
905  if( do_spin3by_2 )
906  {
907  push(xml_out, "Hadron_class7_AAB") ;
908  write(xml_out, "source_time", t_source);
909  write(xml_out, "Mass_A" , Mass_A);
910  write(xml_out, "Mass_B" , Mass);
911 
912  multi1d<Complex> barprop(t_length);
913 
914  // call the baryon_s function in baryon_s.cc
915  baryon_class7_s(quark_propagator_A,quark_propagator_A,
916  quark_propagator,barprop,coord, j_decay,Bc_spec) ;
917  write(xml_out, "baryon_corr", barprop) ;
918 
919  pop(xml_out); // Hadrons
920  }
921 
922 
923  if( do_spin3by_2 )
924  {
925  push(xml_out, "Hadron_class7_ABB") ;
926  write(xml_out, "source_time", t_source);
927  write(xml_out, "Mass_A" , Mass_A);
928  write(xml_out, "Mass_B" , Mass);
929 
930  multi1d<Complex> barprop(t_length);
931 
932  // call the baryon_s function in baryon_s.cc
933  baryon_class7_s(quark_propagator_A,quark_propagator,
934  quark_propagator,barprop,coord, j_decay,Bc_spec) ;
935  write(xml_out, "baryon_corr", barprop) ;
936 
937  pop(xml_out); // Hadrons
938  }
939 
940 
941 
942 
943  if( do_spin3by_2 )
944  {
945  push(xml_out, "Hadron_class7_AAA") ;
946  write(xml_out, "source_time", t_source);
947  write(xml_out, "Mass_A" , Mass_A);
948 
949  multi1d<Complex> barprop(t_length);
950 
951  // call the baryon_s function in baryon_s.cc
952  baryon_class7_s(quark_propagator_A,
953  quark_propagator_A,
954  quark_propagator_A,
955  barprop,coord, j_decay,Bc_spec) ;
956  write(xml_out, "baryon_corr", barprop) ;
957 
958  pop(xml_out); // Hadrons
959  }
960 
961 
962 
963 
964  if( do_spin3by_2 )
965  {
966  push(xml_out, "Hadron_class7_BBB") ;
967  write(xml_out, "source_time", t_source);
968  write(xml_out, "Mass_B" , Mass);
969 
970  multi1d<Complex> barprop(t_length);
971 
972  // call the baryon_s function in baryon_s.cc
973  baryon_class7_s(quark_propagator,
974  quark_propagator,
975  quark_propagator,
976  barprop,coord, j_decay,Bc_spec) ;
977  write(xml_out, "baryon_corr", barprop) ;
978 
979  pop(xml_out); // Hadrons
980  }
981 
982 
983 
984 
985 
986  // **************************************************
987  // Class 7 NLT operator
988  // **************************************************
989 
990 
991  if( do_spin3by_2 )
992  {
993  push(xml_out, "Hadron_class7_NLT_AAB") ;
994  write(xml_out, "source_time", t_source);
995  write(xml_out, "Mass_A" , Mass_A);
996  write(xml_out, "Mass_B" , Mass);
997 
998  multi1d<Complex> barprop(t_length);
999 
1000  // call the baryon_s function in baryon_s.cc
1001  baryon_class7_NLT_s(quark_propagator_A,quark_propagator_A,
1002  quark_propagator,u,barprop,coord, j_decay,Bc_spec) ;
1003  write(xml_out, "baryon_corr", barprop) ;
1004 
1005  pop(xml_out); // Hadrons
1006  }
1007 
1008 
1009  if( do_spin3by_2 )
1010  {
1011  push(xml_out, "Hadron_class7_NLT_ABB") ;
1012  write(xml_out, "source_time", t_source);
1013  write(xml_out, "Mass_A" , Mass_A);
1014  write(xml_out, "Mass_B" , Mass);
1015 
1016  multi1d<Complex> barprop(t_length);
1017 
1018  // call the baryon_s function in baryon_s.cc
1019  baryon_class7_NLT_s(quark_propagator_A,quark_propagator,
1020  quark_propagator,u,barprop,coord, j_decay,Bc_spec) ;
1021  write(xml_out, "baryon_corr", barprop) ;
1022 
1023  pop(xml_out); // Hadrons
1024  }
1025 
1026 
1027 
1028 
1029  if( do_spin3by_2 )
1030  {
1031  push(xml_out, "Hadron_class7_NLT_AAA") ;
1032  write(xml_out, "source_time", t_source);
1033  write(xml_out, "Mass_A" , Mass_A);
1034 
1035  multi1d<Complex> barprop(t_length);
1036 
1037  // call the baryon_s function in baryon_s.cc
1038  baryon_class7_NLT_s(quark_propagator_A,
1039  quark_propagator_A,
1040  quark_propagator_A,u,
1041  barprop,coord, j_decay,Bc_spec) ;
1042  write(xml_out, "baryon_corr", barprop) ;
1043 
1044  pop(xml_out); // Hadrons
1045  }
1046 
1047 
1048 
1049 
1050  if( do_spin3by_2 )
1051  {
1052  push(xml_out, "Hadron_class7_NLT_BBB") ;
1053  write(xml_out, "source_time", t_source);
1054  write(xml_out, "Mass_B" , Mass);
1055 
1056  multi1d<Complex> barprop(t_length);
1057 
1058  // call the baryon_s function in baryon_s.cc
1059  baryon_class7_NLT_s(quark_propagator,
1060  quark_propagator,
1061  quark_propagator,u,
1062  barprop,coord, j_decay,Bc_spec) ;
1063  write(xml_out, "baryon_corr", barprop) ;
1064 
1065  pop(xml_out); // Hadrons
1066  }
1067 
1068 
1069 
1070 
1071 
1072  // ***** ------- ********** ----- ****** ----------------
1073  pop(xml_out);
1074 
1075  xml_in.close();
1076  xml_out.close();
1077 
1078  // Time to bolt
1079  Chroma::finalize();
1080 
1081  exit(0);
1082 }
Primary include file for CHROMA in application codes.
virtual SystemSolver< T > * qprop(Handle< FermState< T, P, Q > > state, const GroupXML_t &invParam) const
Return quark prop solver, solution of unpreconditioned system.
virtual FermState< T, P, Q > * createState(const Q &q) const
Given links (coordinates Q) create the state needed for the linear operators.
Definition: fermact.h:59
Class for counted reference semantics.
Definition: handle.h:33
static T & Instance()
Definition: singleton.h:432
Staggered-like fermion actions.
Definition: fermact.orig.h:644
virtual const Real getQuarkMass() const =0
Return the quark mass.
void dump(int t_source, XMLWriter &xml_out)
Definition: hadron_corr_s.h:33
void compute(LatticeStaggeredPropagator &quark_prop_A, LatticeStaggeredPropagator &quark_prop_B, int j_decay)
Definition: pion_local_s.cc:56
int mu
Definition: cool.cc:24
void FermToProp(const LatticeFermionF &a, LatticePropagatorF &b, int color_index, int spin_index)
Insert a LatticeFermion into a LatticePropagator.
Definition: transf.cc:98
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
void unitarityCheck(const multi1d< LatticeColorMatrixF3 > &u)
Check the unitarity of color matrix in SU(N)
Definition: unit_check.cc:20
void rgauge(multi1d< LatticeColorMatrix > &u, LatticeColorMatrix &g)
Do a random gauge transformation on the u fields.
Definition: rgauge.cc:24
void gaugeStartup(XMLReader &gauge_file_xml, XMLReader &gauge_xml, multi1d< LatticeColorMatrix > &u, Cfg_t &cfg)
Initialize the gauge fields.
CfgType
Configuration type.
GroupXML_t readXMLGroup(XMLReader &xml_in, const std::string &path, const std::string &type_name)
Read group and return as a std::string.
void walfil(LatticeStaggeredFermion &a, int slice, int mu, int color_index, int src_index)
Fill a specific color and spin index with 1.0 on a wall.
Definition: walfil_s.cc:36
void srcfil(LatticeFermion &a, const multi1d< int > &coord, int color_index, int spin_index)
Fill a specific color and spin index with 1.0.
Definition: srcfil.cc:23
int z
Definition: meslate.cc:36
multi1d< int > coord(Nd)
int j_decay
Definition: meslate.cc:22
int x
Definition: meslate.cc:34
Nd
Definition: meslate.cc:74
bool registerAll()
Register all the factories.
bool registerAll()
Register all the factories.
multi1d< LatticeColorMatrix > P
multi1d< int > coords(const int x, const int y, const int z, const int t)
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
void baryon_class7_s(LatticeStaggeredPropagator &quark_propagator_in_a, LatticeStaggeredPropagator &quark_propagator_in_b, LatticeStaggeredPropagator &quark_propagator_in_c, multi1d< Complex > &barprop, multi1d< int > &t_source, int j_decay, int bc_spec)
QDP_error_exit("too many BiCG iterations", n_count, rsd_sq, cp, c, re_rvr, im_rvr, re_a, im_a, re_b, im_b)
static multi1d< LatticeColorMatrix > u
int n_count
Definition: invbicg.cc:78
LinOpSysSolverMGProtoClover::Q Q
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > const multi1d< Real > & Mass
Definition: pbg5p_w.cc:29
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
Double one
Definition: invbicg.cc:105
push(xml_out,"Condensates")
void baryon_s(LatticeStaggeredPropagator &quark_propagator_in, multi1d< Complex > &barprop, multi1d< int > &t_source, int j_decay, int bc_spec)
Definition: baryon_s.cc:51
LinOpSysSolverMGProtoClover::T T
int i
Definition: pbg5p_w.cc:55
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
bool linkageHack(void)
Definition: const_hmc.cc:660
Complex a
Definition: invbicg.cc:95
std::string getXMLInputFileName()
Get input file name.
Definition: chroma_init.cc:88
LatticeFermion psi
Definition: mespbg5p_w.cc:35
pop(xml_out)
void MesPlq(const multi1d< LatticeColorMatrixF3 > &u, multi2d< Double > &plane_plaq, Double &link)
Definition: mesplq.cc:83
void baryon_class4_s(LatticeStaggeredPropagator &quark_propagator_in_a, LatticeStaggeredPropagator &quark_propagator_in_b, LatticeStaggeredPropagator &quark_propagator_in_c, multi1d< Complex > &barprop, multi1d< int > &t_source, int j_decay, int bc_spec)
void baryon_class7_NLT_s(LatticeStaggeredPropagator &quark_propagator_in_a, LatticeStaggeredPropagator &quark_propagator_in_b, LatticeStaggeredPropagator &quark_propagator_in_c, multi1d< LatticeColorMatrix > &u, multi1d< Complex > &barprop, multi1d< int > &t_source, int j_decay, int bc_spec)
START_CODE()
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
XMLFileWriter & getXMLOutputInstance()
Get xml output instance.
Definition: chroma_init.cc:359
const WilsonTypeFermAct< multi1d< LatticeFermion > > & S_f
Definition: pbg5p_w.cc:27
Double zero
Definition: invbicg.cc:106
::std::string string
Definition: gtest.h:1979
Gauge configuration structure.
Definition: cfgtype_io.h:16
Hold group xml and type id.
Params for CG inverter.
Holds return info from SystemSolver call.
Definition: syssolver.h:17
Parameters for running program.
Definition: qpropadd.cc:17
std::string src_type_str
staggered_src_type src_type
GroupXML_t fermact_A
bool gauge_trans
SysSolverCGParams invParam
multi1d< int > t_srce
multi1d< int > nrow
Definition: qpropadd.cc:18
GroupXML_t fermact
staggered_src_type
@ wall_o_and_q
@ local_s
@ local_o_and_q
@ wall_s
@ local_q
@ wall_q
@ local_o
@ wall_o
int main(int argc, char **argv)
void create_stagg_source(LatticeStaggeredFermion &q_source, staggered_src_type src_type, int color_source, int j_decay, int t_source)
void walfil_q(LatticeStaggeredFermion &a, int slice, int mu, int color_index)
void dump_text_src(LatticeStaggeredFermion psi, multi1d< int > nrow)
void srcfil_local_q(LatticeStaggeredFermion &a, int slice, int mu, int color_index)
void walfil_o(LatticeStaggeredFermion &a, int slice, int mu, int color_index)
void srcfil_local_o(LatticeStaggeredFermion &a, int slice, int mu, int color_index)
Read an XML group as a std::string.