mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
Working on the 5d
This commit is contained in:
parent
deef2673b2
commit
392130a537
@ -1,10 +1,10 @@
|
||||
/*************************************************************************************
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./lib/qcd/QCD.h
|
||||
Source file: ./lib/qcd/QCD.h
|
||||
|
||||
Copyright (C) 2015
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
|
||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
@ -12,28 +12,30 @@ Author: Peter Boyle <peterboyle@Peters-MacBook-Pro-2.local>
|
||||
Author: neo <cossu@post.kek.jp>
|
||||
Author: paboyle <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 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.
|
||||
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.
|
||||
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 */
|
||||
See the full license in the file "LICENSE" in the top level distribution
|
||||
directory
|
||||
*************************************************************************************/
|
||||
/* END LEGAL */
|
||||
#ifndef GRID_LT_H
|
||||
#define GRID_LT_H
|
||||
namespace Grid{
|
||||
|
||||
// First steps in the complete generalization of the Physics part
|
||||
// Design not final
|
||||
namespace LatticeTheories {
|
||||
|
||||
template <int Dimensions>
|
||||
@ -50,7 +52,7 @@ struct LatticeGaugeTheory : public LatticeTheory<Dimensions> {
|
||||
static const int Nd = Dimensions;
|
||||
static const int Nc = Colours;
|
||||
|
||||
template <typename vtype>
|
||||
template <typename vtype>
|
||||
using iColourMatrix = iScalar<iScalar<iMatrix<vtype, Nc> > >;
|
||||
template <typename vtype>
|
||||
using iLorentzColourMatrix = iVector<iScalar<iMatrix<vtype, Nc> >, Nd>;
|
||||
@ -82,6 +84,13 @@ struct FermionicLatticeGaugeTheory
|
||||
using iHalfSpinVector = iScalar<iVector<iScalar<vtype>, Nhs> >;
|
||||
template <typename vtype>
|
||||
using iHalfSpinColourVector = iScalar<iVector<iVector<vtype, Nc>, Nhs> >;
|
||||
|
||||
//tests
|
||||
typedef iColourMatrix<Complex> ColourMatrix;
|
||||
typedef iColourMatrix<ComplexF> ColourMatrixF;
|
||||
typedef iColourMatrix<ComplexD> ColourMatrixD;
|
||||
|
||||
|
||||
};
|
||||
|
||||
// Examples, not complete now.
|
||||
@ -97,10 +106,6 @@ struct QCD : public FermionicLatticeGaugeTheory<4, 3, 4> {
|
||||
|
||||
typedef FermionicLatticeGaugeTheory FLGT;
|
||||
|
||||
typedef FLGT::iColourMatrix<Complex > ColourMatrix;
|
||||
typedef FLGT::iColourMatrix<ComplexF > ColourMatrixF;
|
||||
typedef FLGT::iColourMatrix<ComplexD > ColourMatrixD;
|
||||
|
||||
typedef FLGT::iSpinMatrix<Complex > SpinMatrix;
|
||||
typedef FLGT::iSpinMatrix<ComplexF > SpinMatrixF;
|
||||
typedef FLGT::iSpinMatrix<ComplexD > SpinMatrixD;
|
||||
|
@ -46,7 +46,7 @@ namespace QCD {
|
||||
|
||||
static const int Nc=3;
|
||||
static const int Ns=4;
|
||||
static const int Nd=4;
|
||||
static const int Nd=5;
|
||||
static const int Nhs=2; // half spinor
|
||||
static const int Nds=8; // double stored gauge field
|
||||
static const int Ngp=2; // gparity index range
|
||||
|
@ -76,7 +76,7 @@ class WilsonGaugeAction : public Action<typename Gimpl::GaugeField> {
|
||||
// Staple in direction mu
|
||||
WilsonLoops<Gimpl>::Staple(dSdU_mu, U, mu);
|
||||
dSdU_mu = Ta(Umu * dSdU_mu) * factor;
|
||||
|
||||
|
||||
PokeIndex<LorentzIndex>(dSdU, dSdU_mu, mu);
|
||||
}
|
||||
};
|
||||
@ -88,57 +88,70 @@ class VariableWilsonGaugeAction : public Action<typename Gimpl::GaugeField> {
|
||||
INHERIT_GIMPL_TYPES(Gimpl);
|
||||
|
||||
private:
|
||||
std::vector<RealD> b_bulk;// bulk couplings
|
||||
std::vector<RealD> b_xdim;//extra dimension couplings
|
||||
std::vector<RealD> b_bulk; // bulk couplings
|
||||
std::vector<RealD> b_xdim; // extra dimension couplings
|
||||
GridBase *grid;
|
||||
LatticeComplex beta_xdim;
|
||||
LatticeComplex beta_xdim_shifted;
|
||||
LatticeComplex beta_bulk;
|
||||
|
||||
int bulk_volume;
|
||||
|
||||
public:
|
||||
VariableWilsonGaugeAction(std::vector<RealD> bulk, std::vector<RealD> xdim,
|
||||
GridBase *_grid)
|
||||
GridBase *_grid, bool openBC = false)
|
||||
: b_bulk(bulk),
|
||||
b_xdim(xdim),
|
||||
grid(_grid),
|
||||
beta_xdim(grid),
|
||||
beta_xdim_shifted(grid),
|
||||
beta_bulk(grid)
|
||||
{
|
||||
//check that the grid is ok
|
||||
//todo
|
||||
int Ndim = Nd;//change later
|
||||
beta_bulk(grid) {
|
||||
// check that the grid is ok
|
||||
// todo
|
||||
int Ndim = Nd; // change later
|
||||
|
||||
LatticeComplex temp(grid);
|
||||
std::vector<int> FullDim = grid->GlobalDimensions();
|
||||
bulk_volume = 1;
|
||||
for (int s = 0; s < Ndim - 1; s++) bulk_volume *= FullDim[s];
|
||||
|
||||
Lattice<iScalar<vInteger> > coor(grid);
|
||||
LatticeComplex temp(grid);
|
||||
|
||||
LatticeCoordinate(coor, Ndim - 1);
|
||||
Lattice<iScalar<vInteger> > coor(grid);
|
||||
|
||||
int Nex = grid->_fdimensions[Ndim - 1];
|
||||
assert(b_bulk.size() == Nex);
|
||||
assert(b_xdim.size() == Nex);
|
||||
LatticeCoordinate(coor, Ndim - 1);
|
||||
|
||||
beta_xdim = zero;
|
||||
for (int tau = 0; tau < Nex; tau++) {
|
||||
temp = b_xdim[tau];
|
||||
beta_xdim = where(coor == tau, temp, beta_xdim);
|
||||
}
|
||||
int Nex = FullDim[Ndim - 1];
|
||||
assert(b_bulk.size() == Nex);
|
||||
assert(b_xdim.size() == Nex);
|
||||
|
||||
beta_xdim_shifted = Cshift(beta_xdim, Ndim - 1, -1);
|
||||
beta_xdim = zero;
|
||||
for (int tau = 0; tau < Nex - 1; tau++) {
|
||||
temp = b_xdim[tau];
|
||||
beta_xdim = where(coor == tau, temp, beta_xdim);
|
||||
}
|
||||
|
||||
beta_bulk = zero;
|
||||
for (int tau = 0; tau < Nex; tau++) {
|
||||
temp = b_bulk[tau];
|
||||
beta_bulk = where(coor == tau, temp, beta_bulk);
|
||||
}
|
||||
};
|
||||
if (!openBC) {
|
||||
temp = b_xdim[Nex - 1];
|
||||
beta_xdim = where(coor == Nex - 1, temp, beta_xdim);
|
||||
}
|
||||
|
||||
beta_xdim_shifted = Cshift(beta_xdim, Ndim - 1, -1);
|
||||
|
||||
beta_bulk = zero;
|
||||
for (int tau = 0; tau < Nex; tau++) {
|
||||
temp = b_bulk[tau];
|
||||
beta_bulk = where(coor == tau, temp, beta_bulk);
|
||||
}
|
||||
|
||||
std::cout << beta_xdim << std::endl;
|
||||
std::cout << beta_xdim_shifted << std::endl;
|
||||
};
|
||||
|
||||
virtual void refresh(const GaugeField &U,
|
||||
GridParallelRNG &pRNG){}; // noop as no pseudoferms
|
||||
|
||||
virtual RealD S(const GaugeField &Umu) {
|
||||
int Ndim = Nd; // change later for generality
|
||||
int Ndim = Nd; // change later for generality
|
||||
conformable(grid, Umu._grid);
|
||||
|
||||
std::vector<GaugeLinkField> U(Ndim, grid);
|
||||
@ -150,19 +163,34 @@ class VariableWilsonGaugeAction : public Action<typename Gimpl::GaugeField> {
|
||||
LatticeComplex dirPlaq(grid);
|
||||
LatticeComplex Plaq(grid);
|
||||
|
||||
LatticeComplex SumdirPlaq(grid);
|
||||
|
||||
RealD OneOnNc = 1.0 / Real(Nc);
|
||||
|
||||
/////////////
|
||||
// Lower dim plaquettes
|
||||
/////////////
|
||||
Plaq = zero;
|
||||
SumdirPlaq = zero;
|
||||
for (int mu = 1; mu < Ndim - 1; mu++) {
|
||||
for (int nu = 0; nu < mu; nu++) {
|
||||
WilsonLoops<Gimpl>::traceDirPlaquette(dirPlaq, U, mu, nu);
|
||||
SumdirPlaq += dirPlaq;
|
||||
Plaq = Plaq + (1.0 - dirPlaq * OneOnNc) * beta_bulk;
|
||||
}
|
||||
}
|
||||
|
||||
double faces = (1.0 * (Nd - 1) * (Nd - 2)) / 2.0;
|
||||
SumdirPlaq *= OneOnNc / (RealD(bulk_volume) * faces);
|
||||
|
||||
// print slices in the extra dimension
|
||||
int Nex = grid->_fdimensions[Ndim - 1];
|
||||
std::vector<TComplex> plaq_ex(Nex);
|
||||
sliceSum(SumdirPlaq, plaq_ex, Ndim - 1);
|
||||
for (int ex = 0; ex < Nex; ex++)
|
||||
std::cout << GridLogMessage << "Bulk plaq[" << ex
|
||||
<< "] = " << TensorRemove(plaq_ex[ex]).real() << std::endl;
|
||||
|
||||
/////////////
|
||||
// Extra dimension
|
||||
/////////////
|
||||
@ -186,74 +214,66 @@ class VariableWilsonGaugeAction : public Action<typename Gimpl::GaugeField> {
|
||||
|
||||
// for the higher dimension plaquettes take the upper plaq of the
|
||||
// 4d slice and multiply by beta[s] and the lower and multiply by beta[s-1]
|
||||
// todo
|
||||
// derivative of links mu = 0, ... Nd-1 inside plaq (mu,5)
|
||||
// for these I need upper and lower staples separated
|
||||
// each multiplied with their own beta
|
||||
// derivative of links mu = 5
|
||||
// living on the same slice, share the same beta
|
||||
|
||||
conformable(grid, U._grid);
|
||||
int Ndim = Nd; // change later
|
||||
RealD factor = 0.5 / RealD(Nc);
|
||||
|
||||
conformable(grid,U._grid);
|
||||
int Ndim = Nd; // change later
|
||||
RealD factor = 0.5 / RealD(Nc);
|
||||
GaugeLinkField Umu(grid);
|
||||
GaugeLinkField dSdU_mu(grid);
|
||||
GaugeLinkField staple(grid);
|
||||
|
||||
GaugeLinkField Umu(grid);
|
||||
GaugeLinkField dSdU_mu(grid);
|
||||
GaugeLinkField staple(grid);
|
||||
for (int mu = 0; mu < Ndim; mu++) {
|
||||
Umu = PeekIndex<LorentzIndex>(U, mu);
|
||||
dSdU_mu = zero;
|
||||
|
||||
for (int mu = 0; mu < Ndim; mu++) {
|
||||
Umu = PeekIndex<LorentzIndex>(U, mu);
|
||||
dSdU_mu = zero;
|
||||
for (int nu = 0; nu < Ndim; nu++) {
|
||||
if (nu != mu) {
|
||||
if ((mu < (Ndim - 1)) && (nu < (Ndim - 1))) {
|
||||
// Spacelike case apply beta space
|
||||
WilsonLoops<Gimpl>::Staple(staple, U, mu, nu);
|
||||
staple = staple * beta_bulk;
|
||||
dSdU_mu += staple;
|
||||
|
||||
for (int nu = 0; nu < Ndim; nu++) {
|
||||
if (nu != mu) {
|
||||
if ((mu < (Ndim - 1)) && (nu < (Ndim - 1))) {
|
||||
// Spacelike case apply beta space
|
||||
WilsonLoops<Gimpl>::Staple(staple, U, mu, nu);
|
||||
staple = staple * beta_bulk;
|
||||
dSdU_mu += staple;
|
||||
} else if (mu == (Ndim - 1)) {
|
||||
// nu space; mu time link
|
||||
assert(nu < (Ndim - 1));
|
||||
assert(mu == (Ndim - 1));
|
||||
|
||||
} else if (mu == (Ndim - 1)) {
|
||||
// nu space; mu time link
|
||||
assert(nu < (Ndim - 1));
|
||||
assert(mu == (Ndim - 1));
|
||||
// mu==tau dir link deriv, nu spatial
|
||||
WilsonLoops<Gimpl>::Staple(staple, U, mu, nu);
|
||||
staple = staple * beta_xdim;
|
||||
dSdU_mu += staple;
|
||||
|
||||
// mu==tau dir link deriv, nu spatial
|
||||
WilsonLoops<Gimpl>::Staple(staple, U, mu, nu);
|
||||
staple = staple * beta_xdim;
|
||||
dSdU_mu += staple;
|
||||
} else {
|
||||
assert(mu < (Ndim - 1));
|
||||
assert(nu == (Ndim - 1));
|
||||
|
||||
} else {
|
||||
assert(mu < (Ndim - 1));
|
||||
assert(nu == (Ndim - 1));
|
||||
// nu time; mu space link
|
||||
|
||||
// nu time; mu space link
|
||||
// staple forwards in tau
|
||||
WilsonLoops<Gimpl>::StapleUpper(staple, U, mu, nu);
|
||||
staple = staple * beta_xdim;
|
||||
dSdU_mu += staple;
|
||||
|
||||
// staple forwards in tau
|
||||
WilsonLoops<Gimpl>::StapleUpper(staple, U, mu, nu);
|
||||
staple = staple * beta_xdim;
|
||||
dSdU_mu += staple;
|
||||
|
||||
// staple backwards in tau
|
||||
WilsonLoops<Gimpl>::StapleLower(staple, U, mu, nu);
|
||||
staple = staple * beta_xdim_shifted;
|
||||
dSdU_mu += staple;
|
||||
// staple backwards in tau
|
||||
WilsonLoops<Gimpl>::StapleLower(staple, U, mu, nu);
|
||||
staple = staple * beta_xdim_shifted;
|
||||
dSdU_mu += staple;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dSdU_mu = Ta(Umu * dSdU_mu) * factor;
|
||||
PokeIndex<LorentzIndex>(dSdU, dSdU_mu, mu);
|
||||
}
|
||||
}
|
||||
|
||||
dSdU_mu = Ta(Umu * dSdU_mu) * factor;
|
||||
PokeIndex<LorentzIndex>(dSdU, dSdU_mu, mu);
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,9 +23,9 @@ 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
|
||||
*************************************************************************************/
|
||||
See the full license in the file "LICENSE" in the top level distribution
|
||||
directory
|
||||
*************************************************************************************/
|
||||
/* END LEGAL */
|
||||
#ifndef GENERIC_HMC_RUNNER
|
||||
#define GENERIC_HMC_RUNNER
|
||||
@ -33,165 +33,169 @@ directory
|
||||
namespace Grid {
|
||||
namespace QCD {
|
||||
|
||||
// Virtual Class for HMC specific for gauge theories
|
||||
// implement a specific theory by defining the BuildTheAction
|
||||
template <class Implementation,
|
||||
class RepresentationsPolicy = NoHirep>
|
||||
class BinaryHmcRunnerTemplate {
|
||||
public:
|
||||
INHERIT_FIELD_TYPES(Implementation);
|
||||
typedef Implementation ImplPolicy;
|
||||
// Virtual Class for HMC specific for gauge theories
|
||||
// implement a specific theory by defining the BuildTheAction
|
||||
template <class Implementation, class RepresentationsPolicy = NoHirep>
|
||||
class BinaryHmcRunnerTemplate {
|
||||
public:
|
||||
INHERIT_FIELD_TYPES(Implementation);
|
||||
typedef Implementation ImplPolicy;
|
||||
|
||||
enum StartType_t { ColdStart, HotStart, TepidStart, CheckpointStart };
|
||||
enum StartType_t { ColdStart,
|
||||
HotStart,
|
||||
TepidStart,
|
||||
CheckpointStart };
|
||||
|
||||
ActionSet<Field, RepresentationsPolicy> TheAction;
|
||||
|
||||
// A vector of HmcObservable
|
||||
// that can be injected from outside
|
||||
std::vector< HmcObservable<typename Implementation::Field>* > ObservablesList;
|
||||
ActionSet<Field, RepresentationsPolicy> TheAction;
|
||||
|
||||
IntegratorParameters MDparameters;
|
||||
// A vector of HmcObservable
|
||||
// that can be injected from outside
|
||||
std::vector<HmcObservable<typename Implementation::Field> *>
|
||||
ObservablesList;
|
||||
|
||||
GridCartesian *UGrid;
|
||||
GridCartesian *FGrid;
|
||||
GridRedBlackCartesian *UrbGrid;
|
||||
GridRedBlackCartesian *FrbGrid;
|
||||
IntegratorParameters MDparameters;
|
||||
|
||||
std::vector<int> SerialSeed;
|
||||
std::vector<int> ParallelSeed;
|
||||
GridCartesian * UGrid;
|
||||
GridCartesian * FGrid;
|
||||
GridRedBlackCartesian *UrbGrid;
|
||||
GridRedBlackCartesian *FrbGrid;
|
||||
|
||||
void RNGSeeds(std::vector<int> S, std::vector<int> P){
|
||||
SerialSeed = S;
|
||||
ParallelSeed = P;
|
||||
}
|
||||
std::vector<int> SerialSeed;
|
||||
std::vector<int> ParallelSeed;
|
||||
|
||||
virtual void BuildTheAction(int argc, char **argv) = 0; // necessary?
|
||||
void RNGSeeds(std::vector<int> S, std::vector<int> P) {
|
||||
SerialSeed = S;
|
||||
ParallelSeed = P;
|
||||
}
|
||||
|
||||
// A couple of wrapper classes
|
||||
template <class IOCheckpointer>
|
||||
void Run(int argc, char **argv, IOCheckpointer &Checkpoint) {
|
||||
NoSmearing<Implementation> S;
|
||||
Runner(argc, argv, Checkpoint, S);
|
||||
}
|
||||
virtual void BuildTheAction(int argc, char **argv) = 0; // necessary?
|
||||
|
||||
template <class IOCheckpointer, class SmearingPolicy>
|
||||
void Run(int argc, char **argv, IOCheckpointer &CP, SmearingPolicy &S) {
|
||||
Runner(argc, argv, CP, S);
|
||||
}
|
||||
//////////////////////////////
|
||||
// A couple of wrapper classes
|
||||
template <class IOCheckpointer>
|
||||
void Run(int argc, char **argv, IOCheckpointer &Checkpoint) {
|
||||
NoSmearing<Implementation> S;
|
||||
Runner(argc, argv, Checkpoint, S);
|
||||
}
|
||||
|
||||
template <class SmearingPolicy, class IOCheckpointer >
|
||||
void Runner(int argc, char **argv, IOCheckpointer &Checkpoint,
|
||||
SmearingPolicy &Smearing) {
|
||||
StartType_t StartType = HotStart;
|
||||
template <class IOCheckpointer, class SmearingPolicy>
|
||||
void Run(int argc, char **argv, IOCheckpointer &CP, SmearingPolicy &S) {
|
||||
Runner(argc, argv, CP, S);
|
||||
}
|
||||
//////////////////////////////
|
||||
|
||||
std::string arg;
|
||||
template <class SmearingPolicy, class IOCheckpointer>
|
||||
void Runner(int argc,
|
||||
char ** argv,
|
||||
IOCheckpointer &Checkpoint,
|
||||
SmearingPolicy &Smearing) {
|
||||
StartType_t StartType = HotStart;
|
||||
|
||||
if (GridCmdOptionExists(argv, argv + argc, "--StartType")) {
|
||||
arg = GridCmdOptionPayload(argv, argv + argc, "--StartType");
|
||||
if (arg == "HotStart") {
|
||||
StartType = HotStart;
|
||||
} else if (arg == "ColdStart") {
|
||||
StartType = ColdStart;
|
||||
} else if (arg == "TepidStart") {
|
||||
StartType = TepidStart;
|
||||
} else if (arg == "CheckpointStart") {
|
||||
StartType = CheckpointStart;
|
||||
} else {
|
||||
std::cout << GridLogError << "Unrecognized option in --StartType\n";
|
||||
std::cout
|
||||
<< GridLogError
|
||||
<< "Valid [HotStart, ColdStart, TepidStart, CheckpointStart]\n";
|
||||
assert(0);
|
||||
std::string arg;
|
||||
|
||||
if (GridCmdOptionExists(argv, argv + argc, "--StartType")) {
|
||||
arg = GridCmdOptionPayload(argv, argv + argc, "--StartType");
|
||||
if (arg == "HotStart") {
|
||||
StartType = HotStart;
|
||||
} else if (arg == "ColdStart") {
|
||||
StartType = ColdStart;
|
||||
} else if (arg == "TepidStart") {
|
||||
StartType = TepidStart;
|
||||
} else if (arg == "CheckpointStart") {
|
||||
StartType = CheckpointStart;
|
||||
} else {
|
||||
std::cout << GridLogError << "Unrecognized option in --StartType\n";
|
||||
std::cout
|
||||
<< GridLogError
|
||||
<< "Valid [HotStart, ColdStart, TepidStart, CheckpointStart]\n";
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
int StartTraj = 0;
|
||||
if (GridCmdOptionExists(argv, argv + argc, "--StartTrajectory")) {
|
||||
arg = GridCmdOptionPayload(argv, argv + argc, "--StartTrajectory");
|
||||
std::vector<int> ivec(0);
|
||||
GridCmdOptionIntVector(arg, ivec);
|
||||
StartTraj = ivec[0];
|
||||
}
|
||||
|
||||
int NumTraj = 1;
|
||||
if (GridCmdOptionExists(argv, argv + argc, "--Trajectories")) {
|
||||
arg = GridCmdOptionPayload(argv, argv + argc, "--Trajectories");
|
||||
std::vector<int> ivec(0);
|
||||
GridCmdOptionIntVector(arg, ivec);
|
||||
NumTraj = ivec[0];
|
||||
}
|
||||
|
||||
int NumThermalizations = 10;
|
||||
if (GridCmdOptionExists(argv, argv + argc, "--Thermalizations")) {
|
||||
arg = GridCmdOptionPayload(argv, argv + argc, "--Thermalizations");
|
||||
std::vector<int> ivec(0);
|
||||
GridCmdOptionIntVector(arg, ivec);
|
||||
NumThermalizations = ivec[0];
|
||||
}
|
||||
|
||||
GridSerialRNG sRNG;
|
||||
GridParallelRNG pRNG(UGrid);
|
||||
Field U(UGrid);
|
||||
|
||||
typedef MinimumNorm2<Implementation,
|
||||
SmearingPolicy,
|
||||
RepresentationsPolicy>
|
||||
IntegratorType; // change here to change the algorithm
|
||||
IntegratorType MDynamics(UGrid, MDparameters, TheAction, Smearing);
|
||||
|
||||
HMCparameters HMCpar;
|
||||
HMCpar.StartTrajectory = StartTraj;
|
||||
HMCpar.Trajectories = NumTraj;
|
||||
HMCpar.NoMetropolisUntil = NumThermalizations;
|
||||
|
||||
if (StartType == HotStart) {
|
||||
// Hot start
|
||||
HMCpar.MetropolisTest = true;
|
||||
sRNG.SeedFixedIntegers(SerialSeed);
|
||||
pRNG.SeedFixedIntegers(ParallelSeed);
|
||||
Implementation::HotConfiguration(pRNG, U);
|
||||
} else if (StartType == ColdStart) {
|
||||
// Cold start
|
||||
HMCpar.MetropolisTest = true;
|
||||
sRNG.SeedFixedIntegers(SerialSeed);
|
||||
pRNG.SeedFixedIntegers(ParallelSeed);
|
||||
Implementation::ColdConfiguration(pRNG, U);
|
||||
} else if (StartType == TepidStart) {
|
||||
// Tepid start
|
||||
HMCpar.MetropolisTest = true;
|
||||
sRNG.SeedFixedIntegers(SerialSeed);
|
||||
pRNG.SeedFixedIntegers(ParallelSeed);
|
||||
Implementation::TepidConfiguration(pRNG, U);
|
||||
} else if (StartType == CheckpointStart) {
|
||||
HMCpar.MetropolisTest = true;
|
||||
// CheckpointRestart
|
||||
Checkpoint.CheckpointRestore(StartTraj, U, sRNG, pRNG);
|
||||
}
|
||||
|
||||
Smearing.set_Field(U);
|
||||
|
||||
HybridMonteCarlo<IntegratorType> HMC(HMCpar, MDynamics, sRNG, pRNG, U);
|
||||
|
||||
for (int obs = 0; obs < ObservablesList.size(); obs++)
|
||||
HMC.AddObservable(ObservablesList[obs]);
|
||||
|
||||
// Run it
|
||||
HMC.evolve();
|
||||
}
|
||||
};
|
||||
|
||||
int StartTraj = 0;
|
||||
if (GridCmdOptionExists(argv, argv + argc, "--StartTrajectory")) {
|
||||
arg = GridCmdOptionPayload(argv, argv + argc, "--StartTrajectory");
|
||||
std::vector<int> ivec(0);
|
||||
GridCmdOptionIntVector(arg, ivec);
|
||||
StartTraj = ivec[0];
|
||||
}
|
||||
// These are for gauge fields
|
||||
typedef BinaryHmcRunnerTemplate<PeriodicGimplR> BinaryHmcRunner;
|
||||
typedef BinaryHmcRunnerTemplate<PeriodicGimplF> BinaryHmcRunnerF;
|
||||
typedef BinaryHmcRunnerTemplate<PeriodicGimplD> BinaryHmcRunnerD;
|
||||
|
||||
int NumTraj = 1;
|
||||
if (GridCmdOptionExists(argv, argv + argc, "--Trajectories")) {
|
||||
arg = GridCmdOptionPayload(argv, argv + argc, "--Trajectories");
|
||||
std::vector<int> ivec(0);
|
||||
GridCmdOptionIntVector(arg, ivec);
|
||||
NumTraj = ivec[0];
|
||||
}
|
||||
template <class RepresentationsPolicy>
|
||||
using BinaryHmcRunnerTemplateHirep = BinaryHmcRunnerTemplate<PeriodicGimplR, RepresentationsPolicy>;
|
||||
|
||||
int NumThermalizations = 10;
|
||||
if (GridCmdOptionExists(argv, argv + argc, "--Thermalizations")) {
|
||||
arg = GridCmdOptionPayload(argv, argv + argc, "--Thermalizations");
|
||||
std::vector<int> ivec(0);
|
||||
GridCmdOptionIntVector(arg, ivec);
|
||||
NumThermalizations = ivec[0];
|
||||
}
|
||||
|
||||
GridSerialRNG sRNG;
|
||||
GridParallelRNG pRNG(UGrid);
|
||||
Field U(UGrid);
|
||||
|
||||
typedef MinimumNorm2<Implementation, SmearingPolicy,
|
||||
RepresentationsPolicy>
|
||||
IntegratorType; // change here to change the algorithm
|
||||
IntegratorType MDynamics(UGrid, MDparameters, TheAction, Smearing);
|
||||
|
||||
HMCparameters HMCpar;
|
||||
HMCpar.StartTrajectory = StartTraj;
|
||||
HMCpar.Trajectories = NumTraj;
|
||||
HMCpar.NoMetropolisUntil = NumThermalizations;
|
||||
|
||||
if (StartType == HotStart) {
|
||||
// Hot start
|
||||
HMCpar.MetropolisTest = true;
|
||||
sRNG.SeedFixedIntegers(SerialSeed);
|
||||
pRNG.SeedFixedIntegers(ParallelSeed);
|
||||
Implementation::HotConfiguration(pRNG, U);
|
||||
} else if (StartType == ColdStart) {
|
||||
// Cold start
|
||||
HMCpar.MetropolisTest = true;
|
||||
sRNG.SeedFixedIntegers(SerialSeed);
|
||||
pRNG.SeedFixedIntegers(ParallelSeed);
|
||||
Implementation::ColdConfiguration(pRNG, U);
|
||||
} else if (StartType == TepidStart) {
|
||||
// Tepid start
|
||||
HMCpar.MetropolisTest = true;
|
||||
sRNG.SeedFixedIntegers(SerialSeed);
|
||||
pRNG.SeedFixedIntegers(ParallelSeed);
|
||||
Implementation::TepidConfiguration(pRNG, U);
|
||||
} else if (StartType == CheckpointStart) {
|
||||
HMCpar.MetropolisTest = true;
|
||||
// CheckpointRestart
|
||||
Checkpoint.CheckpointRestore(StartTraj, U, sRNG, pRNG);
|
||||
}
|
||||
|
||||
Smearing.set_Field(U);
|
||||
|
||||
HybridMonteCarlo<IntegratorType> HMC(HMCpar, MDynamics, sRNG, pRNG, U);
|
||||
|
||||
for (int obs = 0; obs < ObservablesList.size(); obs++)
|
||||
HMC.AddObservable(ObservablesList[obs]);
|
||||
|
||||
// Run it
|
||||
HMC.evolve();
|
||||
}
|
||||
};
|
||||
|
||||
// These are for gauge fields
|
||||
typedef BinaryHmcRunnerTemplate<PeriodicGimplR> BinaryHmcRunner;
|
||||
typedef BinaryHmcRunnerTemplate<PeriodicGimplF> BinaryHmcRunnerF;
|
||||
typedef BinaryHmcRunnerTemplate<PeriodicGimplD> BinaryHmcRunnerD;
|
||||
|
||||
template <class RepresentationsPolicy>
|
||||
using BinaryHmcRunnerTemplateHirep =
|
||||
BinaryHmcRunnerTemplate<PeriodicGimplR, RepresentationsPolicy>;
|
||||
|
||||
|
||||
|
||||
typedef BinaryHmcRunnerTemplate<ScalarImplR, ScalarFields> ScalarBinaryHmcRunner;
|
||||
typedef BinaryHmcRunnerTemplate<ScalarImplR, ScalarFields>
|
||||
ScalarBinaryHmcRunner;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -34,7 +34,6 @@ directory
|
||||
* @brief Classes for Hybrid Monte Carlo update
|
||||
*
|
||||
* @author Guido Cossu
|
||||
* Time-stamp: <2015-07-30 16:58:26 neo>
|
||||
*/
|
||||
//--------------------------------------------------------------------
|
||||
#ifndef HMC_INCLUDED
|
||||
|
@ -29,14 +29,6 @@ directory
|
||||
*************************************************************************************/
|
||||
/* END LEGAL */
|
||||
//--------------------------------------------------------------------
|
||||
/*! @file Integrator.h
|
||||
* @brief Classes for the Molecular Dynamics integrator
|
||||
*
|
||||
* @author Guido Cossu
|
||||
* Time-stamp: <2015-07-30 16:21:29 neo>
|
||||
*/
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
#ifndef INTEGRATOR_INCLUDED
|
||||
#define INTEGRATOR_INCLUDED
|
||||
|
||||
|
@ -235,7 +235,7 @@ public:
|
||||
|
||||
std::vector<GaugeMat> U(Nd, grid);
|
||||
for (int d = 0; d < Nd; d++) {
|
||||
U[d] = PeekIndex<LorentzIndex>(Umu, d);
|
||||
U[d] = PeekIndex<LorentzIndex>(Umu, d);// some redundant copies
|
||||
}
|
||||
|
||||
// mu
|
||||
@ -268,7 +268,7 @@ public:
|
||||
|
||||
std::vector<GaugeMat> U(Nd, grid);
|
||||
for (int d = 0; d < Nd; d++) {
|
||||
U[d] = PeekIndex<LorentzIndex>(Umu, d);
|
||||
U[d] = PeekIndex<LorentzIndex>(Umu, d);// some redundant copies
|
||||
}
|
||||
|
||||
// mu
|
||||
|
@ -79,12 +79,16 @@ class HmcRunner : public BinaryHmcRunner {
|
||||
|
||||
// Gauge action
|
||||
int Ls = UGrid->_gdimensions[Nd - 1];
|
||||
std::vector<RealD> betat(Ls,5);
|
||||
std::vector<RealD> betat(Ls);
|
||||
std::vector<RealD> betas(Ls);
|
||||
betas={5,6,6,5};
|
||||
//std:cout << "Betas:" << betas << std::endl;
|
||||
//VariableWilsonGaugeActionR Waction(betas, betat, UGrid);
|
||||
WilsonGaugeActionR Waction(5.6);
|
||||
//betat={5,6,6,6,6,6,6,5};
|
||||
betat={1,1,1,0,1,1,1,1};
|
||||
//betas={5.2,5.5,5.8,6,6,5.8,5.5,5.2};
|
||||
betas={0,0,0,0,0,0,0,0};
|
||||
bool openBC = false;
|
||||
std:cout << GridLogMessage << "Betas: " << betas << std::endl;
|
||||
VariableWilsonGaugeActionR Waction(betas, betat, UGrid, openBC);
|
||||
//WilsonGaugeActionR Waction(5.6);
|
||||
|
||||
// Collect actions
|
||||
ActionLevel<Field> Level1(1);
|
||||
|
Loading…
Reference in New Issue
Block a user