1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-09-20 17:25:37 +01:00
Grid/lib/Grid_QCD.h

107 lines
4.2 KiB
C
Raw Normal View History

2015-03-04 05:31:44 +00:00
#ifndef GRID_QCD_H
#define GRID_QCD_H
2015-04-03 05:29:54 +01:00
namespace Grid{
2015-03-04 05:31:44 +00:00
namespace QCD {
static const int Nc=3;
static const int Ns=4;
2015-04-18 14:36:01 +01:00
static const int Nd=4;
2015-03-04 05:31:44 +00:00
static const int CbRed =0;
static const int CbBlack=1;
2015-04-18 14:36:01 +01:00
//////////////////////////////////////////////////////////////////////////////
2015-03-04 05:31:44 +00:00
// QCD iMatrix types
2015-04-18 14:36:01 +01:00
// Index conventions: Lorentz x Spin x Colour
//
// ChrisK very keen to add extra space for Gparity doubling.
//
// Also add domain wall index, in a way where Wilson operator
// naturally distributes across the 5th dimensions.
//////////////////////////////////////////////////////////////////////////////
template<typename vtype> using iSinglet = iScalar<iScalar<iScalar<vtype> > >;
template<typename vtype> using iSpinMatrix = iScalar<iMatrix<iScalar<vtype>, Ns> >;
template<typename vtype> using iSpinColourMatrix = iScalar<iMatrix<iMatrix<vtype, Nc>, Ns> >;
template<typename vtype> using iColourMatrix = iScalar<iScalar<iMatrix<vtype, Nc> > > ;
template<typename vtype> using iLorentzColourMatrix = iVector<iScalar<iMatrix<vtype, Nc> >, Nd > ;
2015-03-04 05:31:44 +00:00
2015-04-18 14:36:01 +01:00
template<typename vtype> using iSpinVector = iScalar<iVector<iScalar<vtype>, Ns> >;
template<typename vtype> using iColourVector = iScalar<iScalar<iVector<vtype, Nc> > >;
template<typename vtype> using iSpinColourVector = iScalar<iVector<iVector<vtype, Nc>, Ns> >;
2015-03-04 05:31:44 +00:00
2015-04-18 14:36:01 +01:00
typedef iSpinMatrix<Complex > SpinMatrix;
typedef iColourMatrix<Complex > ColourMatrix;
typedef iSpinColourMatrix<Complex > SpinColourMatrix;
typedef iLorentzColourMatrix<Complex > LorentzColourMatrix;
2015-03-04 05:31:44 +00:00
typedef iSpinVector<Complex > SpinVector;
typedef iColourVector<Complex > ColourVector;
typedef iSpinColourVector<Complex > SpinColourVector;
2015-04-18 14:36:01 +01:00
typedef iSpinMatrix<vComplex > vSpinMatrix;
typedef iColourMatrix<vComplex > vColourMatrix;
typedef iSpinColourMatrix<vComplex > vSpinColourMatrix;
typedef iLorentzColourMatrix<vComplex > vLorentzColourMatrix;
2015-03-04 05:31:44 +00:00
typedef iSpinVector<vComplex > vSpinVector;
typedef iColourVector<vComplex > vColourVector;
typedef iSpinColourVector<vComplex > vSpinColourVector;
2015-04-18 14:36:01 +01:00
typedef iSinglet<Complex > TComplex; // This is painful. Tensor singlet complex type.
typedef iSinglet<vComplex > vTComplex; // what if we don't know the tensor structure
typedef iSinglet<Real > TReal; // Shouldn't need these; can I make it work without?
typedef iSinglet<vReal > vTReal;
typedef iSinglet<vInteger > vTInteger;
typedef iSinglet<Integer > TInteger;
typedef Lattice<vTReal> LatticeReal;
typedef Lattice<vTComplex> LatticeComplex;
typedef Lattice<vInteger> LatticeInteger; // Predicates for "where"
2015-03-04 05:31:44 +00:00
typedef Lattice<vColourMatrix> LatticeColourMatrix;
typedef Lattice<vSpinMatrix> LatticeSpinMatrix;
2015-04-18 14:36:01 +01:00
typedef Lattice<vSpinColourMatrix> LatticeSpinColourMatrix;
2015-03-04 05:31:44 +00:00
typedef Lattice<vSpinColourVector> LatticeSpinColourVector;
typedef Lattice<vSpinVector> LatticeSpinVector;
typedef Lattice<vColourVector> LatticeColourVector;
2015-04-18 14:36:01 +01:00
///////////////////////////////////////////
// Physical names for things
///////////////////////////////////////////
typedef Lattice<vSpinColourVector> LatticeFermion;
typedef Lattice<vSpinColourMatrix> LatticePropagator;
typedef Lattice<vLorentzColourMatrix> LatticeGaugeField;
2015-04-18 14:36:01 +01:00
inline void LatticeCoordinate(LatticeInteger &l,int mu){
GridBase *grid = l._grid;
int Nsimd = grid->iSites();
std::vector<int> gcoor;
std::vector<Integer> mergebuf(Nsimd);
std::vector<Integer *> mergeptr(Nsimd);
for(int o=0;o<grid->oSites();o++){
for(int i=0;i<grid->iSites();i++){
2015-04-18 14:36:01 +01:00
grid->RankIndexToGlobalCoor(grid->ThisRank(),o,i,gcoor);
// grid->RankIndexToGlobalCoor(0,o,i,gcoor);
mergebuf[i]=gcoor[mu];
mergeptr[i]=&mergebuf[i];
}
merge(l._odata[o],mergeptr);
}
};
#include <Grid_predicated.h>
#if 0
#endif
2015-03-04 05:31:44 +00:00
} //namespace QCD
2015-04-03 05:29:54 +01:00
} // Grid
2015-03-04 05:31:44 +00:00
#endif