21 std::istringstream xml_s(fermact.
xml);
22 XMLReader fermacttop(xml_s);
23 XMLReader top(fermacttop, fermact.
path);
29 if (top.count(
"Mass") != 0)
33 else if (top.count(
"Kappa") != 0)
36 read(top,
"Kappa", Kappa);
39 else if (top.count(
"m_q") != 0)
45 QDPIO::cerr <<
"Neither Mass nor Kappa found" << std::endl;
51 QDPIO::cerr <<
"Error reading fermact: " << e << std::endl;
66 std::istringstream xml_s(fermact.
xml);
67 XMLReader fermacttop(xml_s);
68 XMLReader top(fermacttop, fermact.
path);
70 multi1d<int> boundary;
75 if (top.count(
"FermState/FermionBC/boundary") != 0)
77 read(top,
"FermState/FermionBC/boundary", boundary);
79 else if (top.count(
"FermionBC/boundary") != 0)
81 read(top,
"FermionBC/boundary", boundary);
83 else if (top.count(
"boundary") != 0)
85 read(top,
"boundary", boundary);
89 std::ostringstream os;
90 os << __func__ <<
": Warning: neither FermionBC group nor boundary found - throwing exception. If this is not caught the code will exit" << std::endl;
91 QDPIO::cerr << os.str();
101 if (boundary.size() !=
Nd)
103 QDPIO::cerr << __func__ <<
": boundary is not the expected length = Nd" << std::endl;
126 XMLReader sourcetop(xml_s);
146 for(
int i=0;
i<
Nd-1;
i++)
151 QDPIO::cerr <<
"Error reading source: " << e << std::endl;
167 XMLReader sourcetop(xml_s);
179 QDPIO::cerr <<
"Error reading source: " << e << std::endl;
248 XMLReader paramtop(xml, path);
251 read(paramtop,
"version", version);
256 read(paramtop,
"wave_state", wave_state);
257 if (wave_state !=
"S_WAVE")
259 throw std::string(
"version 5 only supports S_WAVE");
266 if (header.
source.
id ==
"SHELL_SOURCE")
268 XMLReader shelltop(paramtop,
"ShellSource");
274 XMLReader smeartop(shelltop,
"SourceSmearingParam");
276 read(smeartop,
"wvf_kind", wvf_kind);
277 read(smeartop,
"wvf_param", wvf_param);
278 read(smeartop,
"wvfIntPar", wvfIntPar);
282 read(shelltop,
"laplace_power", laplace_power);
283 if (laplace_power != 0)
284 throw std::string(
"only laplace_power=0 supported");
286 Real link_smear_fact;
288 read(shelltop,
"link_smear_fact", link_smear_fact);
289 read(shelltop,
"link_smear_num", link_smear_num);
293 read(shelltop,
"disp_length", disp_length);
294 read(shelltop,
"disp_dir", disp_dir);
296 XMLReader xml_readback;
298 XMLBufferWriter xml_tmp;
299 push(xml_tmp,
"Param");
300 write(xml_tmp,
"version", 6);
301 push(xml_tmp,
"Source");
302 write(xml_tmp,
"version", 2);
306 push(xml_tmp,
"SmearingParam");
307 write(xml_tmp,
"wvf_kind", wvf_kind);
308 write(xml_tmp,
"wvf_param", wvf_param);
309 write(xml_tmp,
"wvfIntPar", wvfIntPar);
315 push(xml_tmp,
"Displacement");
318 write(xml_tmp,
"disp_length", disp_length);
319 write(xml_tmp,
"disp_dir", disp_dir);
325 push(xml_tmp,
"LinkSmearing");
327 write(xml_tmp,
"link_smear_num", link_smear_num);
328 write(xml_tmp,
"link_smear_fact", link_smear_fact);
339 QDPIO::cout <<
"source_xml = XX" << xml_tmp.printCurrentContext() <<
"XX" << std::endl;
341 xml_readback.open(xml_tmp);
345 read(xml_readback,
"/Param", header);
347 else if (header.
source.
id ==
"POINT_SOURCE")
349 XMLReader xml_readback;
351 XMLBufferWriter xml_tmp;
352 push(xml_tmp,
"Param");
353 write(xml_tmp,
"version", 6);
354 push(xml_tmp,
"Source");
355 write(xml_tmp,
"version", 1);
364 QDPIO::cout <<
"source_xml = XX" << xml_tmp.printCurrentContext() <<
"XX" << std::endl;
366 xml_readback.open(xml_tmp);
370 read(xml_readback,
"/Param", header);
372 else if (header.
source.
id ==
"WALL_SOURCE")
374 XMLReader xml_readback;
376 XMLBufferWriter xml_tmp;
377 push(xml_tmp,
"Param");
378 write(xml_tmp,
"version", 6);
379 push(xml_tmp,
"Source");
380 write(xml_tmp,
"version", 1);
389 QDPIO::cout <<
"source_xml = XX" << xml_tmp.printCurrentContext() <<
"XX" << std::endl;
391 xml_readback.open(xml_tmp);
395 read(xml_readback,
"/Param", header);
397 else if (header.
source.
id ==
"RAND_Z2_WALL_SOURCE")
399 XMLReader xml_readback;
401 XMLBufferWriter xml_tmp;
402 push(xml_tmp,
"Param");
403 write(xml_tmp,
"version", 6);
404 push(xml_tmp,
"Source");
405 write(xml_tmp,
"version", 1);
414 QDPIO::cout <<
"source_xml = XX" << xml_tmp.printCurrentContext() <<
"XX" << std::endl;
416 xml_readback.open(xml_tmp);
420 read(xml_readback,
"/Param", header);
424 std::ostringstream os;
425 os <<
"Unsupported source type= " << header.
source.
id
426 <<
" in file= " << __FILE__
427 <<
" at line= " << __LINE__
436 void readV4(XMLReader& xml,
const std::string& path, PropSinkSmear_t& header)
438 XMLReader paramtop(xml, path);
441 read(paramtop,
"version", version);
443 read(paramtop,
"sink_type", header.sink.id);
446 read(paramtop,
"wave_state", wave_state);
447 if (wave_state !=
"S_WAVE")
449 throw std::string(
"version 4 only supports S_WAVE");
452 read(paramtop,
"j_decay", header.j_decay);
454 if (header.sink.id ==
"SHELL_SINK")
456 XMLReader shelltop(paramtop,
"ShellSink");
462 XMLReader smeartop(shelltop,
"SinkSmearingParam");
464 read(smeartop,
"wvf_kind", wvf_kind);
465 read(smeartop,
"wvf_param", wvf_param);
466 read(smeartop,
"wvfIntPar", wvfIntPar);
470 read(shelltop,
"laplace_power", laplace_power);
471 if (laplace_power != 0)
472 throw std::string(
"only laplace_power=0 supported");
474 Real link_smear_fact;
476 read(shelltop,
"link_smear_fact", link_smear_fact);
477 read(shelltop,
"link_smear_num", link_smear_num);
481 read(shelltop,
"disp_length", disp_length);
482 read(shelltop,
"disp_dir", disp_dir);
484 XMLReader xml_readback;
486 XMLBufferWriter xml_tmp;
487 push(xml_tmp,
"Param");
488 write(xml_tmp,
"version", 6);
489 push(xml_tmp,
"Sink");
490 write(xml_tmp,
"version", 2);
491 write(xml_tmp,
"SinkType", header.sink.id);
494 push(xml_tmp,
"SmearingParam");
495 write(xml_tmp,
"wvf_kind", wvf_kind);
496 write(xml_tmp,
"wvf_param", wvf_param);
497 write(xml_tmp,
"wvfIntPar", wvfIntPar);
498 write(xml_tmp,
"no_smear_dir", header.j_decay);
503 push(xml_tmp,
"Displacement");
506 write(xml_tmp,
"disp_length", disp_length);
507 write(xml_tmp,
"disp_dir", disp_dir);
513 push(xml_tmp,
"LinkSmearing");
515 write(xml_tmp,
"link_smear_num", link_smear_num);
516 write(xml_tmp,
"link_smear_fact", link_smear_fact);
517 write(xml_tmp,
"no_smear_dir", header.j_decay);
524 QDPIO::cout <<
"sink_xml = XX" << xml_tmp.printCurrentContext() <<
"XX" << std::endl;
526 xml_readback.open(xml_tmp);
530 read(xml_readback,
"/Param", header);
532 else if (header.sink.id ==
"POINT_SINK")
534 XMLReader xml_readback;
536 XMLBufferWriter xml_tmp;
537 push(xml_tmp,
"Param");
538 write(xml_tmp,
"version", 6);
539 push(xml_tmp,
"Sink");
540 write(xml_tmp,
"version", 1);
541 write(xml_tmp,
"SinkType", header.sink.id);
543 write(xml_tmp,
"j_decay", header.j_decay);
548 QDPIO::cout <<
"sink_xml = XX" << xml_tmp.printCurrentContext() <<
"XX" << std::endl;
550 xml_readback.open(xml_tmp);
554 read(xml_readback,
"/Param", header);
556 else if (header.sink.id ==
"WALL_SINK")
558 XMLReader xml_readback;
560 XMLBufferWriter xml_tmp;
561 push(xml_tmp,
"Param");
562 write(xml_tmp,
"version", 6);
563 push(xml_tmp,
"Sink");
564 write(xml_tmp,
"version", 1);
565 write(xml_tmp,
"SinkType", header.sink.id);
570 QDPIO::cout <<
"sink_xml = XX" << xml_tmp.printCurrentContext() <<
"XX" << std::endl;
572 xml_readback.open(xml_tmp);
576 read(xml_readback,
"/Param", header);
580 std::ostringstream os;
581 os <<
"Unsupported sink type= " << header.sink.id
582 <<
" in file= " << __FILE__
583 <<
" at line= " << __LINE__
595 XMLReader paramtop(xml, path);
598 read(paramtop,
"version", version);
605 readV5(xml, path, header);
612 XMLReader xml_tmp(paramtop,
"Source");
614 if (xml_tmp.count(
"t_source") != 0)
618 else if (xml_tmp.count(
"t_srce") != 0)
630 throw std::string(
"neither t_source nor t_srce found");
637 QDPIO::cerr <<
"PropSourceConst parameter version " << version
638 <<
" unsupported." << std::endl;
644 QDPIO::cerr <<
"PropSourceConst: Error reading source: " << e << std::endl;
653 XMLReader paramtop(xml, path);
656 read(paramtop,
"version", version);
664 XMLReader xml_tmp(paramtop,
"Source");
671 QDPIO::cerr <<
"PropSourceSmear parameter version " << version
672 <<
" unsupported." << std::endl;
681 XMLReader paramtop(xml, path);
684 read(paramtop,
"version", version);
691 readV4(xml, path, header);
698 XMLReader xml_tmp(paramtop,
"Sink");
705 QDPIO::cerr <<
"PropSinkSmear parameter version " << version
706 <<
" unsupported." << std::endl;
712 QDPIO::cerr <<
"PropSinkSmear: Error reading sink: " << e << std::endl;
722 XMLReader paramtop(xml, path);
725 read(paramtop,
"version", version);
731 XMLReader xml_readback;
733 XMLBufferWriter xml_tmp;
734 push(xml_tmp,
"Param");
735 write(xml_tmp,
"version", 2);
736 push(xml_tmp,
"SeqSource");
737 write(xml_tmp,
"version", 1);
739 read(paramtop,
"seq_src", seq_src);
740 write(xml_tmp,
"SeqSourceType", seq_src);
748 write(xml_tmp,
"j_decay",
Nd-1);
753 QDPIO::cout <<
"seqsrc_xml = XX" << xml_tmp.printCurrentContext() <<
"XX" << std::endl;
755 xml_readback.open(xml_tmp);
759 read(xml_readback,
"/Param", param);
767 XMLReader xml_tmp(paramtop,
"SeqSource");
775 QDPIO::cerr <<
"SeqSource parameter version " << version
776 <<
" unsupported." << std::endl;
786 XMLReader paramtop(xml, path);
789 read(paramtop,
"version", version);
791 multi1d<int> boundary;
804 read(paramtop,
"boundary", boundary);
806 XMLBufferWriter xml_out;
807 push(xml_out,
"FermionAction");
811 XMLReader xml_inn(xml_out);
822 read(paramtop,
"boundary", boundary);
824 XMLReader xml_tmp(paramtop,
"FermionAction");
826 XMLBufferWriter xml_out;
827 push(xml_out,
"FermionAction");
829 write(xml_out,
"boundary", boundary);
832 XMLReader xml_inn(xml_out);
841 read(paramtop,
"nonRelProp", nonRelProp);
846 read(paramtop,
"boundary", boundary);
848 XMLReader xml_tmp(paramtop,
"FermionAction");
850 XMLBufferWriter xml_out;
851 push(xml_out,
"FermionAction");
853 write(xml_out,
"boundary", boundary);
856 XMLReader xml_inn(xml_out);
868 read(paramtop,
"nonRelProp", nonRelProp);
872 if (paramtop.count(
"obsvP") != 0)
877 if (paramtop.count(
"boundary") != 0)
879 QDPIO::cerr <<
"ChromaProp: paranoia check - found a misplaced boundary" << std::endl;
890 read(paramtop,
"nonRelProp", nonRelProp);
897 if (paramtop.count(
"boundary") != 0)
899 QDPIO::cerr <<
"ChromaProp: paranoia check - found a misplaced boundary" << std::endl;
917 if (paramtop.count(
"boundary") != 0)
919 QDPIO::cerr <<
"ChromaProp: paranoia check - found a misplaced boundary" << std::endl;
927 QDPIO::cerr <<
"ChromaProp parameter version " << version
928 <<
" unsupported." << std::endl;
938 XMLReader paramtop(xml, path);
941 read(paramtop,
"version", version);
944 multi1d<int> boundary;
955 read(paramtop,
"boundary", boundary);
957 XMLReader xml_tmp(paramtop,
"FermionAction");
959 XMLBufferWriter xml_out;
960 push(xml_out,
"FermionAction");
962 write(xml_out,
"boundary", boundary);
965 XMLReader xml_inn(xml_out);
977 read(paramtop,
"nonRelProp", nonRelProp);
982 read(paramtop,
"boundary", boundary);
984 XMLReader xml_tmp(paramtop,
"FermionAction");
986 XMLBufferWriter xml_out;
987 push(xml_out,
"FermionAction");
989 write(xml_out,
"boundary", boundary);
992 XMLReader xml_inn(xml_out);
1007 read(paramtop,
"nonRelProp", nonRelProp);
1011 if (paramtop.count(
"boundary") != 0)
1013 QDPIO::cerr <<
"ChromaMultiProp: paranoia check - found a misplaced boundary" << std::endl;
1028 read(paramtop,
"nonRelProp", nonRelProp);
1049 QDPIO::cerr <<
"ChromaMultiProp parameter version " << version
1050 <<
" unsupported." << std::endl;
1072 if (paramtop.count(
"Config_info") > 0)
1074 XMLReader xml_tmp(paramtop,
"Config_info");
1075 std::ostringstream os;
1076 xml_tmp.printCurrentContext(os);
1077 gauge_header = os.str();
1081 XMLBufferWriter xml_tmp;
1082 push(xml_tmp,
"Config_info");
1084 gauge_header = xml_tmp.str();
1096 XMLReader paramtop(xml, path);
1106 XMLReader paramtop(xml, path);
1117 XMLReader paramtop(xml, path);
1129 XMLReader paramtop(xml, path);
1141 XMLReader paramtop(xml, path);
1154 XMLReader inputtop(xml, path);
1157 read(inputtop,
"sink", input.
sink);
1172 XMLReader paramtop(xml, path);
1175 read(paramtop,
"version", version);
1183 QDPIO::cerr <<
"QQDiquark parameter version " << version
1184 <<
" unsupported." << std::endl;
1192 QDPIO::cerr <<
"QQDiquark: unexpected number of forward_props = "
1202 XMLReader paramtop(xml, path);
1205 if (paramtop.count(
"version") != 0)
1206 read(paramtop,
"version", version);
1233 QDPIO::cerr <<
"QQQBarcomp parameter version " << version
1234 <<
" unsupported." << std::endl;
1245 QDPIO::cerr <<
"QQQBarcomp: unexpected number of forward_props = "
1255 XMLReader paramtop(xml, path);
1269 QDPIO::cerr <<
"QQbarMescomp parameter version " << version
1270 <<
" unsupported." << std::endl;
1276 QDPIO::cerr <<
"QQbarMescomp: unexpected number of forward_props = "
1292 write(xml,
"version", version);
1307 write(xml,
"version", version);
1321 write(xml,
"version", version);
1335 write(xml,
"version", version);
1350 write(xml,
"version", version);
1366 write(xml,
"version", version);
1379 write(xml,
"version", version);
1393 write(xml,
"version", version);
1409 write(xml,
"version", version);
1427 write(xml,
"version", version);
1445 write(xml,
"version", version);
1476 write(xml,
"version", version);
1492 write(xml,
"version", version);
1513 write(xml,
"version", version);
1533 XMLBufferWriter& record_xml,
const LatticePropagator& quark_prop,
1535 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
1537 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
1538 write(to,record_xml,quark_prop);
1553 const ChromaProp_t& header,
const LatticePropagator& quark_prop,
1555 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
1557 XMLBufferWriter record_xml;
1558 write(record_xml,
"Propagator", header);
1559 writeQprop(file_xml, record_xml, quark_prop, file, volfmt, serpar);
1574 XMLReader& record_xml, LatticePropagator& quark_prop,
1576 QDP_serialparallel_t serpar)
1578 QDPFileReader to(file_xml,file,serpar);
1579 read(to,record_xml,quark_prop);
1594 QDP_serialparallel_t serpar)
1596 XMLReader record_xml;
1597 readQprop(file_xml, record_xml, quark_prop, file, serpar);
1598 read(record_xml,
"/Propagator", header);
1614 XMLBufferWriter& record_xml,
const LatticeFermion& fermion,
1616 QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
1618 QDPFileWriter to(file_xml,file,volfmt,serpar,QDPIO_OPEN);
1619 write(to,record_xml,fermion);
1632 XMLReader& record_xml,
1633 LatticeFermion& fermion,
1635 QDP_serialparallel_t serpar)
1637 QDPFileReader to(file_xml,file,serpar);
1638 read(to,record_xml,fermion);
Primary include file for CHROMA library code.
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.
Real kappaToMass(const Real &Kappa)
Convert a Kappa to a mass.
GroupXML_t readXMLGroup(XMLReader &xml_in, const std::string &path, const std::string &type_name)
Read group and return as a std::string.
std::string getName()
Return the name.
std::string getName()
Return the name.
Asqtad Staggered-Dirac operator.
Real getMass(const GroupXML_t &fermact)
Given a fermion action in std::string form, return the Mass.
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > const multi1d< Real > & Mass
push(xml_out,"Condensates")
void readQprop(XMLReader &file_xml, XMLReader &record_xml, LatticePropagator &quark_prop, const std::string &file, QDP_serialparallel_t serpar)
Read a Chroma propagator.
void writeQprop(XMLBufferWriter &file_xml, XMLBufferWriter &record_xml, const LatticePropagator &quark_prop, const std::string &file, QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
Write a Chroma propagator.
multi1d< int > getFermActBoundary(const GroupXML_t &fermact)
Given a fermion action in std::string form, return the boundary.
void readFermion(XMLReader &file_xml, XMLReader &record_xml, LatticeFermion &fermion, const std::string &file, QDP_serialparallel_t serpar)
void writeFermion(XMLBufferWriter &file_xml, XMLBufferWriter &record_xml, const LatticeFermion &fermion, const std::string &file, QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
void readGaugeHeader(XMLReader ¶mtop, const std::string &path, std::string &gauge_header)
Various parameter structs and reader/writers.
Routines associated with Chroma propagator IO.
Simple quark displacement.
Multi-propagator parameters.
QuarkSpinType quarkSpinType
GroupXML_t fermact
String holding XML of the FermionAction section.
multi1d< Real > MultiMasses
QuarkSpinType quarkSpinType
Mega structure holding a full forward sink-smeared prop.
PropSinkSmear_t sink_header
PropSourceConst_t source_header
Hold group xml and type id.
Mega structure holding a propagator source.
PropSourceConst_t source_header
Sink-smearing parameters.
Propagator source construction parameters.
multi1d< int > getMom() const
multi1d< int > getTSrce() const
Source-smearing parameters.
Mega structure holding a full forward prop (not sink smeared)
PropSourceConst_t source_header
Mega structure holding QQ diquark object.
multi1d< ForwardProp_t > forward_props
Mega structure holding QQQ props.
multi1d< ForwardProp_t > forward_props
multi1d< QQQSpinIndices_t > spin_indices
Hold source and sink spin indices for a sparse QQQ file.
Mega structure holding QQbar props.
multi1d< ForwardProp_t > forward_props
Sequential source parameters.
Mega structure holding a full sequential prop.
ChromaProp_t seqprop_header
PropSinkSmear_t sink_header
multi1d< ForwardProp_t > forward_props
SeqSource_t seqsource_header
Mega structure holding a full sequential source.
PropSinkSmear_t sink_header
multi1d< ForwardProp_t > forward_props
SeqSource_t seqsource_header