CHROMA
lcm_4mn4fp_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 LatColMat4MN4FPRecursiveIntegratorEnv
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_4MN4FP";
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  rho = Real(0.1786178958448091);
53  theta = Real(-0.06626458266981843);
54  lambda = Real(0.7123418310626056);
55 
56  try {
57  read(paramtop, "./n_steps", n_steps);
58  read(paramtop, "./monomial_ids", monomial_ids);
59 
60  // Override default tuning values if desired
61  if ( paramtop.count("./theta") > 0 ) {
62  read(paramtop, "./theta", theta);
63  }
64  if ( paramtop.count("./rho") > 0 ) {
65  read(paramtop, "./rho", rho);
66  }
67  if ( paramtop.count("./lambda") > 0 ) {
68  read(paramtop, "./lambda", lambda);
69  }
70 
71  if( paramtop.count("./SubIntegrator") == 0 ) {
72  // BASE CASE: User does not supply sub-integrator
73  //
74  // Sneaky way - create an XML document for EXP_T
75  XMLBufferWriter subintegrator_writer;
76  int one_sub_step=1;
77 
78  push(subintegrator_writer, "SubIntegrator");
79  write(subintegrator_writer, "Name", "LCM_EXP_T");
80  write(subintegrator_writer, "n_steps", one_sub_step);
81 
82  pop(subintegrator_writer);
83 
84  subintegrator_xml = subintegrator_writer.str();
85 
86  }
87  else {
88  // RECURSIVE CASE: User Does Supply Sub Integrator
89  //
90  // Read it
91  XMLReader subint_reader(paramtop, "./SubIntegrator");
92 
93  std::ostringstream subintegrator_os;
94 
95  subint_reader.print(subintegrator_os);
96  subintegrator_xml = subintegrator_os.str();
97  QDPIO::cout << "Subintegrator XML is: " << std::endl;
98  QDPIO::cout << subintegrator_xml << std::endl;
99  }
100  }
101  catch ( const std::string& e ) {
102  QDPIO::cout << "Error reading XML in LatColMat4MN4FPRecursiveIntegratorParams " << e << std::endl;
103  QDP_abort(1);
104  }
105  }
106 
107  void read(XMLReader& xml,
108  const std::string& path,
111  p = tmp;
112  }
113 
114  void write(XMLWriter& xml,
115  const std::string& path,
117  push(xml, path);
118  write(xml, "n_steps", p.n_steps);
119  write(xml, "monomial_ids", p.monomial_ids);
120  write(xml, "theta", p.theta);
121  write(xml, "rho", p.rho);
122  write(xml, "lambda", p.lambda);
123 
124  xml << p.subintegrator_xml;
125 
126  pop(xml);
127  }
128 
129 
131  AbsFieldState<multi1d<LatticeColorMatrix>,
132  multi1d<LatticeColorMatrix> >& s,
133  const Real& traj_length) const
134  {
135 
136  START_CODE();
137  LatColMatExpSdtIntegrator expSdt(1,
138  monomials); // Single Step
139 
141  multi1d<LatticeColorMatrix> >& subIntegrator = getSubIntegrator();
142 
143 
144 
145 
146  Real dtau = traj_length / params.n_steps;
147 
148  // Various timestep combinations
149  Real theta_dtau = params.theta * dtau;
150  Real rho_dtau = params.rho * dtau;
151  Real lambda_dtau = params.lambda * dtau;
152 
153 
154  Real one_minus_two_lambda_dtau_by2 = (Real(1)-Real(2)*params.lambda)*dtau/Real(2);
155 
156  Real one_minus_two_theta_plus_rho_dtau = (Real(1)-Real(2)*(params.theta+params.rho))*dtau;
157 
158  Real two_rho_dtau= Real(2)*rho_dtau;
159 
160  // From deForcrand-Takaishi paper (eq 24)
161  // But unrolled
162  // Map exp( V ) -> expS
163  // Map exp( T ) -> subIntegrator() (eg at lowest level of recursion)
164 
165  subIntegrator(s, rho_dtau);
166  expSdt(s, lambda_dtau);
167  subIntegrator(s, theta_dtau);
168  expSdt(s, one_minus_two_lambda_dtau_by2 );
169  subIntegrator(s, one_minus_two_theta_plus_rho_dtau);
170  expSdt(s, one_minus_two_lambda_dtau_by2 );
171  subIntegrator(s, theta_dtau);
172  expSdt(s, lambda_dtau);
173 
174  for(int steps = 0; steps < params.n_steps-1; ++steps) {
175  subIntegrator(s, two_rho_dtau);
176  expSdt(s, lambda_dtau);
177  subIntegrator(s, theta_dtau);
178  expSdt(s, one_minus_two_lambda_dtau_by2 );
179  subIntegrator(s, one_minus_two_theta_plus_rho_dtau);
180  expSdt(s, one_minus_two_lambda_dtau_by2 );
181  subIntegrator(s, theta_dtau);
182  expSdt(s, lambda_dtau);
183 
184  }
185 
186  subIntegrator(s, rho_dtau);
187 
188  END_CODE();
189 
190  }
191 
192 
193 }
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 4 Force Min. Norm. Integrator (position variant)
multi1d< IntegratorShared::MonomialPair > monomials
AbsComponentIntegrator< multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > & getSubIntegrator() const
Return the next level down integrator.
void operator()(AbsFieldState< multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &s, const Real &traj_length) const
Do an integration of lenght n*delta tau in n steps.
LatColMat4MN4FPRecursiveIntegratorParams params
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 4 force calculation minimum norm integrator.
Intgrator for exp(S dt)
Integrator factories.
static bool registered
Local registration flag.
bool registerAll()
Register all the factories.
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()
multi1d< LatticeFermion > s(Ncb)
::std::string string
Definition: gtest.h:1979
Singleton instances of xml output.