CHROMA
lcm_tst_leapfrog_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 LatColMatTSTLeapfrogRecursiveIntegratorEnv
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_TST_LEAPFROG";
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  try {
52  read(paramtop, "./n_steps", n_steps);
53  read(paramtop, "./monomial_ids", monomial_ids);
54  if( paramtop.count("./SubIntegrator") == 0 ) {
55  // BASE CASE: User does not supply sub-integrator
56  //
57  // Sneaky way - create an XML document for EXP_T
58  XMLBufferWriter subintegrator_writer;
59  int one_sub_step=1;
60 
61  push(subintegrator_writer, "SubIntegrator");
62  write(subintegrator_writer, "Name", "LCM_EXP_T");
63  write(subintegrator_writer, "n_steps", one_sub_step);
64  pop(subintegrator_writer);
65 
66  subintegrator_xml = subintegrator_writer.str();
67 
68  }
69  else {
70  // RECURSIVE CASE: User Does Supply Sub Integrator
71  //
72  // Read it
73  XMLReader subint_reader(paramtop, "./SubIntegrator");
74 
75  std::ostringstream subintegrator_os;
76 
77  subint_reader.print(subintegrator_os);
78  subintegrator_xml = subintegrator_os.str();
79  QDPIO::cout << "Subintegrator XML is: " << std::endl;
80  QDPIO::cout << subintegrator_xml << std::endl;
81  }
82  }
83  catch ( const std::string& e ) {
84  QDPIO::cout << "Error reading XML in LatColMatTSTLeapfrogRecursiveIntegratorParams " << e << std::endl;
85  QDP_abort(1);
86  }
87  }
88 
89  void read(XMLReader& xml,
90  const std::string& path,
93  p = tmp;
94  }
95 
96  void write(XMLWriter& xml,
97  const std::string& path,
99  push(xml, path);
100  write(xml, "n_steps", p.n_steps);
101  write(xml, "monomial_ids", p.monomial_ids);
102  xml << p.subintegrator_xml;
103  pop(xml);
104  }
105 
106 
108  AbsFieldState<multi1d<LatticeColorMatrix>,
109  multi1d<LatticeColorMatrix> >& s,
110  const Real& traj_length) const
111  {
112 
113  START_CODE();
114  LatColMatExpSdtIntegrator expSdt(1,
115  monomials); // Single Step
116 
118  multi1d<LatticeColorMatrix> >& subIntegrator = getSubIntegrator();
119 
120 
121 
122 
123  Real dtau = traj_length / n_steps;
124  Real dtauby2 = dtau/2;
125 
126  // Its sts so:
127  subIntegrator(s, dtauby2); // First half step
128  expSdt(s, dtau);
129  for(int i=0; i < n_steps-1; i++) { // N-1 full steps
130  subIntegrator(s, dtau);
131  expSdt(s, dtau);
132  }
133  subIntegrator(s, dtauby2); // Last Half Step
134 
135  END_CODE();
136 
137  }
138 
139 
140 }
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 PQP leapfrog.
Definition: lcm_exp_sdt.h:58
MD integrator interface for PQP leapfrog.
void operator()(AbsFieldState< multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &s, const Real &traj_length) const
Do an integration of lenght n*delta tau in n steps.
AbsComponentIntegrator< multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > & getSubIntegrator() const
Return the next level down integrator.
multi1d< IntegratorShared::MonomialPair > monomials
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.
Intgrator for exp(S dt)
Intgrator for exp(S dt)
Integrator factories.
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")
int i
Definition: pbg5p_w.cc:55
pop(xml_out)
START_CODE()
multi1d< LatticeFermion > s(Ncb)
::std::string string
Definition: gtest.h:1979
Singleton instances of xml output.