diff --git a/Grid/qcd/action/gauge/GaugeImplTypes.h b/Grid/qcd/action/gauge/GaugeImplTypes.h index 8e418209..dbab4386 100644 --- a/Grid/qcd/action/gauge/GaugeImplTypes.h +++ b/Grid/qcd/action/gauge/GaugeImplTypes.h @@ -140,8 +140,38 @@ public: PokeIndex(P, Pmu, mu); } } + + - static inline Field projectForce(Field &P) { return Ta(P); } + static inline Field projectForce(Field &P) + { + if (isSp2n == true) + { + P = Ta(P); + const int nsp = Nc / 2; + + Sp::iSp2nMatrix gen; + + + auto Psum = P; + + Psum = Zero(); + + for (int a = 0; a < Sp::AlgebraDimension; a++) + { + Sp::generator(a, gen); + + auto coeff = 2. * trace(P * gen); + Psum += coeff * gen; + } + + return Psum; + + } else + { + return Ta(P); + } + } static inline void update_field(Field& P, Field& U, double ep){ //static std::chrono::duration diff; diff --git a/Grid/tensors/Tensor_Ta.h b/Grid/tensors/Tensor_Ta.h index a82fa7aa..2ee51fb4 100644 --- a/Grid/tensors/Tensor_Ta.h +++ b/Grid/tensors/Tensor_Ta.h @@ -137,6 +137,9 @@ accelerator_inline iMatrix ProjectOnGroup(const iMatrix &arg) // re-do for sp2n +// Ta cannot be defined here for Sp2n because I need the generators from the Sp class +// It is defined in gauge impl types + template accelerator_inline iScalar ProjectOnSpGroup(const iScalar&r) { iScalar ret; @@ -217,88 +220,6 @@ accelerator_inline iMatrix ProjectOnSpGroup(const iMatrix &arg return ret; } - - - - - -/* -template::TensorLevel == 0 >::type * =nullptr> -accelerator_inline iMatrix ProjectOnSpGroup(const iMatrix &arg) -{ - // need a check for the group type? - iMatrix ret(arg); - vtype nrm; - vtype inner; - for(int c1=0;c1 +Author: neo +Author: Guido Cossu + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +See the full license in the file "LICENSE" in the top level distribution +directory +*************************************************************************************/ +/* END LEGAL */ +#include + +int main(int argc, char **argv) +{ + using namespace Grid; + + Grid_init(&argc, &argv); + GridLogLayout(); + + typedef GenericSp2nHMCRunner HMCWrapper; + HMCWrapper TheHMC; + + + TheHMC.Resources.AddFourDimGrid("gauge"); + + + + // Checkpointer definition + CheckpointerParameters CPparams; + CPparams.config_prefix = "ckpoint_lat"; + CPparams.rng_prefix = "ckpoint_rng"; + CPparams.saveInterval = 5; + CPparams.format = "IEEE64BIG"; + + TheHMC.Resources.LoadNerscCheckpointer(CPparams); + + RNGModuleParameters RNGpar; + RNGpar.serial_seeds = "12 22 32 42 52"; + RNGpar.parallel_seeds = "76 77 87 79 70"; + TheHMC.Resources.SetRNGSeeds(RNGpar); + + // Construct observables + // here there is too much indirection + typedef PlaquetteMod PlaqObs; + typedef TopologicalChargeMod QObs; + TheHMC.Resources.AddObservable(); + TopologyObsParameters TopParams; + TopParams.interval = 5; + TopParams.do_smearing = true; + TopParams.Smearing.steps = 200; + TopParams.Smearing.step_size = 0.01; + TopParams.Smearing.meas_interval = 50; + TopParams.Smearing.maxTau = 2.0; + TheHMC.Resources.AddObservable(TopParams); + ////////////////////////////////////////////// + + ///////////////////////////////////////////////////////////// + // Collect actions, here use more encapsulation + // need wrappers of the fermionic classes + // that have a complex construction + // standard + RealD beta = 8.0 ; + SymplWilsonGaugeActionR Waction(beta); + + ActionLevel Level1(1); + Level1.push_back(&Waction); + //Level1.push_back(WGMod.getPtr()); + TheHMC.TheAction.push_back(Level1); + ///////////////////////////////////////////////////////////// + + // HMC parameters are serialisable + TheHMC.Parameters.MD.MDsteps = 10; + TheHMC.Parameters.MD.trajL = 1.0; + + TheHMC.ReadCommandLine(argc, argv); // these can be parameters from file + TheHMC.Run(); // no smearing + + Grid_finalize(); + +} // main