25 namespace InlineStochMesonEnv
61 XMLReader inputtop(xml, path);
79 XMLReader inputtop(xml, path);
82 read(inputtop,
"operator", input.
op);
92 write(xml,
"operator", input.
op);
101 XMLReader paramtop(xml, path);
104 read(paramtop,
"version", version);
115 QDPIO::cerr <<
"Input parameter version " << version <<
" unsupported." << std::endl;
130 write(xml,
"version", version);
140 XMLReader inputtop(xml, path);
168 XMLReader paramtop(xml_in, path);
170 if (paramtop.count(
"Frequency") == 1)
188 if (paramtop.count(
"xml_file") != 0)
195 QDPIO::cerr << __func__ <<
": Caught Exception reading XML: " << e << std::endl;
229 struct QuarkSolution_t
258 multi2d<MesonOperatorElement_t>
op;
268 multi1d<MesonOperatorInsertion_t>
inser;
275 int inser_size =
inser.size();
276 int op_size2 =
inser[0].op.size2();
277 int op_size1 =
inser[0].op.size1();
278 int elem_size2 =
inser[0].op(0,0).elem.size2();
279 int elem_size1 =
inser[0].op(0,0).elem.size1();
282 Complex inser_sizes, op_sizes, elem_sizes;
283 inser_sizes = cmplx(Real(
inser.size()), Real(
zero));
284 op_sizes = cmplx(Real(op_size2), Real(op_size1));
285 elem_sizes = cmplx(Real(elem_size2), Real(elem_size1));
287 multi1d<Complex> mesprop_1d(3 + inser_size*op_size2*op_size1*elem_size2*elem_size1);
291 mesprop_1d[cnt++] = inser_sizes;
292 mesprop_1d[cnt++] = op_sizes;
293 mesprop_1d[cnt++] = elem_sizes;
295 for(
int g=0; g <
inser.size(); ++g)
296 for(
int i=0;
i <
inser[g].op.size2(); ++
i)
297 for(
int j=0;
j <
inser[g].op.size1(); ++
j)
298 for(
int k=0;
k <
inser[g].op(
i,
j).elem.size2(); ++
k)
299 for(
int l=0;
l <
inser[g].op(
i,
j).elem.size1(); ++
l)
300 mesprop_1d[cnt++] =
inser[g].op(
i,
j).elem(
k,
l);
313 write(xml,
"version", version);
338 push(xml_out,
"stoch_meson");
339 write(xml_out,
"update_no", update_no);
340 write(xml_out,
"xml_file", xml_file);
343 XMLFileWriter xml(xml_file);
344 func(update_no, xml);
348 func(update_no, xml_out);
365 XMLBufferWriter gauge_xml;
371 catch( std::bad_cast )
383 const multi1d<LatticeColorMatrix>&
u =
386 push(xml_out,
"stoch_meson");
387 write(xml_out,
"update_no", update_no);
397 write(xml_out,
"Config_info", gauge_xml);
399 push(xml_out,
"Output_version");
400 write(xml_out,
"out_version", 1);
405 MesPlq(xml_out,
"Observables",
u);
420 QDPIO::cout <<
"quarks.size= " << quarks.size() << std::endl;
421 for(
int n=0;
n < quarks.size(); ++
n)
423 QDPIO::cout <<
"Attempt to read solutions for source number=" <<
n << std::endl;
426 QDPIO::cout <<
"dilutions.size= " << quarks[
n].dilutions.size() << std::endl;
427 for(
int i=0;
i < quarks[
n].dilutions.size(); ++
i)
429 XMLReader file_xml, record_xml;
433 read(from, record_xml, quarks[
n].dilutions[
i].soln);
436 read(record_xml,
"/Propagator/PropSource", quarks[
n].dilutions[
i].source_header);
443 QDPIO::cerr <<
"Error extracting headers: " << e << std::endl;
448 QDPIO::cout <<
"Sources and solutions successfully read: time= "
449 << snoop.getTimeInSeconds()
450 <<
" secs" << std::endl;
462 push(xml_out,
"Norms");
463 for(
int n=0;
n < quarks.size(); ++
n)
467 LatticeFermion quark_noise;
469 for(
int i=0;
i < quarks[
n].dilutions.size(); ++
i)
471 std::istringstream xml_s(quarks[
n].dilutions[
i].source_header.source.xml);
472 XMLReader sourcetop(xml_s);
481 QDPIO::cout <<
"Quark num= " <<
n <<
" dilution num= " <<
i << std::endl;
485 quarks[
n].dilutions[
i].source_header.source.path);
492 quarks[0].j_decay = srcParams.
j_decay;
506 if ( toBool(srcParams.
ran_seed != quarks[
n].seed) )
508 QDPIO::cerr <<
"quark source=" <<
n <<
" dilution=" <<
i <<
" seed does not match" << std::endl;
513 if ( toBool(srcParams.
N != N) )
515 QDPIO::cerr <<
"quark source=" <<
n <<
" dilution=" <<
i <<
" N does not match" << std::endl;
523 quarks[
n].dilutions[
i].source = srcConst(
u);
524 quark_noise -= quarks[
n].dilutions[
i].source;
530 multi1d<Double> source_corr = sumMulti(localNorm2(quarks[
n].dilutions[
i].source),
531 phases_nomom.getSet());
533 multi1d<Double> soln_corr = sumMulti(localNorm2(quarks[
n].dilutions[
i].soln),
534 phases_nomom.getSet());
536 push(xml_out,
"elem");
539 write(xml_out,
"source_corr", source_corr);
540 write(xml_out,
"soln_corr", soln_corr);
547 Double dcnt = norm2(quark_noise, phases );
548 if (toDouble(dcnt) != 0.0)
550 QDPIO::cerr <<
"Noise not saturated by all potential solutions: dcnt=" << dcnt << std::endl;
561 QDPIO::cerr <<
": Caught Exception creating source: " << e << std::endl;
567 QDPIO::cout <<
"Sources saturated: time= "
568 << snoop.getTimeInSeconds()
569 <<
" secs" << std::endl;
575 int j_decay = quarks[0].j_decay;
584 if (quarks.size() != 2)
586 QDPIO::cerr <<
"expecting 2 quarks but have num quarks= " << quarks.size() << std::endl;
596 meson_opA.
seed_l = quarks[1].seed;
597 meson_opA.
seed_r = quarks[0].seed;
600 meson_opA.
inser.resize(Ns*Ns);
605 QDPIO::cerr <<
"meson op seeds are the same" << std::endl;
615 XMLReader sourcetop(xml_s);
625 push(xml_out,
"OperatorA");
628 multi1d<LatticeFermion> smeared_sources(quarks[1].dilutions.size());
629 for(
int i=0;
i < smeared_sources.size(); ++
i)
631 smeared_sources[
i] = quarks[1].dilutions[
i].source;
632 (*sourceSmearing)(smeared_sources[
i]);
636 multi1d<LatticeFermion> smeared_solns(quarks[0].dilutions.size());
637 for(
int j=0;
j < smeared_solns.size(); ++
j)
639 smeared_solns[
j] = quarks[0].dilutions[
j].soln;
640 (*sourceSmearing)(smeared_solns[
j]);
643 QDPIO::cout <<
"source smearings done" << std::endl;
645 for(
int gamma_value=0; gamma_value < Ns*Ns; ++gamma_value)
647 meson_opA.
inser[gamma_value].op.resize(smeared_sources.size(), smeared_solns.size());
649 for(
int i=0;
i < smeared_sources.size(); ++
i)
651 for(
int j=0;
j < smeared_solns.size(); ++
j)
654 LatticeComplex corr_fn =
zero;
655 corr_fn[phases.
getSet()[quarks[1].dilutions[
i].source_header.t_source]] =
657 meson_opA.
inser[gamma_value].op(
i,
j).elem = phases.
sft(corr_fn);
666 QDPIO::cerr <<
": Caught Exception creating source smearing: " << e << std::endl;
671 QDPIO::cerr <<
": Caught generic exception creating source smearing" << std::endl;
677 QDPIO::cout <<
"Operator A computed: time= "
678 << snoop.getTimeInSeconds()
679 <<
" secs" << std::endl;
687 meson_opB.
seed_l = quarks[0].seed;
688 meson_opB.
seed_r = quarks[1].seed;
691 meson_opB.
inser.resize(Ns*Ns);
696 QDPIO::cerr <<
"meson op seeds are the same" << std::endl;
705 XMLReader sinktop(xml_s);
715 push(xml_out,
"OperatorB");
718 multi1d<LatticeFermion> smeared_sources(quarks[0].dilutions.size());
719 for(
int j=0;
j < smeared_sources.size(); ++
j)
721 smeared_sources[
j] = quarks[0].dilutions[
j].source;
722 (*sinkSmearing)(smeared_sources[
j]);
726 multi1d<LatticeFermion> smeared_solns(quarks[1].dilutions.size());
727 for(
int i=0;
i < smeared_solns.size(); ++
i)
729 smeared_solns[
i] = quarks[1].dilutions[
i].soln;
730 (*sinkSmearing)(smeared_solns[
i]);
733 QDPIO::cout <<
"sink smearings done" << std::endl;
735 for(
int gamma_value=0; gamma_value < Ns*Ns; ++gamma_value)
737 meson_opB.
inser[gamma_value].op.resize(smeared_sources.size(), smeared_solns.size());
739 for(
int j=0;
j < smeared_sources.size(); ++
j)
741 for(
int i=0;
i < smeared_solns.size(); ++
i)
744 LatticeComplex corr_fn =
zero;
745 corr_fn[phases.
getSet()[quarks[0].dilutions[
j].source_header.t_source]] =
747 meson_opB.
inser[gamma_value].op(
j,
i).elem = phases.
sft(corr_fn);
757 QDPIO::cout <<
"Operator B computed: time= "
758 << snoop.getTimeInSeconds()
759 <<
" secs" << std::endl;
766 XMLBufferWriter file_xml;
767 push(file_xml,
"meson_operator");
768 write(file_xml,
"Config_info", gauge_xml);
772 QDPIO_SINGLEFILE, QDPIO_SERIAL, QDPIO_OPEN);
776 XMLBufferWriter record_xml;
777 write(record_xml,
"SourceMesonOperator", meson_opA);
783 XMLBufferWriter record_xml;
784 write(record_xml,
"SinkMesonOperator", meson_opB);
793 QDPIO::cout <<
"Operators written: time= "
794 << snoop.getTimeInSeconds()
795 <<
" secs" << std::endl;
802 << snoop.getTimeInSeconds()
803 <<
" secs" << std::endl;
Inline measurement factory.
Random complex Z(N) sources using dilution.
Class for counted reference semantics.
Inline measurement of stochastic meson 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.
InlineStochMesonParams params
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 meson operator.
void savern(int iseed[4])
Named object function std::map.
static bool registered
Local registration flag.
std::string getName()
Return the name.
QDPSubTypeTrait< typename BinaryReturn< C1, C2, FnLocalInnerProduct >::Type_t >::Type_t localInnerProduct(const QDPSubType< T1, C1 > &l, const QDPType< T2, C2 > &r)
bool registerAll()
Register all the factories.
bool registerAll()
Register all the factories.
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.
Quark source or sink smearing.
Fourier transform phase factor support.
All make sink constructors.
Factory for producing quark prop sinks.
Factory for producing quark smearing objects.
Random complex Z(N) sources using dilution.
multi1d< std::string > soln_files
PropSinkSmear_t sink_smearing
void write(XMLWriter &xml_out, const std::string &path)
struct Chroma::InlineStochMesonParams::Param_t param
PropSourceSmear_t source_smearing
struct Chroma::InlineStochMesonParams::NamedObject_t named_obj
multi2d< MesonOperatorElement_t > op
multi1d< MesonOperatorInsertion_t > inser
multi1d< Complex > serialize()
Serialize generalized operator object.
Propagator source construction parameters.
PropSourceConst_t source_header
Structure holding a source and its solutions.
multi1d< QuarkSolution_t > dilutions
Volume source of Z(N) noise.