From 58cb7c0732c1cc0be4ccdb58dcd3f94779baf134 Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Sat, 15 May 2021 09:05:34 -0400 Subject: [PATCH] passes force test and conserves in HMC plaquette looks odd --- ...osedBoundaryTwoFlavourRatioPseudoFermion.h | 222 ++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 Grid/qcd/action/pseudofermion/DomainDecomposedBoundaryTwoFlavourRatioPseudoFermion.h diff --git a/Grid/qcd/action/pseudofermion/DomainDecomposedBoundaryTwoFlavourRatioPseudoFermion.h b/Grid/qcd/action/pseudofermion/DomainDecomposedBoundaryTwoFlavourRatioPseudoFermion.h new file mode 100644 index 00000000..5ae0b49b --- /dev/null +++ b/Grid/qcd/action/pseudofermion/DomainDecomposedBoundaryTwoFlavourRatioPseudoFermion.h @@ -0,0 +1,222 @@ +/************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/qcd/action/pseudofermion/DomainDecomposedTwoFlavourBoundary.h + + Copyright (C) 2021 + +Author: Peter Boyle + + 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 */ +#pragma once + +NAMESPACE_BEGIN(Grid); + +/////////////////////////////////////// +// Two flavour ratio +/////////////////////////////////////// +template +class DomainDecomposedBoundaryTwoFlavourRatioPseudoFermion : public Action { +public: + INHERIT_IMPL_TYPES(Impl); + +private: + SchurFactoredFermionOperator & NumOp;// the basic operator + SchurFactoredFermionOperator & DenOp;// the basic operator + + OperatorFunction &DerivativeSolver; + OperatorFunction &ActionSolver; + + FermionField Phi; // the pseudo fermion field for this trajectory + +public: + DomainDecomposedBoundaryTwoFlavourRatioPseudoFermion(SchurFactoredFermionOperator &_NumOp, + SchurFactoredFermionOperator &_DenOp, + OperatorFunction & DS, + OperatorFunction & AS + ) : NumOp(_NumOp), DenOp(_DenOp), + DerivativeSolver(DS), ActionSolver(AS), + Phi(_NumOp.FermOp.FermionGrid()) {}; + + virtual std::string action_name(){return "DomainDecomposedBoundaryTwoFlavourRatioPseudoFermion";} + + + virtual std::string LogParameters(){ + std::stringstream sstream; + return sstream.str(); + } + + virtual void refresh(const GaugeField &U, GridSerialRNG& sRNG, GridParallelRNG& pRNG) + { + NumOp.ImportGauge(U); + DenOp.ImportGauge(U); + + FermionField eta(NumOp.FermOp.FermionGrid()); + FermionField tmp(NumOp.FermOp.FermionGrid()); + + // P(phi) = e^{- phi^dag P^dag Rdag^-1 R^-1 P phi} + // + // NumOp == P + // DenOp == R + // + // Take phi = P^{-1} R eta ; eta = R^-1 P Phi + // + // 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.... + // + RealD scale = std::sqrt(0.5); + + gaussian(pRNG,eta); eta=eta*scale; + + NumOp.ProjectBoundaryBar(eta); + DenOp.R(eta,tmp); + NumOp.RInv(tmp,Phi); + + }; + + ////////////////////////////////////////////////////// + // S = phi^dag Pdag Rdag^-1 R^-1 P phi + ////////////////////////////////////////////////////// + virtual RealD S(const GaugeField &U) { + + NumOp.ImportGauge(U); + DenOp.ImportGauge(U); + + FermionField X(NumOp.FermOp.FermionGrid()); + FermionField Y(NumOp.FermOp.FermionGrid()); + + NumOp.R(Phi,Y); + DenOp.RInv(Y,X); + + RealD action = norm2(X); + // std::cout << " DD boundary action is " <