mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-13 04:37:05 +01:00
Merge remote-tracking branch 'upstream/feature/hadrons' into feature/hadrons
This commit is contained in:
@ -79,7 +79,7 @@ int main (int argc, char ** argv)
|
||||
std::cout <<GridLogMessage<<"** Writing out ILDG conf *********"<<std::endl;
|
||||
std::cout <<GridLogMessage<<"**************************************"<<std::endl;
|
||||
std::string file("./ckpoint_ildg.4000");
|
||||
IldgWriter _IldgWriter;
|
||||
IldgWriter _IldgWriter(Fine.IsBoss());
|
||||
_IldgWriter.open(file);
|
||||
_IldgWriter.writeConfiguration(Umu,4000,std::string("dummy_ildg_LFN"),std::string("dummy_config"));
|
||||
_IldgWriter.close();
|
||||
|
@ -120,6 +120,8 @@ void tensorConvTestFn(GridSerialRNG &rng, const std::string label)
|
||||
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
Grid_init(&argc,&argv);
|
||||
|
||||
GridSerialRNG rng;
|
||||
|
||||
rng.SeedFixedIntegers(std::vector<int>({42,10,81,9}));
|
||||
|
@ -103,6 +103,33 @@ int main (int argc, char ** argv)
|
||||
|
||||
std::cout << "Diff between mixed and regular CG: " << diff << std::endl;
|
||||
|
||||
#ifdef HAVE_LIME
|
||||
if( GridCmdOptionExists(argv,argv+argc,"--checksums") ){
|
||||
|
||||
std::string file1("./Propagator1");
|
||||
std::string file2("./Propagator2");
|
||||
emptyUserRecord record;
|
||||
uint32_t nersc_csum;
|
||||
uint32_t scidac_csuma;
|
||||
uint32_t scidac_csumb;
|
||||
typedef SpinColourVectorD FermionD;
|
||||
typedef vSpinColourVectorD vFermionD;
|
||||
|
||||
BinarySimpleMunger<FermionD,FermionD> munge;
|
||||
std::string format = getFormatString<vFermionD>();
|
||||
|
||||
BinaryIO::writeLatticeObject<vFermionD,FermionD>(result_o,file1,munge, 0, format,
|
||||
nersc_csum,scidac_csuma,scidac_csumb);
|
||||
|
||||
std::cout << " Mixed checksums "<<std::hex << scidac_csuma << " "<<scidac_csumb<<std::endl;
|
||||
|
||||
BinaryIO::writeLatticeObject<vFermionD,FermionD>(result_o_2,file1,munge, 0, format,
|
||||
nersc_csum,scidac_csuma,scidac_csumb);
|
||||
|
||||
std::cout << " CG checksums "<<std::hex << scidac_csuma << " "<<scidac_csumb<<std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Grid_finalize();
|
||||
}
|
||||
|
@ -393,7 +393,6 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
random(Foo);
|
||||
*/
|
||||
lex_sites(Foo);
|
||||
|
||||
Integer mm[4];
|
||||
mm[0] = 1;
|
||||
|
123
tests/forces/Test_gp_plaq_force.cc
Normal file
123
tests/forces/Test_gp_plaq_force.cc
Normal file
@ -0,0 +1,123 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_gp_rect_force.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: paboyle <paboyle@ph.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 */
|
||||
#include <Grid/Grid.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Grid;
|
||||
using namespace Grid::QCD;
|
||||
|
||||
int main (int argc, char ** argv)
|
||||
{
|
||||
Grid_init(&argc,&argv);
|
||||
|
||||
std::vector<int> latt_size = GridDefaultLatt();
|
||||
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||
|
||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||
GridRedBlackCartesian RBGrid(&Grid);
|
||||
|
||||
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);
|
||||
pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||
|
||||
LatticeGaugeField U(&Grid);
|
||||
|
||||
SU3::HotConfiguration(pRNG,U);
|
||||
|
||||
double beta = 1.0;
|
||||
double c1 = 0.331;
|
||||
|
||||
//ConjugatePlaqPlusRectangleActionR Action(beta,c1);
|
||||
ConjugateWilsonGaugeActionR Action(beta);
|
||||
//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
|
||||
////////////////////////////////////
|
||||
RealD dt = 0.0001;
|
||||
|
||||
LatticeColourMatrix mommu(&Grid);
|
||||
LatticeColourMatrix forcemu(&Grid);
|
||||
LatticeGaugeField mom(&Grid);
|
||||
LatticeGaugeField Uprime(&Grid);
|
||||
|
||||
for(int mu=0;mu<Nd;mu++){
|
||||
|
||||
SU3::GaussianFundamentalLieAlgebraMatrix(pRNG, mommu); // Traceless antihermitian momentum; gaussian in lie alg
|
||||
|
||||
PokeIndex<LorentzIndex>(mom,mommu,mu);
|
||||
|
||||
// fourth order exponential approx
|
||||
parallel_for(auto i=mom.begin();i<mom.end();i++){ // exp(pmu dt) * Umu
|
||||
Uprime[i](mu) = U[i](mu) + mom[i](mu)*U[i](mu)*dt ;
|
||||
}
|
||||
}
|
||||
|
||||
ComplexD Sprime = Action.S(Uprime);
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// Use derivative to estimate dS
|
||||
//////////////////////////////////////////////
|
||||
|
||||
LatticeComplex dS(&Grid); dS = zero;
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
ComplexD dSpred = sum(dS);
|
||||
|
||||
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;
|
||||
assert( fabs(real(Sprime-S-dSpred)) < 1.0e-2 ) ;
|
||||
std::cout<< GridLogMessage << "Done" <<std::endl;
|
||||
Grid_finalize();
|
||||
}
|
@ -27,6 +27,7 @@
|
||||
*******************************************************************************/
|
||||
|
||||
#include <Grid/Hadrons/Application.hpp>
|
||||
#include <Grid/Hadrons/Modules.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Hadrons;
|
||||
|
@ -26,6 +26,7 @@
|
||||
*******************************************************************************/
|
||||
|
||||
#include <Grid/Hadrons/Application.hpp>
|
||||
#include <Grid/Hadrons/Modules.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Hadrons;
|
||||
|
@ -1,169 +0,0 @@
|
||||
/*******************************************************************************
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: tests/hadrons/Test_hadrons_spectrum.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Antonin Portelli <antonin.portelli@me.com>
|
||||
|
||||
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.
|
||||
*******************************************************************************/
|
||||
|
||||
#include <Grid/Hadrons/Application.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Hadrons;
|
||||
|
||||
|
||||
BEGIN_HADRONS_NAMESPACE
|
||||
BEGIN_MODULE_NAMESPACE(MFermion)
|
||||
MODULE_REGISTER_NS(GaugeProp2AS, TGaugeProp<WilsonTwoIndexAntiSymmetricImplR>, MFermion);
|
||||
END_MODULE_NAMESPACE
|
||||
BEGIN_MODULE_NAMESPACE(MSource)
|
||||
MODULE_REGISTER_NS(Point2AS, TPoint<WilsonTwoIndexAntiSymmetricImplR>, MSource);
|
||||
END_MODULE_NAMESPACE
|
||||
BEGIN_MODULE_NAMESPACE(MContraction)
|
||||
MODULE_REGISTER_NS(Meson2AS, ARG(TMeson<WilsonTwoIndexAntiSymmetricImplR, WilsonTwoIndexAntiSymmetricImplR>), MContraction);
|
||||
// MODULE_REGISTER_NS(BaryonMultirep, ARG(TBaryon<FIMPL, FIMPL, FIMPL>), MContraction);
|
||||
END_MODULE_NAMESPACE
|
||||
BEGIN_MODULE_NAMESPACE(MSink)
|
||||
MODULE_REGISTER_NS(ScalarPoint2AS, TPoint<WilsonTwoIndexAntiSymmetricImplR>, MSink);
|
||||
END_MODULE_NAMESPACE
|
||||
BEGIN_MODULE_NAMESPACE(MSolver)
|
||||
MODULE_REGISTER_NS(RBPrecCG2AS, TRBPrecCG<WilsonTwoIndexAntiSymmetricImplR>, MSolver);
|
||||
END_MODULE_NAMESPACE
|
||||
BEGIN_MODULE_NAMESPACE(MAction)
|
||||
MODULE_REGISTER_NS(WilsonClover2AS, TWilsonClover<WilsonTwoIndexAntiSymmetricImplR>, MAction);
|
||||
END_MODULE_NAMESPACE
|
||||
END_HADRONS_NAMESPACE
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// initialization //////////////////////////////////////////////////////////
|
||||
Grid_init(&argc, &argv);
|
||||
HadronsLogError.Active(GridLogError.isActive());
|
||||
HadronsLogWarning.Active(GridLogWarning.isActive());
|
||||
HadronsLogMessage.Active(GridLogMessage.isActive());
|
||||
HadronsLogIterative.Active(GridLogIterative.isActive());
|
||||
HadronsLogDebug.Active(GridLogDebug.isActive());
|
||||
LOG(Message) << "Grid initialized" << std::endl;
|
||||
// run setup ///////////////////////////////////////////////////////////////
|
||||
Application application;
|
||||
std::vector<std::string> flavour = {"l", "s"};
|
||||
std::vector<double> mass = {-0.01, -0.04};
|
||||
double csw = 1.0;
|
||||
// global parameters
|
||||
Application::GlobalPar globalPar;
|
||||
globalPar.trajCounter.start = 1500;
|
||||
globalPar.trajCounter.end = 1520;
|
||||
globalPar.trajCounter.step = 20;
|
||||
globalPar.seed = "1 2 3 4";
|
||||
application.setPar(globalPar);
|
||||
// gauge field
|
||||
application.createModule<MGauge::Unit>("gauge");
|
||||
MSource::Point2AS::Par ptPar;
|
||||
ptPar.position = "0 0 0 0";
|
||||
application.createModule<MSource::Point2AS>("pt", ptPar);
|
||||
// sink
|
||||
MSink::ScalarPoint2AS::Par sinkPar;
|
||||
sinkPar.mom = "0 0 0";
|
||||
application.createModule<MSink::ScalarPoint2AS>("sink", sinkPar);
|
||||
|
||||
// set fermion boundary conditions to be periodic space, antiperiodic time.
|
||||
std::string boundary = "1 1 1 -1";
|
||||
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
{
|
||||
// actions
|
||||
MAction::WilsonClover2AS::Par actionPar;
|
||||
actionPar.gauge = "gauge";
|
||||
actionPar.mass = mass[i];
|
||||
actionPar.csw_r = csw;
|
||||
actionPar.csw_t = csw;
|
||||
actionPar.clover_anisotropy.isAnisotropic= false;
|
||||
actionPar.clover_anisotropy.t_direction = Nd-1 ;
|
||||
actionPar.clover_anisotropy.xi_0 = 1.0 ;
|
||||
actionPar.clover_anisotropy.nu = 1.0 ;
|
||||
actionPar.boundary = boundary;
|
||||
application.createModule<MAction::WilsonClover2AS>("WilsonClover2AS_" + flavour[i], actionPar);
|
||||
|
||||
// solvers
|
||||
MSolver::RBPrecCG2AS::Par solverPar;
|
||||
solverPar.action = "WilsonClover2AS_" + flavour[i];
|
||||
solverPar.residual = 1.0e-8;
|
||||
solverPar.maxIteration = 10000;
|
||||
application.createModule<MSolver::RBPrecCG2AS>("CG_" + flavour[i],
|
||||
solverPar);
|
||||
|
||||
// propagators
|
||||
MFermion::GaugeProp2AS::Par quarkPar;
|
||||
quarkPar.solver = "CG_" + flavour[i];
|
||||
quarkPar.source = "pt";
|
||||
application.createModule<MFermion::GaugeProp2AS>("Qpt_" + flavour[i], quarkPar);
|
||||
quarkPar.source = "z2";
|
||||
application.createModule<MFermion::GaugeProp2AS>("QZ2_" + flavour[i], quarkPar);
|
||||
}
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
for (unsigned int j = i; j < flavour.size(); ++j)
|
||||
{
|
||||
MContraction::Meson2AS::Par mesPar;
|
||||
|
||||
mesPar.output = "mesons2AS/pt_" + flavour[i] + flavour[j];
|
||||
mesPar.q1 = "Qpt_" + flavour[i];
|
||||
mesPar.q2 = "Qpt_" + flavour[j];
|
||||
mesPar.gammas = "all";
|
||||
mesPar.sink = "sink";
|
||||
application.createModule<MContraction::Meson2AS>("meson_pt_"
|
||||
+ flavour[i] + flavour[j],
|
||||
mesPar);
|
||||
|
||||
// mesPar.output = "mesons2AS/Z2_" + flavour[i] + flavour[j];
|
||||
// mesPar.q1 = "QZ2_" + flavour[i];
|
||||
// mesPar.q2 = "QZ2_" + flavour[j];
|
||||
// mesPar.gammas = "all";
|
||||
// mesPar.sink = "sink";
|
||||
// application.createModule<MContraction::Meson2AS>("meson_Z2_"
|
||||
// + flavour[i] + flavour[j],
|
||||
// mesPar);
|
||||
}
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
for (unsigned int j = i; j < flavour.size(); ++j)
|
||||
for (unsigned int k = j; k < flavour.size(); ++k)
|
||||
{
|
||||
MContraction::Baryon::Par barPar;
|
||||
|
||||
barPar.output = "baryons/pt_" + flavour[i] + flavour[j] + flavour[k];
|
||||
barPar.q1 = "Qpt_" + flavour[i];
|
||||
barPar.q2 = "Qpt_" + flavour[j];
|
||||
barPar.q3 = "Qpt_" + flavour[k];
|
||||
application.createModule<MContraction::Baryon>(
|
||||
"baryon_pt_" + flavour[i] + flavour[j] + flavour[k], barPar);
|
||||
}
|
||||
|
||||
// execution
|
||||
application.saveParameterFile("spectrum.xml");
|
||||
application.run();
|
||||
|
||||
// epilogue
|
||||
LOG(Message) << "Grid is finalizing now" << std::endl;
|
||||
Grid_finalize();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -26,6 +26,7 @@
|
||||
*******************************************************************************/
|
||||
|
||||
#include <Grid/Hadrons/Application.hpp>
|
||||
#include <Grid/Hadrons/Modules.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Hadrons;
|
||||
|
@ -26,7 +26,6 @@
|
||||
*******************************************************************************/
|
||||
|
||||
#include "Test_hadrons.hpp"
|
||||
#include <Grid/Hadrons/Modules/MFermion/GaugeProp.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace QCD;
|
||||
|
@ -26,6 +26,7 @@
|
||||
*******************************************************************************/
|
||||
|
||||
#include <Grid/Hadrons/Application.hpp>
|
||||
#include <Grid/Hadrons/Modules.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Hadrons;
|
||||
|
@ -26,6 +26,7 @@
|
||||
*******************************************************************************/
|
||||
|
||||
#include <Grid/Hadrons/Application.hpp>
|
||||
#include <Grid/Hadrons/Modules.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Hadrons;
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
{
|
||||
assert(this->subspace.size()==nbasis);
|
||||
emptyUserRecord record;
|
||||
Grid::QCD::ScidacWriter WR;
|
||||
Grid::QCD::ScidacWriter WR(this->_FineGrid->IsBoss());
|
||||
WR.open(evecs_file);
|
||||
for(int k=0;k<nbasis;k++) {
|
||||
WR.writeScidacFieldRecord(this->subspace[k],record);
|
||||
@ -96,7 +96,7 @@ public:
|
||||
{
|
||||
int n = this->evec_coarse.size();
|
||||
emptyUserRecord record;
|
||||
Grid::QCD::ScidacWriter WR;
|
||||
Grid::QCD::ScidacWriter WR(this->_CoarseGrid->IsBoss());
|
||||
WR.open(evecs_file);
|
||||
for(int k=0;k<n;k++) {
|
||||
WR.writeScidacFieldRecord(this->evec_coarse[k],record);
|
||||
@ -180,7 +180,6 @@ int main (int argc, char ** argv) {
|
||||
GridCartesian * CoarseGrid4 = SpaceTimeGrid::makeFourDimGrid(coarseLatt, GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi());
|
||||
GridRedBlackCartesian * CoarseGrid4rb = SpaceTimeGrid::makeFourDimRedBlackGrid(CoarseGrid4);
|
||||
GridCartesian * CoarseGrid5 = SpaceTimeGrid::makeFiveDimGrid(cLs,CoarseGrid4);
|
||||
GridRedBlackCartesian * CoarseGrid5rb = SpaceTimeGrid::makeFourDimRedBlackGrid(CoarseGrid5);
|
||||
|
||||
// Gauge field
|
||||
LatticeGaugeField Umu(UGrid);
|
||||
@ -206,7 +205,7 @@ int main (int argc, char ** argv) {
|
||||
|
||||
const int nbasis= 60;
|
||||
assert(nbasis==Ns1);
|
||||
LocalCoherenceLanczosScidac<vSpinColourVector,vTComplex,nbasis> _LocalCoherenceLanczos(FrbGrid,CoarseGrid5rb,HermOp,Odd);
|
||||
LocalCoherenceLanczosScidac<vSpinColourVector,vTComplex,nbasis> _LocalCoherenceLanczos(FrbGrid,CoarseGrid5,HermOp,Odd);
|
||||
std::cout << GridLogMessage << "Constructed LocalCoherenceLanczos" << std::endl;
|
||||
|
||||
assert( (Params.doFine)||(Params.doFineRead));
|
||||
|
@ -114,7 +114,7 @@ int main (int argc, char ** argv)
|
||||
|
||||
{
|
||||
FGrid->Barrier();
|
||||
ScidacWriter _ScidacWriter;
|
||||
ScidacWriter _ScidacWriter(FGrid->IsBoss());
|
||||
_ScidacWriter.open(file);
|
||||
std::cout << GridLogMessage << "****************************************************************** "<<std::endl;
|
||||
std::cout << GridLogMessage << " Writing out gauge field "<<std::endl;
|
||||
@ -144,7 +144,7 @@ int main (int argc, char ** argv)
|
||||
std::cout << GridLogMessage << "****************************************************************** "<<std::endl;
|
||||
|
||||
std::stringstream filefn; filefn << filef << "."<< n;
|
||||
ScidacWriter _ScidacWriter;
|
||||
ScidacWriter _ScidacWriter(FGrid->IsBoss());
|
||||
_ScidacWriter.open(filefn.str());
|
||||
_ScidacWriter.writeScidacFieldRecord(src[n],record);
|
||||
_ScidacWriter.close();
|
||||
|
Reference in New Issue
Block a user