#ifndef _COMPUTE_SIGMA_H #define _COMPUTE_SIGMA_H #include #include //Compute stationary sigma meson two-point function with and without GPBC CPS_START_NAMESPACE //Policy for stationary sigma with and without GPBC class StationarySigmaMomentaPolicy{ public: void setupMomenta(const int &ngp){ RequiredMomentum *tt = static_cast*>(this); if(ngp == 0){ tt->addP("(0,0,0) + (0,0,0)"); }else if(ngp == 1){ tt->addPandMinusP("(-1,0,0) + (1,0,0)"); tt->addPandMinusP("(-3,0,0) + (3,0,0)"); }else if(ngp == 2){ tt->addPandMinusP("(-1,-1,0) + (1,1,0)"); tt->addPandMinusP("(3,-1,0) + (-3,1,0)"); tt->addPandMinusP("(-1,3,0) + (1,-3,0)"); }else if(ngp == 3){ tt->addPandMinusP("(-1,-1,-1) + (1,1,1)"); tt->addPandMinusP("(3,-1,-1) + (-3,1,1)"); tt->addPandMinusP("(-1,3,-1) + (1,-3,1)"); tt->addPandMinusP("(-1,-1,3) + (1,1,-3)"); }else{ ERR.General("StationarySigmaMomentaPolicy","setupMomenta","ngp cannot be >3\n"); } } }; template class ComputeSigma{ public: typedef typename A2Asource::FieldType::InputParamType FieldParamType; #ifdef USE_DESTRUCTIVE_FFT typedef A2AvectorW Wtype; typedef A2AvectorV Vtype; #else typedef const A2AvectorW Wtype; typedef const A2AvectorV Vtype; #endif //Computes sigma meson fields and saves to disk static void computeAndWrite(const std::string &work_dir, const int traj, Wtype &W, Vtype &V, const Float &rad, Lattice &lattice, const FieldParamType &src_setup_params = NullObject()){ typedef typename mf_Policies::ComplexType ComplexType; typedef typename mf_Policies::ScalarComplexType ScalarComplexType; typedef typename mf_Policies::SourcePolicies SourcePolicies; typedef A2AmesonField MesonFieldType; typedef std::vector MesonFieldVectorType; int Lt = GJP.Tnodes()*GJP.TnodeSites(); RequiredMomentum momenta; std::vector Wspecies(1,&W); std::vector Vspecies(1,&V); if(GJP.Gparity()){ typedef A2AflavorProjectedExpSource ExpSrcType; typedef A2AflavorProjectedHydrogenSource HydSrcType; int pbase[3]; //we reset the momentum for each computation so we technically don't need this - however the code demands a valid momentum GparityBaseMomentum(pbase,+1); #ifdef SIGMA_DO_SOURCES_SEPARATELY //Multi-src multi-mom strategy consumes a lot of memory - too much for a 64-node job on Cori I. This option does the two sources separately, reducing the memory usage by a factor of 2 at the loss of computational efficiency typedef GparitySourceShiftInnerProduct > ExpInnerType; typedef GparityFlavorProjectedShiftSourceStorage ExpStorageType; typedef GparitySourceShiftInnerProduct > HydInnerType; typedef GparityFlavorProjectedShiftSourceStorage HydStorageType; ExpSrcType exp_src(rad,pbase,src_setup_params); //1s HydSrcType hyd_src(2,0,0,rad,pbase,src_setup_params); //2s ExpInnerType exp_gunit_s0_inner(sigma0, exp_src); ExpStorageType exp_mf_store(exp_gunit_s0_inner,exp_src); HydInnerType hyd_gunit_s0_inner(sigma0, hyd_src); HydStorageType hyd_mf_store(hyd_gunit_s0_inner,hyd_src); for(int pidx=0;pidx::compute(exp_mf_store,Wspecies,Vspecies,lattice # ifdef NODE_DISTRIBUTE_MESONFIELDS ,true # endif ); if(!UniqueID()) printf("Computing sigma meson fields with 2s source\n"); ComputeMesonFields::compute(hyd_mf_store,Wspecies,Vspecies,lattice # ifdef NODE_DISTRIBUTE_MESONFIELDS ,true # endif ); #else typedef Elem > SrcList; typedef A2AmultiSource MultiSrcType; //typedef SCFspinflavorInnerProduct<0,ComplexType,MultiSrcType,true,false> MultiInnerType; //unit matrix spin structure //typedef GparityFlavorProjectedMultiSourceStorage StorageType; //Allows for more memory efficient computation algorithm typedef GparitySourceShiftInnerProduct > MultiInnerType; typedef GparityFlavorProjectedShiftSourceStorage StorageType; MultiSrcType src; src.template getSource<0>().setup(rad,pbase,src_setup_params); //1s src.template getSource<1>().setup(2,0,0,rad,pbase,src_setup_params); //2s MultiInnerType gunit_s0_inner(sigma0, src); StorageType mf_store(gunit_s0_inner,src); for(int pidx=0;pidx::compute(mf_store,Wspecies,Vspecies,lattice # ifdef NODE_DISTRIBUTE_MESONFIELDS ,true # endif ); #endif std::string src_names[2] = {"1s","2s"}; if(!UniqueID()) printf("Writing sigma meson fields to disk\n"); for(int pidx=0;pidx SrcType; typedef SCspinInnerProduct<0,ComplexType,SrcType> InnerType; typedef BasicSourceStorage StorageType; SrcType src(rad,src_setup_params); InnerType gunit_inner(src); StorageType mf_store(gunit_inner); for(int pidx=0;pidx::compute(mf_store,Wspecies,Vspecies,lattice); for(int pidx=0;pidx