CHROMA
ExampleBuildingBlocks.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Main code for generating building blocks
3  */
4 
5 //###################################################################################//
6 //###################################################################################//
7 // //
8 // ExampleBuildingBlocks.cc //
9 // //
10 //###################################################################################//
11 //###################################################################################//
12 // //
13 // description: //
14 // //
15 // Note that the file name patterns for the u and d building blocks must be a std::string //
16 // of the form "...%c%i...%c%i...%c%i..." where the first %c%i corresponds to qz, //
17 // the second to qy, and the third to qx. //
18 // //
19 // history: //
20 // //
21 // There were at least four versions of "MIT" code. Andrew Pochinsky has a c //
22 // version. Dmitri Dolgov has a c++ version. Dru B. Renner has c and c++ versions. //
23 // All were independent and checked against one another. Of course, all were //
24 // developed under the guidance of John W. Negele. The code here is just the //
25 // "Building Blocks" portion of the MIT code. //
26 // //
27 // authors: //
28 // //
29 // Dru B. Renner, dru@mit.edu, 2002 - port of Building Blocks (MIT) code to qdp++ //
30 // //
31 // There are others who have contributed since the code has been migrated to qdp++. //
32 // The cvs log entries indicate these other authors. //
33 // //
34 //###################################################################################//
35 //###################################################################################//
36 
37 #include <iostream>
38 #include <string.h>
39 #include <assert.h>
40 #include "chroma.h"
41 
42 using namespace Chroma;
43 
44 //###################################################################################//
45 // Main Function //
46 //###################################################################################//
47 
48 //! Building blocks
49 /*! \defgroup buildingblocks Generate building blocks
50  * \ingroup main
51  *
52  * Main program for generating building blocks
53  */
54 
55 int main( int argc, char** argv )
56 {
57  // Put the machine into a known state
58  Chroma::initialize(&argc, &argv);
59 
60  START_CODE();
61 
62  // Instantiate xml reader for DATA
63  XMLReader xml_in(Chroma::getXMLInputFileName());
64 
65  // Read data
66  InlineBuildingBlocksParams input(xml_in, "/ExampleBuildingBlocks");
67  InlineBuildingBlocks meas(input);
68 
69  // Specify lattice size, shape, etc.
70  Layout::setLattSize(input.param.nrow);
71  Layout::create();
72 
73  // Read gauge field info
74  Cfg_t cfg;
75  try
76  {
77  read(xml_in, "/ExampleBuildingBlocks/Cfg", cfg);
78  }
79  catch(const std::string& e)
80  {
81  QDP_error_exit("Error reading in ExampleBuildingBlocks: %s", e.c_str());
82  }
83 
84  // Start up the gauge field
85  multi1d<LatticeColorMatrix> u(Nd);
86  XMLBufferWriter config_xml;
87  {
88  XMLReader gauge_file_xml, gauge_xml;
89 
90  QDPIO::cout << "Initialize Gauge field" << std::endl;
91  gaugeStartup(gauge_file_xml, gauge_xml, u, cfg);
92  QDPIO::cout << "Gauge field initialized!" << std::endl;
93 
94  config_xml << gauge_xml;
95  }
96 
97  // Check if the gauge field configuration is unitarized
99 
100  // Output
101  XMLFileWriter& xml_out = Chroma::getXMLOutputInstance();
102 
103  unsigned long cur_update = 0;
104  meas(u, config_xml, cur_update, xml_out);
105 
106  xml_out.flush();
107 
108  xml_in.close();
109  xml_out.close();
110 
111  END_CODE();
112 
113  // Time to bolt
115 
116  exit( 0 );
117 }
118 
119 //###################################################################################//
120 //###################################################################################//
int main(int argc, char **argv)
Primary include file for CHROMA in application codes.
Inline measurement of 3-pt functions writing building-blocks.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
void unitarityCheck(const multi1d< LatticeColorMatrixF3 > &u)
Check the unitarity of color matrix in SU(N)
Definition: unit_check.cc:20
void gaugeStartup(XMLReader &gauge_file_xml, XMLReader &gauge_xml, multi1d< LatticeColorMatrix > &u, Cfg_t &cfg)
Initialize the gauge fields.
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
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
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
std::string getXMLInputFileName()
Get input file name.
Definition: chroma_init.cc:88
START_CODE()
XMLFileWriter & getXMLOutputInstance()
Get xml output instance.
Definition: chroma_init.cc:359
::std::string string
Definition: gtest.h:1979
Gauge configuration structure.
Definition: cfgtype_io.h:16
struct Chroma::InlineBuildingBlocksParams::Param_t param