36 namespace InlineDiscoEnv{
65 XMLReader paramtop(xml, path);
68 read(paramtop,
"version", version);
84 QDPIO::cerr <<
"Input parameter version " << version <<
" unsupported." << std::endl;
98 write(xml,
"version", version);
105 for(
int t(0);
t<param.
chi.size();
t++){
107 xml<<param.
chi[
t].xml;
119 XMLReader inputtop(xml, path);
144 XMLReader paramtop(xml_in, path);
146 if (paramtop.count(
"Frequency") == 1)
158 if (paramtop.count(
"xml_file") != 0)
165 QDPIO::cerr << __func__ <<
": Caught Exception reading XML: " << e << std::endl;
198 return ((
a.t_slice<
b.t_slice)||(
a.mom<
b.mom)||(
a.disp<
b.disp));
203 os <<
"KeyOperator_t:"
204 <<
" t_slice = " <<
d.t_slice
206 for (
int i=0;
i<
d.disp.size();
i++){
207 os <<
d.disp[
i] <<
" " ;
210 for (
int i=0;
i<
d.mom.size();
i++){
211 os <<
d.mom[
i] <<
" " ;
219 multi1d<ComplexD>
op ;
228 os <<
"ValOperator_t:\n";
229 for (
int i=0;
i<
d.op.size();
i++){
230 os <<
" gamma["<<
i<<
"] = "<<
d.op[
i] << std::endl ;
244 unsigned short int n ;
254 unsigned short int n ;
272 StandardOutputStream&
operator<<(StandardOutputStream& os,
const multi1d<short int>&
d){
275 for(
int i=1;
i <
d.size(); ++
i)
282 void do_disco(std::map< KeyOperator_t, ValOperator_t >& db,
283 const LatticeFermion& qbar,
284 const LatticeFermion&
q,
287 const multi1d<short int>& path,
288 const int& max_path_length ){
289 QDPIO::cout<<
" Computing Operator with path length "<<path.size()
290 <<
" on timeslice "<<
t<<
". Path: "<<path <<std::endl;
294 std::pair<KeyOperator_t, ValOperator_t> kv ;
297 kv.first.disp.resize(1);
298 kv.first.disp[0] = 0 ;
301 kv.first.disp = path ;
303 multi1d< multi1d<ComplexD> > foo(
p.numMom()) ;
304 for (
int m(0);
m <
p.numMom();
m++)
305 foo[
m].resize(Ns*Ns);
306 for(
int g(0);g<Ns*Ns;g++){
308 for (
int m(0);
m <
p.numMom();
m++){
309 foo[
m][g] =
sum(
p[
m]*cc,
p.getSet()[
t]) ;
312 for (
int m(0);
m <
p.numMom();
m++){
313 for(
int i(0);
i<(
Nd-1);
i++)
314 kv.first.mom[
i] =
p.numToMom(
m)[
i] ;
316 kv.second.op = foo[
m];
317 std::pair<std::map< KeyOperator_t, ValOperator_t >::iterator,
bool> itbo;
319 itbo = db.insert(kv);
321 QDPIO::cout<<
"Inserting new entry in std::map\n";
324 std::cout<<
"Key = "<<kv.first<<std::endl;
325 QDPIO::cout<<
"Adding result to value already there"<<std::endl;
326 for(
int i(0);
i<kv.second.op.size();
i++){
327 itbo.first->second.op[
i] += kv.second.op[
i] ;
332 if(path.size()<max_path_length){
333 QDPIO::cout<<
" attempt to add new path. "
334 <<
" current path length is : "<<path.size();
335 multi1d<short int> new_path(path.size()+1);
336 QDPIO::cout<<
" new path length is : "<<new_path.size()<<std::endl;
337 for(
int i(0);
i<path.size();
i++)
338 new_path[
i] = path[
i] ;
339 for(
int sign(-1);sign<2;sign+=2)
341 new_path[path.size()]= sign*(
mu+1) ;
343 bool back_track=false ;
345 if(path[path.size()-1] == -new_path[path.size()])
348 QDPIO::cout<<
" Added path: "<<new_path<<std::endl;
349 LatticeFermion q_mu ;
355 do_disco(db, qbar, q_mu,
p,
t, new_path, max_path_length);
375 push(xml_out,
"propagator_3pt");
376 write(xml_out,
"update_no", update_no);
377 write(xml_out,
"xml_file", xml_file);
380 XMLFileWriter xml(xml_file);
381 func(update_no, xml);
384 func(update_no, xml_out);
403 XMLBufferWriter gauge_xml;
409 catch( std::bad_cast )
417 QDPIO::cerr <<
name <<
": std::map call failed: " << e
421 const multi1d<LatticeColorMatrix>&
u =
424 push(xml_out,
"disco");
425 write(xml_out,
"update_no", update_no);
427 QDPIO::cout <<
name <<
": Disconnected diagrams" << std::endl;
435 write(xml_out,
"Config_info", gauge_xml);
437 push(xml_out,
"Output_version");
438 write(xml_out,
"out_version", 1);
443 MesPlq(xml_out,
"Observables",
u);
458 multi1d< Handle< DilutionScheme<LatticeFermion> > > quarks(
N_quarks);
464 std::istringstream xml_d(dil_xml.
xml);
465 XMLReader diltop(xml_d);
466 QDPIO::cout <<
"Dilution type = " << dil_xml.
id << std::endl;
474 QDPIO::cerr <<
name <<
": Caught Exception constructing dilution scheme: " << e << std::endl;
485 if (quarks[0]->getCfgInfo() != quarks[
n]->getCfgInfo()){
486 QDPIO::cerr <<
name <<
" : Quarks do not contain the same cfg info";
487 QDPIO::cerr <<
", quark "<<
n << std::endl;
500 write(top,
"Config_info", gauge_xml);
502 XMLReader from2(from,
"/Config_info");
503 std::ostringstream os;
508 if (cfgInfo != quarks[0]->getCfgInfo()){
509 QDPIO::cerr <<
name <<
" : Quarks do not contain the same";
510 QDPIO::cerr <<
" cfg info as the gauge field." ;
511 QDPIO::cerr <<
"gauge: XX"<<cfgInfo<<
"XX quarks: XX" ;
512 QDPIO::cerr << quarks[0]->getCfgInfo()<<
"XX"<< std::endl;
518 int decay_dir = quarks[0]->getDecayDir();
527 for(
int n = 1 ;
n < quarks.size(); ++
n){
528 if(toBool(quarks[
n]->getSeed()==quarks[0]->getSeed())){
529 QDPIO::cerr <<
name <<
": error, quark seeds are the same" << std::endl;
533 if(toBool(quarks[
n]->getDecayDir()!=quarks[0]->getDecayDir())){
534 QDPIO::cerr<<
name<<
": error, quark decay dirs do not match" <<std::endl;
539 std::map< KeyOperator_t, ValOperator_t > data ;
541 for(
int n(0);
n<quarks.size();
n++){
542 for (
int it(0) ;
it < quarks[
n]->getNumTimeSlices() ; ++
it){
543 int t = quarks[
n]->getT0(
it) ;
544 QDPIO::cout<<
" Doing quark: "<<
n <<std::endl ;
545 QDPIO::cout<<
" quark: "<<
n <<
" has "<<quarks[
n]->getDilSize(
it);
546 QDPIO::cout<<
" dilutions on time slice "<<
t<<std::endl ;
547 for(
int i = 0 ;
i < quarks[
n]->getDilSize(
it) ; ++
i){
548 QDPIO::cout<<
" Doing dilution : "<<
i<<std::endl ;
549 multi1d<short int>
d ;
550 LatticeFermion qbar = quarks[
n]->dilutedSource(
it,
i);
551 LatticeFermion
q = quarks[
n]->dilutedSolution(
it,
i);
552 QDPIO::cout<<
" Starting recursion "<<std::endl ;
554 QDPIO::cout<<
" done with recursion! "
555 <<
" The length of the path is: "<<
d.size()<<std::endl ;
557 QDPIO::cout<<
" Done with dilutions for quark: "<<
n <<std::endl ;
566 XMLBufferWriter file_xml;
568 push(file_xml,
"DBMetaData");
570 write(file_xml,
"lattSize", QDP::Layout::lattSize());
571 write(file_xml,
"decay_dir", decay_dir);
573 write(file_xml,
"Config_info", gauge_xml);
577 qdp_db.setMaxUserInfoLen(file_str.size());
581 qdp_db.insertUserdata(file_str);
587 std::map< KeyOperator_t, ValOperator_t >::iterator
it;
588 for(
it=data.begin();
it!=data.end();
it++){
589 key.
key() =
it->first ;
590 val.
data().op.resize(
it->second.op.size()) ;
592 for(
int i(0);
i<
it->second.op.size();
i++)
593 val.
data().op[
i] =
it->second.op[
i]/toDouble(quarks.size());
594 qdp_db.insert(key,val) ;
601 QDPIO::cout <<
name <<
": total time = "
602 << snoop.getTimeInSeconds()
603 <<
" secs" << std::endl;
605 QDPIO::cout <<
name <<
": ran successfully" << std::endl;
Inline measurement factory.
Baryon spin and projector matrices.
Factory for producing baryon operators.
Inline measurement of stochastic baryon operators.
void operator()(const unsigned long update_no, XMLWriter &xml_out)
Do the measurement.
void func(const unsigned long update_no, XMLWriter &xml_out)
Do the measurement.
Serializable value harness.
Serializable key harness.
Fourier transform phase factor support.
Random Z(N) source construction using dilution.
All dilution scheme factories.
Factory for dilution schemes.
Parallel transport a lattice field.
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.
multi1d< GroupXML_t > readXMLArrayGroup(XMLReader &xml_in, const std::string &path, const std::string &type_name)
Read group and return as a std::string.
Class for counted reference semantics.
Inline measurement of stochastic 3pt functions.
void savern(int iseed[4])
Named object function std::map.
static bool registered
Local registration flag.
void read(XMLReader &xml, const std::string &path, Params::Param_t ¶m)
void write(XMLWriter &xml, const std::string &path, const Params::Param_t ¶m)
std::ostream & operator<<(std::ostream &os, const KeyOperator_t &d)
bool registerAll()
Register all the factories.
bool operator<(const KeyOperator_t &a, const KeyOperator_t &b)
void do_disco(std::map< KeyOperator_t, ValOperator_t > &db, const LatticeFermion &qbar, const LatticeFermion &q, const SftMom &p, const int &t, const multi1d< short int > &path, const int &max_path_length)
QDPSubTypeTrait< typename BinaryReturn< C1, C2, FnLocalInnerProduct >::Type_t >::Type_t localInnerProduct(const QDPSubType< T1, C1 > &l, const QDPType< T2, C2 > &r)
const int N_quarks
Number of quarks to be used in this construction.
Asqtad Staggered-Dirac operator.
static multi1d< LatticeColorMatrix > u
push(xml_out,"Condensates")
void MesPlq(const multi1d< LatticeColorMatrixF3 > &u, multi2d< Double > &plane_plaq, Double &link)
Print out basic info about this program.
All quark smearing constructors.
Factory for producing quark smearing objects.
Fourier transform phase factor support.
All make sink constructors.
Factory for producing quark prop sinks.
Factory for producing quark smearing objects.
Hold group xml and type id.
multi1d< short int > disp
unsigned short int t_slice
SerialDBData< ValOperator_t > v
SerialDBKey< KeyOperator_t > k
multi1d< GroupXML_t > chi
struct Chroma::InlineDiscoEnv::Params::NamedObject_t named_obj
struct Chroma::InlineDiscoEnv::Params::Param_t param
void write(XMLWriter &xml_out, const std::string &path)
Volume source of Z(N) noise.