CHROMA
lcm_creutz_gocksch_4_recursive.cc
Go to the documentation of this file.
1 #include "chromabase.h"
5 #include "io/xmllog_io.h"
6 
7 #include <string>
8 
9 namespace Chroma
10 {
11 
12  namespace LatColMatCreutzGocksch4RecursiveIntegratorEnv
13  {
14  namespace
15  {
17  multi1d<LatticeColorMatrix> >*
18  createMDIntegrator(
19  XMLReader& xml,
20  const std::string& path)
21  {
22  // Read the integrator params
24 
26  }
27 
28  //! Local registration flag
29  bool registered = false;
30  }
31 
32  const std::string name = "LCM_CREUTZ_GOCKSCH_4";
33 
34  //! Register all the factories
35  bool registerAll()
36  {
37  bool success = true;
38  if (! registered)
39  {
40  success &= TheMDComponentIntegratorFactory::Instance().registerObject(name, createMDIntegrator);
41  registered = true;
42  }
43  return success;
44  }
45  }
46 
47 
49  {
50  XMLReader paramtop(xml_in, path);
51  // Default values for the tuning constants
52 
53  try {
54  read(paramtop, "./n_steps", n_steps);
55  read(paramtop, "./monomial_ids", monomial_ids);
56 
57  if( paramtop.count("./SubIntegrator") == 0 ) {
58  // BASE CASE: User does not supply sub-integrator
59  //
60  // Sneaky way - create an XML document for EXP_T
61  XMLBufferWriter subintegrator_writer;
62  int one_sub_step=1;
63 
64  push(subintegrator_writer, "SubIntegrator");
65  write(subintegrator_writer, "Name", "LCM_EXP_T");
66  write(subintegrator_writer, "n_steps", one_sub_step);
67 
68  pop(subintegrator_writer);
69 
70  subintegrator_xml = subintegrator_writer.str();
71 
72  }
73  else {
74  // RECURSIVE CASE: User Does Supply Sub Integrator
75  //
76  // Read it
77  XMLReader subint_reader(paramtop, "./SubIntegrator");
78 
79  std::ostringstream subintegrator_os;
80 
81  subint_reader.print(subintegrator_os);
82  subintegrator_xml = subintegrator_os.str();
83  QDPIO::cout << "Subintegrator XML is: " << std::endl;
84  QDPIO::cout << subintegrator_xml << std::endl;
85  }
86  }
87  catch ( const std::string& e ) {
88  QDPIO::cout << "Error reading XML in LatColMatCreutzGocksch4RecursiveIntegratorParams " << e << std::endl;
89  QDP_abort(1);
90  }
91  }
92 
93  void read(XMLReader& xml,
94  const std::string& path,
97  p = tmp;
98  }
99 
100  void write(XMLWriter& xml,
101  const std::string& path,
103  push(xml, path);
104  write(xml, "n_steps", p.n_steps);
105  write(xml, "monomial_ids", p.monomial_ids);
106 
107  xml << p.subintegrator_xml;
108 
109  pop(xml);
110  }
111 
112 
114  AbsFieldState<multi1d<LatticeColorMatrix>,
115  multi1d<LatticeColorMatrix> >& state,
116  const Real& traj_length) const
117  {
118 
119  START_CODE();
120  LatColMatExpSdtIntegrator expSdt(1,
121  monomials); // Single Step
122 
124  multi1d<LatticeColorMatrix> >& subIntegrator = getSubIntegrator();
125 
126 
127  Real one_by_three = Real(1)/Real(3);
128  Real cube_root_two = pow(Real(2), one_by_three);
129 
130  Real dtau = traj_length / params.n_steps;
131 
132 
133  Real s= dtau/(Real(2) - cube_root_two);
134  Real t = -cube_root_two*dtau/ (Real(2) - cube_root_two);
135 
136  Real half_s_plus_t = (s + t)/Real(2);
137  Real half_s = s/Real(2);
138 
139  expSdt(state, half_s);
140 
141  subIntegrator(state, s);
142 
143  expSdt(state, half_s_plus_t);
144 
145  subIntegrator(state, t);
146 
147  expSdt(state, half_s_plus_t);
148 
149  subIntegrator(state, s);
150 
151  for(int step=0; step < params.n_steps-1; ++step) {
152  // One for the end of the previous and one for the start of current
153  expSdt(state, s);
154 
155  subIntegrator(state, s);
156 
157  expSdt(state, half_s_plus_t);
158 
159  subIntegrator(state, t);
160 
161  expSdt(state, half_s_plus_t);
162 
163  subIntegrator(state, s);
164 
165 
166  }
167 
168  expSdt(state, half_s);
169 
170  END_CODE();
171 
172  }
173 
174 
175 }
Primary include file for CHROMA library code.
MD integrator that can be used as a component for other integrators.
Abstract field state.
Definition: field_state.h:27
MD integrator interface for 4th order 5 Force Min. Norm. Integrator (Velocity variant)
AbsComponentIntegrator< multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > & getSubIntegrator() const
Return the next level down integrator.
LatColMatCreutzGocksch4RecursiveIntegratorParams params
void operator()(AbsFieldState< multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &s, const Real &traj_length) const
Do an integration of lenght n*delta tau in n steps.
MD integrator interface for PQP leapfrog.
Definition: lcm_exp_sdt.h:58
static T & Instance()
Definition: singleton.h:432
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.
Lat Col Mat 4th order Creutz-Gocksch (Campostrini?) Integrator.
Intgrator for exp(S dt)
Integrator factories.
int t
Definition: meslate.cc:37
static bool registered
Local registration flag.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
pop(xml_out)
START_CODE()
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
multi1d< LatticeFermion > s(Ncb)
::std::string string
Definition: gtest.h:1979
Singleton instances of xml output.