CHROMA
t_gfix.cc
Go to the documentation of this file.
1 /// $Id: t_gfix.cc,v 3.0 2006-04-03 04:59:14 edwards Exp $
2 
3 #include <iostream>
4 #include <cstdio>
5 
6 #include "chroma.h"
7 
8 using namespace Chroma;
9 
10 int main(int argc, char *argv[])
11 {
12  // Put the machine into a known state
13  Chroma::initialize(&argc, &argv);
14 
15  // Read the lattice size
16  multi1d<int> nrow(Nd);
17  QDPIO::cout << "Enter lattice size" << std::endl;
18  QDPIO::cin >> nrow;
19 
20  // Setup the layout
21  Layout::setLattSize(nrow);
22  Layout::create();
23 
24  int type;
25  QDPIO::cout << "Enter Gauge field type\n"
26  << " (1) Free field\n"
27  << " (2) Random-transformed free field\n"
28  << " (3) Hot start (call hotst)\n"
29  << " (4) SZIN configuration\n"
30  << " (5) NERSC configuration" << std::endl;
31  QDPIO::cin >> type;
32 
33  int j_decay;
34  QDPIO::cout << "Enter the direction of decay" << std::endl;
35  QDPIO::cin >> j_decay;
36 
37  Real GFAccu;
38  QDPIO::cout << "Enter the gauge fixing accuracy" << std::endl;
39  QDPIO::cin >> GFAccu;
40 
41  int GFMax;
42  QDPIO::cout << "Enter the maximum number of gauge fixing sweeps" << std::endl;
43  QDPIO::cin >> GFMax;
44 
45  bool OrlxDo;
46  QDPIO::cout << "Want over-relaxation? (yes=YES)" << std::endl;
47  QDPIO::cin >> OrlxDo;
48 
49  Real OrPara = 1;
50  if (OrlxDo)
51  {
52  QDPIO::cout << "Enter the over-relaxtion parameter" << std::endl;
53  QDPIO::cin >> OrPara;
54  }
55 
56  QDPIO::cout << "Now, I am running..." << std::endl;
57 
58  XMLFileWriter xml_out("t_gfix.xml");
59  push(xml_out, "t_gfix");
60 
61  push(xml_out,"Lattice_dimensions");
62  write(xml_out,"Nc", Nc);
63  write(xml_out,"Nd", Nd);
64  write(xml_out, "nrow", nrow);
65  pop(xml_out);
66 
67  multi1d<LatticeColorMatrix> u(Nd); // Gauge field
68  LatticeColorMatrix g;
69 
70  switch (type)
71  {
72  case 1:
73  push(xml_out,"Free_Field");
74  write(xml_out, "type", type);
75  pop(xml_out);
76  QDPIO::cout << "Fill u with free field" << std::endl;
77  u = 1;
78  break;
79 
80  case 2:
81  push(xml_out,"Free_Field_with_random_gauge_transformation");
82  write(xml_out, "type", type);
83  pop(xml_out);
84  QDPIO::cout << "Fill u with random gauge transformed free field" << std::endl;
85  u = 1;
86  rgauge(u, g);
87  break;
88 
89  case 3:
90  push(xml_out,"Semi-Haar_measure");
91  write(xml_out, "type", type);
92  pop(xml_out);
93  QDPIO::cout << "Fill u with semi-Haar" << std::endl;
94  HotSt(u);
95  break;
96 
97  case 4:
98  {
99  std::string cfg_file_in;
100  QDPIO::cout << "Enter SZIN input file name" << std::endl;
101  QDPIO::cin >> cfg_file_in;
102 
103  push(xml_out,"Configuration");
104  write(xml_out, "type", type);
105  pop(xml_out);
106  QDPIO::cout << "Read SZIN config from " << cfg_file_in << std::endl;
107 
108  XMLReader gauge_xml;
109  readSzin(gauge_xml, u, cfg_file_in);
110  }
111  break;
112 
113  case 5:
114  {
115  std::string cfg_file_in;
116  QDPIO::cout << "Enter NERSC input file name" << std::endl;
117  QDPIO::cin >> cfg_file_in;
118 
119  push(xml_out,"Configuration");
120  write(xml_out, "type", type);
121  pop(xml_out);
122  QDPIO::cout << "Read NERSC config from " << cfg_file_in << std::endl;
123 
124  XMLReader gauge_xml;
125  readArchiv(gauge_xml, u, cfg_file_in);
126  }
127  break;
128 
129  default:
130  QDP_error_exit("unknown type", type);
131  }
132 
133  std::string cfg_file_out;
134  QDPIO::cout << "Enter NERSC output file name" << std::endl;
135  QDPIO::cin >> cfg_file_out;
136 
137 
138  push(xml_out,"Gfix_parameters");
139  write(xml_out, "j_decay", j_decay);
140  write(xml_out, "GFAccu", GFAccu);
141  write(xml_out, "GFMax", GFMax);
142  write(xml_out, "OrlxDo", OrlxDo);
143  write(xml_out, "OrPara", OrPara);
144  pop(xml_out);
145 
148  QDPIO::cout << " Initial plaqettes and link: " << w_plaq
149  << " " << s_plaq << " " << t_plaq << " " << link << std::endl;
150 
151  push(xml_out,"Initial_gauge_invariant_observables");
152  write(xml_out, "w_plaq", w_plaq);
153  write(xml_out, "s_plaq", s_plaq);
154  write(xml_out, "t_plaq", t_plaq);
155  write(xml_out, "link", link);
156  pop(xml_out);
157 
158  // Now gauge fix
159  int nrl_gf;
160  coulGauge(u, nrl_gf, j_decay, GFAccu, GFMax, OrlxDo, OrPara);
161 
163  QDPIO::cout << " Final plaqettes and link: " << w_plaq
164  << " " << s_plaq << " " << t_plaq << " " << link << std::endl;
165 
166  push(xml_out,"Final_gauge_invariant_observables");
167  write(xml_out, "w_plaq",w_plaq);
168  write(xml_out, "s_plaq", s_plaq);
169  write(xml_out, "t_plaq", t_plaq);
170  write(xml_out, "link", link);
171  pop(xml_out);
172 
173  push(xml_out,"Relaxation_iterations_in_GFIX");
174  write(xml_out, "nrl_gf", nrl_gf);
175  pop(xml_out);
176 
177  // Now write the gauge field in NERSC format
178  QDPIO::cout << "Trying to write NERSC Archive to file " << cfg_file_out << std::endl;
179  writeArchiv(u, cfg_file_out);
180 
181  pop(xml_out);
182 
183  // Time to bolt
185 
186  exit(0);
187 }
Primary include file for CHROMA in application codes.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
void rgauge(multi1d< LatticeColorMatrix > &u, LatticeColorMatrix &g)
Do a random gauge transformation on the u fields.
Definition: rgauge.cc:24
void HotSt(multi1d< LatticeColorMatrix > &u)
Set a gauge field from a sample of (almost) Haar measure.
Definition: hotst.cc:34
void coulGauge(multi1d< LatticeColorMatrix > &u, int &n_gf, int j_decay, const Real &GFAccu, int GFMax, bool OrDo, const Real &OrPara)
Coulomb (and Landau) gauge fixing.
Definition: coulgauge.cc:37
void readSzin(SzinGauge_t &header, multi1d< LatticeColorMatrix > &u, const std::string &cfg_file)
Read a SZIN configuration file.
Definition: readszin.cc:31
int j_decay
Definition: meslate.cc:22
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
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)
void MesPlq(const multi1d< LatticeColorMatrixF3 > &u, multi2d< Double > &plane_plaq, Double &link)
Definition: mesplq.cc:83
FloatingPoint< double > Double
Definition: gtest.h:7351
::std::string string
Definition: gtest.h:1979
Double link
Definition: pade_trln_w.cc:146
Double t_plaq
Definition: pade_trln_w.cc:145
Double w_plaq
Definition: pade_trln_w.cc:143
Double s_plaq
Definition: pade_trln_w.cc:144
int main(int argc, char *argv[])
Definition: t_gfix.cc:10