diff --git a/lib/qcd/action/Actions.h b/lib/qcd/action/Actions.h index ef2edc97..20023455 100644 --- a/lib/qcd/action/Actions.h +++ b/lib/qcd/action/Actions.h @@ -72,9 +72,6 @@ namespace QCD { typedef WilsonGaugeAction WilsonGaugeActionR; typedef WilsonGaugeAction WilsonGaugeActionF; typedef WilsonGaugeAction WilsonGaugeActionD; -typedef VariableWilsonGaugeAction VariableWilsonGaugeActionR; -typedef VariableWilsonGaugeAction VariableWilsonGaugeActionF; -typedef VariableWilsonGaugeAction VariableWilsonGaugeActionD; typedef PlaqPlusRectangleAction PlaqPlusRectangleActionR; typedef PlaqPlusRectangleAction PlaqPlusRectangleActionF; diff --git a/lib/qcd/action/gauge/WilsonGaugeAction.h b/lib/qcd/action/gauge/WilsonGaugeAction.h index 8ac1df74..b9216d78 100644 --- a/lib/qcd/action/gauge/WilsonGaugeAction.h +++ b/lib/qcd/action/gauge/WilsonGaugeAction.h @@ -82,193 +82,7 @@ class WilsonGaugeAction : public Action { }; }; -template -class VariableWilsonGaugeAction : public Action { - public: - INHERIT_GIMPL_TYPES(Gimpl); - private: - std::vector b_bulk; // bulk couplings - std::vector b_xdim; // extra dimension couplings - GridBase *grid; - LatticeComplex beta_xdim; - LatticeComplex beta_xdim_shifted; - LatticeComplex beta_bulk; - - int bulk_volume; - - public: - VariableWilsonGaugeAction(std::vector bulk, std::vector xdim, - GridBase *_grid) - : b_bulk(bulk), - b_xdim(xdim), - grid(_grid), - beta_xdim(grid), - beta_xdim_shifted(grid), - beta_bulk(grid) { - // check that the grid is ok - // todo - int Ndim = Nd; // change later - - std::vector FullDim = grid->GlobalDimensions(); - bulk_volume = 1; - for (int s = 0; s < Ndim - 1; s++) bulk_volume *= FullDim[s]; - - LatticeComplex temp(grid); - - Lattice > coor(grid); - - LatticeCoordinate(coor, Ndim - 1); - - int Nex = FullDim[Ndim - 1]; - assert(b_bulk.size() == Nex); - assert(b_xdim.size() == Nex); - - beta_xdim = zero; - for (int tau = 0; tau < Nex - 1; tau++) { - temp = b_xdim[tau]; - beta_xdim = where(coor == tau, temp, beta_xdim); - } - - beta_xdim_shifted = Cshift(beta_xdim, Ndim - 1, -1); - - beta_bulk = zero; - for (int tau = 0; tau < Nex; tau++) { - temp = b_bulk[tau]; - beta_bulk = where(coor == tau, temp, beta_bulk); - } - - - }; - - virtual void refresh(const GaugeField &U, - GridParallelRNG &pRNG){}; // noop as no pseudoferms - - virtual RealD S(const GaugeField &Umu) { - int Ndim = Nd; // change later for generality - conformable(grid, Umu._grid); - - std::vector U(Ndim, grid); - - for (int mu = 0; mu < Ndim; mu++) { - U[mu] = PeekIndex(Umu, mu); - } - - LatticeComplex dirPlaq(grid); - LatticeComplex Plaq(grid); - - LatticeComplex SumdirPlaq(grid); - - RealD OneOnNc = 1.0 / Real(Nc); - - ///////////// - // Lower dim plaquettes - ///////////// - Plaq = zero; - SumdirPlaq = zero; - for (int mu = 1; mu < Ndim - 1; mu++) { - for (int nu = 0; nu < mu; nu++) { - WilsonLoops::traceDirPlaquette(dirPlaq, U, mu, nu); - SumdirPlaq += dirPlaq; - Plaq = Plaq + (1.0 - dirPlaq * OneOnNc) * beta_bulk; - } - } - - - double faces = (1.0 * (Nd - 1) * (Nd - 2)) / 2.0; - SumdirPlaq *= OneOnNc / (RealD(bulk_volume) * faces); - - // print slices in the extra dimension - int Nex = grid->_fdimensions[Ndim - 1]; - std::vector plaq_ex(Nex); - sliceSum(SumdirPlaq, plaq_ex, Ndim - 1); - for (int ex = 0; ex < Nex; ex++) - std::cout << GridLogMessage << "Bulk plaq[" << ex - << "] = " << TensorRemove(plaq_ex[ex]).real() << std::endl; - - ///////////// - // Extra dimension - ///////////// - { - int mu = Ndim - 1; - for (int nu = 0; nu < mu; nu++) { - WilsonLoops::traceDirPlaquette(dirPlaq, U, mu, nu); - Plaq = Plaq + (1.0 - dirPlaq * OneOnNc) * beta_xdim; - } - } - - TComplex Tp = sum(Plaq); - Complex p = TensorRemove(Tp); - RealD action = p.real(); - return action; - }; - - virtual void deriv(const GaugeField &U, GaugeField &dSdU) { - // not optimal implementation FIXME - // extend Ta to include Lorentz indexes - - // for the higher dimension plaquettes take the upper plaq of the - // 4d slice and multiply by beta[s] and the lower and multiply by beta[s-1] - // derivative of links mu = 0, ... Nd-1 inside plaq (mu,5) - // for these I need upper and lower staples separated - // each multiplied with their own beta - // derivative of links mu = 5 - // living on the same slice, share the same beta - - conformable(grid, U._grid); - int Ndim = Nd; // change later - RealD factor = 0.5 / RealD(Nc); - - GaugeLinkField Umu(grid); - GaugeLinkField dSdU_mu(grid); - GaugeLinkField staple(grid); - - for (int mu = 0; mu < Ndim; mu++) { - Umu = PeekIndex(U, mu); - dSdU_mu = zero; - - for (int nu = 0; nu < Ndim; nu++) { - if (nu != mu) { - if ((mu < (Ndim - 1)) && (nu < (Ndim - 1))) { - // Spacelike case apply beta space - WilsonLoops::Staple(staple, U, mu, nu); - staple = staple * beta_bulk; - dSdU_mu += staple; - - } else if (mu == (Ndim - 1)) { - // nu space; mu time link - assert(nu < (Ndim - 1)); - assert(mu == (Ndim - 1)); - - // mu==tau dir link deriv, nu spatial - WilsonLoops::Staple(staple, U, mu, nu); - staple = staple * beta_xdim; - dSdU_mu += staple; - - } else { - assert(mu < (Ndim - 1)); - assert(nu == (Ndim - 1)); - - // nu time; mu space link - - // staple forwards in tau - WilsonLoops::StapleUpper(staple, U, mu, nu); - staple = staple * beta_xdim; - dSdU_mu += staple; - - // staple backwards in tau - WilsonLoops::StapleLower(staple, U, mu, nu); - staple = staple * beta_xdim_shifted; - dSdU_mu += staple; - } - } - } - - dSdU_mu = Ta(Umu * dSdU_mu) * factor; - PokeIndex(dSdU, dSdU_mu, mu); - } - }; -}; } } diff --git a/tests/hmc/Test_hmc_WilsonGauge_Binary.cc b/tests/hmc/Test_hmc_WilsonGauge_Binary.cc index a3bdbe4f..977ca1c8 100644 --- a/tests/hmc/Test_hmc_WilsonGauge_Binary.cc +++ b/tests/hmc/Test_hmc_WilsonGauge_Binary.cc @@ -62,27 +62,15 @@ class HmcRunner : public BinaryHmcRunner { void BuildTheAction(int argc, char **argv) { - int Ndim=5; typedef WilsonImplR ImplPolicy; typedef WilsonFermionR FermionAction; typedef typename FermionAction::FermionField FermionField; - std::vector simd = GridDefaultSimd(Ndim-1,vComplex::Nsimd()); - simd.push_back(1); - - - //UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), simd, GridDefaultMpi()); - UGrid = new GridCartesian(GridDefaultLatt(),simd,GridDefaultMpi()); + UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd, vComplex::Nsimd()), GridDefaultMpi()); + // Gauge action - int Ls = UGrid->_fdimensions[Nd - 1]; - std::vector betat(Ls,6.0); - std::vector betas(Ls,5.6); - betat[Ls-1]= 0.0; - betas={5.2,5.5,5.8,6,6,5.8,5.5,5.2}; - std:cout << GridLogMessage << "Betas: " << betas << std::endl; - VariableWilsonGaugeActionR Waction(betas, betat, UGrid); - //WilsonGaugeActionR Waction(5.6); + WilsonGaugeActionR Waction(5.6); // Collect actions ActionLevel Level1(1);