22 namespace InlineBuildingBlocksEnv
56 XMLReader paramtop(xml, path);
59 read(paramtop,
"version", version);
85 if (paramtop.count(
"FermState") != 0)
95 if (paramtop.count(
"FermState") != 0)
101 << version <<
" unsupported." << std::endl;
116 write(xml,
"version", version);
130 XMLReader inputtop(xml, path);
156 XMLReader inputtop(xml, path);
185 XMLReader paramtop(xml_in, path);
187 if (paramtop.count(
"Frequency") == 1)
196 read(paramtop,
"BuildingBlocks",
bb);
199 if (paramtop.count(
"xml_file") != 0)
206 QDPIO::cerr << __func__ <<
": Caught Exception reading XML: " << e << std::endl;
230 bool & DoFurtherPatterns,
231 multi1d< unsigned short int > & LinkPattern )
233 DoThisPattern =
true;
234 DoFurtherPatterns =
true;
250 push(xml_out,
"ExampleBuildingBlocks");
251 write(xml_out,
"update_no", update_no);
252 write(xml_out,
"xml_file", xml_file);
255 XMLFileWriter xml(xml_file);
256 func(update_no, xml);
260 func(update_no, xml_out);
276 push(XmlOut,
"ExampleBuildingBlocks");
277 write(XmlOut,
"update_no", update_no);
279 QDPIO::cout <<
" ExampleBuildingBlocks" << std::endl;
280 QDPIO::cout <<
" volume: " << QDP::Layout::lattSize()[0];
281 for (
int i=1;
i<
Nd; ++
i) {
282 QDPIO::cout <<
" x " << QDP::Layout::lattSize()[
i];
284 QDPIO::cout << std::endl;
294 Out <<
" NX = " << QDP::Layout::lattSize()[0] <<
"\n";
295 Out <<
" NY = " << QDP::Layout::lattSize()[1] <<
"\n";
296 Out <<
" NZ = " << QDP::Layout::lattSize()[2] <<
"\n";
297 Out <<
" NT = " << QDP::Layout::lattSize()[3] <<
"\n";
303 Out <<
" Backward Propagator = " <<
prop.BkwdPropId <<
"\n";
304 Out <<
" Backward Propagator Gamma5 Format = " <<
prop.BkwdPropG5Format <<
"\n";
305 Out <<
" Gamma Insertion = " <<
prop.GammaInsertion <<
"\n";
306 Out <<
" Flavor = " <<
prop.Flavor <<
"\n";
307 Out <<
" Building Blocks = " <<
prop.BBFileNamePattern <<
"\n";
335 push(XmlOut,
"Output_version");
336 write(XmlOut,
"out_version", 2);
343 Out <<
"Attempt to initialize the gauge field" <<
"\n"; Out.flush();
346 multi1d<LatticeColorMatrix>
U;
347 XMLBufferWriter gauge_xml;
358 XMLReader fermtop(xml_s);
374 catch( std::bad_cast )
397 write(XmlOut,
"Config_info", gauge_xml);
400 Double ave_plaq, ave_spacelike_plaq, ave_timelike_plaq, ave_link_trace;
401 MesPlq(
U, ave_plaq, ave_spacelike_plaq, ave_timelike_plaq, ave_link_trace );
402 Out <<
"basic gauge field observables" <<
"\n";
403 Out <<
"average plaquette = " << ave_plaq <<
"\n";
404 Out <<
"average space-like plaquette = " << ave_spacelike_plaq <<
"\n";
405 Out <<
"average time-like plaquette = " << ave_timelike_plaq <<
"\n";
406 Out <<
"average link trace = " << ave_link_trace <<
"\n";
408 push(XmlOut,
"Observables");
409 write(XmlOut,
"ave_plaq", ave_plaq);
410 write(XmlOut,
"ave_spacelike_plaq", ave_spacelike_plaq);
411 write(XmlOut,
"ave_timelike_plaq", ave_timelike_plaq);
412 write(XmlOut,
"ave_link_trace", ave_link_trace);
419 SftMom phases_nomom( 0,
true,
Nd-1 );
424 QDPIO::cout <<
"Attempt to parse forward propagator" << std::endl;
425 Out <<
"parsing forward propagator " <<
params.
bb.
FrwdPropId <<
" ... " <<
"\n"; Out.flush();
433 XMLReader FrwdPropXML, FrwdPropRecordXML;
440 read(FrwdPropRecordXML,
"/Propagator/PropSource", source_header);
446 multi1d<Double> FrwdPropCheck =
447 sumMulti( localNorm2(
F ), phases_nomom.
getSet() );
449 Out <<
"forward propagator check = " << FrwdPropCheck[0] <<
"\n"; Out.flush();
452 push(XmlOut,
"ForwardProp");
454 write(XmlOut,
"FrwdPropXML", FrwdPropXML);
455 write(XmlOut,
"FrwdPropRecordXML", FrwdPropRecordXML);
456 write(XmlOut,
"FrwdPropCheck", FrwdPropCheck);
460 catch( std::bad_cast )
473 QDPIO::cout <<
"Forward propagator successfully parsed" << std::endl;
474 Out <<
"finished parsing forward propagator " <<
params.
bb.
FrwdPropId <<
"\n"; Out.flush();
488 push(XmlOut,
"SequentialSource");
490 for(
int loop = 0; loop < NF; ++loop)
492 push(XmlOut,
"elem");
493 write(XmlOut,
"loop_ctr", loop);
495 Out <<
"Loop = " << loop <<
"\n"; Out.flush();
496 QDPIO::cout <<
"Loop = " << loop << std::endl;
498 multi1d< LatticePropagator > B( 1 );
500 QDPIO::cout <<
"Attempt to parse backward propagator" << std::endl;
501 Out <<
"parsing backward u propagator " <<
params.
bb.
BkwdProps[loop].BkwdPropId <<
" ... " <<
"\n"; Out.flush();
508 XMLReader BkwdPropXML, BkwdPropRecordXML;
516 read(BkwdPropRecordXML,
"/SequentialProp/SeqSource", seqsource_header);
522 multi1d<Double> BkwdPropCheck = sumMulti( localNorm2( B[0] ), phases_nomom.
getSet() );
524 Out <<
"backward u propagator check = " << BkwdPropCheck[0] <<
"\n"; Out.flush();
527 push(XmlOut,
"BackwardProp");
530 write(XmlOut,
"SequentialSourceType", seqsource_header.
seqsrc.
id);
531 write(XmlOut,
"BkwdPropXML", BkwdPropXML);
532 write(XmlOut,
"BkwdPropRecordXML", BkwdPropRecordXML);
533 write(XmlOut,
"BkwdPropCheck", BkwdPropCheck);
537 catch( std::bad_cast )
550 QDPIO::cout <<
"Backward propagator successfully parse" << std::endl;
551 Out <<
"finished reading backward u propagator " <<
params.
bb.
BkwdProps[loop].BkwdPropId <<
" ... " <<
"\n"; Out.flush();
557 multi1d<int> GammaInsertions(1);
560 if (GammaInsertions[0] < 0 || GammaInsertions[0] >= Ns*Ns)
562 QDPIO::cerr <<
"InlineBuildingBlocks: Gamma insertion out of bounds: " << GammaInsertions[0] << std::endl;
570 QDPIO::cout <<
"Seqsource name = " << seqsource_header.
seqsrc.
id << std::endl;
571 QDPIO::cout <<
"Gamma insertion = " <<
params.
bb.
BkwdProps[loop].GammaInsertion << std::endl;
575 write(XmlOut,
"gamma_insertion", GammaInsertions[0]);
587 LatticePropagator Bu = B[0];
588 B[0] = Gamma( 15 ) * Bu;
592 LatticePropagator Bu = B[0];
593 B[0] = Bu * Gamma( 15 );
597 LatticePropagator Bu = B[0];
598 B[0] = Gamma( 15 ) * Bu * Gamma( 15 );
605 multi1d< int > SnkMom(
Nd - 1 );
619 int NumO = PhasesCanonical.
numMom();
621 multi2d< std::string > Files( 1, NumO );
623 const int BBFileNameLength =
params.
bb.
BkwdProps[loop].BBFileNamePattern.length() + 3 * 3 + 1;
625 for(
int o = 0; o < NumO; o ++ )
627 multi1d< int >
Q = PhasesCanonical.
numToMom( o );
646 char* bbf =
new char[BBFileNameLength + 1];
647 sprintf( bbf,
params.
bb.
BkwdProps[loop].BBFileNamePattern.c_str(), ZSign, abs(
Q[2]), YSign, abs(
Q[1]), XSign, abs(
Q[0]) );
658 multi1d< int > Flavors( 1 );
680 <<
", should be one of U,D,S,C,T,B" << std::endl;
705 push(XmlOut,
"LoopBackTest");
707 write(XmlOut,
"gamma_insertion", GammaInsertions[0]);
713 LatticeComplex tr = trace(adj(B[0]) * Gamma(GammaInsertions[0]));
714 Complex seq_src_value = peekSite(tr,
t_srce);
715 write(XmlOut,
"source_value", seq_src_value);
724 int GammaInsertion = GammaInsertions[0];
726 push(XmlOut,
"DiagnosticTest");
727 write(XmlOut,
"GammaInsertion", GammaInsertion);
730 LatticePropagator GFG = Gamma(0) *
F * Gamma( GammaInsertion );
732 multi1d< DComplex > pr = sumMulti(tr, Phases.
getSet());
733 write(XmlOut,
"formFactor_G0", pr);
736 LatticePropagator GFG = Gamma(8) *
F * Gamma( GammaInsertion );
738 multi1d< DComplex > pr = sumMulti(tr, Phases.
getSet());
739 write(XmlOut,
"formFactor_G8", pr);
742 LatticePropagator GFG = Gamma(Ns*Ns-1) *
F * Gamma( GammaInsertion );
744 multi1d< DComplex > pr = sumMulti(tr, Phases.
getSet());
745 write(XmlOut,
"formFactor_G15", pr);
756 Out <<
"calculating building blocks" <<
"\n"; Out.flush();
757 QDPIO::cout <<
"calculating building blocks" << std::endl;
759 const signed short int T1 = 0;
760 const signed short int T2 = QDP::Layout::lattSize()[
j_decay] - 1;
761 const signed short int DecayDir =
j_decay;
762 const signed short int Tsrc = source_header.
t_source;
763 const signed short int Tsnk = seqsource_header.
t_sink;
767 GammaInsertions, Flavors,
769 Phases, PhasesCanonical,
777 Out <<
"finished calculating building blocks for loop = " << loop <<
"\n"; Out.flush();
778 QDPIO::cout <<
"finished calculating building blocks for loop = " << loop
780 << swatch.getTimeInSeconds()
781 <<
" secs" << std::endl;
790 Out <<
"\n" <<
"FINISHED" <<
"\n" <<
"\n";
795 << snoop.getTimeInSeconds()
796 <<
" secs" << std::endl;
Inline measurement factory.
Class for counted reference semantics.
Inline measurement of 3-pt functions writing building-blocks.
void operator()(const unsigned long update_no, XMLWriter &xml_out)
Do the measurement.
InlineBuildingBlocksParams params
void func(const unsigned long update_no, XMLWriter &xml_out)
Do the measurement.
Fourier transform phase factor support.
multi1d< int > numToMom(int mom_num) const
Convert momenta id to actual array of momenta.
int numMom() const
Number of momenta.
const Set & getSet() const
The set to be used in sumMulti.
All ferm create-state method.
Fermion create state factory.
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.
GroupXML_t readXMLGroup(XMLReader &xml_in, const std::string &path, const std::string &type_name)
Read group and return as a std::string.
std::map< std::string, SinkPropContainer_t > prop
ForwardProp_t prop_header
Inline construction of BuildingBlocks.
Named object function std::map.
static bool registered
Local registration flag.
GroupXML_t nullXMLGroup()
Returns a periodic createstate group.
bool registerAll()
Register all the factories.
bool registerAll()
Register all the factories.
QDPSubTypeTrait< typename BinaryReturn< C1, C2, FnLocalInnerProduct >::Type_t >::Type_t localInnerProduct(const QDPSubType< T1, C1 > &l, const QDPType< T2, C2 > &r)
Asqtad Staggered-Dirac operator.
LinOpSysSolverMGProtoClover::Q Q
push(xml_out,"Condensates")
void write(XMLWriter &xml, const std::string &path, const InlineBuildingBlocksParams::BB_out_t &input)
BB parameters.
static const char *const CVSBuildingBlocks_hh
void AllLinkPatterns(bool &DoThisPattern, bool &DoFurtherPatterns, multi1d< unsigned short int > &LinkPattern)
void BuildingBlocks(const multi1d< LatticePropagator > &B, const LatticePropagator &F, const multi1d< LatticeColorMatrix > &U, const multi1d< int > &GammaInsertions, const multi1d< int > &Flavors, const unsigned short int MaxNLinks, const BBLinkPattern LinkPattern, const SftMom &Phases, const SftMom &PhasesCanonical, const multi2d< std::string > &BinaryDataFileNames, const signed short int T1, const signed short int T2, const signed short int Tsrc, const signed short int Tsnk, const std::string &SeqSourceType, const multi1d< int > &SnkMom, const signed short int DecayDir, const bool TimeReverse, const bool ShiftFlag)
void MesPlq(const multi1d< LatticeColorMatrixF3 > &u, multi2d< Double > &plane_plaq, Double &link)
void CVSBuildingBlocks(TextWriter &Out)
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
FloatingPoint< double > Double
Print out basic info about this program.
Fourier transform phase factor support.
multi1d< NamedObject_t > BkwdProps
std::string BkwdPropG5Format
std::string BBFileNamePattern
void write(XMLWriter &xml_out, const std::string &path)
struct Chroma::InlineBuildingBlocksParams::BB_out_t bb
InlineBuildingBlocksParams()
struct Chroma::InlineBuildingBlocksParams::Param_t param
Propagator source construction parameters.
multi1d< int > getTSrce() const
Sequential source parameters.
multi1d< LatticeColorMatrix > U
static INTERNAL_PRECISION F