Grid 0.7.0
DomainDecomposedBoundaryTwoFlavourBosonPseudoFermion.h
Go to the documentation of this file.
1/*************************************************************************************
2
3 Grid physics library, www.github.com/paboyle/Grid
4
5 Source file: ./lib/qcd/action/pseudofermion/DomainDecomposedTwoFlavourBoundaryBoson.h
6
7 Copyright (C) 2021
8
9Author: Peter Boyle <paboyle@ph.ed.ac.uk>
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License along
22 with this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
25 See the full license in the file "LICENSE" in the top level distribution directory
26*************************************************************************************/
27/* END LEGAL */
28#pragma once
29
31
33// Two flavour ratio
35template<class ImplD,class ImplF>
36class DomainDecomposedBoundaryTwoFlavourBosonPseudoFermion : public Action<typename ImplD::GaugeField> {
37public:
39
40private:
41 SchurFactoredFermionOperator<ImplD,ImplF> & NumOp;// the basic operator
45 FermionField Phi; // the pseudo fermion field for this trajectory
46public:
47 DomainDecomposedBoundaryTwoFlavourBosonPseudoFermion(SchurFactoredFermionOperator<ImplD,ImplF> &_NumOp,RealD _DerivativeTol, RealD _ActionTol, RealD _InnerTol=1.0e-6)
48 : NumOp(_NumOp),
49 DerivativeStoppingCondition(_DerivativeTol),
50 ActionStoppingCondition(_ActionTol),
51 InnerStoppingCondition(_InnerTol),
52 Phi(_NumOp.FermionGrid()) {};
53
54 virtual std::string action_name(){return "DomainDecomposedBoundaryTwoFlavourBosonPseudoFermion";}
55
56 virtual std::string LogParameters(){
57 std::stringstream sstream;
58 return sstream.str();
59 }
60
61 virtual void refresh(const GaugeField &U, GridSerialRNG& sRNG, GridParallelRNG& pRNG)
62 {
63 // P(phi) = e^{- phi^dag P^dag P phi}
64 //
65 // NumOp == P
66 //
67 // Take phi = P^{-1} eta ; eta = P Phi
68 //
69 // P(eta) = e^{- eta^dag eta}
70 //
71 // e^{x^2/2 sig^2} => sig^2 = 0.5.
72 //
73 // So eta should be of width sig = 1/sqrt(2) and must multiply by 0.707....
74 //
75 RealD scale = std::sqrt(0.5);
76
79 NumOp.ImportGauge(U);
80
81 FermionField eta(NumOp.FermionGrid());
82
83 gaussian(pRNG,eta); eta=eta*scale;
84
85 NumOp.ProjectBoundaryBar(eta);
86 //DumpSliceNorm("eta",eta);
87 NumOp.RInv(eta,Phi);
88
89 //DumpSliceNorm("Phi",Phi);
90
91 };
92
94 // S = phi^dag Pdag P phi
96 virtual RealD S(const GaugeField &U) {
97
100 NumOp.ImportGauge(U);
101
102 FermionField Y(NumOp.FermionGrid());
103
104 NumOp.R(Phi,Y);
105
106 RealD action = norm2(Y);
107
108 return action;
109 };
110
111 virtual void deriv(const GaugeField &U,GaugeField & dSdU)
112 {
115 NumOp.ImportGauge(U);
116
117 GridBase *fgrid = NumOp.FermionGrid();
118 GridBase *ugrid = NumOp.GaugeGrid();
119
120 FermionField X(fgrid);
121 FermionField Y(fgrid);
122 FermionField tmp(fgrid);
123
124 GaugeField force(ugrid);
125
126 FermionField DobiDdbPhi(fgrid); // Vector A in my notes
127 FermionField DoiDdDobiDdbPhi(fgrid); // Vector B in my notes
128 FermionField DoidP_Phi(fgrid); // Vector E in my notes
129 FermionField DobidDddDoidP_Phi(fgrid); // Vector F in my notes
130
131 FermionField P_Phi(fgrid);
132
133 // P term
134 NumOp.dBoundaryBar(Phi,tmp);
135 NumOp.dOmegaBarInv(tmp,DobiDdbPhi); // Vector A
136 NumOp.dBoundary(DobiDdbPhi,tmp);
137 NumOp.dOmegaInv(tmp,DoiDdDobiDdbPhi); // Vector B
138 P_Phi = Phi - DoiDdDobiDdbPhi;
139 NumOp.ProjectBoundaryBar(P_Phi);
140
141 // P^dag P term
142 NumOp.dOmegaDagInv(P_Phi,DoidP_Phi); // Vector E
143 NumOp.dBoundaryDag(DoidP_Phi,tmp);
144 NumOp.dOmegaBarDagInv(tmp,DobidDddDoidP_Phi); // Vector F
145 NumOp.dBoundaryBarDag(DobidDddDoidP_Phi,tmp);
146
147 X = DobiDdbPhi;
148 Y = DobidDddDoidP_Phi;
149 NumOp.DirichletFermOpD.MDeriv(force,Y,X,DaggerNo); dSdU=force;
150 NumOp.DirichletFermOpD.MDeriv(force,X,Y,DaggerYes); dSdU=dSdU+force;
151
152 X = DoiDdDobiDdbPhi;
153 Y = DoidP_Phi;
154 NumOp.DirichletFermOpD.MDeriv(force,Y,X,DaggerNo); dSdU=dSdU+force;
155 NumOp.DirichletFermOpD.MDeriv(force,X,Y,DaggerYes); dSdU=dSdU+force;
156
157 dSdU *= -1.0;
158
159 };
160};
161
163
RealD norm2(const Lattice< vobj > &arg)
void gaussian(GridParallelRNG &rng, Lattice< vobj > &l)
#define NAMESPACE_BEGIN(A)
Definition Namespace.h:35
#define NAMESPACE_END(A)
Definition Namespace.h:36
static constexpr int DaggerYes
Definition QCD.h:70
static constexpr int DaggerNo
Definition QCD.h:69
double RealD
Definition Simd.h:61
static INTERNAL_PRECISION U
Definition Zolotarev.cc:230
Base class for all actions.
Definition ActionBase.h:64
virtual RealD S(const GaugeField &U)
Evaluate this action with the given gauge field.
DomainDecomposedBoundaryTwoFlavourBosonPseudoFermion(SchurFactoredFermionOperator< ImplD, ImplF > &_NumOp, RealD _DerivativeTol, RealD _ActionTol, RealD _InnerTol=1.0e-6)
virtual void refresh(const GaugeField &U, GridSerialRNG &sRNG, GridParallelRNG &pRNG)
Refresh pseudofermion fields.