1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-09-20 09:15:38 +01:00

Fixing the implicit integration

This commit is contained in:
Guido Cossu 2017-03-01 11:56:35 +00:00
parent 596dcd85b2
commit ec035983fd
3 changed files with 30 additions and 21 deletions

View File

@ -142,7 +142,7 @@ class HMCWrapperTemplate: public HMCRunnerBase<ReaderClass> {
//TrivialMetric<typename Implementation::Field> Mtr;
ConjugateGradient<LatticeGaugeField> CG(1.0e-8,10000);
LaplacianParams LapPar(0.0001, 1.0, 1000, 1e-8, 12, 64);
RealD Kappa = 0.9;
RealD Kappa = 0.6;
// Better to pass the generalised momenta to the integrator
LaplacianAdjointField<PeriodicGimplR> Laplacian(UGrid, CG, LapPar, Kappa);

View File

@ -114,6 +114,23 @@ class Integrator {
void update_P(MomentaField& Mom, Field& U, int level, double ep) {
// input U actually not used in the fundamental case
// Fundamental updates, include smearing
// Generalised momenta
// Derivative of the kinetic term must be computed before
// Mom is the momenta and gets updated by the
// actions derivatives
MomentaField MomDer(P.Mom._grid);
P.M.ImportGauge(U);
P.DerivativeU(P.Mom, MomDer);
Mom -= MomDer * ep;
// Auxiliary fields
//P.update_auxiliary_momenta(ep*0.5);
//P.AuxiliaryFieldsDerivative(MomDer);
//Mom -= MomDer * ep;
//P.update_auxiliary_momenta(ep*0.5);
for (int a = 0; a < as[level].actions.size(); ++a) {
Field force(U._grid);
conformable(U._grid, Mom._grid);
@ -128,17 +145,7 @@ class Integrator {
Mom -= force * ep;
}
// Generalised momenta
MomentaField MomDer(P.Mom._grid);
P.M.ImportGauge(U);
P.DerivativeU(P.Mom, MomDer);
Mom -= MomDer * ep;
// Auxiliary fields
//P.update_auxiliary_momenta(ep*0.5);
//P.AuxiliaryFieldsDerivative(MomDer);
//Mom -= MomDer * ep;
//P.update_auxiliary_momenta(ep*0.5);
// Force from the other representations
as[level].apply(update_P_hireps, Representations, Mom, U, ep);
@ -179,9 +186,11 @@ class Integrator {
MomentaField AuxDer(P.Mom._grid);
MomDer1 = zero;
MomentaField diff(P.Mom._grid);
if (intermediate)
double factor = 2.0;
if (intermediate){
P.DerivativeU(P.Mom, MomDer1);
factor = 1.0;
}
// Auxiliary fields
//P.update_auxiliary_momenta(ep*0.5);
@ -202,7 +211,7 @@ class Integrator {
std::cout << GridLogIntegrator << "|Force| laplacian site average: " << force_abs
<< std::endl;
NewMom = P.Mom - ep* 0.5 * (2.0*Msum + MomDer + MomDer1);// simplify
NewMom = P.Mom - ep* 0.5 * (2.0*Msum + factor*MomDer + MomDer1);// simplify
diff = NewMom - OldMom;
counter++;
RelativeError = std::sqrt(norm2(diff))/std::sqrt(norm2(NewMom));
@ -245,7 +254,7 @@ class Integrator {
MomentaField Mom2(P.Mom._grid);
RealD RelativeError;
Field diff(U._grid);
Real threshold = 1e-6;
Real threshold = 1e-8;
int counter = 1;
int MaxCounter = 100;
@ -269,7 +278,7 @@ class Integrator {
for (int mu = 0; mu < Nd; mu++) {
auto Umu = PeekIndex<LorentzIndex>(U, mu);
auto Pmu = PeekIndex<LorentzIndex>(sum, mu);
Umu = expMat(Pmu, ep * 0.5, 12) * Umu;
Umu = expMat(Pmu, ep * 0.5, 24) * Umu;
PokeIndex<LorentzIndex>(NewU, ProjectOnGroup(Umu), mu);
}
@ -330,7 +339,7 @@ class Integrator {
}
void reverse_momenta(){
P.Mom *= 1.0;
P.Mom *= -1.0;
}
// to be used by the actionlevel class to iterate

View File

@ -53,14 +53,14 @@ int main(int argc, char **argv) {
CheckpointerParameters CPparams;
CPparams.config_prefix = "ckpoint_lat";
CPparams.rng_prefix = "ckpoint_rng";
CPparams.saveInterval = 20;
CPparams.saveInterval = 10;
CPparams.format = "IEEE64BIG";
TheHMC.Resources.LoadBinaryCheckpointer(CPparams);
RNGModuleParameters RNGpar;
RNGpar.serial_seeds = "1 2 3 4 5";
RNGpar.parallel_seeds = "6 7 8 9 10 12";
RNGpar.parallel_seeds = "6 7 8 9 10";
TheHMC.Resources.SetRNGSeeds(RNGpar);
// Construct observables
@ -76,7 +76,7 @@ int main(int argc, char **argv) {
// need wrappers of the fermionic classes
// that have a complex construction
// standard
RealD beta = 0.0;
RealD beta = 5.6;
WilsonGaugeActionR Waction(beta);
ActionLevel<HMCWrapper::Field> Level1(1);
@ -86,7 +86,7 @@ int main(int argc, char **argv) {
/////////////////////////////////////////////////////////////
// HMC parameters are serialisable
TheHMC.Parameters.MD.MDsteps = 60;
TheHMC.Parameters.MD.MDsteps = 40;
TheHMC.Parameters.MD.trajL = 1.0;
TheHMC.ReadCommandLine(argc, argv); // these can be parameters from file