25 namespace InlineUSQCDWriteDDPairsPropEnv
48 success &= TheInlineMeasurementFactory::Instance().registerObject(
name, createMeasurement);
73 write(xml,
"Frequency",
p.frequency);
75 write(xml,
"OutputFile",
p.output_file_name);
76 write(xml,
"OutputVolfmt",
p.qio_volfmt);
77 bool parallel_io_choice =
false;
78 if(
p.parallel_io == QDPIO_PARALLEL) {
79 parallel_io_choice =
true;
81 write(xml,
"parallel_io", parallel_io_choice);
82 write(xml,
"Precision",
p.precision);
86 push(xml,
"NamedObject");
87 write(xml,
"prop_id",
p.prop_id);
88 write(xml,
"gauge_id",
p.gauge_id);
91 if (
p.xml_file !=
"") {
92 write(xml,
"xml_file",
p.xml_file);
98 InlineUSQCDWriteDDPairsPropParams::InlineUSQCDWriteDDPairsPropParams() { frequency = 0; xml_file=
""; }
100 InlineUSQCDWriteDDPairsPropParams::InlineUSQCDWriteDDPairsPropParams(XMLReader& xml_in,
const std::string& path)
104 XMLReader paramtop(xml_in, path);
106 if (paramtop.count(
"Frequency") == 1)
107 read(paramtop,
"Frequency", frequency);
112 read(paramtop,
"Param/OutputFile", output_file_name);
113 read(paramtop,
"Param/OutputVolfmt", qio_volfmt);
114 bool parallel_io_choice = Layout::isIOGridDefined() && ( Layout::numIONodeGrid() > 1);
116 if( paramtop.count(
"Param/parallel_io") == 1) {
117 read(paramtop,
"Param/parallel_io", parallel_io_choice);
120 if( parallel_io_choice ) {
121 parallel_io = QDPIO_PARALLEL;
124 parallel_io = QDPIO_SERIAL;
126 read(paramtop,
"Param/Precision", precision);
129 read(paramtop,
"./NamedObject/prop_id", prop_id);
130 read(paramtop,
"./NamedObject/gauge_id", gauge_id);
132 if( paramtop.count(
"xml_file") == 1 ) {
133 read(paramtop,
"./xml_file", xml_file);
141 QDPIO::cerr << __func__ <<
": caught Exception reading XML: " << e << std::endl;
154 if(
params.xml_file ==
"" ) {
155 func(update_no, xml_out);
158 XMLFileWriter separate_output(
params.xml_file);
159 func(update_no, separate_output);
170 QDPIO::cerr<<
" code only works for Nc=3 and Ns=4\n";
176 push(xml_out,
"USQCDWriteDDPairsProp");
177 write(xml_out,
"update_no", update_no);
183 QDPIO::cout <<
"Attempt to write object name = " <<
params.prop_id << std::endl;
184 QDPIO::cout <<
"Output file = " <<
params.output_file_name << std::endl;
196 LatticeDiracPropagator& trial_prop=TheNamedObjMap::Instance().getData<LatticePropagator>(
params.prop_id);
198 const multi1d<LatticeColorMatrix>& u_trial =
199 TheNamedObjMap::Instance().getData<multi1d<LatticeColorMatrix> >(
params.gauge_id);
202 QDPIO::cout <<
"Could not get the prop from the named ObjectMap. Missing ID"<<
params.prop_id << std::endl;
208 const LatticePropagator& theProp=
209 TheNamedObjMap::Instance().getData<LatticePropagator>(
params.prop_id);
211 const multi1d<LatticeColorMatrix>&
u =
212 TheNamedObjMap::Instance().getData<multi1d<LatticeColorMatrix> >(
params.gauge_id);
216 XMLReader thePropHeader;
217 TheNamedObjMap::Instance().get(
params.prop_id).getRecordXML(thePropHeader);
221 XMLReader theSourceHeader(thePropHeader,
"//PropSource");
231 LatticePropagator theSource;
239 QDPIO::cout <<
"Source = " <<
source_type << std::endl;
243 sourceConstruction(ThePropSourceConstructionFactory::Instance().createObject(
source_type,theSourceHeader,
"Source"));
246 theSource = (*sourceConstruction)(
u);
268 read(thePropHeader,
"//PropSource", source_info);
270 QDPIO::cout <<
"Source timeslice is " << source_info.
t_source << std::endl;
287 XMLBufferWriter file_xml;
288 push(file_xml,
"usqcdPropFile");
289 write(file_xml,
"version",
"1.0");
290 write(file_xml,
"type",
"USQCD_DiracFermion_Source_Sink_Pairs");
291 push(file_xml,
"info");
297 QDPIO::cout <<
"File XML is:" << std::endl;
298 QDPIO::cout << file_xml.str();
305 XMLBufferWriter source_xml;
306 push(source_xml,
"usqcdSourceInfo");
307 write(source_xml,
"version",
"1.0");
308 push(source_xml,
"info");
316 QDPIO::cout <<
"Source XML is:" << std::endl;
317 QDPIO::cout << source_xml.str();
319 if (
params.parallel_io == QDPIO_PARALLEL ) {
320 QDPIO::cout <<
"Attempting Parallel IO for writing" << std::endl;
323 QDPIO::cout <<
"Attempting Serial IO for reading " << std::endl;
327 QDPFileWriter qio_out(file_xml,
params.output_file_name,
334 multi1d<int> lower(
Nd);
335 multi1d<int> upper(
Nd);
339 for(
int i=0;
i <
Nd;
i++) {
341 upper[
i] = Layout::lattSize()[
i]-1;
351 for(
int spin=0; spin < Ns; spin++) {
352 for(
int color=0; color < Nc; color++) {
360 XMLBufferWriter prop_sink_xml;
361 push(prop_sink_xml, sinkRecordName);
362 write(prop_sink_xml,
"version",
"1.0");
363 write(prop_sink_xml,
"spin", spin);
364 write(prop_sink_xml,
"color", color);
365 push(prop_sink_xml,
"info");
376 LatticeDiracFermion tmpFerm=
zero;
380 if (
params.precision ==
"single" ) {
381 LatticeDiracFermionF3 ferm_out(tmpFerm) ;
384 QDPIO::cout <<
"About to write single prec. source record...." << std::endl;
385 write(qio_out, source_xml, ferm_out, lower, upper);
389 LatticeDiracFermionD3 ferm_out(tmpFerm);
392 QDPIO::cout <<
"About to write double prec. source record....";
393 write(qio_out, source_xml,ferm_out, lower, upper);
404 if (
params.precision ==
"single" ) {
405 LatticeDiracFermionF3 ferm_out = tmpFerm ;
408 QDPIO::cout <<
"About to write single prec. prop component record...." << std::endl;
409 write(qio_out, prop_sink_xml, ferm_out);
413 LatticeDiracFermionD3 ferm_out(tmpFerm);
416 QDPIO::cout <<
"About to write double prec. prop component record...." << std::endl;
417 write(qio_out, prop_sink_xml, ferm_out);
Inline measurement factory.
Primary include file for CHROMA library code.
Class for counted reference semantics.
Inline writing of memory objects.
void PropToFerm(const LatticePropagatorF &b, LatticeFermionF &a, int color_index, int spin_index)
Extract a LatticeFermion from a LatticePropagator.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams ¶m)
Read parameters.
Class for counted reference semantics.
ForwardProp_t prop_header
Inline task to read a USQCD DD Pairs Prop.
Named object function std::map.
static bool registered
Local registration flag.
bool registerAll()
Register all the factories.
multi1d< Hadron2PtContraction_t > operator()(const multi1d< LatticeColorMatrix > &u)
Asqtad Staggered-Dirac operator.
static multi1d< LatticeColorMatrix > u
void write(XMLWriter &xml, const std::string &path, const InlineUSQCDWriteDDPairsPropParams &p)
Object buffer.
Routines associated with Chroma propagator IO.
Fourier transform phase factor support.
Factory for producing quark prop sources.
Propagator source construction parameters.
Mega structure holding a full forward prop (not sink smeared)
push(xml_out,"Cooled_Topology")