mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-15 02:05:37 +00:00
Debugging the shGordon action
This commit is contained in:
parent
1ba61680db
commit
f5cc7e253b
@ -51,7 +51,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=2;
|
||||||
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
|
||||||
|
@ -55,16 +55,16 @@ class shGordonAction : public QCD::Action<typename Impl::Field> {
|
|||||||
virtual void refresh(const Field &U, GridParallelRNG &pRNG) {} // noop as no pseudoferms
|
virtual void refresh(const Field &U, GridParallelRNG &pRNG) {} // noop as no pseudoferms
|
||||||
|
|
||||||
virtual RealD S(const Field &phi) {
|
virtual RealD S(const Field &phi) {
|
||||||
return 0.5*ScalarObs<Impl>::sumphider(phi) - 0.5*mass_square/(g*g)*sum(trace(exp(g*phi) + exp(-g*phi))) ;
|
return QCD::Nd * ScalarObs<Impl>::sumphisquared(phi) + ScalarObs<Impl>::sumphider(phi) - 0.5*mass_square/(g*g)*sum(trace(exp(g*phi) + exp(-g*phi))) ;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void deriv(const Field &phi,
|
virtual void deriv(const Field &phi,
|
||||||
Field &force) {
|
Field &force) {
|
||||||
Field tmp(phi._grid);
|
Field tmp(phi._grid);
|
||||||
tmp = zero;
|
tmp = 2.0*QCD::Nd*phi;
|
||||||
for (int mu = 0; mu < QCD::Nd; mu++) tmp += Cshift(phi, mu, 1) - Cshift(phi, mu, -1);
|
for (int mu = 0; mu < QCD::Nd; mu++) tmp -= Cshift(phi, mu, 1) + Cshift(phi, mu, -1);
|
||||||
|
|
||||||
force+= 0.5*tmp - 0.5*mass_square/g*(exp(g*phi) - exp(-g*phi));
|
force+= tmp - 0.5*mass_square/g*(exp(g*phi) - exp(-g*phi));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,12 +44,29 @@ int main(int argc, char **argv) {
|
|||||||
HMCWrapper TheHMC;
|
HMCWrapper TheHMC;
|
||||||
|
|
||||||
// Grid from the command line
|
// Grid from the command line
|
||||||
|
constexpr int Ndimensions = 2;
|
||||||
|
GridModule ScalarGrid;
|
||||||
|
if (GridDefaultLatt().size() != Ndimensions){
|
||||||
|
std::cout << "Incorrect dimension of the grid\n. Expected dim="<< Ndimensions << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (GridDefaultMpi().size() != Ndimensions){
|
||||||
|
std::cout << "Incorrect dimension of the mpi grid\n. Expected dim="<< Ndimensions << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
ScalarGrid.set_full(new GridCartesian(GridDefaultLatt(),GridDefaultSimd(Ndimensions, vComplex::Nsimd()),GridDefaultMpi()));
|
||||||
|
ScalarGrid.set_rb(new GridRedBlackCartesian(ScalarGrid.get_full()));
|
||||||
|
TheHMC.Resources.AddGrid("scalar", ScalarGrid);
|
||||||
|
std::cout << "Lattice size : " << GridDefaultLatt() << std::endl;
|
||||||
|
|
||||||
|
/*
|
||||||
GridModule ScalarGrid;
|
GridModule ScalarGrid;
|
||||||
ScalarGrid.set_full( SpaceTimeGrid::makeFourDimGrid(
|
ScalarGrid.set_full( SpaceTimeGrid::makeFourDimGrid(
|
||||||
GridDefaultLatt(), GridDefaultSimd(Nd, vReal::Nsimd()),
|
GridDefaultLatt(), GridDefaultSimd(Nd, vReal::Nsimd()),
|
||||||
GridDefaultMpi()));
|
GridDefaultMpi()));
|
||||||
ScalarGrid.set_rb(SpaceTimeGrid::makeFourDimRedBlackGrid(ScalarGrid.get_full()));
|
ScalarGrid.set_rb(SpaceTimeGrid::makeFourDimRedBlackGrid(ScalarGrid.get_full()));
|
||||||
TheHMC.Resources.AddGrid("scalar", ScalarGrid);
|
TheHMC.Resources.AddGrid("scalar", ScalarGrid);
|
||||||
|
*/
|
||||||
// Possibile to create the module by hand
|
// Possibile to create the module by hand
|
||||||
// hardcoding parameters or using a Reader
|
// hardcoding parameters or using a Reader
|
||||||
|
|
||||||
@ -76,7 +93,7 @@ int main(int argc, char **argv) {
|
|||||||
// standard
|
// standard
|
||||||
|
|
||||||
// Real Scalar action
|
// Real Scalar action
|
||||||
shGordonActionR Saction(1.0,1.0);
|
shGordonActionR Saction(0.1,0.1);
|
||||||
|
|
||||||
// Collect actions
|
// Collect actions
|
||||||
ActionLevel<shGordonActionR::Field, ScalarFields> Level1(1);
|
ActionLevel<shGordonActionR::Field, ScalarFields> Level1(1);
|
||||||
@ -87,7 +104,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
|
|
||||||
// HMC parameters are serialisable
|
// HMC parameters are serialisable
|
||||||
TheHMC.Parameters.MD.MDsteps = 60;
|
TheHMC.Parameters.MD.MDsteps = 100;
|
||||||
TheHMC.Parameters.MD.trajL = 1.0;
|
TheHMC.Parameters.MD.trajL = 1.0;
|
||||||
|
|
||||||
TheHMC.ReadCommandLine(argc, argv); // these can be parameters from file
|
TheHMC.ReadCommandLine(argc, argv); // these can be parameters from file
|
||||||
|
Loading…
Reference in New Issue
Block a user