1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-10 22:20:45 +01:00

Added the ability for Perambulator module to save unsmeared sinks through the addition of two optional parameters:

UnsmearedSinkFileName: If present, specifies the filename to write to
UnsmearedSinkMultiFile: defaults to true to write each sink vector to a different file, but can be set to 0 for a single file
This commit is contained in:
Michael Marshall 2019-07-01 17:28:27 +01:00
parent 5fc0188205
commit ae3abbe53d

View File

@ -49,6 +49,8 @@ public:
std::string, solver,
std::string, noise,
std::string, PerambFileName, //stem!!!
std::string, UnsmearedSinkFileName, // Filename to save unsmeared sink
std::string, UnsmearedSinkMultiFile, // One file per vector?
int, nvec,
DistilParameters, Distil);
};
@ -125,6 +127,9 @@ void TPerambulator<FImpl>::setup(void)
grid4d = env().getGrid();
grid3d = MakeLowerDimGrid(grid4d);
DISTIL_PARAMETERS_DEFINE( true );
const std::string UnsmearedSinkFileName{ par().UnsmearedSinkFileName };
if( !UnsmearedSinkFileName.empty() )
bool bMulti = ( Hadrons::MDistil::DistilParameters::ParameterDefault( par().UnsmearedSinkMultiFile, 1, true ) != 0 );
envCreate(PerambTensor, getName(), 1, PerambIndexNames,Nt,nvec,LI,nnoise,Nt_inv,SI);
envCreate(std::vector<FermionField>, getName() + "_unsmeared_sink", 1,
@ -258,12 +263,12 @@ void TPerambulator<FImpl>::execute(void)
perambulator.write(sPerambName.c_str());
}
const int X{grid4d->GlobalDimensions()[0]};
// Save the unsmeared sink as well if requested
/*const int X{grid4d->GlobalDimensions()[0]};
const int Y{grid4d->GlobalDimensions()[1]};
const int Z{grid4d->GlobalDimensions()[2]};
const int T{grid4d->GlobalDimensions()[3]};
if(grid4d->IsBoss()) {
Eigen::Tensor<ComplexD, 10> sink(nnoise,LI,Nt_inv,SI,X,Y,Z,T,3,4);
@ -285,15 +290,16 @@ void TPerambulator<FImpl>::execute(void)
}
}
}
}*/
const std::string UnsmearedSinkFileName{ par().UnsmearedSinkFileName };
if( !UnsmearedSinkFileName.empty() ) {
bool bMulti = ( Hadrons::MDistil::DistilParameters::ParameterDefault( par().UnsmearedSinkMultiFile, 1, false ) != 0 );
std::cout << "Writing unsmeared sink to " << UnsmearedSinkFileName << std::endl;
//Grid::Hdf5Writer writer(filename);
//write(writer,"unsmeared_sink",sink);
A2AVectorsIo::write(UnsmearedSinkFileName, unsmeared_sink, bMulti, vm().getTrajectory());
}
std::string filename ="./" + par().PerambFileName + "_sink.h5";
std::cout << "Writing to file " << filename << std::endl;
Grid::Hdf5Writer writer(filename);
write(writer,"unsmeared_sink",sink);
}
}
END_MODULE_NAMESPACE