CHROMA
lcm_4mn5fp_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 LatColMat4MN5FPRecursiveIntegratorEnv
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_4MN5FP";
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  theta = Real(0.08398315262876693);
53  rho = Real(0.2539785108410595);
54  lambda = Real(0.6822365335719091);
55  mu = Real(-0.03230286765269967);
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  if ( paramtop.count("./mu") > 0 ) {
71  read(paramtop, "./mu", mu);
72  }
73 
74 
75  if( paramtop.count("./SubIntegrator") == 0 ) {
76  // BASE CASE: User does not supply sub-integrator
77  //
78  // Sneaky way - create an XML document for EXP_T
79  XMLBufferWriter subintegrator_writer;
80  int one_sub_step=1;
81 
82  push(subintegrator_writer, "SubIntegrator");
83  write(subintegrator_writer, "Name", "LCM_EXP_T");
84  write(subintegrator_writer, "n_steps", one_sub_step);
85 
86  pop(subintegrator_writer);
87 
88  subintegrator_xml = subintegrator_writer.str();
89 
90  }
91  else {
92  // RECURSIVE CASE: User Does Supply Sub Integrator
93  //
94  // Read it
95  XMLReader subint_reader(paramtop, "./SubIntegrator");
96 
97  std::ostringstream subintegrator_os;
98 
99  subint_reader.print(subintegrator_os);
100  subintegrator_xml = subintegrator_os.str();
101  QDPIO::cout << "Subintegrator XML is: " << std::endl;
102  QDPIO::cout << subintegrator_xml << std::endl;
103  }
104  }
105  catch ( const std::string& e ) {
106  QDPIO::cout << "Error reading XML in LatColMat4MN5FPRecursiveIntegratorParams " << e << std::endl;
107  QDP_abort(1);
108  }
109  }
110 
111  void read(XMLReader& xml,
112  const std::string& path,
115  p = tmp;
116  }
117 
118  void write(XMLWriter& xml,
119  const std::string& path,
121  push(xml, path);
122  write(xml, "n_steps", p.n_steps);
123  write(xml, "monomial_ids", p.monomial_ids);
124  write(xml, "theta", p.theta);
125  write(xml, "rho", p.rho);
126  write(xml, "lambda", p.lambda);
127  write(xml, "mu", p.mu);
128 
129  xml << p.subintegrator_xml;
130 
131  pop(xml);
132  }
133 
134 
136  AbsFieldState<multi1d<LatticeColorMatrix>,
137  multi1d<LatticeColorMatrix> >& s,
138  const Real& traj_length) const
139  {
140 
141  START_CODE();
142  LatColMatExpSdtIntegrator expSdt(1,
143  monomials); // Single Step
144 
146  multi1d<LatticeColorMatrix> >& subIntegrator = getSubIntegrator();
147 
148 
149 
150 
151  Real dtau = traj_length / params.n_steps;
152 
153  // Various timestep combinations
154  Real theta_dtau = params.theta * dtau;
155  Real two_theta_dtau = Real(2)*theta_dtau;
156  Real rho_dtau = params.rho * dtau;
157  Real lambda_dtau = params.lambda * dtau;
158  Real mu_dtau = params.mu*dtau;
159 
160  Real one_minus_two_lambda_plus_theta_dtau_by2 = (Real(1)-Real(2)*(params.lambda+params.theta))*dtau/Real(2);
161 
162  Real one_minus_two_mu_plus_rho_dtau = (Real(1)-Real(2)*(params.mu+params.rho))*dtau;
163 
164 
165  // From deForcrand-Takaishi paper (eq 24)
166  // But unrolled
167  // Map exp( V ) -> expS
168  // Map exp( T ) -> subIntegrator() (eg at lowest level of recursion)
169  subIntegrator(s, theta_dtau);
170 
171  expSdt(s, rho_dtau);
172 
173  subIntegrator(s, lambda_dtau);
174 
175  expSdt(s, mu_dtau);
176 
177  subIntegrator(s, one_minus_two_lambda_plus_theta_dtau_by2);
178 
179  expSdt(s, one_minus_two_mu_plus_rho_dtau);
180 
181  subIntegrator(s, one_minus_two_lambda_plus_theta_dtau_by2);
182 
183  expSdt(s, mu_dtau);
184 
185  subIntegrator(s, lambda_dtau);
186 
187  expSdt(s, rho_dtau);
188 
189  for(int step=0; step < params.n_steps-1; ++step) {
190  // One for the end of the previous and one for the start of current
191  subIntegrator(s, two_theta_dtau);
192 
193  expSdt(s, rho_dtau);
194 
195  subIntegrator(s, lambda_dtau);
196 
197  expSdt(s, mu_dtau);
198 
199  subIntegrator(s, one_minus_two_lambda_plus_theta_dtau_by2);
200 
201  expSdt(s, one_minus_two_mu_plus_rho_dtau);
202 
203  subIntegrator(s, one_minus_two_lambda_plus_theta_dtau_by2);
204 
205  expSdt(s, mu_dtau);
206 
207  subIntegrator(s, lambda_dtau);
208 
209  expSdt(s, rho_dtau);
210  }
211 
212  // Finish off the last one
213  subIntegrator(s, theta_dtau);
214 
215  END_CODE();
216 
217  }
218 
219 
220 }
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)
LatColMat4MN5FPRecursiveIntegratorParams 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.
multi1d< IntegratorShared::MonomialPair > monomials
AbsComponentIntegrator< multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > & getSubIntegrator() const
Return the next level down integrator.
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 5 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.