CHROMA
inline_disco_eoprec_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Inline measurement 3pt_prop
3  *
4  */
5 
6 #include "handle.h"
15 #include "meas/sources/zN_src.h"
23 #include "meas/glue/mesplq.h"
24 #include "util/ft/sftmom.h"
25 #include "util/info/proginfo.h"
27 #include "util/info/unique_id.h"
28 #include "util/ferm/transf.h"
30 
31 #include "util/ferm/key_val_db.h"
35 
38 
41 
42 #include <vector>
43 #include <map>
44 
45 namespace Chroma{
46  namespace InlineDiscoEOPrecEnv{
47  namespace{
48  AbsInlineMeasurement* createMeasurement(XMLReader& xml_in,
49  const std::string& path)
50  {
51  return new InlineMeas(Params(xml_in, path));
52  }
53 
54  //! Local registration flag
55  bool registered = false;
56  }
57 
58  const std::string name = "DISCO_EOPREC";
59 
60  //! Register all the factories
61  bool registerAll()
62  {
63  bool success = true;
64  if (! registered)
65  {
66  success &= TheInlineMeasurementFactory::Instance().registerObject(name, createMeasurement);
67  registered = true;
68  }
69  return success;
70  }
71 
72  // Reader for input parameters
73  void read(XMLReader& xml, const std::string& path, Params::Param_t& param){
74  XMLReader paramtop(xml, path);
75 
76  int version;
77  read(paramtop, "version", version);
78 
79  switch (version)
80  {
81  case 1:
82  /************************************************************/
83  read(paramtop,"max_path_length",param.max_path_length);
84  read(paramtop,"p2_max",param.p2_max);
85  read(paramtop,"mass_label",param.mass_label);
86  param.chi = readXMLArrayGroup(paramtop, "Quarks", "DilutionType");
87  param.action = readXMLGroup(paramtop, "FermionAction","FermAct");
88 
89  break;
90 
91  default :
92  /**************************************************************/
93 
94  QDPIO::cerr << "Input parameter version " << version << " unsupported." << std::endl;
95  QDP_abort(1);
96  }
97  }
98 
99 
100  // Writer for input parameters
101  void write(XMLWriter& xml, const std::string& path, const Params::Param_t& param){
102  push(xml, path);
103 
104  int version = 1;
105 
106  write(xml, "version", version);
107 
108  write(xml,"max_path_length",param.max_path_length);
109  write(xml,"p2_max",param.p2_max);
110  write(xml,"mass_label",param.mass_label);
111  push(xml,"FermionAction");
112  xml<<param.action.xml ;
113  pop(xml);
114 
115  push(xml,"Quarks");
116  for( int t(0);t<param.chi.size();t++){
117  push(xml,"elem");
118  xml<<param.chi[t].xml;
119  pop(xml);
120  }
121  pop(xml);
122 
123  pop(xml); // final pop
124  }
125 
126 
127  //! Gauge field parameters
128  void read(XMLReader& xml, const std::string& path, Params::NamedObject_t& input)
129  {
130  XMLReader inputtop(xml, path);
131 
132  read(inputtop, "gauge_id", input.gauge_id);
133  read(inputtop, "op_db_file", input.op_db_file);
134  }
135 
136  //! Gauge field parameters
137  void write(XMLWriter& xml, const std::string& path, const Params::NamedObject_t& input){
138  push(xml, path);
139 
140  write(xml, "gauge_id", input.gauge_id);
141  write(xml, "op_db_file", input.op_db_file);
142  pop(xml);
143  }
144 
145  // Param stuff
147  frequency = 0;
148  }
149 
150  Params::Params(XMLReader& xml_in, const std::string& path)
151  {
152  try
153  {
154  XMLReader paramtop(xml_in, path);
155 
156  if (paramtop.count("Frequency") == 1)
157  read(paramtop, "Frequency", frequency);
158  else
159  frequency = 1;
160 
161  // Read program parameters
162  read(paramtop, "Param", param);
163 
164  // Read in the output propagator/source configuration info
165  read(paramtop, "NamedObject", named_obj);
166 
167  // Possible alternate XML file pattern
168  if (paramtop.count("xml_file") != 0)
169  {
170  read(paramtop, "xml_file", xml_file);
171  }
172  }
173  catch(const std::string& e)
174  {
175  QDPIO::cerr << __func__ << ": Caught Exception reading XML: " << e << std::endl;
176  QDP_abort(1);
177  }
178  }
179 
180  void Params::write(XMLWriter& xml_out, const std::string& path)
181  {
182  push(xml_out, path);
183 
184  // Parameters for source construction
185  InlineDiscoEOPrecEnv::write(xml_out, "Param", param);
186 
187  // Write out the output propagator/source configuration info
188  InlineDiscoEOPrecEnv::write(xml_out, "NamedObject", named_obj);
189 
190  pop(xml_out);
191  }
192 
193 
194  //! Meson operator
196  {
197  unsigned short int t_slice ; /*!< Meson operator time slice */
198  multi1d<short int> disp ; /*!< Displacement dirs of quark (right)*/
199  multi1d<short int> mom ; /*!< D-1 momentum of this operator */
200 
202  mom.resize(Nd-1);
203  }
204  };
205 
206  bool operator<(const KeyOperator_t& a, const KeyOperator_t& b){
207  return ((a.t_slice<b.t_slice)||(a.mom<b.mom)||(a.disp<b.disp));
208  }
209 
210  std::ostream& operator<<(std::ostream& os, const KeyOperator_t& d)
211  {
212  os << "KeyOperator_t:"
213  << " t_slice = " << d.t_slice
214  << ", disp = ";
215  for (int i=0; i<d.disp.size();i++){
216  os << d.disp[i] << " " ;
217  }
218  os << ", mom = ";
219  for (int i=0; i<d.mom.size();i++){
220  os << d.mom[i] << " " ;
221  }
222  os << std::endl;
223 
224  return os;
225  }
227  public:
228  multi1d<ComplexD> op ;
229  ValOperator_t(){op.resize(Ns*Ns);} // Here go the 16 gamma matrices
231  } ;
232 
233  //-------------------------------------------------------------------------
234  //! stream IO
235  std::ostream& operator<<(std::ostream& os, const ValOperator_t& d)
236  {
237  os << "ValOperator_t:\n";
238  for (int i=0; i<d.op.size();i++){
239  os <<" gamma["<<i<<"] = "<< d.op[i] << std::endl ;
240  }
241 
242  return os;
243  }
244 
245  struct KeyVal_t{
248  };
249 
250  //! KeyOperator reader
251  void read(BinaryReader& bin, KeyOperator_t& d){
252  read(bin,d.t_slice);
253  unsigned short int n ;
254  read(bin,n);
255  d.disp.resize(n);
256  read(bin,d.disp);
257  d.mom.resize(Nd-1) ;
258  read(bin,d.mom);
259  }
260  //! KeyOperator writer
261  void write(BinaryWriter& bin, const KeyOperator_t& d){
262  write(bin,d.t_slice);
263  unsigned short int n ;
264  n = d.disp.size();
265  write(bin,n);
266  write(bin,d.disp);
267  write(bin,d.mom);
268  }
269 
270  //! ValOperator reader
271  void read(BinaryReader& bin, ValOperator_t& d){
272  d.op.resize(Ns*Ns);
273  read(bin,d.op);
274  }
275  //! ValOperator writer
276  void write(BinaryWriter& bin, const ValOperator_t& d){
277  write(bin,d.op);
278  }
279 
280  namespace{
281  StandardOutputStream& operator<<(StandardOutputStream& os, const multi1d<short int>& d){
282  if (d.size() > 0){
283  os << d[0];
284  for(int i=1; i < d.size(); ++i)
285  os << " " << d[i];
286  }
287  return os;
288  }
289  }
290 
291  typedef LatticeFermion T;
292  typedef multi1d<LatticeColorMatrix> P;
293  typedef multi1d<LatticeColorMatrix> Q;
294 
296  createOddOdd_Op( const Params::Param_t& param, const P& u){
297  //
298  // Initialize fermion action
299  //
300  std::istringstream xml_s(param.action.xml);
301  XMLReader fermacttop(xml_s);
302  QDPIO::cout << "FermAct = " << param.action.id << std::endl;
303  //
304  // Try the factories
305  //
307  try{
308  QDPIO::cout << "Try the various Wilson fermion factories" << std::endl;
309  // Generic Wilson-Type stuff
311  Sf(TheFermionActionFactory::Instance().createObject(param.action.id,
312  fermacttop,
313  param.action.path));
314  state = Sf->createState(u);//got the state
315  QDPIO::cout << "Suitable factory found: compute the trace quark prop"<<std::endl;
316  }
317  catch (const std::string& e){
318  QDPIO::cout << name
319  << ": caught exception instantiating the action: " << e << std::endl;
320  }
321 
322  // Now need to construct the operator
323  // this seems tricky and maybe there is a better way... (Robert-Balint help!)
324  // We only work with Wilson and Clover Wilson fermions so check the following 2
325 
326  //this is the Odd-Odd piece
328  if(param.action.id == "WILSON"){
329  WilsonFermActParams wp(fermacttop,param.action.path);
330  return new EvenOddPrecWilsonLinOp(state,wp.Mass,wp.anisoParam ) ;
331  }
332  else if(param.action.id == "CLOVER"){
333  CloverFermActParams cp(fermacttop,param.action.path);
334  return new EvenOddPrecCloverLinOp(state,cp) ;
335  }
336  else{
337  QDPIO::cout<<name<<" : Tough luck dude! No code for you..."<<std::endl ;
338  QDP_abort(1);
339  }
340  return NULL ;
341  }
342 
343  void do_disco(std::map< KeyOperator_t, ValOperator_t >& db,
344  const LatticeFermion& qbar,
345  const LatticeFermion& q,
346  const SftMom& p,
347  const int& t,
348  const Subset& trb,
349  const multi1d<short int>& path,
350  const int& max_path_length ){
351  QDPIO::cout<<" Computing Operator with path length "<<path.size()
352  <<" on timeslice "<<t<<". Path: "<<path <<std::endl;
353 
354  ValOperator_t val ;
355  KeyOperator_t key ;
356  std::pair<KeyOperator_t, ValOperator_t> kv ;
357  kv.first.t_slice = t ;
358  if(path.size()==0){
359  kv.first.disp.resize(1);
360  kv.first.disp[0] = 0 ;
361  }
362  else
363  kv.first.disp = path ;
364 
365  multi1d< multi1d<ComplexD> > foo(p.numMom()) ;
366  for (int m(0); m < p.numMom(); m++)
367  foo[m].resize(Ns*Ns);
368  for(int g(0);g<Ns*Ns;g++){
369  LatticeComplex cc = localInnerProduct(qbar,Gamma(g)*q);
370  for (int m(0); m < p.numMom(); m++){
371  foo[m][g] = sum(p[m]*cc,p.getSet()[t]) ;// Since ferms are defined only on odd/even sites,
372  // Don't need to restrict this...
373  // foo[m][g] = sum(p[m]*cc,trb) ;//Only sum even/odd sites on time t
374  }
375  }
376  for (int m(0); m < p.numMom(); m++){
377  for(int i(0);i<(Nd-1);i++)
378  kv.first.mom[i] = p.numToMom(m)[i] ;
379 
380  kv.second.op = foo[m];
381  std::pair<std::map< KeyOperator_t, ValOperator_t >::iterator, bool> itbo;
382 
383  itbo = db.insert(kv);
384  if( itbo.second ){
385  QDPIO::cout<<"Inserting new entry in std::map\n";
386  }
387  else{ // if insert fails, key already exists, so add result
388  std::cout<<"Key = "<<kv.first<<std::endl;
389  QDPIO::cout<<"Adding result to value already there"<<std::endl;
390  for(int i(0);i<kv.second.op.size();i++){
391  itbo.first->second.op[i] += kv.second.op[i] ;
392  }
393  }
394  }
395 
396  if(path.size()<max_path_length){
397  QDPIO::cout<<" attempt to add new path. "
398  <<" current path length is : "<<path.size();
399  multi1d<short int> new_path(path.size()+1);
400  QDPIO::cout<<" new path length is : "<<new_path.size()<<std::endl;
401  for(int i(0);i<path.size();i++)
402  new_path[i] = path[i] ;
403  for(int sign(-1);sign<2;sign+=2)
404  for(int mu(0);mu<Nd;mu++){
405  new_path[path.size()]= sign*(mu+1) ;
406  //skip back tracking
407  bool back_track=false ;
408  if(path.size()>0)
409  if(path[path.size()-1] == -new_path[path.size()])
410  back_track=true;
411  if(!back_track){
412  QDPIO::cout<<" Added path: "<<new_path<<std::endl;
413  LatticeFermion q_mu ;
414  if(sign>0)
415  q_mu = shift(q, FORWARD, mu);
416  else
417  q_mu = shift(q, BACKWARD, mu);
418 
419  do_disco(db, qbar, q_mu, p, t, trb, new_path, max_path_length);
420  } // skip backtracking
421  } // mu
422  }
423 
424  }// do_disco
425 
426  void do_disco(std::map< KeyOperator_t, ValOperator_t >& db,
427  const Params::Param_t& param,
428  const P& u,
429  const SftMom& p,
430  const int& t,
431  const Subset& trb,
433  const multi1d<short int>& path){
434  QDPIO::cout<<" Computing Operator with path length "<<path.size()
435  <<" on timeslice "<<t<<". Path: "<<path <<std::endl;
436 
437  int max_path_length = param.max_path_length;
438  ValOperator_t val ;
439  KeyOperator_t key ;
440  std::pair<KeyOperator_t, ValOperator_t> kv ;
441  kv.first.t_slice = t ;
442  if(path.size()==0){
443  kv.first.disp.resize(1);
444  kv.first.disp[0] = 0 ;
445  }
446  else
447  kv.first.disp = path ;
448 
449  multi1d< multi1d<ComplexD> > foo(p.numMom()) ;
450  for (int m(0); m < p.numMom(); m++){
451  foo[m].resize(Ns*Ns);
452  for (int g(0); g<Ns*Ns;g++){
453  foo[m][g] = 0.0;
454  }
455  }
456  for(int g(0);g<Ns*Ns;g++){
457  for(int col=0;col<3;col++){
458  for(int sp=0;sp<4;sp++){
459  Fermion tt = zero ;
460  ColorVector cv = zero ;
461  Complex z = cmplx(Real(1.0),0.0) ;
462  pokeColor(cv,z,col);
463  pokeSpin(tt,cv,sp);
464  LatticeFermion V = tt ;
465  for (int m(0); m < p.numMom(); m++){
466  //only on even sites
467  LatticeFermion DV = zero;
468  Doo->evenEvenInvLinOp(DV,V,PLUS);
469  foo[m][g] += sum(p[m]*localInnerProduct(V,Gamma(g)*DV),p.getSet()[t]);
470  // foo[m][g] += sum(p[m]*localInnerProduct(V,Gamma(g)*DV),trb);
471  }//m
472  }//spin
473  }//col
474  }//g
475 
476  for (int m(0); m < p.numMom(); m++){
477  for(int i(0);i<(Nd-1);i++)
478  kv.first.mom[i] = p.numToMom(m)[i] ;
479 
480  kv.second.op = foo[m];
481  std::pair<std::map< KeyOperator_t, ValOperator_t >::iterator, bool> itbo;
482 
483  itbo = db.insert(kv);
484  if( itbo.second ){
485  QDPIO::cout<<"Inserting new entry in std::map\n";
486  }
487  else{ // if insert fails, key already exists, so add result
488  for(int i(0);i<kv.second.op.size();i++)
489  itbo.first->second.op[i] += kv.second.op[i] ;
490  }
491  }//m
492 
493  }// do_disco
494 
495  //--------------------------------------------------------------
496  // Function call
497  // void
498  //InlineDisco::operator()(unsigned long update_no,
499  // XMLWriter& xml_out)
500  void InlineMeas::operator()(unsigned long update_no,
501  XMLWriter& xml_out)
502  {
503  // If xml file not empty, then use alternate
504  if (params.xml_file != ""){
505  std::string xml_file = makeXMLFileName(params.xml_file, update_no);
506 
507  push(xml_out, "propagator_3pt");
508  write(xml_out, "update_no", update_no);
509  write(xml_out, "xml_file", xml_file);
510  pop(xml_out);
511 
512  XMLFileWriter xml(xml_file);
513  func(update_no, xml);
514  }
515  else{
516  func(update_no, xml_out);
517  }
518  }
519 
520 
521  // Function call
522  //void
523  //InlineDisco::func(unsigned long update_no,
524  // XMLWriter& xml_out)
525  void InlineMeas::func(unsigned long update_no,
526  XMLWriter& xml_out)
527  {
528  START_CODE();
529 
530  StopWatch snoop;
531  snoop.reset();
532  snoop.start();
533 
534  // Test and grab a reference to the gauge field
535  XMLBufferWriter gauge_xml;
536  try
537  {
538  TheNamedObjMap::Instance().getData< multi1d<LatticeColorMatrix> >(params.named_obj.gauge_id);
539  TheNamedObjMap::Instance().get(params.named_obj.gauge_id).getRecordXML(gauge_xml);
540  }
541  catch( std::bad_cast )
542  {
543  QDPIO::cerr << InlineDiscoEOPrecEnv::name << ": caught dynamic cast error"
544  << std::endl;
545  QDP_abort(1);
546  }
547  catch (const std::string& e)
548  {
549  QDPIO::cerr << name << ": std::map call failed: " << e
550  << std::endl;
551  QDP_abort(1);
552  }
553  const multi1d<LatticeColorMatrix>& u =
554  TheNamedObjMap::Instance().getData< multi1d<LatticeColorMatrix> >(params.named_obj.gauge_id);
555 
556  push(xml_out, "disco");
557  write(xml_out, "update_no", update_no);
558 
559  QDPIO::cout << name << ": Disconnected diagrams" << std::endl;
560 
561  proginfo(xml_out); // Print out basic program info
562 
563  // Write out the input
564  params.write(xml_out, "Input");
565 
566  // Write out the config info
567  write(xml_out, "Config_info", gauge_xml);
568 
569  push(xml_out, "Output_version");
570  write(xml_out, "out_version", 1);
571  pop(xml_out);
572 
573  // First calculate some gauge invariant observables just for info.
574  // This is really cheap.
575  MesPlq(xml_out, "Observables", u);
576 
577  // Save current seed
578  Seed ran_seed;
579  QDP::RNG::savern(ran_seed);
580 
581  //
582  // Read the source and solutions
583  //
584  StopWatch swatch;
585  swatch.reset();
586  swatch.start();
587 
588  int N_quarks = params.param.chi.size() ;
589 
590  multi1d< Handle< DilutionScheme<LatticeFermion> > > quarks(N_quarks);
591 
592  try{
593  // Loop over quark dilutions
594  for(int n(0); n < params.param.chi.size(); ++n){
595  const GroupXML_t& dil_xml = params.param.chi[n];
596  std::istringstream xml_d(dil_xml.xml);
597  XMLReader diltop(xml_d);
598  QDPIO::cout << "Dilution type = " << dil_xml.id << std::endl;
599  quarks[n] =
600  TheFermDilutionSchemeFactory::Instance().createObject(dil_xml.id,
601  diltop,
602  dil_xml.path);
603  }
604  }
605  catch(const std::string& e){
606  QDPIO::cerr << name << ": Caught Exception constructing dilution scheme: " << e << std::endl;
607  QDP_abort(1);
608  }
609 
610 
611  //-------------------------------------------------------------------
612  //Sanity checks
613 
614  //Another Sanity check, the three quarks must all be
615  //inverted on the same cfg
616  for (int n = 1 ; n < N_quarks ; ++n){
617  if (quarks[0]->getCfgInfo() != quarks[n]->getCfgInfo()){
618  QDPIO::cerr << name << " : Quarks do not contain the same cfg info";
619  QDPIO::cerr << ", quark "<< n << std::endl;
620  QDP_abort(1);
621  }
622  }
623 
624  //Also ensure that the cfg on which the inversions were performed
625  //is the same as the cfg that we are using
626  {
627  std::string cfgInfo;
628 
629  //Really ugly way of doing this(Robert Heeeelp!!)
630  XMLBufferWriter top;
631  write(top, "Config_info", gauge_xml);
632  XMLReader from(top);
633  XMLReader from2(from, "/Config_info");
634  std::ostringstream os;
635  from2.print(os);
636 
637  cfgInfo = os.str();
638 
639  if (cfgInfo != quarks[0]->getCfgInfo()){
640  QDPIO::cerr << name << " : Quarks do not contain the same";
641  QDPIO::cerr << " cfg info as the gauge field." ;
642  QDPIO::cerr << "gauge: XX"<<cfgInfo<<"XX quarks: XX" ;
643  QDPIO::cerr << quarks[0]->getCfgInfo()<<"XX"<< std::endl;
644  QDP_abort(1);
645  }
646  }
647 
648  int decay_dir = quarks[0]->getDecayDir();
649  //
650  // Initialize the slow Fourier transform phases
651  //
652  //SftMom phases(params.param.mom2_max, false, decay_dir);
653  SftMom phases(params.param.p2_max, false, decay_dir);
654 
655  // Another sanity check. The seeds of all the quarks must be different
656  // and thier decay directions must be the same
657  for(int n = 1 ; n < quarks.size(); ++n){
658  if(toBool(quarks[n]->getSeed()==quarks[0]->getSeed())){
659  QDPIO::cerr << name << ": error, quark seeds are the same" << std::endl;
660  QDP_abort(1);
661  }
662 
663  if(toBool(quarks[n]->getDecayDir()!=quarks[0]->getDecayDir())){
664  QDPIO::cerr<<name<< ": error, quark decay dirs do not match" <<std::endl;
665  QDP_abort(1);
666  }
667  }
668 
669  std::map< KeyOperator_t, ValOperator_t > data ;
670 
671  Set timerb;
672  timerb.make(TimeSliceRBFunc(decay_dir));
673 
675 
676  for(int n(0);n<quarks.size();n++){
677  for (int it(0) ; it < quarks[n]->getNumTimeSlices() ; ++it){
678  int t = quarks[n]->getT0(it) ;
679  QDPIO::cout<<" Doing quark: "<<n <<std::endl ;
680  QDPIO::cout<<" quark: "<<n <<" has "<<quarks[n]->getDilSize(it);
681  QDPIO::cout<<" dilutions on time slice "<<t<<std::endl ;
682  for(int i = 0 ; i < quarks[n]->getDilSize(it) ; ++i){
683  QDPIO::cout<<" Doing dilution : "<<i<<std::endl ;
684  multi1d<short int> d ;
685  LatticeFermion qbar = quarks[n]->dilutedSource(it,i);
686  LatticeFermion q = quarks[n]->dilutedSolution(it,i);
687  QDPIO::cout<<" Starting recursion "<<std::endl ;
688  // First do_disco for odd piece:
689  // timerb for sum over only odd sites on this timeslice
690  do_disco(data, qbar, q, phases, t, timerb[2*t+1], d, params.param.max_path_length);
691  QDPIO::cout<<" done with recursion! "
692  <<" The length of the path is: "<<d.size()<<std::endl ;
693  // Now do_disco for even piece:
694  LatticeFermion q1 = zero;
695  LatticeFermion q2 = zero;
696  LatticeFermion qb1 = zero;
697  LatticeFermion qb2 = zero;
698  Doo->evenOddLinOp(q1,q,PLUS);
699  Doo->evenEvenInvLinOp(q2,q1,PLUS);
700  Doo->evenOddLinOp(qb1,qbar,MINUS);
701  Doo->evenEvenInvLinOp(qb2,qb1,MINUS);
702  // timerb for sum over only even sites on this timeslice
703  do_disco(data, qb2, q2, phases, t, timerb[2*t+0], d, params.param.max_path_length);
704  QDPIO::cout<<" done with recursion! "
705  <<" The length of the path is: "<<d.size()<<std::endl ;
706  }
707  QDPIO::cout<<" Done with dilutions for quark: "<<n <<std::endl ;
708  }
709  }
710  /**
711  NOTE THAT WE ARE NOT NORMALIZING ANYTHING B/C FOR NOW
712  WE ASSUME TO HAVE ONLY ONE QUARK!!!!
713  **/
714 
715  // Now we have to do the tr[gamma*D^-1_ee] part
716  for (int it(0) ; it < quarks[0]->getNumTimeSlices() ; it++){
717  multi1d<short int> d ;
718  int t = quarks[0]->getT0(it) ;
719  // Now let's do the Tr[Dee^-1 gamma]
720  do_disco(data,params.param, u, phases, t, timerb[2*t+0], Doo, d);
721  }
722 
723 
724  // DB storage
725  BinaryStoreDB<SerialDBKey<KeyOperator_t>,SerialDBData<ValOperator_t> > qdp_db;
726 
727  // Open the file, and write the meta-data and the binary for this operator
728  {
729  XMLBufferWriter file_xml;
730 
731  push(file_xml, "DBMetaData");
732  write(file_xml, "id", std::string("eigElemOp"));
733  write(file_xml, "lattSize", QDP::Layout::lattSize());
734  write(file_xml, "decay_dir", decay_dir);
735  write(file_xml, "Params", params.param);
736  write(file_xml, "Config_info", gauge_xml);
737  pop(file_xml);
738 
739  std::string file_str(file_xml.str());
740  qdp_db.setMaxUserInfoLen(file_str.size());
741 
742  qdp_db.open(params.named_obj.op_db_file, O_RDWR | O_CREAT, 0664);
743 
744  qdp_db.insertUserdata(file_str);
745  }
746 
747  // Write the data
750  std::map< KeyOperator_t, ValOperator_t >::iterator it;
751  for(it=data.begin();it!=data.end();it++){
752  key.key() = it->first ;
753  val.data().op.resize(it->second.op.size()) ;
754  // normalize to number of quarks
755  for(int i(0);i<it->second.op.size();i++)
756  val.data().op[i] = it->second.op[i]/toDouble(quarks.size());
757  qdp_db.insert(key,val) ;
758  }
759 
760  // Close the namelist output file XMLDAT
761  pop(xml_out); // Disco
762 
763  snoop.stop();
764  QDPIO::cout << name << ": total time = "
765  << snoop.getTimeInSeconds()
766  << " secs" << std::endl;
767 
768  QDPIO::cout << name << ": ran successfully" << std::endl;
769 
770  END_CODE();
771  }
772  } // namespace InlineDiscoEOPrecEnv
773 }// namespace chroma
Inline measurement factory.
Baryon spin and projector matrices.
All baryon operators.
Factory for producing baryon operators.
Even-odd preconditioned Clover-Dirac operator.
Even-odd preconditioned linear operator.
Definition: eoprec_linop.h:92
Even-odd preconditioned Wilson-Dirac operator.
Class for counted reference semantics.
Definition: handle.h:33
Inline measurement of stochastic baryon operators.
void func(const unsigned long update_no, XMLWriter &xml_out)
Do the measurement.
void operator()(const unsigned long update_no, XMLWriter &xml_out)
Do the measurement.
Serializable value harness.
Definition: key_val_db.h:69
D & data()
Setter.
Definition: key_val_db.h:78
Serializable key harness.
Definition: key_val_db.h:21
K & key()
Setter.
Definition: key_val_db.h:30
Fourier transform phase factor support.
Definition: sftmom.h:35
static T & Instance()
Definition: singleton.h:432
Parameters for Clover fermion action.
int mu
Definition: cool.cc:24
Random Z(N) source construction using dilution.
All dilution scheme factories.
Factory for dilution schemes.
Parallel transport a lattice field.
Even-odd const determinant Wilson-like fermact.
Fermion action factories.
All Wilson-type fermion actions.
void proginfo(XMLWriter &xml)
Print out basic information about this program.
Definition: proginfo.cc:24
std::string makeXMLFileName(std::string xml_file, unsigned long update_no)
Return a xml file name for inline measurements.
multi1d< GroupXML_t > readXMLArrayGroup(XMLReader &xml_in, const std::string &path, const std::string &type_name)
Read group and return as a std::string.
GroupXML_t readXMLGroup(XMLReader &xml_in, const std::string &path, const std::string &type_name)
Read group and return as a std::string.
Class for counted reference semantics.
Inline measurement of stochastic 3pt functions.
Key and values for DB.
unsigned n
Definition: ldumul_w.cc:36
Linear operators.
static int m[4]
Definition: make_seeds.cc:16
void savern(int iseed[4])
Definition: make_seeds.cc:46
Make xml file writer.
int z
Definition: meslate.cc:36
int it
Definition: meslate.cc:33
int t
Definition: meslate.cc:37
Nd
Definition: meslate.cc:74
Double q
Definition: mesq.cc:17
Named object function std::map.
static bool registered
Local registration flag.
multi1d< LatticeColorMatrix > Q
bool registerAll()
Register all the factories.
void write(XMLWriter &xml, const std::string &path, const Params::Param_t &param)
multi1d< LatticeColorMatrix > P
void read(XMLReader &xml, const std::string &path, Params::Param_t &param)
std::ostream & operator<<(std::ostream &os, const KeyOperator_t &d)
Handle< EvenOddPrecLinearOperator< T, P, Q > > createOddOdd_Op(const Params::Param_t &param, const P &u)
void do_disco(std::map< KeyOperator_t, ValOperator_t > &db, const LatticeFermion &qbar, const LatticeFermion &q, const SftMom &p, const int &t, const Subset &trb, const multi1d< short int > &path, const int &max_path_length)
bool operator<(const KeyOperator_t &a, const KeyOperator_t &b)
QDPSubTypeTrait< typename BinaryReturn< C1, C2, FnLocalInnerProduct >::Type_t >::Type_t localInnerProduct(const QDPSubType< T1, C1 > &l, const QDPType< T2, C2 > &r)
const int N_quarks
Number of quarks to be used in this construction.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
push(xml_out,"Condensates")
int i
Definition: pbg5p_w.cc:55
@ MINUS
Definition: chromabase.h:45
@ PLUS
Definition: chromabase.h:45
Double cp
Definition: invbicg.cc:107
Complex a
Definition: invbicg.cc:95
pop(xml_out)
void MesPlq(const multi1d< LatticeColorMatrixF3 > &u, multi2d< Double > &plane_plaq, Double &link)
Definition: mesplq.cc:83
DComplex d
Definition: invbicg.cc:99
START_CODE()
Complex b
Definition: invbicg.cc:96
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
Double zero
Definition: invbicg.cc:106
::std::string string
Definition: gtest.h:1979
#define FORWARD
Definition: primitives.h:82
#define BACKWARD
Definition: primitives.h:83
Print out basic info about this program.
Double sum
Definition: qtopcor.cc:37
All quark smearing constructors.
Factory for producing quark smearing objects.
Fourier transform phase factor support.
SpinMatrix sp
All make sink constructors.
Factory for producing quark prop sinks.
All source smearing.
Factory for producing quark smearing objects.
Params for clover ferm acts.
Hold group xml and type id.
void write(XMLWriter &xml_out, const std::string &path)
struct Chroma::InlineDiscoEOPrecEnv::Params::Param_t param
struct Chroma::InlineDiscoEOPrecEnv::Params::NamedObject_t named_obj
Params for wilson ferm acts.
Generate a unique id.
Wilson fermion action parameters.
Volume source of Z(N) noise.