22 namespace InlineNoisyBuildingBlocksEnv
55 XMLReader paramtop(xml, path);
58 read(paramtop,
"version", version);
83 if (paramtop.count(
"FermState") != 0)
92 if (paramtop.count(
"FermState") != 0)
98 << version <<
" unsupported." << std::endl;
113 write(xml,
"version", version);
152 XMLReader inputtop(xml, path);
189 XMLReader paramtop(xml_in, path);
191 if (paramtop.count(
"Frequency") == 1)
200 read(paramtop,
"BuildingBlocks",
bb);
203 if (paramtop.count(
"xml_file") != 0)
210 QDPIO::cerr << __func__ <<
": Caught Exception reading XML: " << e << std::endl;
234 multi1d< unsigned short int > & LinkPattern )
236 DoThisPattern =
true;
237 DoFurtherPatterns =
true;
253 push(xml_out,
"ExampleBuildingBlocks");
254 write(xml_out,
"update_no", update_no);
255 write(xml_out,
"xml_file", xml_file);
258 XMLFileWriter xml(xml_file);
259 func(update_no, xml);
263 func(update_no, xml_out);
279 push(XmlOut,
"ExampleBuildingBlocks");
280 write(XmlOut,
"update_no", update_no);
282 QDPIO::cout <<
" ExampleBuildingBlocks" << std::endl;
283 QDPIO::cout <<
" volume: " << QDP::Layout::lattSize()[0];
284 for (
int i=1;
i<
Nd; ++
i) {
285 QDPIO::cout <<
" x " << QDP::Layout::lattSize()[
i];
287 QDPIO::cout << std::endl;
297 Out <<
" NX = " << QDP::Layout::lattSize()[0] <<
"\n";
298 Out <<
" NY = " << QDP::Layout::lattSize()[1] <<
"\n";
299 Out <<
" NZ = " << QDP::Layout::lattSize()[2] <<
"\n";
300 Out <<
" NT = " << QDP::Layout::lattSize()[3] <<
"\n";
315 Out <<
" Gamma Insertion = "
319 Out <<
" Building Blocks = "
345 push(XmlOut,
"Output_version");
346 write(XmlOut,
"out_version", 2);
353 Out <<
"Attempt to initialize the gauge field" <<
"\n"; Out.flush();
356 multi1d<LatticeColorMatrix>
U;
357 XMLBufferWriter gauge_xml;
367 XMLReader fermtop(xml_s);
383 catch( std::bad_cast )
400 write(XmlOut,
"Config_info", gauge_xml);
403 Double ave_plaq, ave_spacelike_plaq, ave_timelike_plaq, ave_link_trace;
404 MesPlq(
U, ave_plaq, ave_spacelike_plaq, ave_timelike_plaq, ave_link_trace );
405 Out <<
"basic gauge field observables" <<
"\n";
406 Out <<
"average plaquette = " << ave_plaq <<
"\n";
407 Out <<
"average space-like plaquette = " << ave_spacelike_plaq <<
"\n";
408 Out <<
"average time-like plaquette = " << ave_timelike_plaq <<
"\n";
409 Out <<
"average link trace = " << ave_link_trace <<
"\n";
411 push(XmlOut,
"Observables");
412 write(XmlOut,
"ave_plaq", ave_plaq);
413 write(XmlOut,
"ave_spacelike_plaq", ave_spacelike_plaq);
414 write(XmlOut,
"ave_timelike_plaq", ave_timelike_plaq);
415 write(XmlOut,
"ave_link_trace", ave_link_trace);
425 SftMom phases_nomom( 0,
true,
Nd-1 );
430 QDPIO::cout <<
"Attempt to parse forward propagator" << std::endl;
441 XMLReader FrwdPropXML, FrwdPropRecordXML;
448 read(FrwdPropRecordXML,
"/Propagator/PropSource", source_header_check);
454 multi1d<Double> FrwdPropCheck =
455 sumMulti( localNorm2(
F ), phases_nomom.
getSet() );
457 Out <<
"forward propagator check = " << FrwdPropCheck[0] <<
"\n"; Out.flush();
460 push(XmlOut,
"ForwardProp");
462 write(XmlOut,
"FrwdPropXML", FrwdPropXML);
463 write(XmlOut,
"FrwdPropRecordXML", FrwdPropRecordXML);
464 write(XmlOut,
"FrwdPropCheck", FrwdPropCheck);
468 catch( std::bad_cast )
481 QDPIO::cout <<
"Forward propagator successfully parsed" << std::endl;
482 Out <<
"finished parsing forward propagator " <<
params.
bb.
FrwdPropId <<
"\n"; Out.flush();
488 multi1d<LatticePropagator> S( 1 );
490 QDPIO::cout <<
"Attempt to parse noisy source" << std::endl;
501 XMLReader NoisySrcXML, NoisySrcRecordXML;
507 if (NoisySrcRecordXML.count(
"/MakeSource") != 0) {
508 read(NoisySrcRecordXML,
"/MakeSource/PropSource", source_header);
516 multi1d<Double> NoisySrcCheck =
517 sumMulti( localNorm2( S[0] ), phases_nomom.
getSet() );
519 Out <<
"noisy source check = " << NoisySrcCheck[0] <<
"\n";
523 push(XmlOut,
"NoisySource");
525 write(XmlOut,
"NoisySrcXML", NoisySrcXML);
526 write(XmlOut,
"NoisySrcRecordXML", NoisySrcRecordXML);
527 write(XmlOut,
"NoisySrcCheck", NoisySrcCheck);
531 catch( std::bad_cast )
534 <<
": caught dynamic cast error" << std::endl;
540 <<
": noisy source: error message: " << e << std::endl;
544 QDPIO::cout <<
"Noisy source successfully parsed" << std::endl;
555 multi1d<int> GammaInsertions(1);
558 if (GammaInsertions[0] < 0 || GammaInsertions[0] >= Ns*Ns) {
560 <<
"InlineNoisyBuildingBlocks: Gamma insertion out of bounds: "
561 << GammaInsertions[0] << std::endl;
569 LatticePropagator Su = S[0] ;
572 S[0] = Gamma( 15 ) * Su;
574 S[0] = Su * Gamma( 15 );
576 S[0] = Gamma( 15 ) * Su * Gamma( 15 );
583 multi1d< int > SnkMom(
Nd - 1 );
600 int NumO = PhasesCanonical.
numMom();
602 multi2d< std::string > Files( 1, NumO );
604 const int BBFileNameLength
607 for (
int o = 0; o < NumO; o ++ ) {
609 multi1d< int >
Q = PhasesCanonical.
numToMom( o );
625 char* bbf =
new char[BBFileNameLength + 1];
627 ZSign, abs(
Q[2]), YSign, abs(
Q[1]), XSign, abs(
Q[0]) );
638 multi1d< int > Flavors( 1 );
659 <<
", should be one of U,D,S,C,T,B" << std::endl;
668 Out <<
"calculating building blocks" <<
"\n";
670 QDPIO::cout <<
"calculating building blocks" << std::endl;
672 const signed short int T1 = 0;
673 const signed short int T2 = QDP::Layout::lattSize()[
j_decay] - 1;
674 const signed short int DecayDir =
j_decay;
675 const signed short int Tsrc = T1;
676 const signed short int Tsnk = T2;
682 Files, T1, T2, Tsrc, Tsnk,
690 Out <<
"finished calculating building blocks" <<
"\n";
692 QDPIO::cout <<
"finished calculating building blocks, time= "
693 << swatch.getTimeInSeconds() <<
" secs" << std::endl;
697 Out <<
"\n" <<
"FINISHED" <<
"\n" <<
"\n";
703 << snoop.getTimeInSeconds()
704 <<
" secs" << std::endl;
Inline measurement factory.
Class for counted reference semantics.
Inline measurement of noisy building blocks.
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.
InlineNoisyBuildingBlocksParams params
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.
ForwardProp_t prop_header
Inline construction of noisy 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.
Asqtad Staggered-Dirac operator.
LinOpSysSolverMGProtoClover::Q Q
push(xml_out,"Condensates")
void AllNoisyLinkPatterns(bool &DoThisPattern, bool &DoFurtherPatterns, multi1d< unsigned short int > &LinkPattern)
static const char *const CVSBuildingBlocks_hh
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 write(XMLWriter &xml, const std::string &path, const InlineNoisyBuildingBlocksParams::BB_out_t &input)
BB parameters.
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.
std::string NoisySrcG5Format
std::string BBFileNamePattern
struct Chroma::InlineNoisyBuildingBlocksParams::Param_t param
void write(XMLWriter &xml_out, const std::string &path)
struct Chroma::InlineNoisyBuildingBlocksParams::BB_out_t bb
InlineNoisyBuildingBlocksParams()
Propagator source construction parameters.
multi1d< LatticeColorMatrix > U
static INTERNAL_PRECISION F