2023-05-17 22:15:54 +01:00
|
|
|
/*
|
|
|
|
* Test_fatLinks.cc
|
|
|
|
*
|
|
|
|
* D. Clarke
|
|
|
|
*
|
|
|
|
* Test the various constructs used to make fat links.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <Grid/Grid.h>
|
2023-05-21 11:33:20 +01:00
|
|
|
#include <Grid/lattice/PaddedCell.h>
|
|
|
|
#include <Grid/stencil/GeneralLocalStencil.h>
|
2023-06-09 00:37:25 +01:00
|
|
|
#include <Grid/qcd/smearing/HISQSmearing.h>
|
2023-05-17 22:15:54 +01:00
|
|
|
using namespace Grid;
|
|
|
|
|
|
|
|
|
2023-05-21 11:33:20 +01:00
|
|
|
// Make the logger work like Python print()
|
|
|
|
template<typename ... Args>
|
|
|
|
inline std::string sjoin(Args&&... args) noexcept {
|
|
|
|
std::ostringstream msg;
|
|
|
|
(msg << ... << args);
|
|
|
|
return msg.str();
|
|
|
|
}
|
|
|
|
template <typename ... Args>
|
|
|
|
inline void Grid_log(Args&&... args) {
|
|
|
|
std::string msg = sjoin(std::forward<Args>(args)...);
|
|
|
|
std::cout << GridLogMessage << msg << std::endl;
|
|
|
|
}
|
2023-05-17 22:15:54 +01:00
|
|
|
|
2023-05-21 11:33:20 +01:00
|
|
|
struct fatParams: Serializable {
|
|
|
|
GRID_SERIALIZABLE_CLASS_MEMBERS(
|
|
|
|
fatParams,
|
|
|
|
std::string, conf_in,
|
|
|
|
std::string, conf_out);
|
2023-05-17 22:15:54 +01:00
|
|
|
|
2023-05-21 11:33:20 +01:00
|
|
|
template <class ReaderClass>
|
|
|
|
fatParams(Reader<ReaderClass>& Reader){
|
|
|
|
read(Reader, "parameters", *this);
|
2023-05-17 22:15:54 +01:00
|
|
|
}
|
2023-05-21 11:33:20 +01:00
|
|
|
};
|
|
|
|
|
2023-06-09 00:37:25 +01:00
|
|
|
//
|
|
|
|
// one method: input --> fat
|
|
|
|
// another : input --> long (naik)
|
|
|
|
// another : input --> unitarize
|
|
|
|
//
|
2023-05-17 22:15:54 +01:00
|
|
|
|
|
|
|
int main (int argc, char **argv)
|
|
|
|
{
|
2023-06-12 23:55:44 +01:00
|
|
|
// Initialize the Grid
|
2023-05-21 11:33:20 +01:00
|
|
|
Grid_init(&argc,&argv);
|
2023-05-17 22:15:54 +01:00
|
|
|
Coordinate latt_size = GridDefaultLatt();
|
2023-05-21 11:33:20 +01:00
|
|
|
Coordinate simd_layout = GridDefaultSimd(Nd,vComplexD::Nsimd());
|
|
|
|
Coordinate mpi_layout = GridDefaultMpi();
|
|
|
|
Grid_log("mpi = ",mpi_layout);
|
|
|
|
Grid_log("simd = ",simd_layout);
|
|
|
|
Grid_log("latt = ",latt_size);
|
|
|
|
GridCartesian GRID(latt_size,simd_layout,mpi_layout);
|
|
|
|
|
2023-06-12 23:55:44 +01:00
|
|
|
// Instantiate the LatticeGaugeField objects holding thin (Umu) and fat (U_smr) links
|
2023-05-21 11:33:20 +01:00
|
|
|
LatticeGaugeField Umu(&GRID);
|
2023-06-09 00:37:25 +01:00
|
|
|
LatticeGaugeField U_smr(&GRID);
|
2023-06-12 23:55:44 +01:00
|
|
|
|
|
|
|
// Read in the parameter file
|
|
|
|
XmlReader Reader("fatParams.xml",false, "grid");
|
|
|
|
fatParams param(Reader);
|
2023-05-21 11:33:20 +01:00
|
|
|
FieldMetaData header;
|
2023-06-12 23:55:44 +01:00
|
|
|
|
|
|
|
// Read the configuration into Umu
|
2023-05-21 11:33:20 +01:00
|
|
|
NerscIO::readConfiguration(Umu, header, param.conf_in);
|
|
|
|
|
2023-06-12 23:55:44 +01:00
|
|
|
// Smear Umu and store result in U_smr
|
2023-06-20 22:37:54 +01:00
|
|
|
Smear_HISQ_fat<LatticeGaugeField> hisq_fat(&GRID,1/8.,0.,1/16.,1/64.,1/384.,0.);
|
2023-06-09 23:27:45 +01:00
|
|
|
hisq_fat.smear(U_smr,Umu);
|
2023-05-17 22:15:54 +01:00
|
|
|
|
2023-06-09 00:37:25 +01:00
|
|
|
NerscIO::writeConfiguration(U_smr,param.conf_out,"HISQ");
|
2023-05-17 22:15:54 +01:00
|
|
|
|
2023-06-20 22:37:54 +01:00
|
|
|
// Test a C-style instantiation
|
2023-06-12 23:55:44 +01:00
|
|
|
double path_coeff[6] = {1, 2, 3, 4, 5, 6};
|
2023-06-20 22:37:54 +01:00
|
|
|
Smear_HISQ_fat<LatticeGaugeField> hisq_fat_Cstyle(&GRID,path_coeff);
|
2023-06-12 23:55:44 +01:00
|
|
|
|
2023-05-17 22:15:54 +01:00
|
|
|
Grid_finalize();
|
|
|
|
}
|