46 namespace InlineDiscoEOPrecEnv{
74 XMLReader paramtop(xml, path);
77 read(paramtop,
"version", version);
94 QDPIO::cerr <<
"Input parameter version " << version <<
" unsupported." << std::endl;
106 write(xml,
"version", version);
111 push(xml,
"FermionAction");
116 for(
int t(0);
t<param.
chi.size();
t++){
118 xml<<param.
chi[
t].xml;
130 XMLReader inputtop(xml, path);
154 XMLReader paramtop(xml_in, path);
156 if (paramtop.count(
"Frequency") == 1)
168 if (paramtop.count(
"xml_file") != 0)
175 QDPIO::cerr << __func__ <<
": Caught Exception reading XML: " << e << std::endl;
207 return ((
a.t_slice<
b.t_slice)||(
a.mom<
b.mom)||(
a.disp<
b.disp));
212 os <<
"KeyOperator_t:"
213 <<
" t_slice = " <<
d.t_slice
215 for (
int i=0;
i<
d.disp.size();
i++){
216 os <<
d.disp[
i] <<
" " ;
219 for (
int i=0;
i<
d.mom.size();
i++){
220 os <<
d.mom[
i] <<
" " ;
228 multi1d<ComplexD>
op ;
237 os <<
"ValOperator_t:\n";
238 for (
int i=0;
i<
d.op.size();
i++){
239 os <<
" gamma["<<
i<<
"] = "<<
d.op[
i] << std::endl ;
253 unsigned short int n ;
263 unsigned short int n ;
281 StandardOutputStream&
operator<<(StandardOutputStream& os,
const multi1d<short int>&
d){
284 for(
int i=1;
i <
d.size(); ++
i)
291 typedef LatticeFermion
T;
292 typedef multi1d<LatticeColorMatrix>
P;
293 typedef multi1d<LatticeColorMatrix>
Q;
300 std::istringstream xml_s(param.
action.
xml);
301 XMLReader fermacttop(xml_s);
302 QDPIO::cout <<
"FermAct = " << param.
action.
id << std::endl;
308 QDPIO::cout <<
"Try the various Wilson fermion factories" << std::endl;
314 state = Sf->createState(
u);
315 QDPIO::cout <<
"Suitable factory found: compute the trace quark prop"<<std::endl;
319 <<
": caught exception instantiating the action: " << e << std::endl;
332 else if(param.
action.
id ==
"CLOVER"){
337 QDPIO::cout<<
name<<
" : Tough luck dude! No code for you..."<<std::endl ;
343 void do_disco(std::map< KeyOperator_t, ValOperator_t >& db,
344 const LatticeFermion& qbar,
345 const LatticeFermion&
q,
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;
356 std::pair<KeyOperator_t, ValOperator_t> kv ;
359 kv.first.disp.resize(1);
360 kv.first.disp[0] = 0 ;
363 kv.first.disp = path ;
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++){
370 for (
int m(0);
m <
p.numMom();
m++){
371 foo[
m][g] =
sum(
p[
m]*cc,
p.getSet()[
t]) ;
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] ;
380 kv.second.op = foo[
m];
381 std::pair<std::map< KeyOperator_t, ValOperator_t >::iterator,
bool> itbo;
383 itbo = db.insert(kv);
385 QDPIO::cout<<
"Inserting new entry in std::map\n";
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] ;
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)
405 new_path[path.size()]= sign*(
mu+1) ;
407 bool back_track=false ;
409 if(path[path.size()-1] == -new_path[path.size()])
412 QDPIO::cout<<
" Added path: "<<new_path<<std::endl;
413 LatticeFermion q_mu ;
419 do_disco(db, qbar, q_mu,
p,
t, trb, new_path, max_path_length);
426 void do_disco(std::map< KeyOperator_t, ValOperator_t >& db,
433 const multi1d<short int>& path){
434 QDPIO::cout<<
" Computing Operator with path length "<<path.size()
435 <<
" on timeslice "<<
t<<
". Path: "<<path <<std::endl;
440 std::pair<KeyOperator_t, ValOperator_t> kv ;
443 kv.first.disp.resize(1);
444 kv.first.disp[0] = 0 ;
447 kv.first.disp = path ;
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++){
456 for(
int g(0);g<Ns*Ns;g++){
457 for(
int col=0;col<3;col++){
460 ColorVector cv =
zero ;
461 Complex
z = cmplx(Real(1.0),0.0) ;
464 LatticeFermion V = tt ;
465 for (
int m(0);
m <
p.numMom();
m++){
467 LatticeFermion DV =
zero;
468 Doo->evenEvenInvLinOp(DV,V,
PLUS);
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] ;
480 kv.second.op = foo[
m];
481 std::pair<std::map< KeyOperator_t, ValOperator_t >::iterator,
bool> itbo;
483 itbo = db.insert(kv);
485 QDPIO::cout<<
"Inserting new entry in std::map\n";
488 for(
int i(0);
i<kv.second.op.size();
i++)
489 itbo.first->second.op[
i] += kv.second.op[
i] ;
507 push(xml_out,
"propagator_3pt");
508 write(xml_out,
"update_no", update_no);
509 write(xml_out,
"xml_file", xml_file);
512 XMLFileWriter xml(xml_file);
513 func(update_no, xml);
516 func(update_no, xml_out);
535 XMLBufferWriter gauge_xml;
541 catch( std::bad_cast )
549 QDPIO::cerr <<
name <<
": std::map call failed: " << e
553 const multi1d<LatticeColorMatrix>&
u =
556 push(xml_out,
"disco");
557 write(xml_out,
"update_no", update_no);
559 QDPIO::cout <<
name <<
": Disconnected diagrams" << std::endl;
567 write(xml_out,
"Config_info", gauge_xml);
569 push(xml_out,
"Output_version");
570 write(xml_out,
"out_version", 1);
575 MesPlq(xml_out,
"Observables",
u);
590 multi1d< Handle< DilutionScheme<LatticeFermion> > > quarks(
N_quarks);
596 std::istringstream xml_d(dil_xml.
xml);
597 XMLReader diltop(xml_d);
598 QDPIO::cout <<
"Dilution type = " << dil_xml.
id << std::endl;
606 QDPIO::cerr <<
name <<
": Caught Exception constructing dilution scheme: " << e << std::endl;
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;
631 write(top,
"Config_info", gauge_xml);
633 XMLReader from2(from,
"/Config_info");
634 std::ostringstream os;
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;
648 int decay_dir = quarks[0]->getDecayDir();
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;
663 if(toBool(quarks[
n]->getDecayDir()!=quarks[0]->getDecayDir())){
664 QDPIO::cerr<<
name<<
": error, quark decay dirs do not match" <<std::endl;
669 std::map< KeyOperator_t, ValOperator_t > data ;
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 ;
691 QDPIO::cout<<
" done with recursion! "
692 <<
" The length of the path is: "<<
d.size()<<std::endl ;
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);
704 QDPIO::cout<<
" done with recursion! "
705 <<
" The length of the path is: "<<
d.size()<<std::endl ;
707 QDPIO::cout<<
" Done with dilutions for quark: "<<
n <<std::endl ;
716 for (
int it(0) ;
it < quarks[0]->getNumTimeSlices() ;
it++){
717 multi1d<short int>
d ;
718 int t = quarks[0]->getT0(
it) ;
729 XMLBufferWriter file_xml;
731 push(file_xml,
"DBMetaData");
733 write(file_xml,
"lattSize", QDP::Layout::lattSize());
734 write(file_xml,
"decay_dir", decay_dir);
736 write(file_xml,
"Config_info", gauge_xml);
740 qdp_db.setMaxUserInfoLen(file_str.size());
744 qdp_db.insertUserdata(file_str);
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()) ;
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) ;
764 QDPIO::cout <<
name <<
": total time = "
765 << snoop.getTimeInSeconds()
766 <<
" secs" << std::endl;
768 QDPIO::cout <<
name <<
": ran successfully" << std::endl;
Inline measurement factory.
Baryon spin and projector matrices.
Factory for producing baryon operators.
Even-odd preconditioned Clover-Dirac operator.
Even-odd preconditioned linear operator.
Even-odd preconditioned Wilson-Dirac operator.
Class for counted reference semantics.
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.
Serializable key harness.
Fourier transform phase factor support.
Parameters for Clover fermion action.
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.
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.
void savern(int iseed[4])
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 ¶m)
multi1d< LatticeColorMatrix > P
void read(XMLReader &xml, const std::string &path, Params::Param_t ¶m)
std::ostream & operator<<(std::ostream &os, const KeyOperator_t &d)
Handle< EvenOddPrecLinearOperator< T, P, Q > > createOddOdd_Op(const Params::Param_t ¶m, 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.
static multi1d< LatticeColorMatrix > u
push(xml_out,"Condensates")
void MesPlq(const multi1d< LatticeColorMatrixF3 > &u, multi2d< Double > &plane_plaq, Double &link)
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Print out basic info about this program.
All quark smearing constructors.
Factory for producing quark smearing objects.
Fourier transform phase factor support.
All make sink constructors.
Factory for producing quark prop sinks.
Factory for producing quark smearing objects.
Params for clover ferm acts.
Hold group xml and type id.
unsigned short int t_slice
multi1d< short int > disp
SerialDBData< ValOperator_t > v
SerialDBKey< KeyOperator_t > k
multi1d< GroupXML_t > chi
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.
Wilson fermion action parameters.
Volume source of Z(N) noise.