1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-10 06:00: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

@ -26,7 +26,8 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
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
@ -34,6 +35,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
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

@ -95,36 +95,46 @@ class VariableWilsonGaugeAction : public Action<typename Gimpl::GaugeField> {
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);
Lattice<iScalar<vInteger> > coor(grid); Lattice<iScalar<vInteger> > coor(grid);
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,14 +214,12 @@ 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); conformable(grid, U._grid);
int Ndim = Nd; // change later int Ndim = Nd; // change later
RealD factor = 0.5 / RealD(Nc); RealD factor = 0.5 / RealD(Nc);
@ -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

@ -35,20 +35,23 @@ 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;
@ -81,7 +84,9 @@ 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);
@ -186,12 +192,10 @@ 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);