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

added Spin dilution

This commit is contained in:
ferben 2019-03-22 13:30:11 +00:00
parent 9dc3fe9922
commit fbf286b0e3
4 changed files with 20 additions and 22 deletions

View File

@ -108,13 +108,13 @@ void TDistilSink<FImpl>::setup(void)
int nnoise=par().nnoise;
int LI=par().LI;
int Ns=par().Ns;
int SI=par().SI;
int Nt_inv=par().Nt_inv;
envCreate(std::vector<FermionField>, getName(), 1,
nnoise*LI*Ns*Nt_inv, envGetGrid(FermionField));
nnoise*LI*SI*Nt_inv, envGetGrid(FermionField));
//GridCartesian * grid4d = env().getGrid();
grid4d = env().getGrid();
grid4d = env().getGrid();
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd, vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
@ -122,7 +122,6 @@ void TDistilSink<FImpl>::setup(void)
latt_size[Nd-1] = 1;
simd_layout_3.push_back( 1 );
mpi_layout[Nd-1] = 1;
//GridCartesian * grid3d = new GridCartesian(latt_size,simd_layout_3,mpi_layout,*grid4d);
grid3d = MakeLowerDimGrid(grid4d);
@ -161,14 +160,13 @@ void TDistilSink<FImpl>::execute(void)
envGetTmp(LatticeSpinColourVector, sink_tslice);
envGetTmp(LatticeColourVector, evec3d);
//GridCartesian * grid4d = env().getGrid();
int Ntlocal = grid4d->LocalDimensions()[3];
int Ntfirst = grid4d->LocalStarts()[3];
int tsrc=par().tsrc;
int nnoise=par().nnoise;
int LI=par().LI;
int SI=par().SI;
int Ns=par().Ns;
int Nt_inv=par().Nt_inv; // TODO: No input, but define through Nt, TI
int Nt=par().Nt;
@ -182,8 +180,8 @@ void TDistilSink<FImpl>::execute(void)
for (int inoise = 0; inoise < nnoise; inoise++) {
for (int dk = 0; dk < LI; dk++) {
for (int dt = 0; dt < Nt_inv; dt++) {
for (int ds = 0; ds < Ns; ds++) {
vecindex = inoise + nnoise * dk + nnoise * LI * ds + nnoise *LI * Ns*dt;
for (int ds = 0; ds < SI; ds++) {
vecindex = inoise + nnoise * dk + nnoise * LI * ds + nnoise *LI * SI*dt;
phi[vecindex] = zero;
for (int t = Ntfirst; t < Ntfirst + Ntlocal; t++) {
sink_tslice=zero;
@ -198,8 +196,6 @@ void TDistilSink<FImpl>::execute(void)
}
}
std::cout << "size phi" << phi.size() << std::endl;
}
END_MODULE_NAMESPACE

View File

@ -113,12 +113,13 @@ void TDistilVectors<FImpl>::setup(void)
int nnoise=par().nnoise;
int LI=par().LI;
int Ns=par().Ns;
int SI=par().SI;
int Nt_inv=par().Nt_inv;
envCreate(std::vector<FermionField>, getName() + "_rho", 1,
nnoise*LI*Ns*Nt_inv, envGetGrid(FermionField));
nnoise*LI*SI*Nt_inv, envGetGrid(FermionField));
envCreate(std::vector<FermionField>, getName() + "_phi", 1,
nnoise*LI*Ns*Nt_inv, envGetGrid(FermionField));
nnoise*LI*SI*Nt_inv, envGetGrid(FermionField));
//GridCartesian * grid4d = env().getGrid();
grid4d = env().getGrid();
@ -184,6 +185,7 @@ void TDistilVectors<FImpl>::execute(void)
int Nt=par().Nt;
int TI=par().TI;
int nvec=par().nvec;
int SI=par().SI;
bool full_tdil=(TI==Nt);
@ -192,18 +194,17 @@ void TDistilVectors<FImpl>::execute(void)
for (int inoise = 0; inoise < nnoise; inoise++) {
for (int dk = 0; dk < LI; dk++) {
for (int dt = 0; dt < Nt_inv; dt++) {
for (int ds = 0; ds < Ns; ds++) {
vecindex = inoise + nnoise * dk + nnoise * LI * ds + nnoise *LI * Ns*dt;
for (int ds = 0; ds < SI; ds++) {
vecindex = inoise + nnoise * dk + nnoise * LI * ds + nnoise *LI * SI*dt;
rho[vecindex] = zero;
tmp3d_nospin = zero;
for (int it = dt; it < Nt; it += TI){
if (full_tdil) t_inv = tsrc; else t_inv = it;
if( t_inv >= Ntfirst && t_inv < Ntfirst + Ntlocal ) {
for (int ik = dk; ik < nvec; ik += LI){
for (int is = ds; is < Ns; is += Ns){ //at the moment, full spin dilution is enforced
for (int is = ds; is < Ns; is += SI){
ExtractSliceLocal(evec3d,epack.evec[ik],0,t_inv,3);
tmp3d_nospin = evec3d * noise[inoise + nnoise*(t_inv + Nt*(ik+nvec*is))];
//tmp3d_nospin = evec3d * noise[inoise][it][ik]()(is)(); //noises do not have to be a spin vector
tmp3d=zero;
pokeSpin(tmp3d,tmp3d_nospin,is);
tmp2=zero;
@ -221,8 +222,8 @@ void TDistilVectors<FImpl>::execute(void)
for (int inoise = 0; inoise < nnoise; inoise++) {
for (int dk = 0; dk < LI; dk++) {
for (int dt = 0; dt < Nt_inv; dt++) {
for (int ds = 0; ds < Ns; ds++) {
vecindex = inoise + nnoise * dk + nnoise * LI * ds + nnoise *LI * Ns*dt;
for (int ds = 0; ds < SI; ds++) {
vecindex = inoise + nnoise * dk + nnoise * LI * ds + nnoise *LI * SI*dt;
phi[vecindex] = zero;
for (int t = Ntfirst; t < Ntfirst + Ntlocal; t++) {
sink_tslice=zero;

View File

@ -164,6 +164,7 @@ void TPerambFromSolve<FImpl>::execute(void)
const DistilParameters & Distil{par().Distil};
const int LI{Distil.LI};
const int TI{Distil.TI};
const int SI{Distil.SI};
const int nnoise{Distil.nnoise};
const int Nt{Distil.Nt};
const int Nt_inv{Distil.Nt_inv};
@ -191,7 +192,7 @@ void TPerambFromSolve<FImpl>::execute(void)
for (int inoise = 0; inoise < nnoise; inoise++) {
for (int dk = 0; dk < LI_reduced; dk++) {
for (int dt = 0; dt < Nt_inv; dt++) {
for (int ds = 0; ds < Ns; ds++) {
for (int ds = 0; ds < SI; ds++) {
for (int is = 0; is < Ns; is++) {
result_nospin = peekSpin(solve[inoise+nnoise*(dk+LI*(dt+Nt_inv*ds))],is);
for (int t = Ntfirst; t < Ntfirst + Ntlocal; t++) {

View File

@ -156,7 +156,7 @@ void TPerambLight<FImpl>::execute(void)
const int nvec{par().nvec};
const DistilParameters & Distil{par().Distil};
const int LI{Distil.LI};
//const int SI{Distil.SI};
const int SI{Distil.SI};
const int TI{Distil.TI};
const int nnoise{Distil.nnoise};
const int Nt{Distil.Nt};
@ -239,7 +239,7 @@ void TPerambLight<FImpl>::execute(void)
for (int inoise = 0; inoise < nnoise; inoise++) {
for (int dk = 0; dk < LI; dk++) {
for (int dt = 0; dt < Nt_inv; dt++) {
for (int ds = 0; ds < Ns; ds++) {
for (int ds = 0; ds < SI; ds++) {
std::cout << "LapH source vector from noise " << inoise << " and dilution component (d_k,d_t,d_alpha) : (" << dk << ","<< dt << "," << ds << ")" << std::endl;
dist_source = zero;
tmp3d_nospin = zero;
@ -248,7 +248,7 @@ void TPerambLight<FImpl>::execute(void)
if (full_tdil) t_inv = tsrc; else t_inv = it;
if( t_inv >= Ntfirst && t_inv < Ntfirst + Ntlocal ) {
for (int ik = dk; ik < nvec; ik += LI){
for (int is = ds; is < Ns; is += Ns){ // TODO: Also allow non-full spin dilution (re-define exact_distillation?)
for (int is = ds; is < Ns; is += SI){
ExtractSliceLocal(evec3d,epack.evec[ik],0,t_inv,3);
tmp3d_nospin = evec3d * noise[inoise + nnoise*(t_inv + Nt*(ik+nvec*is))];
tmp3d=zero;