2016-01-02 14:51:32 +00:00
|
|
|
/*************************************************************************************
|
|
|
|
|
|
|
|
Grid physics library, www.github.com/paboyle/Grid
|
|
|
|
|
|
|
|
Source file: ./lib/qcd/action/pseudofermion/TwoFlavour.h
|
|
|
|
|
|
|
|
Copyright (C) 2015
|
|
|
|
|
|
|
|
Author: Peter Boyle <pabobyle@ph.ed.ac.uk>
|
|
|
|
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|
|
|
|
|
|
|
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 */
|
2015-07-26 04:28:03 +01:00
|
|
|
#ifndef QCD_PSEUDOFERMION_TWO_FLAVOUR_H
|
|
|
|
#define QCD_PSEUDOFERMION_TWO_FLAVOUR_H
|
|
|
|
|
|
|
|
namespace Grid{
|
|
|
|
namespace QCD{
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// Two flavour pseudofermion action for any dop
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
2015-08-10 20:47:44 +01:00
|
|
|
template<class Impl>
|
|
|
|
class TwoFlavourPseudoFermionAction : public Action<typename Impl::GaugeField> {
|
2015-08-15 23:25:49 +01:00
|
|
|
public:
|
|
|
|
INHERIT_IMPL_TYPES(Impl);
|
2015-07-26 04:28:03 +01:00
|
|
|
|
|
|
|
private:
|
2015-07-29 09:53:39 +01:00
|
|
|
|
2015-08-10 20:47:44 +01:00
|
|
|
FermionOperator<Impl> & FermOp;// the basic operator
|
2015-07-26 04:28:03 +01:00
|
|
|
|
|
|
|
OperatorFunction<FermionField> &DerivativeSolver;
|
|
|
|
|
|
|
|
OperatorFunction<FermionField> &ActionSolver;
|
|
|
|
|
|
|
|
FermionField Phi; // the pseudo fermion field for this trajectory
|
|
|
|
|
|
|
|
public:
|
|
|
|
/////////////////////////////////////////////////
|
|
|
|
// Pass in required objects.
|
|
|
|
/////////////////////////////////////////////////
|
2015-08-10 20:47:44 +01:00
|
|
|
TwoFlavourPseudoFermionAction(FermionOperator<Impl> &Op,
|
2015-07-29 09:53:39 +01:00
|
|
|
OperatorFunction<FermionField> & DS,
|
2015-08-07 08:37:15 +01:00
|
|
|
OperatorFunction<FermionField> & AS
|
|
|
|
) : FermOp(Op), DerivativeSolver(DS), ActionSolver(AS), Phi(Op.FermionGrid()) {
|
2015-07-26 04:28:03 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Push the gauge field in to the dops. Assume any BC's and smearing already applied
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////
|
2015-08-30 13:39:19 +01:00
|
|
|
virtual void refresh(const GaugeField &U, GridParallelRNG& pRNG) {
|
2015-07-26 04:28:03 +01:00
|
|
|
|
2015-07-29 09:53:39 +01:00
|
|
|
// P(phi) = e^{- phi^dag (MdagM)^-1 phi}
|
|
|
|
// Phi = Mdag eta
|
|
|
|
// P(eta) = e^{- eta^dag eta}
|
|
|
|
//
|
|
|
|
// e^{x^2/2 sig^2} => sig^2 = 0.5.
|
|
|
|
//
|
|
|
|
// So eta should be of width sig = 1/sqrt(2).
|
|
|
|
// and must multiply by 0.707....
|
|
|
|
//
|
|
|
|
// Chroma has this scale factor: two_flavor_monomial_w.h
|
|
|
|
// IroIro: does not use this scale. It is absorbed by a change of vars
|
|
|
|
// in the Phi integral, and thus is only an irrelevant prefactor for the partition function.
|
|
|
|
//
|
|
|
|
RealD scale = std::sqrt(0.5);
|
2015-08-07 08:37:15 +01:00
|
|
|
FermionField eta(FermOp.FermionGrid());
|
2015-07-29 09:53:39 +01:00
|
|
|
|
|
|
|
gaussian(pRNG,eta);
|
|
|
|
|
2015-07-29 13:02:07 +01:00
|
|
|
FermOp.ImportGauge(U);
|
2015-07-29 09:53:39 +01:00
|
|
|
FermOp.Mdag(eta,Phi);
|
|
|
|
|
|
|
|
Phi=Phi*scale;
|
|
|
|
|
2015-07-26 04:28:03 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////
|
|
|
|
// S = phi^dag (Mdag M)^-1 phi
|
|
|
|
//////////////////////////////////////////////////////
|
|
|
|
virtual RealD S(const GaugeField &U) {
|
|
|
|
|
2015-07-29 09:53:39 +01:00
|
|
|
FermOp.ImportGauge(U);
|
2015-07-26 04:28:03 +01:00
|
|
|
|
2015-08-07 08:37:15 +01:00
|
|
|
FermionField X(FermOp.FermionGrid());
|
|
|
|
FermionField Y(FermOp.FermionGrid());
|
2015-07-29 09:53:39 +01:00
|
|
|
|
2015-08-10 20:47:44 +01:00
|
|
|
MdagMLinearOperator<FermionOperator<Impl> ,FermionField> MdagMOp(FermOp);
|
2015-07-29 09:53:39 +01:00
|
|
|
X=zero;
|
|
|
|
ActionSolver(MdagMOp,Phi,X);
|
2015-07-26 04:28:03 +01:00
|
|
|
MdagMOp.Op(X,Y);
|
|
|
|
|
|
|
|
RealD action = norm2(Y);
|
2015-07-29 09:53:39 +01:00
|
|
|
std::cout << GridLogMessage << "Pseudofermion action "<<action<<std::endl;
|
2015-07-26 04:28:03 +01:00
|
|
|
return action;
|
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////
|
|
|
|
// dS/du = - phi^dag (Mdag M)^-1 [ Mdag dM + dMdag M ] (Mdag M)^-1 phi
|
2015-07-29 09:53:39 +01:00
|
|
|
// = - phi^dag M^-1 dM (MdagM)^-1 phi - phi^dag (MdagM)^-1 dMdag dM (Mdag)^-1 phi
|
|
|
|
//
|
|
|
|
// = - Ydag dM X - Xdag dMdag Y
|
|
|
|
//
|
2015-07-26 04:28:03 +01:00
|
|
|
//////////////////////////////////////////////////////
|
|
|
|
virtual void deriv(const GaugeField &U,GaugeField & dSdU) {
|
|
|
|
|
2015-07-29 09:53:39 +01:00
|
|
|
FermOp.ImportGauge(U);
|
2015-07-26 04:28:03 +01:00
|
|
|
|
2015-08-07 08:37:15 +01:00
|
|
|
FermionField X(FermOp.FermionGrid());
|
|
|
|
FermionField Y(FermOp.FermionGrid());
|
|
|
|
GaugeField tmp(FermOp.GaugeGrid());
|
2015-07-26 04:28:03 +01:00
|
|
|
|
2015-08-10 20:47:44 +01:00
|
|
|
MdagMLinearOperator<FermionOperator<Impl> ,FermionField> MdagMOp(FermOp);
|
2015-07-29 09:53:39 +01:00
|
|
|
|
|
|
|
X=zero;
|
|
|
|
DerivativeSolver(MdagMOp,Phi,X);
|
2015-07-26 04:28:03 +01:00
|
|
|
MdagMOp.Op(X,Y);
|
|
|
|
|
|
|
|
// Our conventions really make this UdSdU; We do not differentiate wrt Udag here.
|
|
|
|
// So must take dSdU - adj(dSdU) and left multiply by mom to get dS/dt.
|
|
|
|
|
|
|
|
FermOp.MDeriv(tmp , Y, X,DaggerNo ); dSdU=tmp;
|
2015-07-29 09:53:39 +01:00
|
|
|
FermOp.MDeriv(tmp , X, Y,DaggerYes); dSdU=dSdU+tmp;
|
|
|
|
|
2016-07-04 16:09:19 +01:00
|
|
|
//dSdU = Ta(dSdU);
|
2015-07-26 04:28:03 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|