/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid Source file: ./tests/hmc/Test_WilsonFlow_adaptive.cc Copyright (C) 2017 Author: Christopher Kelly 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 using namespace Grid; //Linearly interpolate between two nearest times RealD interpolate(const RealD t_int, const std::vector > &data){ RealD tdiff1=1e32; int t1_idx=-1; RealD tdiff2=1e32; int t2_idx=-1; for(int i=0;i seeds({1, 2, 3, 4, 5}); GridSerialRNG sRNG; GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds); LatticeGaugeField U(&Grid); SU::HotConfiguration(pRNG, U); int Nstep = 300; RealD epsilon = 0.01; RealD maxTau = Nstep*epsilon; RealD tolerance = 1e-4; for(int i=1;i> tolerance; } } std::cout << "Adaptive smear tolerance " << tolerance << std::endl; //Setup iterative Wilson flow WilsonFlow wflow(epsilon,Nstep); wflow.resetActions(); std::vector > meas_orig; wflow.addMeasurement(1, [&wflow,&meas_orig](int step, RealD t, const LatticeGaugeField &U){ std::cout << GridLogMessage << "[WilsonFlow] Computing Cloverleaf energy density for step " << step << std::endl; meas_orig.push_back( {t, wflow.energyDensityCloverleaf(t,U)} ); }); //Setup adaptive Wilson flow WilsonFlowAdaptive wflow_ad(epsilon,maxTau,tolerance); wflow_ad.resetActions(); std::vector > meas_adaptive; wflow_ad.addMeasurement(1, [&wflow_ad,&meas_adaptive](int step, RealD t, const LatticeGaugeField &U){ std::cout << GridLogMessage << "[WilsonFlow] Computing Cloverleaf energy density for step " << step << std::endl; meas_adaptive.push_back( {t, wflow_ad.energyDensityCloverleaf(t,U)} ); }); //Run LatticeGaugeFieldD Vtmp(U.Grid()); wflow.smear(Vtmp, U); //basic smear Vtmp = Zero(); wflow_ad.smear(Vtmp, U); //Output values for plotting { std::ofstream out("wflow_t2E_orig.dat"); out.precision(16); for(auto const &e: meas_orig){ out << e.first << " " << e.second << std::endl; } } { std::ofstream out("wflow_t2E_adaptive.dat"); out.precision(16); for(auto const &e: meas_adaptive){ out << e.first << " " << e.second << std::endl; } } //Compare at times available with adaptive smearing for(int i=0;i