mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-11 22:50:45 +01:00
Fixing the implicit integration
This commit is contained in:
parent
596dcd85b2
commit
ec035983fd
@ -142,7 +142,7 @@ class HMCWrapperTemplate: public HMCRunnerBase<ReaderClass> {
|
|||||||
//TrivialMetric<typename Implementation::Field> Mtr;
|
//TrivialMetric<typename Implementation::Field> Mtr;
|
||||||
ConjugateGradient<LatticeGaugeField> CG(1.0e-8,10000);
|
ConjugateGradient<LatticeGaugeField> CG(1.0e-8,10000);
|
||||||
LaplacianParams LapPar(0.0001, 1.0, 1000, 1e-8, 12, 64);
|
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
|
// Better to pass the generalised momenta to the integrator
|
||||||
LaplacianAdjointField<PeriodicGimplR> Laplacian(UGrid, CG, LapPar, Kappa);
|
LaplacianAdjointField<PeriodicGimplR> Laplacian(UGrid, CG, LapPar, Kappa);
|
||||||
|
@ -114,6 +114,23 @@ class Integrator {
|
|||||||
void update_P(MomentaField& Mom, Field& U, int level, double ep) {
|
void update_P(MomentaField& Mom, Field& U, int level, double ep) {
|
||||||
// input U actually not used in the fundamental case
|
// input U actually not used in the fundamental case
|
||||||
// Fundamental updates, include smearing
|
// 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) {
|
for (int a = 0; a < as[level].actions.size(); ++a) {
|
||||||
Field force(U._grid);
|
Field force(U._grid);
|
||||||
conformable(U._grid, Mom._grid);
|
conformable(U._grid, Mom._grid);
|
||||||
@ -128,17 +145,7 @@ class Integrator {
|
|||||||
Mom -= force * ep;
|
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
|
// Force from the other representations
|
||||||
as[level].apply(update_P_hireps, Representations, Mom, U, ep);
|
as[level].apply(update_P_hireps, Representations, Mom, U, ep);
|
||||||
@ -179,9 +186,11 @@ class Integrator {
|
|||||||
MomentaField AuxDer(P.Mom._grid);
|
MomentaField AuxDer(P.Mom._grid);
|
||||||
MomDer1 = zero;
|
MomDer1 = zero;
|
||||||
MomentaField diff(P.Mom._grid);
|
MomentaField diff(P.Mom._grid);
|
||||||
|
double factor = 2.0;
|
||||||
if (intermediate)
|
if (intermediate){
|
||||||
P.DerivativeU(P.Mom, MomDer1);
|
P.DerivativeU(P.Mom, MomDer1);
|
||||||
|
factor = 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
// Auxiliary fields
|
// Auxiliary fields
|
||||||
//P.update_auxiliary_momenta(ep*0.5);
|
//P.update_auxiliary_momenta(ep*0.5);
|
||||||
@ -202,7 +211,7 @@ class Integrator {
|
|||||||
std::cout << GridLogIntegrator << "|Force| laplacian site average: " << force_abs
|
std::cout << GridLogIntegrator << "|Force| laplacian site average: " << force_abs
|
||||||
<< std::endl;
|
<< 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;
|
diff = NewMom - OldMom;
|
||||||
counter++;
|
counter++;
|
||||||
RelativeError = std::sqrt(norm2(diff))/std::sqrt(norm2(NewMom));
|
RelativeError = std::sqrt(norm2(diff))/std::sqrt(norm2(NewMom));
|
||||||
@ -245,7 +254,7 @@ class Integrator {
|
|||||||
MomentaField Mom2(P.Mom._grid);
|
MomentaField Mom2(P.Mom._grid);
|
||||||
RealD RelativeError;
|
RealD RelativeError;
|
||||||
Field diff(U._grid);
|
Field diff(U._grid);
|
||||||
Real threshold = 1e-6;
|
Real threshold = 1e-8;
|
||||||
int counter = 1;
|
int counter = 1;
|
||||||
int MaxCounter = 100;
|
int MaxCounter = 100;
|
||||||
|
|
||||||
@ -269,7 +278,7 @@ class Integrator {
|
|||||||
for (int mu = 0; mu < Nd; mu++) {
|
for (int mu = 0; mu < Nd; mu++) {
|
||||||
auto Umu = PeekIndex<LorentzIndex>(U, mu);
|
auto Umu = PeekIndex<LorentzIndex>(U, mu);
|
||||||
auto Pmu = PeekIndex<LorentzIndex>(sum, 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);
|
PokeIndex<LorentzIndex>(NewU, ProjectOnGroup(Umu), mu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,7 +339,7 @@ class Integrator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void reverse_momenta(){
|
void reverse_momenta(){
|
||||||
P.Mom *= 1.0;
|
P.Mom *= -1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// to be used by the actionlevel class to iterate
|
// to be used by the actionlevel class to iterate
|
||||||
|
@ -53,14 +53,14 @@ int main(int argc, char **argv) {
|
|||||||
CheckpointerParameters CPparams;
|
CheckpointerParameters CPparams;
|
||||||
CPparams.config_prefix = "ckpoint_lat";
|
CPparams.config_prefix = "ckpoint_lat";
|
||||||
CPparams.rng_prefix = "ckpoint_rng";
|
CPparams.rng_prefix = "ckpoint_rng";
|
||||||
CPparams.saveInterval = 20;
|
CPparams.saveInterval = 10;
|
||||||
CPparams.format = "IEEE64BIG";
|
CPparams.format = "IEEE64BIG";
|
||||||
|
|
||||||
TheHMC.Resources.LoadBinaryCheckpointer(CPparams);
|
TheHMC.Resources.LoadBinaryCheckpointer(CPparams);
|
||||||
|
|
||||||
RNGModuleParameters RNGpar;
|
RNGModuleParameters RNGpar;
|
||||||
RNGpar.serial_seeds = "1 2 3 4 5";
|
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);
|
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||||
|
|
||||||
// Construct observables
|
// Construct observables
|
||||||
@ -76,7 +76,7 @@ int main(int argc, char **argv) {
|
|||||||
// need wrappers of the fermionic classes
|
// need wrappers of the fermionic classes
|
||||||
// that have a complex construction
|
// that have a complex construction
|
||||||
// standard
|
// standard
|
||||||
RealD beta = 0.0;
|
RealD beta = 5.6;
|
||||||
WilsonGaugeActionR Waction(beta);
|
WilsonGaugeActionR Waction(beta);
|
||||||
|
|
||||||
ActionLevel<HMCWrapper::Field> Level1(1);
|
ActionLevel<HMCWrapper::Field> Level1(1);
|
||||||
@ -86,7 +86,7 @@ int main(int argc, char **argv) {
|
|||||||
/////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// HMC parameters are serialisable
|
// HMC parameters are serialisable
|
||||||
TheHMC.Parameters.MD.MDsteps = 60;
|
TheHMC.Parameters.MD.MDsteps = 40;
|
||||||
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…
x
Reference in New Issue
Block a user