2017-04-26 09:32:57 +01:00
|
|
|
/*************************************************************************************
|
|
|
|
|
|
|
|
Grid physics library, www.github.com/paboyle/Grid
|
|
|
|
|
|
|
|
Source file: extras/Hadrons/Modules/MContraction/WardIdentity.hpp
|
|
|
|
|
2017-12-26 13:16:47 +00:00
|
|
|
Copyright (C) 2015-2018
|
2017-04-26 09:32:57 +01:00
|
|
|
|
2017-12-26 13:16:47 +00:00
|
|
|
Author: Antonin Portelli <antonin.portelli@me.com>
|
|
|
|
Author: Lanny91 <andrew.lawson@gmail.com>
|
2017-04-26 09:32:57 +01:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along
|
|
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
|
|
|
See the full license in the file "LICENSE" in the top level distribution directory
|
|
|
|
*************************************************************************************/
|
|
|
|
/* END LEGAL */
|
|
|
|
|
2017-06-12 10:32:14 +01:00
|
|
|
#ifndef Hadrons_MContraction_WardIdentity_hpp_
|
|
|
|
#define Hadrons_MContraction_WardIdentity_hpp_
|
2017-04-25 22:08:33 +01:00
|
|
|
|
|
|
|
#include <Grid/Hadrons/Global.hpp>
|
|
|
|
#include <Grid/Hadrons/Module.hpp>
|
|
|
|
#include <Grid/Hadrons/ModuleFactory.hpp>
|
|
|
|
|
|
|
|
BEGIN_HADRONS_NAMESPACE
|
|
|
|
|
|
|
|
/*
|
|
|
|
Ward Identity contractions
|
|
|
|
-----------------------------
|
|
|
|
|
|
|
|
* options:
|
2017-05-18 13:16:14 +01:00
|
|
|
- q: propagator, 5D if available (string)
|
|
|
|
- action: action module used for propagator solution (string)
|
|
|
|
- mass: mass of quark (double)
|
|
|
|
- test_axial: whether or not to test PCAC relation.
|
2017-04-25 22:08:33 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* WardIdentity *
|
|
|
|
******************************************************************************/
|
|
|
|
BEGIN_MODULE_NAMESPACE(MContraction)
|
|
|
|
|
|
|
|
class WardIdentityPar: Serializable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GRID_SERIALIZABLE_CLASS_MEMBERS(WardIdentityPar,
|
|
|
|
std::string, q,
|
|
|
|
std::string, action,
|
2017-05-18 13:16:14 +01:00
|
|
|
double, mass,
|
|
|
|
bool, test_axial);
|
2017-04-25 22:08:33 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
template <typename FImpl>
|
|
|
|
class TWardIdentity: public Module<WardIdentityPar>
|
|
|
|
{
|
|
|
|
public:
|
2017-06-07 16:26:22 +01:00
|
|
|
FERM_TYPE_ALIASES(FImpl,);
|
2017-04-25 22:08:33 +01:00
|
|
|
public:
|
|
|
|
// constructor
|
|
|
|
TWardIdentity(const std::string name);
|
|
|
|
// destructor
|
2018-04-24 17:20:25 +01:00
|
|
|
virtual ~TWardIdentity(void) {};
|
2017-04-25 22:08:33 +01:00
|
|
|
// dependency relation
|
|
|
|
virtual std::vector<std::string> getInput(void);
|
|
|
|
virtual std::vector<std::string> getOutput(void);
|
2017-12-03 18:46:18 +00:00
|
|
|
protected:
|
2017-04-25 22:08:33 +01:00
|
|
|
// setup
|
|
|
|
virtual void setup(void);
|
|
|
|
// execution
|
|
|
|
virtual void execute(void);
|
|
|
|
private:
|
|
|
|
unsigned int Ls_;
|
|
|
|
};
|
|
|
|
|
2018-04-23 17:35:01 +01:00
|
|
|
MODULE_REGISTER_TMP(WardIdentity, TWardIdentity<FIMPL>, MContraction);
|
2017-04-25 22:08:33 +01:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* TWardIdentity implementation *
|
|
|
|
******************************************************************************/
|
|
|
|
// constructor /////////////////////////////////////////////////////////////////
|
|
|
|
template <typename FImpl>
|
|
|
|
TWardIdentity<FImpl>::TWardIdentity(const std::string name)
|
|
|
|
: Module<WardIdentityPar>(name)
|
|
|
|
{}
|
|
|
|
|
|
|
|
// dependencies/products ///////////////////////////////////////////////////////
|
|
|
|
template <typename FImpl>
|
|
|
|
std::vector<std::string> TWardIdentity<FImpl>::getInput(void)
|
|
|
|
{
|
2017-05-18 13:16:14 +01:00
|
|
|
std::vector<std::string> in = {par().q, par().action};
|
2017-04-25 22:08:33 +01:00
|
|
|
|
|
|
|
return in;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename FImpl>
|
|
|
|
std::vector<std::string> TWardIdentity<FImpl>::getOutput(void)
|
|
|
|
{
|
2017-12-13 19:41:41 +00:00
|
|
|
std::vector<std::string> out = {};
|
2017-04-25 22:08:33 +01:00
|
|
|
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
// setup ///////////////////////////////////////////////////////////////////////
|
|
|
|
template <typename FImpl>
|
|
|
|
void TWardIdentity<FImpl>::setup(void)
|
|
|
|
{
|
|
|
|
Ls_ = env().getObjectLs(par().q);
|
2017-04-28 16:50:17 +01:00
|
|
|
if (Ls_ != env().getObjectLs(par().action))
|
|
|
|
{
|
2018-04-25 16:49:14 +01:00
|
|
|
HADRONS_ERROR(Size, "Ls mismatch between quark action and propagator");
|
2017-04-28 16:50:17 +01:00
|
|
|
}
|
2017-12-13 19:41:41 +00:00
|
|
|
envTmpLat(PropagatorField, "tmp");
|
|
|
|
envTmpLat(PropagatorField, "vector_WI");
|
|
|
|
if (par().test_axial)
|
|
|
|
{
|
|
|
|
envTmpLat(PropagatorField, "psi");
|
|
|
|
envTmpLat(LatticeComplex, "PP");
|
|
|
|
envTmpLat(LatticeComplex, "axial_defect");
|
|
|
|
envTmpLat(LatticeComplex, "PJ5q");
|
|
|
|
}
|
2017-04-25 22:08:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// execution ///////////////////////////////////////////////////////////////////
|
|
|
|
template <typename FImpl>
|
|
|
|
void TWardIdentity<FImpl>::execute(void)
|
|
|
|
{
|
|
|
|
LOG(Message) << "Performing Ward Identity checks for quark '" << par().q
|
|
|
|
<< "'." << std::endl;
|
|
|
|
|
2017-12-13 19:41:41 +00:00
|
|
|
auto &q = envGet(PropagatorField, par().q);
|
|
|
|
auto &act = envGet(FMat, par().action);
|
|
|
|
Gamma g5(Gamma::Algebra::Gamma5);
|
2017-06-05 15:56:43 +01:00
|
|
|
|
2017-05-18 13:16:14 +01:00
|
|
|
// Compute D_mu V_mu, D here is backward derivative.
|
2017-12-13 19:41:41 +00:00
|
|
|
envGetTmp(PropagatorField, tmp);
|
|
|
|
envGetTmp(PropagatorField, vector_WI);
|
2017-05-18 13:16:14 +01:00
|
|
|
vector_WI = zero;
|
2017-04-25 22:08:33 +01:00
|
|
|
for (unsigned int mu = 0; mu < Nd; ++mu)
|
|
|
|
{
|
|
|
|
act.ContractConservedCurrent(q, q, tmp, Current::Vector, mu);
|
2017-05-18 13:16:14 +01:00
|
|
|
tmp -= Cshift(tmp, mu, -1);
|
|
|
|
vector_WI += tmp;
|
2017-04-25 22:08:33 +01:00
|
|
|
}
|
|
|
|
|
2017-06-05 11:55:41 +01:00
|
|
|
// Test ward identity D_mu V_mu = 0;
|
2017-05-18 13:16:14 +01:00
|
|
|
LOG(Message) << "Vector Ward Identity check Delta_mu V_mu = "
|
|
|
|
<< norm2(vector_WI) << std::endl;
|
2017-04-25 22:08:33 +01:00
|
|
|
|
2017-05-18 13:16:14 +01:00
|
|
|
if (par().test_axial)
|
2017-04-25 22:08:33 +01:00
|
|
|
{
|
2017-12-13 19:41:41 +00:00
|
|
|
envGetTmp(PropagatorField, psi);
|
|
|
|
envGetTmp(LatticeComplex, PP);
|
|
|
|
envGetTmp(LatticeComplex, axial_defect);
|
|
|
|
envGetTmp(LatticeComplex, PJ5q);
|
2017-06-05 11:55:41 +01:00
|
|
|
std::vector<TComplex> axial_buf;
|
2017-05-18 13:16:14 +01:00
|
|
|
|
2017-06-05 11:55:41 +01:00
|
|
|
// Compute <P|D_mu A_mu>, D is backwards derivative.
|
2017-05-18 13:16:14 +01:00
|
|
|
axial_defect = zero;
|
|
|
|
for (unsigned int mu = 0; mu < Nd; ++mu)
|
|
|
|
{
|
|
|
|
act.ContractConservedCurrent(q, q, tmp, Current::Axial, mu);
|
|
|
|
tmp -= Cshift(tmp, mu, -1);
|
2017-06-05 15:56:43 +01:00
|
|
|
axial_defect += trace(g5*tmp);
|
2017-05-18 13:16:14 +01:00
|
|
|
}
|
|
|
|
|
2017-06-05 11:55:41 +01:00
|
|
|
// Get <P|J5q> for 5D (zero for 4D) and <P|P>.
|
2017-05-18 13:16:14 +01:00
|
|
|
PJ5q = zero;
|
|
|
|
if (Ls_ > 1)
|
|
|
|
{
|
2017-06-05 11:55:41 +01:00
|
|
|
// <P|P>
|
2017-05-18 13:16:14 +01:00
|
|
|
ExtractSlice(tmp, q, 0, 0);
|
2017-06-05 11:55:41 +01:00
|
|
|
psi = 0.5 * (tmp - g5*tmp);
|
2017-05-18 13:16:14 +01:00
|
|
|
ExtractSlice(tmp, q, Ls_ - 1, 0);
|
2017-06-05 11:55:41 +01:00
|
|
|
psi += 0.5 * (tmp + g5*tmp);
|
2017-05-18 13:16:14 +01:00
|
|
|
PP = trace(adj(psi)*psi);
|
|
|
|
|
2017-06-05 11:55:41 +01:00
|
|
|
// <P|5Jq>
|
2017-05-18 13:16:14 +01:00
|
|
|
ExtractSlice(tmp, q, Ls_/2 - 1, 0);
|
|
|
|
psi = 0.5 * (tmp + g5*tmp);
|
|
|
|
ExtractSlice(tmp, q, Ls_/2, 0);
|
|
|
|
psi += 0.5 * (tmp - g5*tmp);
|
|
|
|
PJ5q = trace(adj(psi)*psi);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PP = trace(adj(q)*q);
|
|
|
|
}
|
|
|
|
|
2017-06-05 11:55:41 +01:00
|
|
|
// Test ward identity <P|D_mu A_mu> = 2m<P|P> + 2<P|J5q>
|
|
|
|
LOG(Message) << "|D_mu A_mu|^2 = " << norm2(axial_defect) << std::endl;
|
|
|
|
LOG(Message) << "|PP|^2 = " << norm2(PP) << std::endl;
|
|
|
|
LOG(Message) << "|PJ5q|^2 = " << norm2(PJ5q) << std::endl;
|
2017-05-18 13:16:14 +01:00
|
|
|
LOG(Message) << "Axial Ward Identity defect Delta_mu A_mu = "
|
|
|
|
<< norm2(axial_defect) << std::endl;
|
2017-06-05 15:56:43 +01:00
|
|
|
|
2017-06-05 11:55:41 +01:00
|
|
|
// Axial defect by timeslice.
|
|
|
|
axial_defect -= 2.*(par().mass*PP + PJ5q);
|
|
|
|
LOG(Message) << "Check Axial defect by timeslice" << std::endl;
|
|
|
|
sliceSum(axial_defect, axial_buf, Tp);
|
|
|
|
for (int t = 0; t < axial_buf.size(); ++t)
|
|
|
|
{
|
|
|
|
LOG(Message) << "t = " << t << ": "
|
|
|
|
<< TensorRemove(axial_buf[t]) << std::endl;
|
|
|
|
}
|
2017-04-25 22:08:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
END_MODULE_NAMESPACE
|
|
|
|
|
|
|
|
END_HADRONS_NAMESPACE
|
|
|
|
|
|
|
|
#endif // Hadrons_WardIdentity_hpp_
|