1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-10 22:20:45 +01:00

Working on the 5d

This commit is contained in:
Guido Cossu 2016-10-21 14:22:25 +01:00
parent deef2673b2
commit 392130a537
8 changed files with 286 additions and 262 deletions

View File

@ -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: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
Author: Peter Boyle <paboyle@ph.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: neo <cossu@post.kek.jp>
Author: paboyle <paboyle@ph.ed.ac.uk> Author: paboyle <paboyle@ph.ed.ac.uk>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along 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., with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 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 */ *************************************************************************************/
/* END LEGAL */
#ifndef GRID_LT_H #ifndef GRID_LT_H
#define GRID_LT_H #define GRID_LT_H
namespace Grid{ namespace Grid{
// First steps in the complete generalization of the Physics part // First steps in the complete generalization of the Physics part
// Design not final
namespace LatticeTheories { namespace LatticeTheories {
template <int Dimensions> template <int Dimensions>
@ -82,6 +84,13 @@ struct FermionicLatticeGaugeTheory
using iHalfSpinVector = iScalar<iVector<iScalar<vtype>, Nhs> >; using iHalfSpinVector = iScalar<iVector<iScalar<vtype>, Nhs> >;
template <typename vtype> template <typename vtype>
using iHalfSpinColourVector = iScalar<iVector<iVector<vtype, Nc>, Nhs> >; 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. // Examples, not complete now.
@ -97,10 +106,6 @@ struct QCD : public FermionicLatticeGaugeTheory<4, 3, 4> {
typedef FermionicLatticeGaugeTheory FLGT; 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<Complex > SpinMatrix;
typedef FLGT::iSpinMatrix<ComplexF > SpinMatrixF; typedef FLGT::iSpinMatrix<ComplexF > SpinMatrixF;
typedef FLGT::iSpinMatrix<ComplexD > SpinMatrixD; typedef FLGT::iSpinMatrix<ComplexD > SpinMatrixD;

View File

@ -46,7 +46,7 @@ namespace QCD {
static const int Nc=3; static const int Nc=3;
static const int Ns=4; 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 Nhs=2; // half spinor
static const int Nds=8; // double stored gauge field static const int Nds=8; // double stored gauge field
static const int Ngp=2; // gparity index range static const int Ngp=2; // gparity index range

View File

@ -88,26 +88,31 @@ class VariableWilsonGaugeAction : public Action<typename Gimpl::GaugeField> {
INHERIT_GIMPL_TYPES(Gimpl); INHERIT_GIMPL_TYPES(Gimpl);
private: private:
std::vector<RealD> b_bulk;// bulk couplings std::vector<RealD> b_bulk; // bulk couplings
std::vector<RealD> b_xdim;//extra dimension couplings std::vector<RealD> b_xdim; // extra dimension couplings
GridBase *grid; GridBase *grid;
LatticeComplex beta_xdim; LatticeComplex beta_xdim;
LatticeComplex beta_xdim_shifted; LatticeComplex beta_xdim_shifted;
LatticeComplex beta_bulk; LatticeComplex beta_bulk;
int bulk_volume;
public: public:
VariableWilsonGaugeAction(std::vector<RealD> bulk, std::vector<RealD> xdim, VariableWilsonGaugeAction(std::vector<RealD> bulk, std::vector<RealD> xdim,
GridBase *_grid) GridBase *_grid, bool openBC = false)
: b_bulk(bulk), : b_bulk(bulk),
b_xdim(xdim), b_xdim(xdim),
grid(_grid), grid(_grid),
beta_xdim(grid), beta_xdim(grid),
beta_xdim_shifted(grid), beta_xdim_shifted(grid),
beta_bulk(grid) beta_bulk(grid) {
{ // check that the grid is ok
//check that the grid is ok // todo
//todo int Ndim = Nd; // change later
int Ndim = Nd;//change later
std::vector<int> FullDim = grid->GlobalDimensions();
bulk_volume = 1;
for (int s = 0; s < Ndim - 1; s++) bulk_volume *= FullDim[s];
LatticeComplex temp(grid); LatticeComplex temp(grid);
@ -115,16 +120,21 @@ class VariableWilsonGaugeAction : public Action<typename Gimpl::GaugeField> {
LatticeCoordinate(coor, Ndim - 1); LatticeCoordinate(coor, Ndim - 1);
int Nex = grid->_fdimensions[Ndim - 1]; int Nex = FullDim[Ndim - 1];
assert(b_bulk.size() == Nex); assert(b_bulk.size() == Nex);
assert(b_xdim.size() == Nex); assert(b_xdim.size() == Nex);
beta_xdim = zero; beta_xdim = zero;
for (int tau = 0; tau < Nex; tau++) { for (int tau = 0; tau < Nex - 1; tau++) {
temp = b_xdim[tau]; temp = b_xdim[tau];
beta_xdim = where(coor == tau, temp, beta_xdim); beta_xdim = where(coor == tau, temp, beta_xdim);
} }
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_xdim_shifted = Cshift(beta_xdim, Ndim - 1, -1);
beta_bulk = zero; beta_bulk = zero;
@ -132,6 +142,9 @@ class VariableWilsonGaugeAction : public Action<typename Gimpl::GaugeField> {
temp = b_bulk[tau]; temp = b_bulk[tau];
beta_bulk = where(coor == tau, temp, beta_bulk); 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, virtual void refresh(const GaugeField &U,
@ -150,19 +163,34 @@ class VariableWilsonGaugeAction : public Action<typename Gimpl::GaugeField> {
LatticeComplex dirPlaq(grid); LatticeComplex dirPlaq(grid);
LatticeComplex Plaq(grid); LatticeComplex Plaq(grid);
LatticeComplex SumdirPlaq(grid);
RealD OneOnNc = 1.0 / Real(Nc); RealD OneOnNc = 1.0 / Real(Nc);
///////////// /////////////
// Lower dim plaquettes // Lower dim plaquettes
///////////// /////////////
Plaq = zero; Plaq = zero;
SumdirPlaq = zero;
for (int mu = 1; mu < Ndim - 1; mu++) { for (int mu = 1; mu < Ndim - 1; mu++) {
for (int nu = 0; nu < mu; nu++) { for (int nu = 0; nu < mu; nu++) {
WilsonLoops<Gimpl>::traceDirPlaquette(dirPlaq, U, mu, nu); WilsonLoops<Gimpl>::traceDirPlaquette(dirPlaq, U, mu, nu);
SumdirPlaq += dirPlaq;
Plaq = Plaq + (1.0 - dirPlaq * OneOnNc) * beta_bulk; 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 // Extra dimension
///////////// /////////////
@ -186,23 +214,21 @@ class VariableWilsonGaugeAction : public Action<typename Gimpl::GaugeField> {
// for the higher dimension plaquettes take the upper plaq of the // 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] // 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) // derivative of links mu = 0, ... Nd-1 inside plaq (mu,5)
// for these I need upper and lower staples separated // for these I need upper and lower staples separated
// each multiplied with their own beta // each multiplied with their own beta
// derivative of links mu = 5 // derivative of links mu = 5
// living on the same slice, share the same beta // 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); GaugeLinkField Umu(grid);
int Ndim = Nd; // change later GaugeLinkField dSdU_mu(grid);
RealD factor = 0.5 / RealD(Nc); GaugeLinkField staple(grid);
GaugeLinkField Umu(grid); for (int mu = 0; mu < Ndim; mu++) {
GaugeLinkField dSdU_mu(grid);
GaugeLinkField staple(grid);
for (int mu = 0; mu < Ndim; mu++) {
Umu = PeekIndex<LorentzIndex>(U, mu); Umu = PeekIndex<LorentzIndex>(U, mu);
dSdU_mu = zero; dSdU_mu = zero;
@ -246,14 +272,8 @@ for (int mu = 0; mu < Ndim; mu++) {
dSdU_mu = Ta(Umu * dSdU_mu) * factor; dSdU_mu = Ta(Umu * dSdU_mu) * factor;
PokeIndex<LorentzIndex>(dSdU, dSdU_mu, mu); PokeIndex<LorentzIndex>(dSdU, dSdU_mu, mu);
} }
}; };
}; };
} }
} }

View File

@ -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., with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
See the full license in the file "LICENSE" in the top level distribution See the full license in the file "LICENSE" in the top level distribution
directory directory
*************************************************************************************/ *************************************************************************************/
/* END LEGAL */ /* END LEGAL */
#ifndef GENERIC_HMC_RUNNER #ifndef GENERIC_HMC_RUNNER
#define GENERIC_HMC_RUNNER #define GENERIC_HMC_RUNNER
@ -33,34 +33,37 @@ directory
namespace Grid { namespace Grid {
namespace QCD { namespace QCD {
// Virtual Class for HMC specific for gauge theories // Virtual Class for HMC specific for gauge theories
// implement a specific theory by defining the BuildTheAction // implement a specific theory by defining the BuildTheAction
template <class Implementation, template <class Implementation, class RepresentationsPolicy = NoHirep>
class RepresentationsPolicy = NoHirep> class BinaryHmcRunnerTemplate {
class BinaryHmcRunnerTemplate {
public: public:
INHERIT_FIELD_TYPES(Implementation); INHERIT_FIELD_TYPES(Implementation);
typedef Implementation ImplPolicy; typedef Implementation ImplPolicy;
enum StartType_t { ColdStart, HotStart, TepidStart, CheckpointStart }; enum StartType_t { ColdStart,
HotStart,
TepidStart,
CheckpointStart };
ActionSet<Field, RepresentationsPolicy> TheAction; ActionSet<Field, RepresentationsPolicy> TheAction;
// A vector of HmcObservable // A vector of HmcObservable
// that can be injected from outside // that can be injected from outside
std::vector< HmcObservable<typename Implementation::Field>* > ObservablesList; std::vector<HmcObservable<typename Implementation::Field> *>
ObservablesList;
IntegratorParameters MDparameters; IntegratorParameters MDparameters;
GridCartesian *UGrid; GridCartesian * UGrid;
GridCartesian *FGrid; GridCartesian * FGrid;
GridRedBlackCartesian *UrbGrid; GridRedBlackCartesian *UrbGrid;
GridRedBlackCartesian *FrbGrid; GridRedBlackCartesian *FrbGrid;
std::vector<int> SerialSeed; std::vector<int> SerialSeed;
std::vector<int> ParallelSeed; std::vector<int> ParallelSeed;
void RNGSeeds(std::vector<int> S, std::vector<int> P){ void RNGSeeds(std::vector<int> S, std::vector<int> P) {
SerialSeed = S; SerialSeed = S;
ParallelSeed = P; ParallelSeed = P;
} }
@ -80,8 +83,10 @@ class BinaryHmcRunnerTemplate {
} }
////////////////////////////// //////////////////////////////
template <class SmearingPolicy, class IOCheckpointer > template <class SmearingPolicy, class IOCheckpointer>
void Runner(int argc, char **argv, IOCheckpointer &Checkpoint, void Runner(int argc,
char ** argv,
IOCheckpointer &Checkpoint,
SmearingPolicy &Smearing) { SmearingPolicy &Smearing) {
StartType_t StartType = HotStart; StartType_t StartType = HotStart;
@ -134,7 +139,8 @@ class BinaryHmcRunnerTemplate {
GridParallelRNG pRNG(UGrid); GridParallelRNG pRNG(UGrid);
Field U(UGrid); Field U(UGrid);
typedef MinimumNorm2<Implementation, SmearingPolicy, typedef MinimumNorm2<Implementation,
SmearingPolicy,
RepresentationsPolicy> RepresentationsPolicy>
IntegratorType; // change here to change the algorithm IntegratorType; // change here to change the algorithm
IntegratorType MDynamics(UGrid, MDparameters, TheAction, Smearing); IntegratorType MDynamics(UGrid, MDparameters, TheAction, Smearing);
@ -178,20 +184,18 @@ class BinaryHmcRunnerTemplate {
// Run it // Run it
HMC.evolve(); HMC.evolve();
} }
}; };
// These are for gauge fields // These are for gauge fields
typedef BinaryHmcRunnerTemplate<PeriodicGimplR> BinaryHmcRunner; typedef BinaryHmcRunnerTemplate<PeriodicGimplR> BinaryHmcRunner;
typedef BinaryHmcRunnerTemplate<PeriodicGimplF> BinaryHmcRunnerF; typedef BinaryHmcRunnerTemplate<PeriodicGimplF> BinaryHmcRunnerF;
typedef BinaryHmcRunnerTemplate<PeriodicGimplD> BinaryHmcRunnerD; typedef BinaryHmcRunnerTemplate<PeriodicGimplD> BinaryHmcRunnerD;
template <class RepresentationsPolicy> template <class RepresentationsPolicy>
using BinaryHmcRunnerTemplateHirep = using BinaryHmcRunnerTemplateHirep = BinaryHmcRunnerTemplate<PeriodicGimplR, RepresentationsPolicy>;
BinaryHmcRunnerTemplate<PeriodicGimplR, RepresentationsPolicy>;
typedef BinaryHmcRunnerTemplate<ScalarImplR, ScalarFields>
ScalarBinaryHmcRunner;
typedef BinaryHmcRunnerTemplate<ScalarImplR, ScalarFields> ScalarBinaryHmcRunner;
} }
} }
#endif #endif

View File

@ -34,7 +34,6 @@ directory
* @brief Classes for Hybrid Monte Carlo update * @brief Classes for Hybrid Monte Carlo update
* *
* @author Guido Cossu * @author Guido Cossu
* Time-stamp: <2015-07-30 16:58:26 neo>
*/ */
//-------------------------------------------------------------------- //--------------------------------------------------------------------
#ifndef HMC_INCLUDED #ifndef HMC_INCLUDED

View File

@ -29,14 +29,6 @@ directory
*************************************************************************************/ *************************************************************************************/
/* END LEGAL */ /* 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 #ifndef INTEGRATOR_INCLUDED
#define INTEGRATOR_INCLUDED #define INTEGRATOR_INCLUDED

View File

@ -235,7 +235,7 @@ public:
std::vector<GaugeMat> U(Nd, grid); std::vector<GaugeMat> U(Nd, grid);
for (int d = 0; d < Nd; d++) { for (int d = 0; d < Nd; d++) {
U[d] = PeekIndex<LorentzIndex>(Umu, d); U[d] = PeekIndex<LorentzIndex>(Umu, d);// some redundant copies
} }
// mu // mu
@ -268,7 +268,7 @@ public:
std::vector<GaugeMat> U(Nd, grid); std::vector<GaugeMat> U(Nd, grid);
for (int d = 0; d < Nd; d++) { for (int d = 0; d < Nd; d++) {
U[d] = PeekIndex<LorentzIndex>(Umu, d); U[d] = PeekIndex<LorentzIndex>(Umu, d);// some redundant copies
} }
// mu // mu

View File

@ -79,12 +79,16 @@ class HmcRunner : public BinaryHmcRunner {
// Gauge action // Gauge action
int Ls = UGrid->_gdimensions[Nd - 1]; int Ls = UGrid->_gdimensions[Nd - 1];
std::vector<RealD> betat(Ls,5); std::vector<RealD> betat(Ls);
std::vector<RealD> betas(Ls); std::vector<RealD> betas(Ls);
betas={5,6,6,5}; //betat={5,6,6,6,6,6,6,5};
//std:cout << "Betas:" << betas << std::endl; betat={1,1,1,0,1,1,1,1};
//VariableWilsonGaugeActionR Waction(betas, betat, UGrid); //betas={5.2,5.5,5.8,6,6,5.8,5.5,5.2};
WilsonGaugeActionR Waction(5.6); 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 // Collect actions
ActionLevel<Field> Level1(1); ActionLevel<Field> Level1(1);