1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

unsmeared sinks can now be computed - new test program available

This commit is contained in:
ferben 2019-02-01 13:23:42 +00:00
parent 7cc13f48d5
commit a9848becb0
3 changed files with 59 additions and 29 deletions

View File

@ -4,4 +4,4 @@ using namespace Grid;
using namespace Hadrons;
using namespace MDistil;
template class Grid::Hadrons::MDistil::TPerambLight<GIMPL>;
template class Grid::Hadrons::MDistil::TPerambLight<FIMPL>;

View File

@ -56,11 +56,11 @@ public:
SolverParameters, Solver);
};
template <typename GImpl>
template <typename FImpl>
class TPerambLight: public Module<PerambLightPar>
{
public:
GAUGE_TYPE_ALIASES(GImpl,);
FERM_TYPE_ALIASES(FImpl,);
// constructor
TPerambLight(const std::string name);
// destructor
@ -81,27 +81,27 @@ protected:
virtual void Cleanup(void);
};
MODULE_REGISTER_TMP(PerambLight, TPerambLight<GIMPL>, MDistil);
MODULE_REGISTER_TMP(PerambLight, TPerambLight<FIMPL>, MDistil);
/******************************************************************************
* TPerambLight implementation *
******************************************************************************/
// constructor /////////////////////////////////////////////////////////////////
template <typename GImpl>
TPerambLight<GImpl>::TPerambLight(const std::string name)
template <typename FImpl>
TPerambLight<FImpl>::TPerambLight(const std::string name)
: grid3d{nullptr}, grid4d{nullptr}, Module<PerambLightPar>(name)
{}
// destructor
template <typename GImpl>
TPerambLight<GImpl>::~TPerambLight(void)
template <typename FImpl>
TPerambLight<FImpl>::~TPerambLight(void)
{
Cleanup();
};
// dependencies/products ///////////////////////////////////////////////////////
template <typename GImpl>
std::vector<std::string> TPerambLight<GImpl>::getInput(void)
template <typename FImpl>
std::vector<std::string> TPerambLight<FImpl>::getInput(void)
{
std::vector<std::string> in;
@ -110,29 +110,35 @@ std::vector<std::string> TPerambLight<GImpl>::getInput(void)
return in;
}
template <typename GImpl>
std::vector<std::string> TPerambLight<GImpl>::getOutput(void)
template <typename FImpl>
std::vector<std::string> TPerambLight<FImpl>::getOutput(void)
{
std::vector<std::string> out = {getName() + "_perambulator_light",getName() + "_noise"};
std::vector<std::string> out = {getName() + "_perambulator_light",getName() + "_noise",getName() + "_unsmeared_sink"};
return out;
}
// setup ///////////////////////////////////////////////////////////////////////
template <typename GImpl>
void TPerambLight<GImpl>::setup(void)
template <typename FImpl>
void TPerambLight<FImpl>::setup(void)
{
Cleanup();
// auto &noise = envGet(std::vector<std::vector<std::vector<SpinVector>>>, par().noise);
const int nvec{par().nvec};
const DistilParameters & Distil{par().Distil};
const int LI{Distil.LI};
const int nnoise{Distil.nnoise};
const int Nt_inv{Distil.Nt_inv}; // TODO: PROBABLY BETTER: if (full_tdil) Nt_inv=1; else Nt_inv = TI;
const int Ns{Distil.Ns};
//envCreate(Perambulator<SpinVector, 6>, getName() + "_perambulator_light", 1,
env().template createObject<Perambulator<SpinVector, 6> >(getName() + "_perambulator_light", Environment::Storage::object, 1,
Distil.Nt,nvec,Distil.LI,Distil.nnoise,Distil.Nt_inv,Distil.SI);
envCreate(std::vector<Complex>, getName() + "_noise", 1,
nvec*Distil.Ns*Distil.Nt*Distil.nnoise);
envCreate(std::vector<FermionField>, getName() + "_unsmeared_sink", 1,
nnoise*LI*Ns*Nt_inv, envGetGrid(FermionField));
grid4d = env().getGrid();
grid3d = MakeLowerDimGrid(grid4d);//new GridCartesian(latt_size,simd_layout_3,mpi_layout,*grid4d);
@ -152,8 +158,8 @@ void TPerambLight<GImpl>::setup(void)
}
// clean up any temporaries created by setup (that aren't stored in the environment)
template <typename GImpl>
void TPerambLight<GImpl>::Cleanup(void)
template <typename FImpl>
void TPerambLight<FImpl>::Cleanup(void)
{
if( grid3d != nullptr ) {
delete grid3d;
@ -163,8 +169,8 @@ void TPerambLight<GImpl>::Cleanup(void)
}
// execution ///////////////////////////////////////////////////////////////////
template <typename GImpl>
void TPerambLight<GImpl>::execute(void)
template <typename FImpl>
void TPerambLight<FImpl>::execute(void)
{
const int nvec{par().nvec};
const DistilParameters & Distil{par().Distil};
@ -187,6 +193,7 @@ void TPerambLight<GImpl>::execute(void)
*env().template getObject<Perambulator<SpinVector,6> >(
getName() + "_perambulator_light");
auto &epack = envGet(Grid::Hadrons::EigenPack<LatticeColourVector>, par().eigenPack);
auto &unsmeared_sink = envGet(std::vector<FermionField>, getName() + "_unsmeared_sink");
envGetTmp(GaugeField, Umu);
FieldMetaData header;
@ -315,8 +322,8 @@ void TPerambLight<GImpl>::execute(void)
SchurSolver(Dop,src5,sol5);
Dop.ExportPhysicalFermionSolution(sol5,result); //These are the meson sinks
// TODO: Can we inherit something from MContraction to compute the fourier-transformed sinks???
//if (compute_current_sink)
// current_sink[inoise+nnoise*(dk+LI*(dt+Nt_inv*ds))] = result;
if ((1)) // comment out if unsmeared sink is too large???
unsmeared_sink[inoise+nnoise*(dk+LI*(dt+Nt_inv*ds))] = result;
std::cout << "Contraction of perambulator from noise " << inoise << " and dilution component (d_k,d_t,d_alpha) : (" << dk << ","<< dt << "," << ds << ")" << std::endl;
for (int is = 0; is < Ns; is++) {
result_nospin = peekSpin(result,is);
@ -341,7 +348,7 @@ void TPerambLight<GImpl>::execute(void)
perambulator.SliceShare( grid3d, grid4d );
// THIS IS WHERE WE WANT TO SAVE THE PERAMBULATORS TO DISK
perambulator.WriteTemporary(std::string("perambulators/file"));
perambulator.WriteTemporary(std::string("perambulators/file")); // TODO: Specify the file name in the xml
}

View File

@ -169,22 +169,21 @@ void test_DistilVectorsS(Application &application)
application.createModule<MDistil::DistilVectors>("DistilVecsS",DistilVecPar);
}
/////////////////////////////////////////////////////////////
// MesonFields
// MesonSink
/////////////////////////////////////////////////////////////
void test_MesonField(Application &application)
void test_MesonSink(Application &application)
{
// DistilVectors parameters
MContraction::A2AMesonField::Par A2AMesonFieldPar;
A2AMesonFieldPar.left="DistilVecs_phi";
//A2AMesonFieldPar.right="DistilVecs_rho";
A2AMesonFieldPar.right="DistilVecs_phi";
A2AMesonFieldPar.left="Peramb_unsmeared_sink";
A2AMesonFieldPar.right="Peramb_unsmeared_sink";
A2AMesonFieldPar.output="DistilFields";
A2AMesonFieldPar.gammas="all";
A2AMesonFieldPar.mom={"0 0 0"};
A2AMesonFieldPar.cacheBlock=2;
A2AMesonFieldPar.block=4;
application.createModule<MContraction::A2AMesonField>("DistilMesonField",A2AMesonFieldPar);
application.createModule<MContraction::A2AMesonField>("DistilMesonSink",A2AMesonFieldPar);
}
/////////////////////////////////////////////////////////////
// MesonFields
@ -197,7 +196,25 @@ void test_MesonFieldSL(Application &application)
A2AMesonFieldPar.left="DistilVecsS_phi";
//A2AMesonFieldPar.right="DistilVecs_rho";
A2AMesonFieldPar.right="DistilVecs_phi";
A2AMesonFieldPar.output="DistilFields";
A2AMesonFieldPar.output="DistilFieldsS";
A2AMesonFieldPar.gammas="all";
A2AMesonFieldPar.mom={"0 0 0"};
A2AMesonFieldPar.cacheBlock=2;
A2AMesonFieldPar.block=4;
application.createModule<MContraction::A2AMesonField>("DistilMesonFieldS",A2AMesonFieldPar);
}
/////////////////////////////////////////////////////////////
// MesonFields
/////////////////////////////////////////////////////////////
void test_MesonField(Application &application)
{
// DistilVectors parameters
MContraction::A2AMesonField::Par A2AMesonFieldPar;
A2AMesonFieldPar.left="DistilVecs_phi";
//A2AMesonFieldPar.right="DistilVecs_rho";
A2AMesonFieldPar.right="DistilVecs_phi";
A2AMesonFieldPar.output="MesonSinks";
A2AMesonFieldPar.gammas="all";
A2AMesonFieldPar.mom={"0 0 0"};
A2AMesonFieldPar.cacheBlock=2;
@ -360,6 +377,12 @@ int main(int argc, char *argv[])
test_DistilVectorsS( application );
test_MesonFieldSL( application );
break;
case 6: // 3
test_Global( application );
test_LapEvec( application );
test_Perambulators( application );
test_MesonSink( application );
break;
}
LOG(Message) << "====== XML creation for test " << iTestNum << " complete ======" << std::endl;