1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-17 07:17:06 +01:00

Working on the 5d

This commit is contained in:
Guido Cossu
2016-10-21 14:22:25 +01:00
parent deef2673b2
commit 392130a537
8 changed files with 286 additions and 262 deletions

View File

@ -76,7 +76,7 @@ class WilsonGaugeAction : public Action<typename Gimpl::GaugeField> {
// Staple in direction mu
WilsonLoops<Gimpl>::Staple(dSdU_mu, U, mu);
dSdU_mu = Ta(Umu * dSdU_mu) * factor;
PokeIndex<LorentzIndex>(dSdU, dSdU_mu, mu);
}
};
@ -88,57 +88,70 @@ class VariableWilsonGaugeAction : public Action<typename Gimpl::GaugeField> {
INHERIT_GIMPL_TYPES(Gimpl);
private:
std::vector<RealD> b_bulk;// bulk couplings
std::vector<RealD> b_xdim;//extra dimension couplings
std::vector<RealD> b_bulk; // bulk couplings
std::vector<RealD> b_xdim; // extra dimension couplings
GridBase *grid;
LatticeComplex beta_xdim;
LatticeComplex beta_xdim_shifted;
LatticeComplex beta_bulk;
int bulk_volume;
public:
VariableWilsonGaugeAction(std::vector<RealD> bulk, std::vector<RealD> xdim,
GridBase *_grid)
GridBase *_grid, bool openBC = false)
: 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
beta_bulk(grid) {
// check that the grid is ok
// todo
int Ndim = Nd; // change later
LatticeComplex temp(grid);
std::vector<int> FullDim = grid->GlobalDimensions();
bulk_volume = 1;
for (int s = 0; s < Ndim - 1; s++) bulk_volume *= FullDim[s];
Lattice<iScalar<vInteger> > coor(grid);
LatticeComplex temp(grid);
LatticeCoordinate(coor, Ndim - 1);
Lattice<iScalar<vInteger> > coor(grid);
int Nex = grid->_fdimensions[Ndim - 1];
assert(b_bulk.size() == Nex);
assert(b_xdim.size() == Nex);
LatticeCoordinate(coor, Ndim - 1);
beta_xdim = zero;
for (int tau = 0; tau < Nex; tau++) {
temp = b_xdim[tau];
beta_xdim = where(coor == tau, temp, beta_xdim);
}
int Nex = FullDim[Ndim - 1];
assert(b_bulk.size() == Nex);
assert(b_xdim.size() == Nex);
beta_xdim_shifted = Cshift(beta_xdim, Ndim - 1, -1);
beta_xdim = zero;
for (int tau = 0; tau < Nex - 1; tau++) {
temp = b_xdim[tau];
beta_xdim = where(coor == tau, temp, beta_xdim);
}
beta_bulk = zero;
for (int tau = 0; tau < Nex; tau++) {
temp = b_bulk[tau];
beta_bulk = where(coor == tau, temp, beta_bulk);
}
};
if (!openBC) {
temp = b_xdim[Nex - 1];
beta_xdim = where(coor == Nex - 1, 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);
}
std::cout << beta_xdim << std::endl;
std::cout << beta_xdim_shifted << std::endl;
};
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
int Ndim = Nd; // change later for generality
conformable(grid, Umu._grid);
std::vector<GaugeLinkField> U(Ndim, grid);
@ -150,19 +163,34 @@ class VariableWilsonGaugeAction : public Action<typename Gimpl::GaugeField> {
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<Gimpl>::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<TComplex> 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
/////////////
@ -186,74 +214,66 @@ class VariableWilsonGaugeAction : public Action<typename Gimpl::GaugeField> {
// 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]
// todo
// 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);
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);
GaugeLinkField Umu(grid);
GaugeLinkField dSdU_mu(grid);
GaugeLinkField staple(grid);
for (int mu = 0; mu < Ndim; mu++) {
Umu = PeekIndex<LorentzIndex>(U, mu);
dSdU_mu = zero;
for (int mu = 0; mu < Ndim; mu++) {
Umu = PeekIndex<LorentzIndex>(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<Gimpl>::Staple(staple, U, mu, nu);
staple = staple * beta_bulk;
dSdU_mu += staple;
for (int nu = 0; nu < Ndim; nu++) {
if (nu != mu) {
if ((mu < (Ndim - 1)) && (nu < (Ndim - 1))) {
// Spacelike case apply beta space
WilsonLoops<Gimpl>::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));
} 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<Gimpl>::Staple(staple, U, mu, nu);
staple = staple * beta_xdim;
dSdU_mu += staple;
// mu==tau dir link deriv, nu spatial
WilsonLoops<Gimpl>::Staple(staple, U, mu, nu);
staple = staple * beta_xdim;
dSdU_mu += staple;
} else {
assert(mu < (Ndim - 1));
assert(nu == (Ndim - 1));
} else {
assert(mu < (Ndim - 1));
assert(nu == (Ndim - 1));
// nu time; mu space link
// nu time; mu space link
// staple forwards in tau
WilsonLoops<Gimpl>::StapleUpper(staple, U, mu, nu);
staple = staple * beta_xdim;
dSdU_mu += staple;
// staple forwards in tau
WilsonLoops<Gimpl>::StapleUpper(staple, U, mu, nu);
staple = staple * beta_xdim;
dSdU_mu += staple;
// staple backwards in tau
WilsonLoops<Gimpl>::StapleLower(staple, U, mu, nu);
staple = staple * beta_xdim_shifted;
dSdU_mu += staple;
// staple backwards in tau
WilsonLoops<Gimpl>::StapleLower(staple, U, mu, nu);
staple = staple * beta_xdim_shifted;
dSdU_mu += staple;
}
}
}
dSdU_mu = Ta(Umu * dSdU_mu) * factor;
PokeIndex<LorentzIndex>(dSdU, dSdU_mu, mu);
}
}
dSdU_mu = Ta(Umu * dSdU_mu) * factor;
PokeIndex<LorentzIndex>(dSdU, dSdU_mu, mu);
}
};
};
}
}