23 namespace InlineStochBaryonEnv
58 XMLReader inputtop(xml, path);
76 XMLReader inputtop(xml, path);
79 read(inputtop,
"operator", input.
op);
89 write(xml,
"operator", input.
op);
98 XMLReader paramtop(xml, path);
101 read(paramtop,
"version", version);
112 QDPIO::cerr <<
"Input parameter version " << version <<
" unsupported." << std::endl;
119 XMLReader xml_tmp(paramtop,
"BaryonOperator");
120 std::ostringstream os;
136 write(xml,
"version", version);
146 XMLReader inputtop(xml, path);
174 XMLReader paramtop(xml_in, path);
176 if (paramtop.count(
"Frequency") == 1)
188 if (paramtop.count(
"xml_file") != 0)
195 QDPIO::cerr << __func__ <<
": Caught Exception reading XML: " << e << std::endl;
253 multi1d<BaryonOperatorElement_t>
ind;
256 multi3d<BaryonOperatorIndex_t>
op;
308 write(xml,
"version", version);
333 push(xml_out,
"stoch_baryon");
334 write(xml_out,
"update_no", update_no);
335 write(xml_out,
"xml_file", xml_file);
338 XMLFileWriter xml(xml_file);
339 func(update_no, xml);
343 func(update_no, xml_out);
360 XMLBufferWriter gauge_xml;
366 catch( std::bad_cast )
378 const multi1d<LatticeColorMatrix>&
u =
381 push(xml_out,
"stoch_baryon");
382 write(xml_out,
"update_no", update_no);
392 write(xml_out,
"Config_info", gauge_xml);
394 push(xml_out,
"Output_version");
395 write(xml_out,
"out_version", 1);
400 MesPlq(xml_out,
"Observables",
u);
418 QDPIO::cout <<
"quarks.size= " << quarks.size() << std::endl;
419 for(
int n=0;
n < quarks.size(); ++
n)
421 QDPIO::cout <<
"Attempt to read solutions for source number=" <<
n << std::endl;
424 QDPIO::cout <<
"dilutions.size= " << quarks[
n].dilutions.size() << std::endl;
425 for(
int i=0;
i < quarks[
n].dilutions.size(); ++
i)
427 XMLReader file_xml, record_xml;
431 read(from, record_xml, quarks[
n].dilutions[
i].soln);
434 read(record_xml,
"/Propagator/PropSource", quarks[
n].dilutions[
i].source_header);
441 QDPIO::cerr <<
"Error extracting headers: " << e << std::endl;
446 QDPIO::cout <<
"Sources and solutions successfully read: time= "
447 << swatch.getTimeInSeconds()
448 <<
" secs" << std::endl;
460 push(xml_out,
"Norms");
461 for(
int n=0;
n < quarks.size(); ++
n)
465 LatticeFermion quark_noise;
467 for(
int i=0;
i < quarks[
n].dilutions.size(); ++
i)
469 std::istringstream xml_s(quarks[
n].dilutions[
i].source_header.source.xml);
470 XMLReader sourcetop(xml_s);
479 QDPIO::cout <<
"Quark num= " <<
n <<
" dilution num= " <<
i << std::endl;
483 quarks[
n].dilutions[
i].source_header.source.path);
490 quarks[0].j_decay = srcParams.
j_decay;
504 if ( toBool(srcParams.
ran_seed != quarks[
n].seed) )
506 QDPIO::cerr <<
"quark source=" <<
n <<
" dilution=" <<
i <<
" seed does not match" << std::endl;
511 if ( toBool(srcParams.
N != N) )
513 QDPIO::cerr <<
"quark source=" <<
n <<
" dilution=" <<
i <<
" N does not match" << std::endl;
520 quarks[
n].dilutions[
i].source = srcConst(
u);
521 quark_noise -= quarks[
n].dilutions[
i].source;
527 SftMom phases_nomom(0,
true, quarks[
n].dilutions[
i].source_header.j_decay);
529 multi1d<Double> source_corr = sumMulti(localNorm2(quarks[
n].dilutions[
i].source),
532 multi1d<Double> soln_corr = sumMulti(localNorm2(quarks[
n].dilutions[
i].soln),
535 push(xml_out,
"elem");
538 write(xml_out,
"source_corr", source_corr);
539 write(xml_out,
"soln_corr", soln_corr);
545 Double dcnt = norm2(quark_noise);
546 if (toDouble(dcnt) != 0.0)
548 QDPIO::cerr <<
"Noise not saturated by all potential solutions: dcnt=" << dcnt << std::endl;
558 QDPIO::cerr <<
": Caught Exception creating source: " << e << std::endl;
564 QDPIO::cout <<
"Sources saturated: time= "
565 << swatch.getTimeInSeconds()
566 <<
" secs" << std::endl;
572 int j_decay = quarks[0].j_decay;
580 if (quarks.size() != 3)
582 QDPIO::cerr <<
"expecting 3 quarks but have num quarks= " << quarks.size() << std::endl;
590 XMLReader optop(xml_op);
591 const std::string operator_path =
"/BaryonOperator";
602 int num_orderings = 6;
603 multi1d< multi1d<int> > perms(num_orderings);
607 if (num_orderings >= 1)
609 p[0] = 0;
p[1] = 1;
p[2] = 2;
613 if (num_orderings >= 2)
615 p[0] = 0;
p[1] = 2;
p[2] = 1;
619 if (num_orderings >= 3)
621 p[0] = 1;
p[1] = 0;
p[2] = 2;
625 if (num_orderings >= 4)
627 p[0] = 1;
p[1] = 2;
p[2] = 0;
631 if (num_orderings >= 5)
633 p[0] = 2;
p[1] = 1;
p[2] = 0;
637 if (num_orderings >= 6)
639 p[0] = 2;
p[1] = 0;
p[2] = 1;
649 baryon_opA.
seed_l = quarks[0].seed;
650 baryon_opA.
seed_m = quarks[1].seed;
651 baryon_opA.
seed_r = quarks[2].seed;
652 baryon_opA.
orderings.resize(num_orderings);
653 baryon_opA.
perms.resize(num_orderings);
655 push(xml_out,
"OperatorA");
660 QDPIO::cerr <<
"baryon op seeds are the same" << std::endl;
667 QDPIO::cerr <<
"baryon op seeds are the same" << std::endl;
674 QDPIO::cerr <<
"baryon op seeds are the same" << std::endl;
682 for(
int ord=0; ord < baryon_opA.
orderings.size(); ++ord)
684 QDPIO::cout <<
"Operator A: ordering = " << ord << std::endl;
686 baryon_opA.
perms[ord] = perms[ord];
704 multi1d<LatticeComplex> bar = (*baryonOperator)(q0.
dilutions[
i].source,
709 baryon_opA.
orderings[ord].op(
i,
j,
k).ind.resize(bar.size());
710 for(
int l=0;
l < bar.size(); ++
l)
720 QDPIO::cerr <<
": Caught Exception creating source operator: " << e << std::endl;
725 QDPIO::cerr <<
": Caught generic exception creating source operator" << std::endl;
733 QDPIO::cout <<
"Operator A computed: time= "
734 << swatch.getTimeInSeconds()
735 <<
" secs" << std::endl;
743 baryon_opB.
seed_l = quarks[0].seed;
744 baryon_opB.
seed_m = quarks[1].seed;
745 baryon_opB.
seed_r = quarks[2].seed;
746 baryon_opB.
orderings.resize(num_orderings);
747 baryon_opB.
perms.resize(num_orderings);
749 push(xml_out,
"OperatorB");
754 QDPIO::cerr <<
"baryon op seeds are the same" << std::endl;
761 QDPIO::cerr <<
"baryon op seeds are the same" << std::endl;
768 QDPIO::cerr <<
"baryon op seeds are the same" << std::endl;
776 for(
int ord=0; ord < baryon_opB.
orderings.size(); ++ord)
778 QDPIO::cout <<
"Operator B: ordering = " << ord << std::endl;
780 baryon_opB.
perms[ord] = perms[ord];
797 multi1d<LatticeComplex> bar = (*baryonOperator)(q0.
dilutions[
i].soln,
802 baryon_opB.
orderings[ord].op(
i,
j,
k).ind.resize(bar.size());
803 for(
int l=0;
l < bar.size(); ++
l)
813 QDPIO::cerr <<
": Caught Exception creating sink operator: " << e << std::endl;
818 QDPIO::cerr <<
": Caught generic exception creating sink operator" << std::endl;
826 QDPIO::cout <<
"Operator B computed: time= "
827 << swatch.getTimeInSeconds()
828 <<
" secs" << std::endl;
835 XMLBufferWriter file_xml;
836 push(file_xml,
"baryon_operator");
838 write(file_xml,
"Config_info", gauge_xml);
842 QDPIO_SINGLEFILE, QDPIO_SERIAL, QDPIO_OPEN);
846 XMLBufferWriter record_xml;
847 BinaryBufferWriter record_bin;
848 write(record_xml,
"SourceBaryonOperator", baryon_opA);
849 write(record_bin, baryon_opA);
850 write(to, record_xml, record_bin);
855 XMLBufferWriter record_xml;
856 BinaryBufferWriter record_bin;
857 write(record_xml,
"SinkBaryonOperator", baryon_opB);
858 write(record_bin, baryon_opB);
859 write(to, record_xml, record_bin);
867 QDPIO::cout <<
"Operators written: time= "
868 << swatch.getTimeInSeconds()
869 <<
" secs" << std::endl;
876 << snoop.getTimeInSeconds()
877 <<
" secs" << std::endl;
Inline measurement factory.
Baryon spin and projector matrices.
Factory for producing baryon operators.
Random complex Z(N) sources using dilution.
Class for counted reference semantics.
Inline measurement of stochastic baryon operators.
InlineStochBaryonParams params
void operator()(const unsigned long update_no, XMLWriter &xml_out)
Do the measurement.
void func(const unsigned long update_no, XMLWriter &xml_out)
Do the measurement.
Fourier transform phase factor support.
int numSubsets() const
Number of subsets - length in decay direction.
multi2d< DComplex > sft(const LatticeComplex &cf) const
Do a sumMulti(cf*phases,getSet())
const Set & getSet() const
The set to be used in sumMulti.
Random Z(N) source construction using dilution.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams ¶m)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams ¶m)
Writer parameters.
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.
void zN_src(LatticeFermion &a, int N)
Volume source of Z(N) noise.
Class for counted reference semantics.
ForwardProp_t prop_header
Inline measurement of stochastic baryon operator.
void savern(int iseed[4])
Named object function std::map.
static bool registered
Local registration flag.
bool registerAll()
Register all the factories.
std::string getName()
Return the name.
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
static multi1d< LatticeColorMatrix > u
push(xml_out,"Condensates")
void MesPlq(const multi1d< LatticeColorMatrixF3 > &u, multi2d< Double > &plane_plaq, Double &link)
FloatingPoint< double > Double
Print out basic info about this program.
Fourier transform phase factor support.
multi1d< BaryonOperatorElement_t > ind
multi3d< BaryonOperatorIndex_t > op
multi1d< BaryonOperatorInsertion_t > orderings
multi1d< multi1d< int > > perms
Random complex Z(N) sources using dilution.
std::string baryon_operator
std::string baryon_operator_type
multi1d< std::string > soln_files
void write(XMLWriter &xml_out, const std::string &path)
struct Chroma::InlineStochBaryonParams::NamedObject_t named_obj
struct Chroma::InlineStochBaryonParams::Param_t param
InlineStochBaryonParams()
Propagator source construction parameters.
Structure holding solutions.
PropSourceConst_t source_header
Structure holding a source and its solutions.
multi1d< QuarkSolution_t > dilutions
Volume source of Z(N) noise.