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

First implementation of the sh-Gordon action

This commit is contained in:
Guido Cossu
2018-01-17 18:17:58 +00:00
parent b00d2d2c39
commit 1ba61680db
3 changed files with 179 additions and 0 deletions

View File

@ -32,6 +32,7 @@ directory
#include <Grid/qcd/action/scalar/ScalarImpl.h>
#include <Grid/qcd/action/scalar/ScalarAction.h>
#include <Grid/qcd/action/scalar/ScalarInteractionAction.h>
#include <Grid/qcd/action/scalar/shGordonAction.h>
namespace Grid {
namespace QCD {
@ -44,6 +45,9 @@ namespace QCD {
template <int Colours, int Dimensions> using ScalarAdjActionF = ScalarInteractionAction<ScalarNxNAdjImplF<Colours>, Dimensions>;
template <int Colours, int Dimensions> using ScalarAdjActionD = ScalarInteractionAction<ScalarNxNAdjImplD<Colours>, Dimensions>;
typedef shGordonAction<ScalarImplR> shGordonActionR;
typedef shGordonAction<ScalarImplF> shGordonActionF;
typedef shGordonAction<ScalarImplD> shGordonActionD;
}
}

View File

@ -0,0 +1,75 @@
/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Source file: ./lib/qcd/action/gauge/shGordonAction.h
Copyright (C) 2018
Author: Guido Cossu <guido.cossu@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 */
#ifndef SHGORDON_ACTION_H
#define SHGORDON_ACTION_H
namespace Grid {
template <class Impl>
class shGordonAction : public QCD::Action<typename Impl::Field> {
public:
INHERIT_FIELD_TYPES(Impl);
private:
RealD mass_square;
RealD g;
public:
shGordonAction(RealD ms, RealD g) : mass_square(ms), g(g) {}
virtual std::string LogParameters() {
std::stringstream sstream;
sstream << GridLogMessage << "[shGordonAction] g : " << g << std::endl;
sstream << GridLogMessage << "[shGordonAction] mass_square : " << mass_square << std::endl;
return sstream.str();
}
virtual std::string action_name() {return "shGordonAction";}
virtual void refresh(const Field &U, GridParallelRNG &pRNG) {} // noop as no pseudoferms
virtual RealD S(const Field &phi) {
return 0.5*ScalarObs<Impl>::sumphider(phi) - 0.5*mass_square/(g*g)*sum(trace(exp(g*phi) + exp(-g*phi))) ;
};
virtual void deriv(const Field &phi,
Field &force) {
Field tmp(phi._grid);
tmp = zero;
for (int mu = 0; mu < QCD::Nd; mu++) tmp += Cshift(phi, mu, 1) - Cshift(phi, mu, -1);
force+= 0.5*tmp - 0.5*mass_square/g*(exp(g*phi) - exp(-g*phi));
}
};
} // namespace Grid
#endif // SHGORDON_ACTION_H