2016-01-02 14:51:32 +00:00
|
|
|
/*************************************************************************************
|
|
|
|
|
|
|
|
Grid physics library, www.github.com/paboyle/Grid
|
|
|
|
|
|
|
|
Source file: ./tests/Test_rect_force.cc
|
|
|
|
|
|
|
|
Copyright (C) 2015
|
|
|
|
|
|
|
|
Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
|
|
|
|
|
|
|
|
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 */
|
2016-07-07 22:31:07 +01:00
|
|
|
#include <Grid/Grid.h>
|
2015-12-28 16:38:31 +00:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace Grid;
|
2018-01-15 09:37:58 +00:00
|
|
|
;
|
2015-12-28 16:38:31 +00:00
|
|
|
|
2017-02-21 10:24:27 +00:00
|
|
|
|
2015-12-28 16:38:31 +00:00
|
|
|
|
|
|
|
int main (int argc, char ** argv)
|
|
|
|
{
|
|
|
|
Grid_init(&argc,&argv);
|
|
|
|
|
2018-02-24 22:19:28 +00:00
|
|
|
Coordinate latt_size = GridDefaultLatt();
|
|
|
|
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
|
|
|
Coordinate mpi_layout = GridDefaultMpi();
|
2015-12-28 16:38:31 +00:00
|
|
|
|
|
|
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
2017-06-22 08:14:34 +01:00
|
|
|
GridRedBlackCartesian RBGrid(&Grid);
|
2015-12-28 16:38:31 +00:00
|
|
|
|
|
|
|
int threads = GridThread::GetThreads();
|
|
|
|
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
|
|
|
|
|
|
|
std::vector<int> seeds({1,2,3,4});
|
|
|
|
|
|
|
|
GridParallelRNG pRNG(&Grid);
|
2017-04-01 16:29:40 +01:00
|
|
|
pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
2015-12-28 16:38:31 +00:00
|
|
|
|
|
|
|
LatticeGaugeField U(&Grid);
|
|
|
|
|
2020-10-07 18:07:00 +01:00
|
|
|
SU<Nc>::HotConfiguration(pRNG,U);
|
2015-12-28 16:38:31 +00:00
|
|
|
|
|
|
|
double beta = 1.0;
|
2019-02-24 15:21:19 +00:00
|
|
|
double c1 = -0.331;
|
2015-12-28 16:38:31 +00:00
|
|
|
|
2019-02-24 15:21:19 +00:00
|
|
|
IwasakiGaugeActionR Action(beta);
|
|
|
|
// PlaqPlusRectangleActionR Action(beta,c1);
|
2015-12-28 16:38:31 +00:00
|
|
|
// WilsonGaugeActionR Action(beta);
|
|
|
|
|
|
|
|
ComplexD S = Action.S(U);
|
|
|
|
|
|
|
|
// get the deriv of phidag MdagM phi with respect to "U"
|
|
|
|
LatticeGaugeField UdSdU(&Grid);
|
|
|
|
|
|
|
|
Action.deriv(U,UdSdU);
|
|
|
|
|
|
|
|
////////////////////////////////////
|
|
|
|
// Modify the gauge field a little
|
|
|
|
////////////////////////////////////
|
2019-07-19 05:28:26 +01:00
|
|
|
RealD dt = 0.002;
|
2015-12-28 16:38:31 +00:00
|
|
|
|
|
|
|
LatticeColourMatrix mommu(&Grid);
|
|
|
|
LatticeColourMatrix forcemu(&Grid);
|
|
|
|
LatticeGaugeField mom(&Grid);
|
|
|
|
LatticeGaugeField Uprime(&Grid);
|
|
|
|
|
|
|
|
for(int mu=0;mu<Nd;mu++){
|
|
|
|
|
2020-10-07 18:07:00 +01:00
|
|
|
SU<Nc>::GaussianFundamentalLieAlgebraMatrix(pRNG, mommu); // Traceless antihermitian momentum; gaussian in lie alg
|
2015-12-28 16:38:31 +00:00
|
|
|
|
|
|
|
PokeIndex<LorentzIndex>(mom,mommu,mu);
|
|
|
|
|
|
|
|
// fourth order exponential approx
|
2020-06-05 23:52:35 +01:00
|
|
|
autoView(Uprime_v, Uprime, CpuWrite);
|
|
|
|
autoView( U_v , U, CpuRead);
|
|
|
|
autoView( mom_v, mom, CpuRead);
|
2019-06-15 12:53:27 +01:00
|
|
|
thread_foreach(i,mom_v,{ // exp(pmu dt) * Umu
|
2018-03-04 16:40:11 +00:00
|
|
|
Uprime_v[i](mu) = U_v[i](mu) + mom_v[i](mu)*U_v[i](mu)*dt ;
|
2018-01-28 01:00:55 +00:00
|
|
|
});
|
2015-12-28 16:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ComplexD Sprime = Action.S(Uprime);
|
|
|
|
|
|
|
|
//////////////////////////////////////////////
|
|
|
|
// Use derivative to estimate dS
|
|
|
|
//////////////////////////////////////////////
|
|
|
|
|
2018-01-27 23:46:02 +00:00
|
|
|
LatticeComplex dS(&Grid); dS = Zero();
|
2015-12-28 16:38:31 +00:00
|
|
|
|
|
|
|
for(int mu=0;mu<Nd;mu++){
|
|
|
|
|
|
|
|
auto UdSdUmu = PeekIndex<LorentzIndex>(UdSdU,mu);
|
|
|
|
mommu = PeekIndex<LorentzIndex>(mom,mu);
|
|
|
|
|
|
|
|
// Update gauge action density
|
|
|
|
// U = exp(p dt) U
|
|
|
|
// dU/dt = p U
|
|
|
|
// so dSdt = trace( dUdt dSdU) = trace( p UdSdUmu )
|
|
|
|
|
|
|
|
dS = dS - trace(mommu*UdSdUmu)*dt*2.0;
|
|
|
|
|
|
|
|
}
|
2017-05-30 23:37:02 +01:00
|
|
|
ComplexD dSpred = sum(dS);
|
2015-12-28 16:38:31 +00:00
|
|
|
|
2019-02-24 15:21:19 +00:00
|
|
|
std::cout << std::setprecision(15)<<std::endl;
|
2015-12-28 16:38:31 +00:00
|
|
|
std::cout << GridLogMessage << " S "<<S<<std::endl;
|
|
|
|
std::cout << GridLogMessage << " Sprime "<<Sprime<<std::endl;
|
|
|
|
std::cout << GridLogMessage << "dS "<<Sprime-S<<std::endl;
|
|
|
|
std::cout << GridLogMessage << "pred dS "<< dSpred <<std::endl;
|
|
|
|
|
2017-05-06 00:46:31 +01:00
|
|
|
assert( fabs(real(Sprime-S-dSpred)) < 1.0e-2 ) ;
|
|
|
|
|
2015-12-28 16:38:31 +00:00
|
|
|
std::cout<< GridLogMessage << "Done" <<std::endl;
|
|
|
|
Grid_finalize();
|
|
|
|
}
|