1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-14 17:55:38 +00:00
Grid/lib/qcd/utils/ScalarObjs.h

94 lines
2.8 KiB
C
Raw Normal View History

/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Source file: ./lib/qcd/utils/WilsonLoops.h
Copyright (C) 2015
Author: neo <cossu@post.kek.jp>
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 SCALAR_OBJS_H
#define SCALAR_OBJS_H
2017-01-26 15:24:49 +00:00
2018-01-14 21:55:47 +00:00
NAMESPACE_BEGIN(Grid);
// Scalar field obs
template <class Impl>
class ScalarObs {
2018-01-14 21:55:47 +00:00
public:
//////////////////////////////////////////////////
// squared field
//////////////////////////////////////////////////
static void phisquared(typename Impl::Field &fsq,
const typename Impl::Field &f) {
fsq = f * f;
}
//////////////////////////////////////////////////
// phi^4 interaction term
//////////////////////////////////////////////////
static void phifourth(typename Impl::Field &fsq,
const typename Impl::Field &f) {
fsq = f * f * f * f;
}
//////////////////////////////////////////////////
// phi(x)phi(x+mu)
//////////////////////////////////////////////////
static void phider(typename Impl::Field &fsq,
const typename Impl::Field &f) {
fsq = Cshift(f, 0, -1) * f;
2018-01-14 21:55:47 +00:00
for (int mu = 1; mu < Nd; mu++) fsq += Cshift(f, mu, -1) * f;
}
//////////////////////////////////////////////////
// Vol sum of the previous obs.
//////////////////////////////////////////////////
static RealD sumphider(const typename Impl::Field &f) {
2018-01-27 00:04:12 +00:00
typename Impl::Field tmp(f.Grid());
tmp = Cshift(f, 0, -1) * f;
2018-01-14 21:55:47 +00:00
for (int mu = 1; mu < Nd; mu++) {
tmp += Cshift(f, mu, -1) * f;
}
return -sum(trace(tmp));
}
static RealD sumphisquared(const typename Impl::Field &f) {
2018-01-27 00:04:12 +00:00
typename Impl::Field tmp(f.Grid());
tmp = f * f;
return sum(trace(tmp));
}
static RealD sumphifourth(const typename Impl::Field &f) {
2018-01-27 00:04:12 +00:00
typename Impl::Field tmp(f.Grid());
phifourth(tmp, f);
return sum(trace(tmp));
}
};
2017-01-26 15:24:49 +00:00
2018-01-14 21:55:47 +00:00
NAMESPACE_END(Grid);
2017-01-26 15:24:49 +00:00
#endif