mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-12 20:27:06 +01:00
Merge remote-tracking branch 'LupoA/develop' into LupoA-develop
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
SUBDIRS = . core forces hmc solver debug smearing IO lanczos
|
||||
SUBDIRS = . core forces hmc solver debug smearing IO lanczos sp2n
|
||||
|
||||
if BUILD_CHROMA_REGRESSION
|
||||
SUBDIRS+= qdpxx
|
||||
|
@ -218,9 +218,9 @@ void runBenchmark(int* argc, char*** argv) {
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
Grid_init(&argc, &argv);
|
||||
|
||||
#if Nc==3
|
||||
runBenchmark<vComplexD>(&argc, &argv);
|
||||
runBenchmark<vComplexF>(&argc, &argv);
|
||||
|
||||
#endif
|
||||
Grid_finalize();
|
||||
}
|
||||
|
@ -29,13 +29,14 @@ See the full license in the file "LICENSE" in the top level distribution
|
||||
directory
|
||||
*************************************************************************************/
|
||||
/* END LEGAL */
|
||||
|
||||
#include <Grid/Grid.h>
|
||||
|
||||
#include <Grid/qcd/utils/CovariantCshift.h>
|
||||
|
||||
#include <Grid/qcd/utils/SUn.h>
|
||||
#include <Grid/qcd/utils/GaugeGroup.h>
|
||||
#include <Grid/qcd/utils/SUnAdjoint.h>
|
||||
#include <Grid/qcd/utils/SUnTwoIndex.h>
|
||||
#include <Grid/qcd/utils/GaugeGroupTwoIndex.h>
|
||||
|
||||
#include <Grid/qcd/representations/adjoint.h>
|
||||
#include <Grid/qcd/representations/two_index.h>
|
||||
@ -43,7 +44,6 @@ directory
|
||||
|
||||
using namespace std;
|
||||
using namespace Grid;
|
||||
;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
Grid_init(&argc, &argv);
|
||||
@ -62,20 +62,17 @@ int main(int argc, char** argv) {
|
||||
SU2::printGenerators();
|
||||
std::cout << "Dimension of adjoint representation: "<< SU2Adjoint::Dimension << std::endl;
|
||||
|
||||
// guard as this code fails to compile for Nc != 3
|
||||
#if 1
|
||||
|
||||
std::cout << " Printing Adjoint Generators"<< std::endl;
|
||||
|
||||
|
||||
SU2Adjoint::printGenerators();
|
||||
SU2::testGenerators();
|
||||
SU2Adjoint::testGenerators();
|
||||
|
||||
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
std::cout << GridLogMessage << "* Generators for SU(Nc" << std::endl;
|
||||
<< std::endl;
|
||||
std::cout << GridLogMessage << "* Generators for SU(3)" << std::endl;
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
<< std::endl;
|
||||
SU3::printGenerators();
|
||||
std::cout << "Dimension of adjoint representation: "<< SU3Adjoint::Dimension << std::endl;
|
||||
SU3Adjoint::printGenerators();
|
||||
@ -94,22 +91,22 @@ int main(int argc, char** argv) {
|
||||
// Projectors
|
||||
GridParallelRNG gridRNG(grid);
|
||||
gridRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||
SU3Adjoint::LatticeAdjMatrix Gauss(grid);
|
||||
SU3::LatticeAlgebraVector ha(grid);
|
||||
SU3::LatticeAlgebraVector hb(grid);
|
||||
SU_Adjoint<Nc>::LatticeAdjMatrix Gauss(grid);
|
||||
SU<Nc>::LatticeAlgebraVector ha(grid);
|
||||
SU<Nc>::LatticeAlgebraVector hb(grid);
|
||||
random(gridRNG,Gauss);
|
||||
|
||||
std::cout << GridLogMessage << "Start projectOnAlgebra" << std::endl;
|
||||
SU3Adjoint::projectOnAlgebra(ha, Gauss);
|
||||
SU_Adjoint<Nc>::projectOnAlgebra(ha, Gauss);
|
||||
std::cout << GridLogMessage << "end projectOnAlgebra" << std::endl;
|
||||
std::cout << GridLogMessage << "Start projector" << std::endl;
|
||||
SU3Adjoint::projector(hb, Gauss);
|
||||
SU_Adjoint<Nc>::projector(hb, Gauss);
|
||||
std::cout << GridLogMessage << "end projector" << std::endl;
|
||||
|
||||
std::cout << GridLogMessage << "ReStart projector" << std::endl;
|
||||
SU3Adjoint::projector(hb, Gauss);
|
||||
SU_Adjoint<Nc>::projector(hb, Gauss);
|
||||
std::cout << GridLogMessage << "end projector" << std::endl;
|
||||
SU3::LatticeAlgebraVector diff = ha -hb;
|
||||
SU<Nc>::LatticeAlgebraVector diff = ha -hb;
|
||||
std::cout << GridLogMessage << "Difference: " << norm2(diff) << std::endl;
|
||||
|
||||
|
||||
@ -119,17 +116,17 @@ int main(int argc, char** argv) {
|
||||
// AdjointRepresentation has the predefined number of colours Nc
|
||||
// Representations<FundamentalRepresentation, AdjointRepresentation, TwoIndexSymmetricRepresentation> RepresentationTypes(grid);
|
||||
LatticeGaugeField U(grid), V(grid);
|
||||
SU3::HotConfiguration<LatticeGaugeField>(gridRNG, U);
|
||||
SU3::HotConfiguration<LatticeGaugeField>(gridRNG, V);
|
||||
|
||||
SU<Nc>::HotConfiguration<LatticeGaugeField>(gridRNG, U);
|
||||
SU<Nc>::HotConfiguration<LatticeGaugeField>(gridRNG, V);
|
||||
|
||||
// Adjoint representation
|
||||
// Test group structure
|
||||
// (U_f * V_f)_r = U_r * V_r
|
||||
LatticeGaugeField UV(grid);
|
||||
UV = Zero();
|
||||
for (int mu = 0; mu < Nd; mu++) {
|
||||
SU3::LatticeMatrix Umu = peekLorentz(U,mu);
|
||||
SU3::LatticeMatrix Vmu = peekLorentz(V,mu);
|
||||
SU<Nc>::LatticeMatrix Umu = peekLorentz(U,mu);
|
||||
SU<Nc>::LatticeMatrix Vmu = peekLorentz(V,mu);
|
||||
pokeLorentz(UV,Umu*Vmu, mu);
|
||||
}
|
||||
|
||||
@ -151,6 +148,7 @@ int main(int argc, char** argv) {
|
||||
pokeLorentz(UrVr,Urmu*Vrmu, mu);
|
||||
}
|
||||
|
||||
#if Nc==3
|
||||
typedef typename SU_Adjoint<Nc>::AMatrix AdjointMatrix;
|
||||
typename AdjointRep<Nc>::LatticeField Diff_check = UVr - UrVr;
|
||||
std::cout << GridLogMessage << "Group structure SU("<<Nc<<") check difference (Adjoint representation) : " << norm2(Diff_check) << std::endl;
|
||||
@ -176,19 +174,19 @@ int main(int argc, char** argv) {
|
||||
assert(abs( (2.0*tr1-tr2) ) < 1.0e-7);
|
||||
std::cout << "------------------"<<std::endl;
|
||||
}}}
|
||||
|
||||
#endif
|
||||
// Check correspondence of algebra and group transformations
|
||||
// Create a random vector
|
||||
SU3::LatticeAlgebraVector h_adj(grid);
|
||||
SU<Nc>::LatticeAlgebraVector h_adj(grid);
|
||||
typename AdjointRep<Nc>::LatticeMatrix Ar(grid);
|
||||
random(gridRNG,h_adj);
|
||||
h_adj = real(h_adj);
|
||||
SU_Adjoint<Nc>::AdjointLieAlgebraMatrix(h_adj,Ar);
|
||||
|
||||
// Re-extract h_adj
|
||||
SU3::LatticeAlgebraVector h_adj2(grid);
|
||||
SU<Nc>::LatticeAlgebraVector h_adj2(grid);
|
||||
SU_Adjoint<Nc>::projectOnAlgebra(h_adj2, Ar);
|
||||
SU3::LatticeAlgebraVector h_diff = h_adj - h_adj2;
|
||||
SU<Nc>::LatticeAlgebraVector h_diff = h_adj - h_adj2;
|
||||
std::cout << GridLogMessage << "Projections structure check vector difference (Adjoint representation) : " << norm2(h_diff) << std::endl;
|
||||
|
||||
// Exponentiate
|
||||
@ -210,14 +208,14 @@ int main(int argc, char** argv) {
|
||||
<< std::endl;
|
||||
|
||||
// Construct the fundamental matrix in the group
|
||||
SU3::LatticeMatrix Af(grid);
|
||||
SU3::FundamentalLieAlgebraMatrix(h_adj,Af);
|
||||
SU3::LatticeMatrix Ufund(grid);
|
||||
SU<Nc>::LatticeMatrix Af(grid);
|
||||
SU<Nc>::FundamentalLieAlgebraMatrix(h_adj,Af);
|
||||
SU<Nc>::LatticeMatrix Ufund(grid);
|
||||
Ufund = expMat(Af, 1.0, 16);
|
||||
// Check unitarity
|
||||
SU3::LatticeMatrix uno_f(grid);
|
||||
SU<Nc>::LatticeMatrix uno_f(grid);
|
||||
uno_f = 1.0;
|
||||
SU3::LatticeMatrix UnitCheck(grid);
|
||||
SU<Nc>::LatticeMatrix UnitCheck(grid);
|
||||
UnitCheck = Ufund * adj(Ufund) - uno_f;
|
||||
std::cout << GridLogMessage << "unitarity check 1: " << norm2(UnitCheck)
|
||||
<< std::endl;
|
||||
@ -280,20 +278,20 @@ int main(int argc, char** argv) {
|
||||
std::cout << GridLogMessage << "Test for the Two Index Symmetric projectors"
|
||||
<< std::endl;
|
||||
// Projectors
|
||||
SU3TwoIndexSymm::LatticeTwoIndexMatrix Gauss2(grid);
|
||||
SU_TwoIndex<Nc, Symmetric>::LatticeTwoIndexMatrix Gauss2(grid);
|
||||
random(gridRNG,Gauss2);
|
||||
|
||||
std::cout << GridLogMessage << "Start projectOnAlgebra" << std::endl;
|
||||
SU3TwoIndexSymm::projectOnAlgebra(ha, Gauss2);
|
||||
SU_TwoIndex<Nc, Symmetric>::projectOnAlgebra(ha, Gauss2);
|
||||
std::cout << GridLogMessage << "end projectOnAlgebra" << std::endl;
|
||||
std::cout << GridLogMessage << "Start projector" << std::endl;
|
||||
SU3TwoIndexSymm::projector(hb, Gauss2);
|
||||
SU_TwoIndex<Nc, Symmetric>::projector(hb, Gauss2);
|
||||
std::cout << GridLogMessage << "end projector" << std::endl;
|
||||
|
||||
std::cout << GridLogMessage << "ReStart projector" << std::endl;
|
||||
SU3TwoIndexSymm::projector(hb, Gauss2);
|
||||
SU_TwoIndex<Nc, Symmetric>::projector(hb, Gauss2);
|
||||
std::cout << GridLogMessage << "end projector" << std::endl;
|
||||
SU3::LatticeAlgebraVector diff2 = ha - hb;
|
||||
SU<Nc>::LatticeAlgebraVector diff2 = ha - hb;
|
||||
std::cout << GridLogMessage << "Difference: " << norm2(diff) << std::endl;
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
@ -304,20 +302,20 @@ int main(int argc, char** argv) {
|
||||
std::cout << GridLogMessage << "Test for the Two index anti-Symmetric projectors"
|
||||
<< std::endl;
|
||||
// Projectors
|
||||
SU3TwoIndexAntiSymm::LatticeTwoIndexMatrix Gauss2a(grid);
|
||||
SU_TwoIndex<Nc, AntiSymmetric>::LatticeTwoIndexMatrix Gauss2a(grid);
|
||||
random(gridRNG,Gauss2a);
|
||||
|
||||
std::cout << GridLogMessage << "Start projectOnAlgebra" << std::endl;
|
||||
SU3TwoIndexAntiSymm::projectOnAlgebra(ha, Gauss2a);
|
||||
SU_TwoIndex<Nc, AntiSymmetric>::projectOnAlgebra(ha, Gauss2a);
|
||||
std::cout << GridLogMessage << "end projectOnAlgebra" << std::endl;
|
||||
std::cout << GridLogMessage << "Start projector" << std::endl;
|
||||
SU3TwoIndexAntiSymm::projector(hb, Gauss2a);
|
||||
SU_TwoIndex<Nc, AntiSymmetric>::projector(hb, Gauss2a);
|
||||
std::cout << GridLogMessage << "end projector" << std::endl;
|
||||
|
||||
std::cout << GridLogMessage << "ReStart projector" << std::endl;
|
||||
SU3TwoIndexAntiSymm::projector(hb, Gauss2a);
|
||||
SU_TwoIndex<Nc, AntiSymmetric>::projector(hb, Gauss2a);
|
||||
std::cout << GridLogMessage << "end projector" << std::endl;
|
||||
SU3::LatticeAlgebraVector diff2a = ha - hb;
|
||||
SU<Nc>::LatticeAlgebraVector diff2a = ha - hb;
|
||||
std::cout << GridLogMessage << "Difference: " << norm2(diff2a) << std::endl;
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
@ -326,55 +324,59 @@ int main(int argc, char** argv) {
|
||||
std::cout << GridLogMessage << "Two index Symmetric: Checking Group Structure"
|
||||
<< std::endl;
|
||||
// Testing HMC representation classes
|
||||
TwoIndexRep< Nc, Symmetric > TIndexRep(grid);
|
||||
TwoIndexRep< Nc, Symmetric> TIndexRep(grid);
|
||||
|
||||
// Test group structure
|
||||
// (U_f * V_f)_r = U_r * V_r
|
||||
LatticeGaugeField U2(grid), V2(grid);
|
||||
SU3::HotConfiguration<LatticeGaugeField>(gridRNG, U2);
|
||||
SU3::HotConfiguration<LatticeGaugeField>(gridRNG, V2);
|
||||
|
||||
|
||||
SU<Nc>::HotConfiguration<LatticeGaugeField>(gridRNG, U2);
|
||||
SU<Nc>::HotConfiguration<LatticeGaugeField>(gridRNG, V2);
|
||||
|
||||
LatticeGaugeField UV2(grid);
|
||||
UV2 = Zero();
|
||||
for (int mu = 0; mu < Nd; mu++) {
|
||||
SU3::LatticeMatrix Umu2 = peekLorentz(U2,mu);
|
||||
SU3::LatticeMatrix Vmu2 = peekLorentz(V2,mu);
|
||||
SU<Nc>::LatticeMatrix Umu2 = peekLorentz(U2,mu);
|
||||
SU<Nc>::LatticeMatrix Vmu2 = peekLorentz(V2,mu);
|
||||
pokeLorentz(UV2,Umu2*Vmu2, mu);
|
||||
}
|
||||
|
||||
TIndexRep.update_representation(UV2);
|
||||
|
||||
typename TwoIndexRep< Nc, Symmetric >::LatticeField UVr2 = TIndexRep.U; // (U_f * V_f)_r
|
||||
|
||||
|
||||
TIndexRep.update_representation(U2);
|
||||
typename TwoIndexRep< Nc, Symmetric >::LatticeField Ur2 = TIndexRep.U; // U_r
|
||||
|
||||
|
||||
TIndexRep.update_representation(V2);
|
||||
typename TwoIndexRep< Nc, Symmetric >::LatticeField Vr2 = TIndexRep.U; // V_r
|
||||
|
||||
typename TwoIndexRep< Nc, Symmetric >::LatticeField Ur2Vr2(grid);
|
||||
|
||||
Ur2Vr2 = Zero();
|
||||
for (int mu = 0; mu < Nd; mu++) {
|
||||
typename TwoIndexRep< Nc, Symmetric >::LatticeMatrix Urmu2 = peekLorentz(Ur2,mu);
|
||||
typename TwoIndexRep< Nc, Symmetric >::LatticeMatrix Vrmu2 = peekLorentz(Vr2,mu);
|
||||
typename TwoIndexRep< Nc, Symmetric>::LatticeMatrix Urmu2 = peekLorentz(Ur2,mu);
|
||||
typename TwoIndexRep< Nc, Symmetric>::LatticeMatrix Vrmu2 = peekLorentz(Vr2,mu);
|
||||
pokeLorentz(Ur2Vr2,Urmu2*Vrmu2, mu);
|
||||
}
|
||||
|
||||
typename TwoIndexRep< Nc, Symmetric >::LatticeField Diff_check2 = UVr2 - Ur2Vr2;
|
||||
|
||||
std::cout << GridLogMessage << "Group structure SU("<<Nc<<") check difference (Two Index Symmetric): " << norm2(Diff_check2) << std::endl;
|
||||
|
||||
|
||||
// Check correspondence of algebra and group transformations
|
||||
// Create a random vector
|
||||
SU3::LatticeAlgebraVector h_sym(grid);
|
||||
SU<Nc>::LatticeAlgebraVector h_sym(grid);
|
||||
typename TwoIndexRep< Nc, Symmetric>::LatticeMatrix Ar_sym(grid);
|
||||
random(gridRNG,h_sym);
|
||||
h_sym = real(h_sym);
|
||||
SU_TwoIndex<Nc,Symmetric>::TwoIndexLieAlgebraMatrix(h_sym,Ar_sym);
|
||||
|
||||
// Re-extract h_sym
|
||||
SU3::LatticeAlgebraVector h_sym2(grid);
|
||||
SU<Nc>::LatticeAlgebraVector h_sym2(grid);
|
||||
SU_TwoIndex< Nc, Symmetric>::projectOnAlgebra(h_sym2, Ar_sym);
|
||||
SU3::LatticeAlgebraVector h_diff_sym = h_sym - h_sym2;
|
||||
SU<Nc>::LatticeAlgebraVector h_diff_sym = h_sym - h_sym2;
|
||||
std::cout << GridLogMessage << "Projections structure check vector difference (Two Index Symmetric): " << norm2(h_diff_sym) << std::endl;
|
||||
|
||||
// Exponentiate
|
||||
@ -396,11 +398,11 @@ int main(int argc, char** argv) {
|
||||
<< std::endl;
|
||||
|
||||
// Construct the fundamental matrix in the group
|
||||
SU3::LatticeMatrix Af_sym(grid);
|
||||
SU3::FundamentalLieAlgebraMatrix(h_sym,Af_sym);
|
||||
SU3::LatticeMatrix Ufund2(grid);
|
||||
SU<Nc>::LatticeMatrix Af_sym(grid);
|
||||
SU<Nc>::FundamentalLieAlgebraMatrix(h_sym,Af_sym);
|
||||
SU<Nc>::LatticeMatrix Ufund2(grid);
|
||||
Ufund2 = expMat(Af_sym, 1.0, 16);
|
||||
SU3::LatticeMatrix UnitCheck2(grid);
|
||||
SU<Nc>::LatticeMatrix UnitCheck2(grid);
|
||||
UnitCheck2 = Ufund2 * adj(Ufund2) - uno_f;
|
||||
std::cout << GridLogMessage << "unitarity check 1: " << norm2(UnitCheck2)
|
||||
<< std::endl;
|
||||
@ -425,115 +427,113 @@ int main(int argc, char** argv) {
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
|
||||
|
||||
std::cout << GridLogMessage << "Two Index anti-Symmetric: Check Group Structure"
|
||||
<< std::endl;
|
||||
// Testing HMC representation classes
|
||||
TwoIndexRep< Nc, AntiSymmetric > TIndexRepA(grid);
|
||||
std::cout << GridLogMessage << "Two Index anti-Symmetric: Check Group Structure"
|
||||
<< std::endl;
|
||||
// Testing HMC representation classes
|
||||
TwoIndexRep< Nc, AntiSymmetric> TIndexRepA(grid);
|
||||
|
||||
|
||||
// Test group structure
|
||||
// (U_f * V_f)_r = U_r * V_r
|
||||
LatticeGaugeField U2A(grid), V2A(grid);
|
||||
SU3::HotConfiguration<LatticeGaugeField>(gridRNG, U2A);
|
||||
SU3::HotConfiguration<LatticeGaugeField>(gridRNG, V2A);
|
||||
// Test group structure
|
||||
// (U_f * V_f)_r = U_r * V_r
|
||||
LatticeGaugeField U2A(grid), V2A(grid);
|
||||
SU<Nc>::HotConfiguration<LatticeGaugeField>(gridRNG, U2A);
|
||||
SU<Nc>::HotConfiguration<LatticeGaugeField>(gridRNG, V2A);
|
||||
|
||||
LatticeGaugeField UV2A(grid);
|
||||
UV2A = Zero();
|
||||
for (int mu = 0; mu < Nd; mu++) {
|
||||
SU3::LatticeMatrix Umu2A = peekLorentz(U2,mu);
|
||||
SU3::LatticeMatrix Vmu2A = peekLorentz(V2,mu);
|
||||
pokeLorentz(UV2A,Umu2A*Vmu2A, mu);
|
||||
}
|
||||
|
||||
TIndexRep.update_representation(UV2A);
|
||||
typename TwoIndexRep< Nc, AntiSymmetric >::LatticeField UVr2A = TIndexRepA.U; // (U_f * V_f)_r
|
||||
|
||||
TIndexRep.update_representation(U2A);
|
||||
typename TwoIndexRep< Nc, AntiSymmetric >::LatticeField Ur2A = TIndexRepA.U; // U_r
|
||||
|
||||
TIndexRep.update_representation(V2A);
|
||||
typename TwoIndexRep< Nc, AntiSymmetric >::LatticeField Vr2A = TIndexRepA.U; // V_r
|
||||
|
||||
typename TwoIndexRep< Nc, AntiSymmetric >::LatticeField Ur2Vr2A(grid);
|
||||
Ur2Vr2A = Zero();
|
||||
for (int mu = 0; mu < Nd; mu++) {
|
||||
typename TwoIndexRep< Nc, AntiSymmetric >::LatticeMatrix Urmu2A = peekLorentz(Ur2A,mu);
|
||||
typename TwoIndexRep< Nc, AntiSymmetric >::LatticeMatrix Vrmu2A = peekLorentz(Vr2A,mu);
|
||||
pokeLorentz(Ur2Vr2A,Urmu2A*Vrmu2A, mu);
|
||||
}
|
||||
|
||||
typename TwoIndexRep< Nc, AntiSymmetric >::LatticeField Diff_check2A = UVr2A - Ur2Vr2A;
|
||||
std::cout << GridLogMessage << "Group structure SU("<<Nc<<") check difference (Two Index anti-Symmetric): " << norm2(Diff_check2A) << std::endl;
|
||||
|
||||
|
||||
// Check correspondence of algebra and group transformations
|
||||
// Create a random vector
|
||||
SU3::LatticeAlgebraVector h_Asym(grid);
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Ar_Asym(grid);
|
||||
random(gridRNG,h_Asym);
|
||||
h_Asym = real(h_Asym);
|
||||
SU_TwoIndex< Nc, AntiSymmetric>::TwoIndexLieAlgebraMatrix(h_Asym,Ar_Asym);
|
||||
|
||||
// Re-extract h_sym
|
||||
SU3::LatticeAlgebraVector h_Asym2(grid);
|
||||
SU_TwoIndex< Nc, AntiSymmetric>::projectOnAlgebra(h_Asym2, Ar_Asym);
|
||||
SU3::LatticeAlgebraVector h_diff_Asym = h_Asym - h_Asym2;
|
||||
std::cout << GridLogMessage << "Projections structure check vector difference (Two Index anti-Symmetric): " << norm2(h_diff_Asym) << std::endl;
|
||||
|
||||
|
||||
// Exponentiate
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix U2iAS(grid);
|
||||
U2iAS = expMat(Ar_Asym, 1.0, 16);
|
||||
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix uno2iAS(grid);
|
||||
uno2iAS = 1.0;
|
||||
// Check matrix U2iS, must be real orthogonal
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Ucheck2iAS = U2iAS - conjugate(U2iAS);
|
||||
std::cout << GridLogMessage << "Reality check: " << norm2(Ucheck2iAS)
|
||||
<< std::endl;
|
||||
|
||||
Ucheck2iAS = U2iAS * adj(U2iAS) - uno2iAS;
|
||||
std::cout << GridLogMessage << "orthogonality check 1: " << norm2(Ucheck2iAS)
|
||||
<< std::endl;
|
||||
Ucheck2iAS = adj(U2iAS) * U2iAS - uno2iAS;
|
||||
std::cout << GridLogMessage << "orthogonality check 2: " << norm2(Ucheck2iAS)
|
||||
<< std::endl;
|
||||
|
||||
|
||||
|
||||
// Construct the fundamental matrix in the group
|
||||
SU3::LatticeMatrix Af_Asym(grid);
|
||||
SU3::FundamentalLieAlgebraMatrix(h_Asym,Af_Asym);
|
||||
SU3::LatticeMatrix Ufund2A(grid);
|
||||
Ufund2A = expMat(Af_Asym, 1.0, 16);
|
||||
SU3::LatticeMatrix UnitCheck2A(grid);
|
||||
UnitCheck2A = Ufund2A * adj(Ufund2A) - uno_f;
|
||||
std::cout << GridLogMessage << "unitarity check 1: " << norm2(UnitCheck2A)
|
||||
<< std::endl;
|
||||
UnitCheck2A = adj(Ufund2A) * Ufund2A - uno_f;
|
||||
std::cout << GridLogMessage << "unitarity check 2: " << norm2(UnitCheck2A)
|
||||
<< std::endl;
|
||||
|
||||
|
||||
// Tranform to the 2Index Sym representation
|
||||
U = Zero(); // fill this with only one direction
|
||||
pokeLorentz(U,Ufund2A,0); // the representation transf acts on full gauge fields
|
||||
|
||||
TIndexRepA.update_representation(U);
|
||||
Ur2A = TIndexRepA.U; // U_r
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Ur02A = peekLorentz(Ur2A,0); // this should be the same as U2iS
|
||||
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Diff_check_mat2A = Ur02A - U2iAS;
|
||||
std::cout << GridLogMessage << "Projections structure check group difference (Two Index anti-Symmetric): " << norm2(Diff_check_mat2A) << std::endl;
|
||||
|
||||
} else {
|
||||
std::cout << GridLogMessage << "Skipping Two Index anti-Symmetric tests "
|
||||
"because representation is trivial (dim = 1)"
|
||||
<< std::endl;
|
||||
LatticeGaugeField UV2A(grid);
|
||||
UV2A = Zero();
|
||||
for (int mu = 0; mu < Nd; mu++) {
|
||||
SU<Nc>::LatticeMatrix Umu2A = peekLorentz(U2,mu);
|
||||
SU<Nc>::LatticeMatrix Vmu2A = peekLorentz(V2,mu);
|
||||
pokeLorentz(UV2A,Umu2A*Vmu2A, mu);
|
||||
}
|
||||
|
||||
TIndexRep.update_representation(UV2A);
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeField UVr2A = TIndexRepA.U; // (U_f * V_f)_r
|
||||
|
||||
TIndexRep.update_representation(U2A);
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeField Ur2A = TIndexRepA.U; // U_r
|
||||
|
||||
TIndexRep.update_representation(V2A);
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeField Vr2A = TIndexRepA.U; // V_r
|
||||
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeField Ur2Vr2A(grid);
|
||||
Ur2Vr2A = Zero();
|
||||
for (int mu = 0; mu < Nd; mu++) {
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Urmu2A = peekLorentz(Ur2A,mu);
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Vrmu2A = peekLorentz(Vr2A,mu);
|
||||
pokeLorentz(Ur2Vr2A,Urmu2A*Vrmu2A, mu);
|
||||
}
|
||||
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeField Diff_check2A = UVr2A - Ur2Vr2A;
|
||||
std::cout << GridLogMessage << "Group structure SU("<<Nc<<") check difference (Two Index anti-Symmetric): " << norm2(Diff_check2A) << std::endl;
|
||||
|
||||
#endif
|
||||
|
||||
// Check correspondence of algebra and group transformations
|
||||
// Create a random vector
|
||||
SU<Nc>::LatticeAlgebraVector h_Asym(grid);
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Ar_Asym(grid);
|
||||
random(gridRNG,h_Asym);
|
||||
h_Asym = real(h_Asym);
|
||||
SU_TwoIndex< Nc, AntiSymmetric>::TwoIndexLieAlgebraMatrix(h_Asym,Ar_Asym);
|
||||
|
||||
// Re-extract h_sym
|
||||
SU<Nc>::LatticeAlgebraVector h_Asym2(grid);
|
||||
SU_TwoIndex< Nc, AntiSymmetric>::projectOnAlgebra(h_Asym2, Ar_Asym);
|
||||
SU<Nc>::LatticeAlgebraVector h_diff_Asym = h_Asym - h_Asym2;
|
||||
std::cout << GridLogMessage << "Projections structure check vector difference (Two Index anti-Symmetric): " << norm2(h_diff_Asym) << std::endl;
|
||||
|
||||
|
||||
// Exponentiate
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix U2iAS(grid);
|
||||
U2iAS = expMat(Ar_Asym, 1.0, 16);
|
||||
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix uno2iAS(grid);
|
||||
uno2iAS = 1.0;
|
||||
// Check matrix U2iS, must be real orthogonal
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Ucheck2iAS = U2iAS - conjugate(U2iAS);
|
||||
std::cout << GridLogMessage << "Reality check: " << norm2(Ucheck2iAS)
|
||||
<< std::endl;
|
||||
|
||||
Ucheck2iAS = U2iAS * adj(U2iAS) - uno2iAS;
|
||||
std::cout << GridLogMessage << "orthogonality check 1: " << norm2(Ucheck2iAS)
|
||||
<< std::endl;
|
||||
Ucheck2iAS = adj(U2iAS) * U2iAS - uno2iAS;
|
||||
std::cout << GridLogMessage << "orthogonality check 2: " << norm2(Ucheck2iAS)
|
||||
<< std::endl;
|
||||
|
||||
|
||||
|
||||
// Construct the fundamental matrix in the group
|
||||
SU<Nc>::LatticeMatrix Af_Asym(grid);
|
||||
SU<Nc>::FundamentalLieAlgebraMatrix(h_Asym,Af_Asym);
|
||||
SU<Nc>::LatticeMatrix Ufund2A(grid);
|
||||
Ufund2A = expMat(Af_Asym, 1.0, 16);
|
||||
SU<Nc>::LatticeMatrix UnitCheck2A(grid);
|
||||
UnitCheck2A = Ufund2A * adj(Ufund2A) - uno_f;
|
||||
std::cout << GridLogMessage << "unitarity check 1: " << norm2(UnitCheck2A)
|
||||
<< std::endl;
|
||||
UnitCheck2A = adj(Ufund2A) * Ufund2A - uno_f;
|
||||
std::cout << GridLogMessage << "unitarity check 2: " << norm2(UnitCheck2A)
|
||||
<< std::endl;
|
||||
|
||||
|
||||
// Tranform to the 2Index Sym representation
|
||||
U = Zero(); // fill this with only one direction
|
||||
pokeLorentz(U,Ufund2A,0); // the representation transf acts on full gauge fields
|
||||
|
||||
TIndexRepA.update_representation(U);
|
||||
Ur2A = TIndexRepA.U; // U_r
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Ur02A = peekLorentz(Ur2A,0); // this should be the same as U2iS
|
||||
|
||||
typename TwoIndexRep< Nc, AntiSymmetric>::LatticeMatrix Diff_check_mat2A = Ur02A - U2iAS;
|
||||
std::cout << GridLogMessage << "Projections structure check group difference (Two Index anti-Symmetric): " << norm2(Diff_check_mat2A) << std::endl;
|
||||
|
||||
} else {
|
||||
std::cout << GridLogMessage << "Skipping Two Index anti-Symmetric tests "
|
||||
"because representation is trivial (dim = 1)"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
Grid_finalize();
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
See the full license in the file "LICENSE" in the top level distribution directory
|
||||
*************************************************************************************/
|
||||
/* END LEGAL */
|
||||
|
||||
#include <Grid/Grid.h>
|
||||
|
||||
using namespace std;
|
||||
@ -121,8 +122,9 @@ int main (int argc, char ** argv)
|
||||
detU=detU-1.0;
|
||||
std::cout << "Determinant defect before projection " <<norm2(detU)<<std::endl;
|
||||
tmp = U*adj(U) - ident;
|
||||
std::cout << "Unitarity check before projection " << norm2(tmp)<<std::endl;
|
||||
#if (Nc == 3)
|
||||
std::cout << "Unitarity check before projection " << norm2(tmp)<<std::endl;
|
||||
|
||||
#if Nc==3
|
||||
ProjectSU3(U);
|
||||
detU= Determinant(U) ;
|
||||
detU= detU -1.0;
|
||||
@ -130,7 +132,7 @@ int main (int argc, char ** argv)
|
||||
tmp = U*adj(U) - ident;
|
||||
std::cout << "Unitarity check after projection " << norm2(tmp)<<std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
ProjectSUn(UU);
|
||||
detUU= Determinant(UU);
|
||||
detUU= detUU -1.0;
|
||||
@ -140,7 +142,3 @@ int main (int argc, char ** argv)
|
||||
|
||||
Grid_finalize();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -93,16 +93,9 @@ int main(int argc, char** argv) {
|
||||
// Setup of Dirac Matrix and Operator //
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
LatticeGaugeField Umu(Grid_f);
|
||||
#if (Nc==2)
|
||||
SU2::HotConfiguration(pRNG_f, Umu);
|
||||
#elif (defined Nc==3)
|
||||
SU3::HotConfiguration(pRNG_f, Umu);
|
||||
#elif (defined Nc==4)
|
||||
SU4::HotConfiguration(pRNG_f, Umu);
|
||||
#elif (defined Nc==5)
|
||||
SU5::HotConfiguration(pRNG_f, Umu);
|
||||
#endif
|
||||
SU<Nc>::HotConfiguration(pRNG_f, Umu);
|
||||
RealD checkTolerance = (getPrecision<LatticeFermion>::value == 1) ? 1e-7 : 1e-15;
|
||||
|
||||
RealD mass = -0.30;
|
||||
|
8
tests/sp2n/Makefile.am
Normal file
8
tests/sp2n/Makefile.am
Normal file
@ -0,0 +1,8 @@
|
||||
.PHONY: check
|
||||
|
||||
include Make.inc
|
||||
|
||||
check: tests
|
||||
./Test_project_on_Sp
|
||||
./Test_sp2n_lie_gen
|
||||
./Test_Sp_start
|
149
tests/sp2n/Test_2as_base.cc
Normal file
149
tests/sp2n/Test_2as_base.cc
Normal file
@ -0,0 +1,149 @@
|
||||
#include <Grid/Grid.h>
|
||||
|
||||
#define verbose 0
|
||||
|
||||
using namespace Grid;
|
||||
|
||||
template<int this_nc>
|
||||
static void check_dimensions() {
|
||||
|
||||
const int this_n = this_nc/2;
|
||||
const int this_algebra_dim = Sp<this_nc>::AlgebraDimension;
|
||||
|
||||
RealD realA;
|
||||
std::cout << GridLogMessage << "Nc = " << this_n << " 2as dimension is " << Sp_TwoIndex<this_nc, AntiSymmetric>::Dimension << std::endl;
|
||||
std::cout << GridLogMessage << "Nc = " << this_n << " 2s dimension is " << Sp_TwoIndex<this_nc, Symmetric>::Dimension << std::endl;
|
||||
std::cout << GridLogMessage << "Nc = " << this_n << " algebra dimension is " << this_algebra_dim << std::endl;
|
||||
realA = Sp_TwoIndex<this_nc, AntiSymmetric>::Dimension + Sp_TwoIndex<this_nc, Symmetric>::Dimension;
|
||||
std::cout << GridLogMessage << "Checking dim(2AS) + dim(AS) + 1 = Nc * Nc " << this_algebra_dim << std::endl;
|
||||
assert ( realA == this_nc * this_nc - 1); // Nc x Nc = dim(2indxS) + dim(2indxAS) + dim(singlet)
|
||||
}
|
||||
|
||||
template<int this_nc, TwoIndexSymmetry S>
|
||||
static void run_symmetry_checks() {
|
||||
typedef typename Sp_TwoIndex<this_nc, S>::template iGroupMatrix<Complex> Matrix;
|
||||
const int this_n = this_nc/2;
|
||||
const int this_irrep_dim = Sp_TwoIndex<this_nc, S>::Dimension;
|
||||
const int this_algebra_dim = Sp<this_nc>::AlgebraDimension;
|
||||
Matrix eij_c;
|
||||
Matrix e_sum;
|
||||
RealD realS = S;
|
||||
|
||||
std::cout << GridLogMessage << "checking base has symmetry " << S << std::endl;
|
||||
for (int a=0; a < this_irrep_dim; a++)
|
||||
{
|
||||
Sp_TwoIndex<this_nc, S>::base(a, eij_c);
|
||||
e_sum = eij_c - realS * transpose(eij_c);
|
||||
std::cout << GridLogMessage << "e_ab - (" << S << " * e_ab^T ) = " << norm2(e_sum) << std::endl;
|
||||
assert(norm2(e_sum) < 1e-8);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
template<int this_nc, TwoIndexSymmetry S>
|
||||
static void run_traces_checks() {
|
||||
typedef typename Sp_TwoIndex<this_nc, S>::template iGroupMatrix<Complex> Matrix;
|
||||
const int this_n = this_nc/2;
|
||||
const int this_irrep_dim = Sp_TwoIndex<this_nc, S>::Dimension;
|
||||
const int this_algebra_dim = Sp<this_nc>::AlgebraDimension;
|
||||
Matrix eij_a;
|
||||
Matrix eij_b;
|
||||
Matrix Omega;
|
||||
Sp<this_nc>::Omega(Omega);
|
||||
RealD realS = S;
|
||||
RealD realA;
|
||||
|
||||
std::cout << GridLogMessage << "Checking Tr (e^(ab) Omega ) = 0 and Tr (e^(ab) e^(cd) = delta^((ab)(cd)) ) " << std::endl;
|
||||
for (int a=0; a < Sp_TwoIndex<this_nc, S>::Dimension; a++) {
|
||||
Sp_TwoIndex<this_nc, S>::base(a, eij_a);
|
||||
realA = norm2(trace(Omega*eij_a));
|
||||
std::cout << GridLogMessage << "Checkig Omega-trace for e_{ab=" << a << "} " << std::endl;
|
||||
//std::cout << GridLogMessage << "Tr ( Omega e_{ab=" << a << "} ) = " << realA << std::endl;
|
||||
assert(realA < 1e-8);
|
||||
for (int b=0; b < Sp_TwoIndex<this_nc, S>::Dimension; b++) {
|
||||
Sp_TwoIndex<this_nc, S>::base(b, eij_b);
|
||||
auto d_ab = TensorRemove(trace(eij_a * eij_b));
|
||||
#if verbose
|
||||
std::cout << GridLogMessage << "Tr( e_{ab=" << a << "} e_{cd=" << b << "} ) = " << d_ab << std::endl;
|
||||
#endif
|
||||
std::cout << GridLogMessage << "Checking orthonormality for e_{ab = " << a << "} " << std::endl;
|
||||
if (a==b) {
|
||||
assert(real(d_ab) - realS < 1e-8);
|
||||
} else {
|
||||
assert(real(d_ab) < 1e-8);
|
||||
}
|
||||
assert(imag(d_ab) < 1e-8);
|
||||
assert(imag(d_ab) < 1e-8);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template<int this_nc, TwoIndexSymmetry S>
|
||||
static void run_generators_checks() {
|
||||
const int this_n = this_nc/2;
|
||||
const int this_irrep_dim = Sp_TwoIndex<this_nc, S>::Dimension;
|
||||
const int this_algebra_dim = Sp<this_nc>::AlgebraDimension;
|
||||
typedef typename Sp_TwoIndex<this_nc, S>::template iGroupMatrix<Complex> Matrix;
|
||||
int sum = 0;
|
||||
int sum_im = 0;
|
||||
Vector<Matrix> ta_fund(this_algebra_dim);
|
||||
Vector<Matrix> eij(this_irrep_dim);
|
||||
Matrix tmp_l;
|
||||
Matrix tmp_r;
|
||||
for (int n = 0; n < this_algebra_dim; n++)
|
||||
{
|
||||
Sp<this_nc>::generator(n, ta_fund[n]); // generators in the fundamental
|
||||
}
|
||||
for (int a = 0; a < this_irrep_dim; a++)
|
||||
{
|
||||
Sp_TwoIndex<this_nc, S>::base(a, eij[a]); // base functions e_ij^a for upgrading gauge links from fund to 2-index
|
||||
}
|
||||
for (int gen_id = 0; gen_id < this_algebra_dim; gen_id++)
|
||||
{
|
||||
sum = 0;
|
||||
sum_im = 0;
|
||||
std::cout << GridLogMessage << "generator number " << gen_id << std::endl;
|
||||
for (int a = 0; a < this_irrep_dim; a++)
|
||||
{
|
||||
|
||||
tmp_l = adj(eij[a])*ta_fund[gen_id]*eij[a];
|
||||
tmp_r = adj(eij[a])*eij[a]*transpose(ta_fund[gen_id]);
|
||||
#if verbose
|
||||
std::cout << GridLogMessage << " as_indx = " << a << " eDag T_F e = " << std::endl << tmp_l << std::endl;
|
||||
std::cout << GridLogMessage << " as_indx = " << a << " eDag e T_F^T = " << std::endl << tmp_r << std::endl;
|
||||
#endif
|
||||
//std::cout << GridLogMessage << " as_indx = " << a << " Tr(eDag T_F e + eDag e T_F^T) = " << TensorRemove(trace(tmp_l+tmp_r)) << std::endl;
|
||||
sum += real(TensorRemove(trace(tmp_l+tmp_r)));
|
||||
sum_im += imag(TensorRemove(trace(tmp_l+tmp_r)));
|
||||
}
|
||||
std::cout << GridLogMessage << "re-evaluated trace of the generator " << gen_id << " is " << sum << " " << sum_im << std::endl;
|
||||
assert ( sum < 1e-8) ;
|
||||
assert ( sum_im < 1e-8) ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template<int this_nc, TwoIndexSymmetry S>
|
||||
static void run_base_checks() {
|
||||
std::cout << GridLogMessage << " ****** " << std::endl;
|
||||
std::cout << GridLogMessage << "Running checks for Nc = " << this_nc << " TwoIndex Symmetry = " << S << std::endl;
|
||||
run_symmetry_checks<this_nc, S>();
|
||||
run_traces_checks<this_nc, S>();
|
||||
run_generators_checks<this_nc, S>();
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
check_dimensions<2>();
|
||||
check_dimensions<4>();
|
||||
check_dimensions<6>();
|
||||
check_dimensions<8>();
|
||||
|
||||
run_base_checks<2, Symmetric>(); // For Nc=2 the AS is the singlet
|
||||
run_base_checks<4, Symmetric>();
|
||||
run_base_checks<4, AntiSymmetric>();
|
||||
run_base_checks<6, Symmetric>();
|
||||
run_base_checks<6, AntiSymmetric>();
|
||||
run_base_checks<8, Symmetric>();
|
||||
run_base_checks<8, AntiSymmetric>();
|
||||
}
|
110
tests/sp2n/Test_Sp_start.cc
Normal file
110
tests/sp2n/Test_Sp_start.cc
Normal file
@ -0,0 +1,110 @@
|
||||
#include <Grid/Grid.h>
|
||||
|
||||
using namespace Grid;
|
||||
|
||||
template <typename T>
|
||||
bool has_correct_group_block_structure(const T& U) {
|
||||
std::cout << GridLogMessage << "Checking the structure is " << std::endl;
|
||||
std::cout << GridLogMessage << "U = ( W X ) " << std::endl;
|
||||
std::cout << GridLogMessage << " ( -X^* W^* ) " << std::endl;
|
||||
std::cout << GridLogMessage << std::endl;
|
||||
|
||||
const int nsp = Nc / 2;
|
||||
Complex i(0., 1.);
|
||||
for (int c1 = 0; c1 < nsp; c1++) // check on W
|
||||
{
|
||||
for (int c2 = 0; c2 < nsp; c2++) {
|
||||
auto W = PeekIndex<ColourIndex>(U, c1, c2);
|
||||
auto Wstar = PeekIndex<ColourIndex>(U, c1 + nsp, c2 + nsp);
|
||||
auto Ww = conjugate(Wstar);
|
||||
auto amizero = sum(W - Ww);
|
||||
auto amizeroo = TensorRemove(amizero);
|
||||
assert(amizeroo.real() < 10e-6);
|
||||
amizeroo *= i;
|
||||
assert(amizeroo.real() < 10e-6);
|
||||
}
|
||||
}
|
||||
|
||||
for (int c1 = 0; c1 < nsp; c1++) {
|
||||
for (int c2 = 0; c2 < nsp; c2++) {
|
||||
auto X = PeekIndex<ColourIndex>(U, c1, c2 + nsp);
|
||||
auto minusXstar = PeekIndex<ColourIndex>(U, c1 + nsp, c2);
|
||||
auto minusXx = conjugate(minusXstar);
|
||||
auto amizero = sum(X + minusXx);
|
||||
auto amizeroo = TensorRemove(amizero);
|
||||
assert(amizeroo.real() < 10e-6);
|
||||
amizeroo *= i;
|
||||
assert(amizeroo.real() < 10e-6);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
bool is_element_of_sp2n_group(const T& U) {
|
||||
LatticeColourMatrixD aux(U.Grid());
|
||||
LatticeColourMatrixD identity(U.Grid());
|
||||
identity = 1.0;
|
||||
LatticeColourMatrixD Omega(U.Grid());
|
||||
Sp<Nc>::Omega(Omega);
|
||||
|
||||
std::cout << GridLogMessage << "Check matrix is non-zero " << std::endl;
|
||||
assert(norm2(U) > 1e-8);
|
||||
|
||||
std::cout << GridLogMessage << "Unitary check" << std::endl;
|
||||
aux = U * adj(U) - identity;
|
||||
std::cout << GridLogMessage << "U adjU - 1 = " << norm2(aux) << std::endl;
|
||||
assert(norm2(aux) < 1e-8);
|
||||
|
||||
aux = Omega - (U * Omega * transpose(U));
|
||||
std::cout << GridLogMessage << "Omega - U Omega transpose(U) = " << norm2(aux)
|
||||
<< std::endl;
|
||||
assert(norm2(aux) < 1e-8);
|
||||
|
||||
std::cout << GridLogMessage
|
||||
<< "|Det| = " << norm2(Determinant(U)) / U.Grid()->gSites()
|
||||
<< std::endl;
|
||||
assert(norm2(Determinant(U)) / U.Grid()->gSites() - 1 < 1e-8);
|
||||
|
||||
return has_correct_group_block_structure(U);
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
Grid_init(&argc,&argv);
|
||||
|
||||
Coordinate latt_size = GridDefaultLatt();
|
||||
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||
Coordinate mpi_layout = GridDefaultMpi();
|
||||
|
||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||
GridRedBlackCartesian RBGrid(&Grid);
|
||||
|
||||
LatticeGaugeField Umu(&Grid);
|
||||
LatticeColourMatrixD U(&Grid);
|
||||
|
||||
std::vector<int> pseeds({1,2,3,4,5});
|
||||
std::vector<int> sseeds({6,7,8,9,10});
|
||||
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(pseeds);
|
||||
GridSerialRNG sRNG; sRNG.SeedFixedIntegers(sseeds);
|
||||
|
||||
std::cout << GridLogMessage << "Checking Cold Configuration " << std::endl;
|
||||
Sp<Nc>::ColdConfiguration(pRNG,Umu);
|
||||
U = PeekIndex<LorentzIndex>(Umu,1);
|
||||
assert(is_element_of_sp2n_group(U));
|
||||
|
||||
std::cout << GridLogMessage << "Checking Hot Configuration" << std::endl;
|
||||
Sp<Nc>::HotConfiguration(pRNG,Umu);
|
||||
U = PeekIndex<LorentzIndex>(Umu,1);
|
||||
assert(is_element_of_sp2n_group(U));
|
||||
|
||||
std::cout << GridLogMessage << "Checking Tepid Configuration" << std::endl;
|
||||
Sp<Nc>::TepidConfiguration(pRNG,Umu);
|
||||
U = PeekIndex<LorentzIndex>(Umu,1);
|
||||
assert(is_element_of_sp2n_group(U));
|
||||
|
||||
Grid_finalize();
|
||||
|
||||
|
||||
}
|
||||
|
97
tests/sp2n/Test_hmc_Sp_WF_2_Fund_3_2AS.cc
Normal file
97
tests/sp2n/Test_hmc_Sp_WF_2_Fund_3_2AS.cc
Normal file
@ -0,0 +1,97 @@
|
||||
#include <Grid/Grid.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
using namespace Grid;
|
||||
|
||||
typedef Representations< SpFundamentalRepresentation, SpTwoIndexAntiSymmetricRepresentation > TheRepresentations;
|
||||
|
||||
Grid_init(&argc, &argv);
|
||||
|
||||
typedef GenericSpHMCRunnerHirep<TheRepresentations, MinimumNorm2> HMCWrapper;
|
||||
|
||||
typedef SpWilsonTwoIndexAntiSymmetricImplR TwoIndexFermionImplPolicy;
|
||||
typedef SpWilsonTwoIndexAntiSymmetricFermionD TwoIndexFermionAction;
|
||||
typedef typename TwoIndexFermionAction::FermionField TwoIndexFermionField;
|
||||
|
||||
typedef SpWilsonImplR FundFermionImplPolicy; // ok
|
||||
typedef SpWilsonFermionD FundFermionAction; // ok
|
||||
typedef typename FundFermionAction::FermionField FundFermionField;
|
||||
|
||||
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
|
||||
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 = "1 2 3 4 5";
|
||||
RNGpar.parallel_seeds = "6 7 8 9 10";
|
||||
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||
|
||||
// Construct observables
|
||||
typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs;
|
||||
TheHMC.Resources.AddObservable<PlaqObs>();
|
||||
|
||||
typedef PolyakovMod<HMCWrapper::ImplPolicy> PolyakovObs;
|
||||
TheHMC.Resources.AddObservable<PolyakovObs>();
|
||||
|
||||
RealD beta = 6 ;
|
||||
|
||||
SpWilsonGaugeActionR Waction(beta);
|
||||
|
||||
auto GridPtr = TheHMC.Resources.GetCartesian();
|
||||
auto GridRBPtr = TheHMC.Resources.GetRBCartesian();
|
||||
|
||||
SpFundamentalRepresentation::LatticeField fundU(GridPtr);
|
||||
SpTwoIndexAntiSymmetricRepresentation::LatticeField asU(GridPtr);
|
||||
//LatticeGaugeField U(GridPtr);
|
||||
|
||||
RealD Fundmass = -0.71;
|
||||
RealD ASmass = -0.71;
|
||||
std::vector<Complex> boundary = {-1,-1,-1,-1};
|
||||
|
||||
FundFermionAction::ImplParams bc(boundary);
|
||||
TwoIndexFermionAction::ImplParams bbc(boundary);
|
||||
|
||||
FundFermionAction FundFermOp(fundU, *GridPtr, *GridRBPtr, Fundmass, bbc);
|
||||
TwoIndexFermionAction TwoIndexFermOp(asU, *GridPtr, *GridRBPtr, ASmass, bbc);
|
||||
ConjugateGradient<FundFermionField> fCG(1.0e-8, 2000, false);
|
||||
ConjugateGradient<TwoIndexFermionField> asCG(1.0e-8, 2000, false);
|
||||
OneFlavourRationalParams Params(1.0e-6, 64.0, 2000, 1.0e-6, 16);
|
||||
|
||||
TwoFlavourPseudoFermionAction<FundFermionImplPolicy> fundNf2(FundFermOp, fCG, fCG);
|
||||
TwoFlavourPseudoFermionAction<TwoIndexFermionImplPolicy> asNf2(TwoIndexFermOp, asCG, asCG);
|
||||
OneFlavourRationalPseudoFermionAction<TwoIndexFermionImplPolicy> asNf1(TwoIndexFermOp,Params);
|
||||
|
||||
fundNf2.is_smeared = false;
|
||||
asNf2.is_smeared = false;
|
||||
asNf1.is_smeared = false;
|
||||
|
||||
ActionLevel<HMCWrapper::Field, TheRepresentations > Level1(1);
|
||||
Level1.push_back(&fundNf2);
|
||||
Level1.push_back(&asNf2);
|
||||
Level1.push_back(&asNf1);
|
||||
|
||||
ActionLevel<HMCWrapper::Field, TheRepresentations > Level2(4);
|
||||
Level2.push_back(&Waction);
|
||||
|
||||
TheHMC.TheAction.push_back(Level1);
|
||||
TheHMC.TheAction.push_back(Level2);
|
||||
|
||||
TheHMC.Parameters.MD.MDsteps = 28;
|
||||
TheHMC.Parameters.MD.trajL = 1.0;
|
||||
|
||||
TheHMC.ReadCommandLine(argc, argv);
|
||||
TheHMC.Run();
|
||||
|
||||
Grid_finalize();
|
||||
}
|
81
tests/sp2n/Test_hmc_Sp_Wilson2ASFermionGauge.cc
Normal file
81
tests/sp2n/Test_hmc_Sp_Wilson2ASFermionGauge.cc
Normal file
@ -0,0 +1,81 @@
|
||||
#include <Grid/Grid.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
using namespace Grid;
|
||||
|
||||
typedef Representations<SpFundamentalRepresentation,
|
||||
SpTwoIndexAntiSymmetricRepresentation>
|
||||
TheRepresentations;
|
||||
|
||||
Grid_init(&argc, &argv);
|
||||
|
||||
typedef GenericSpHMCRunnerHirep<TheRepresentations, MinimumNorm2>
|
||||
HMCWrapper;
|
||||
typedef SpWilsonTwoIndexAntiSymmetricImplR FermionImplPolicy;
|
||||
typedef SpWilsonTwoIndexAntiSymmetricFermionD FermionAction;
|
||||
typedef typename FermionAction::FermionField FermionField;
|
||||
|
||||
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
|
||||
HMCWrapper TheHMC;
|
||||
|
||||
TheHMC.Resources.AddFourDimGrid("gauge");
|
||||
|
||||
// Checkpointer definition
|
||||
CheckpointerParameters CPparams;
|
||||
CPparams.config_prefix = "ckpoint_lat";
|
||||
CPparams.rng_prefix = "ckpoint_rng";
|
||||
CPparams.saveInterval = 100;
|
||||
CPparams.format = "IEEE64BIG";
|
||||
|
||||
TheHMC.Resources.LoadNerscCheckpointer(CPparams);
|
||||
|
||||
RNGModuleParameters RNGpar;
|
||||
RNGpar.serial_seeds = "1 2 3 4 5";
|
||||
RNGpar.parallel_seeds = "6 7 8 9 10";
|
||||
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||
|
||||
// Construct observables
|
||||
typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs;
|
||||
TheHMC.Resources.AddObservable<PlaqObs>();
|
||||
|
||||
RealD beta = 6.7;
|
||||
|
||||
SpWilsonGaugeActionR Waction(beta);
|
||||
|
||||
auto GridPtr = TheHMC.Resources.GetCartesian();
|
||||
auto GridRBPtr = TheHMC.Resources.GetRBCartesian();
|
||||
|
||||
SpTwoIndexAntiSymmetricRepresentation::LatticeField U(GridPtr);
|
||||
// LatticeGaugeField U(GridPtr);
|
||||
|
||||
RealD mass = -0.115;
|
||||
|
||||
std::vector<Complex> boundary = {-1, -1, -1, -1};
|
||||
FermionAction::ImplParams bc(boundary);
|
||||
FermionAction FermOp(U, *GridPtr, *GridRBPtr, mass, bc);
|
||||
|
||||
ConjugateGradient<FermionField> CG(1.0e-8, 2000, false);
|
||||
|
||||
TwoFlavourPseudoFermionAction<FermionImplPolicy> Nf2(FermOp, CG, CG);
|
||||
|
||||
Nf2.is_smeared = false;
|
||||
std::cout << GridLogMessage << "mass " << mass << std::endl;
|
||||
|
||||
ActionLevel<HMCWrapper::Field, TheRepresentations> Level1(1);
|
||||
Level1.push_back(&Nf2);
|
||||
|
||||
ActionLevel<HMCWrapper::Field, TheRepresentations> Level2(4);
|
||||
Level2.push_back(&Waction);
|
||||
|
||||
TheHMC.TheAction.push_back(Level1);
|
||||
TheHMC.TheAction.push_back(Level2);
|
||||
|
||||
TheHMC.Parameters.MD.MDsteps = 16;
|
||||
TheHMC.Parameters.MD.trajL = 1.0;
|
||||
|
||||
TheHMC.ReadCommandLine(argc, argv);
|
||||
TheHMC.Run();
|
||||
|
||||
Grid_finalize();
|
||||
}
|
74
tests/sp2n/Test_hmc_Sp_WilsonFundFermionGauge.cc
Normal file
74
tests/sp2n/Test_hmc_Sp_WilsonFundFermionGauge.cc
Normal file
@ -0,0 +1,74 @@
|
||||
#include <Grid/Grid.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
using namespace Grid;
|
||||
|
||||
typedef Representations< SpFundamentalRepresentation > TheRepresentations;
|
||||
|
||||
Grid_init(&argc, &argv);
|
||||
|
||||
typedef GenericSpHMCRunnerHirep<TheRepresentations, MinimumNorm2> HMCWrapper; // ok
|
||||
typedef SpWilsonImplR FermionImplPolicy; // ok
|
||||
typedef SpWilsonFermionD FermionAction; // ok
|
||||
typedef typename FermionAction::FermionField FermionField; // ok?
|
||||
|
||||
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
|
||||
HMCWrapper TheHMC;
|
||||
|
||||
TheHMC.Resources.AddFourDimGrid("gauge");
|
||||
|
||||
// Checkpointer definition
|
||||
CheckpointerParameters CPparams;
|
||||
CPparams.config_prefix = "ckpoint_lat";
|
||||
CPparams.rng_prefix = "ckpoint_rng";
|
||||
CPparams.saveInterval = 100;
|
||||
CPparams.format = "IEEE64BIG";
|
||||
|
||||
TheHMC.Resources.LoadNerscCheckpointer(CPparams);
|
||||
|
||||
RNGModuleParameters RNGpar;
|
||||
RNGpar.serial_seeds = "1 2 3 4 5";
|
||||
RNGpar.parallel_seeds = "6 7 8 9 10";
|
||||
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||
|
||||
// Construct observables
|
||||
typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs;
|
||||
TheHMC.Resources.AddObservable<PlaqObs>();
|
||||
|
||||
RealD beta = 7.2 ;
|
||||
|
||||
SpWilsonGaugeActionR Waction(beta);
|
||||
|
||||
auto GridPtr = TheHMC.Resources.GetCartesian();
|
||||
auto GridRBPtr = TheHMC.Resources.GetRBCartesian();
|
||||
|
||||
SpFundamentalRepresentation::LatticeField U(GridPtr);
|
||||
|
||||
RealD mass = -0.76;
|
||||
|
||||
FermionAction FermOp(U, *GridPtr, *GridRBPtr, mass);
|
||||
|
||||
ConjugateGradient<FermionField> CG(1.0e-8, 2000, false);
|
||||
|
||||
TwoFlavourPseudoFermionAction<FermionImplPolicy> Nf2(FermOp, CG, CG);
|
||||
|
||||
Nf2.is_smeared = false;
|
||||
|
||||
ActionLevel<HMCWrapper::Field, TheRepresentations > Level1(1);
|
||||
Level1.push_back(&Nf2);
|
||||
|
||||
ActionLevel<HMCWrapper::Field, TheRepresentations > Level2(4);
|
||||
Level2.push_back(&Waction);
|
||||
|
||||
TheHMC.TheAction.push_back(Level1);
|
||||
TheHMC.TheAction.push_back(Level2);
|
||||
|
||||
TheHMC.Parameters.MD.MDsteps = 36;
|
||||
TheHMC.Parameters.MD.trajL = 1.0;
|
||||
|
||||
TheHMC.ReadCommandLine(argc, argv);
|
||||
TheHMC.Run();
|
||||
|
||||
Grid_finalize();
|
||||
}
|
99
tests/sp2n/Test_hmc_Sp_pureGaugeWilson.cc
Normal file
99
tests/sp2n/Test_hmc_Sp_pureGaugeWilson.cc
Normal file
@ -0,0 +1,99 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_hmc_WilsonFermionGauge.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Peter Boyle <pabobyle@ph.ed.ac.uk>
|
||||
Author: neo <cossu@post.kek.jp>
|
||||
Author: Guido Cossu <guido.cossu@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>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
using namespace Grid;
|
||||
|
||||
Grid_init(&argc, &argv);
|
||||
GridLogLayout();
|
||||
|
||||
typedef GenericSpHMCRunner<MinimumNorm2> 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<HMCWrapper::ImplPolicy> PlaqObs;
|
||||
typedef TopologicalChargeMod<HMCWrapper::ImplPolicy> QObs;
|
||||
TheHMC.Resources.AddObservable<PlaqObs>();
|
||||
TopologyObsParameters TopParams;
|
||||
TopParams.interval = 5;
|
||||
TopParams.do_smearing = true;
|
||||
TopParams.Smearing.init_step_size = 0.01;
|
||||
TopParams.Smearing.tolerance = 1e-5;
|
||||
//TopParams.Smearing.steps = 200;
|
||||
//TopParams.Smearing.step_size = 0.01;
|
||||
TopParams.Smearing.meas_interval = 50;
|
||||
TopParams.Smearing.maxTau = 2.0;
|
||||
TheHMC.Resources.AddObservable<QObs>(TopParams);
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Collect actions, here use more encapsulation
|
||||
// need wrappers of the fermionic classes
|
||||
// that have a complex construction
|
||||
// standard
|
||||
RealD beta = 8.0 ;
|
||||
SpWilsonGaugeActionR Waction(beta);
|
||||
|
||||
ActionLevel<HMCWrapper::Field> 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
|
240
tests/sp2n/Test_project_on_Sp.cc
Normal file
240
tests/sp2n/Test_project_on_Sp.cc
Normal file
@ -0,0 +1,240 @@
|
||||
#include <Grid/Grid.h>
|
||||
|
||||
using namespace Grid;
|
||||
|
||||
template <typename T>
|
||||
bool has_correct_group_block_structure(const T& U) {
|
||||
std::cout << GridLogMessage << "Checking the structure is " << std::endl;
|
||||
std::cout << GridLogMessage << "U = ( W X ) " << std::endl;
|
||||
std::cout << GridLogMessage << " ( -X^* W^* ) " << std::endl;
|
||||
std::cout << GridLogMessage << std::endl;
|
||||
|
||||
const int nsp = Nc / 2;
|
||||
Complex i(0., 1.);
|
||||
for (int c1 = 0; c1 < nsp; c1++) // check on W
|
||||
{
|
||||
for (int c2 = 0; c2 < nsp; c2++) {
|
||||
auto W = PeekIndex<ColourIndex>(U, c1, c2);
|
||||
auto Wstar = PeekIndex<ColourIndex>(U, c1 + nsp, c2 + nsp);
|
||||
auto Ww = conjugate(Wstar);
|
||||
auto amizero = sum(W - Ww);
|
||||
auto amizeroo = TensorRemove(amizero);
|
||||
assert(amizeroo.real() < 10e-6);
|
||||
amizeroo *= i;
|
||||
assert(amizeroo.real() < 10e-6);
|
||||
}
|
||||
}
|
||||
|
||||
for (int c1 = 0; c1 < nsp; c1++) {
|
||||
for (int c2 = 0; c2 < nsp; c2++) {
|
||||
auto X = PeekIndex<ColourIndex>(U, c1, c2 + nsp);
|
||||
auto minusXstar = PeekIndex<ColourIndex>(U, c1 + nsp, c2);
|
||||
auto minusXx = conjugate(minusXstar);
|
||||
auto amizero = sum(X + minusXx);
|
||||
auto amizeroo = TensorRemove(amizero);
|
||||
assert(amizeroo.real() < 10e-6);
|
||||
amizeroo *= i;
|
||||
assert(amizeroo.real() < 10e-6);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
bool is_element_of_sp2n_group(const T& U) {
|
||||
LatticeColourMatrixD aux(U.Grid());
|
||||
LatticeColourMatrixD identity(U.Grid());
|
||||
identity = 1.0;
|
||||
LatticeColourMatrixD Omega(U.Grid());
|
||||
Sp<Nc>::Omega(Omega);
|
||||
|
||||
std::cout << GridLogMessage << "Check matrix is non-zero " << std::endl;
|
||||
assert(norm2(U) > 1e-8);
|
||||
|
||||
std::cout << GridLogMessage << "Unitary check" << std::endl;
|
||||
aux = U * adj(U) - identity;
|
||||
std::cout << GridLogMessage << "U adjU - 1 = " << norm2(aux) << std::endl;
|
||||
assert(norm2(aux) < 1e-8);
|
||||
|
||||
aux = Omega - (U * Omega * transpose(U));
|
||||
std::cout << GridLogMessage << "Omega - U Omega transpose(U) = " << norm2(aux)
|
||||
<< std::endl;
|
||||
assert(norm2(aux) < 1e-8);
|
||||
|
||||
std::cout << GridLogMessage
|
||||
<< "|Det| = " << norm2(Determinant(U)) / U.Grid()->gSites()
|
||||
<< std::endl;
|
||||
assert(norm2(Determinant(U)) / U.Grid()->gSites() - 1 < 1e-8);
|
||||
|
||||
return has_correct_group_block_structure(U);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void test_group_projections(T U) {
|
||||
RealD Delta = 666.;
|
||||
LatticeColourMatrixD identity(U.Grid());
|
||||
identity = 1.0;
|
||||
|
||||
std::cout << GridLogMessage << "# # # #" << std::endl;
|
||||
std::cout << GridLogMessage << "Group" << std::endl;
|
||||
std::cout << GridLogMessage << "# # # #" << std::endl;
|
||||
std::cout << GridLogMessage << std::endl;
|
||||
|
||||
std::string name = "ProjectOnSpGroup";
|
||||
std::cout << GridLogMessage << "Testing " << name << std::endl;
|
||||
std::cout << GridLogMessage << "Apply to deformed matrix" << std::endl;
|
||||
|
||||
U = U + Delta * identity;
|
||||
U = ProjectOnSpGroup(U);
|
||||
assert(is_element_of_sp2n_group(U));
|
||||
|
||||
name = "ProjectOnGeneralGroup";
|
||||
std::cout << GridLogMessage << "Testing " << name << std::endl;
|
||||
std::cout << GridLogMessage << "Apply to deformed matrix" << std::endl;
|
||||
|
||||
U = U + Delta * identity;
|
||||
U = Sp<Nc>::ProjectOnGeneralGroup(U);
|
||||
assert(is_element_of_sp2n_group(U));
|
||||
|
||||
name = "ProjectOnSpecialGroup";
|
||||
std::cout << GridLogMessage << "Testing " << name << std::endl;
|
||||
std::cout << GridLogMessage << "Apply to deformed matrix" << std::endl;
|
||||
|
||||
U = U + Delta * identity;
|
||||
Sp<Nc>::ProjectOnSpecialGroup(U);
|
||||
assert(is_element_of_sp2n_group(U));
|
||||
|
||||
name = "ProjectSpn";
|
||||
std::cout << GridLogMessage << "Testing " << name << std::endl;
|
||||
std::cout << GridLogMessage << "Apply to deformed matrix" << std::endl;
|
||||
|
||||
U = U + Delta * identity;
|
||||
ProjectSpn(U);
|
||||
assert(is_element_of_sp2n_group(U));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool has_correct_algebra_block_structure(const T& U) {
|
||||
// this only checks for the anti-hermitian part of the algebra
|
||||
const int nsp = Nc / 2;
|
||||
Complex i(0., 1.);
|
||||
std::cout << GridLogMessage << "Checking the structure is " << std::endl;
|
||||
std::cout << GridLogMessage << "U = ( W X ) " << std::endl;
|
||||
std::cout << GridLogMessage << " ( -X^* W^* ) " << std::endl;
|
||||
for (int c1 = 0; c1 < nsp; c1++) // check on W
|
||||
{
|
||||
for (int c2 = 0; c2 < nsp; c2++) {
|
||||
auto W = PeekIndex<ColourIndex>(U, c1, c2);
|
||||
auto Wstar = PeekIndex<ColourIndex>(U, c1 + nsp, c2 + nsp);
|
||||
auto Ww = conjugate(Wstar);
|
||||
auto amizero = sum(W - Ww);
|
||||
auto amizeroo = TensorRemove(amizero);
|
||||
assert(amizeroo.real() < 10e-6);
|
||||
amizeroo *= i;
|
||||
assert(amizeroo.real() < 10e-6);
|
||||
}
|
||||
}
|
||||
for (int c1 = 0; c1 < nsp; c1++) {
|
||||
for (int c2 = 0; c2 < nsp; c2++) {
|
||||
auto X = PeekIndex<ColourIndex>(U, c1, c2 + nsp);
|
||||
auto minusXstar = PeekIndex<ColourIndex>(U, c1 + nsp, c2);
|
||||
auto minusXx = conjugate(minusXstar);
|
||||
auto amizero = sum(X + minusXx);
|
||||
auto amizeroo = TensorRemove(amizero);
|
||||
assert(amizeroo.real() < 10e-6);
|
||||
amizeroo *= i;
|
||||
assert(amizeroo.real() < 10e-6);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool is_element_of_sp2n_algebra(const T& U) {
|
||||
LatticeColourMatrixD aux(U.Grid());
|
||||
LatticeColourMatrixD identity(U.Grid());
|
||||
identity = 1.0;
|
||||
LatticeColourMatrixD Omega(U.Grid());
|
||||
Sp<Nc>::Omega(Omega);
|
||||
|
||||
std::cout << GridLogMessage << "Check matrix is non-zero " << std::endl;
|
||||
assert(norm2(U) > 1e-8);
|
||||
|
||||
aux = U - adj(U);
|
||||
std::cout << GridLogMessage << "T - Tda = " << norm2(aux)
|
||||
<< " (not supposed to vanish)" << std::endl;
|
||||
|
||||
aux = U + adj(U);
|
||||
std::cout << GridLogMessage << "T + Tda = " << norm2(aux)
|
||||
<< " (supposed to vanish)" << std::endl;
|
||||
assert(norm2(aux) - 1 < 1e-8);
|
||||
|
||||
std::cout << GridLogMessage << "Check that Omega T Omega + conj(T) = 0 "
|
||||
<< std::endl;
|
||||
aux = Omega * U * Omega + conjugate(U);
|
||||
assert(norm2(aux) < 1e-8);
|
||||
|
||||
return has_correct_algebra_block_structure(U);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void test_algebra_projections(T U) {
|
||||
RealD Delta = 666.;
|
||||
LatticeColourMatrixD tmp(U.Grid());
|
||||
LatticeColourMatrixD identity(U.Grid());
|
||||
identity = 1.0;
|
||||
|
||||
std::cout << GridLogMessage << "# # # #" << std::endl;
|
||||
std::cout << GridLogMessage << "Algebra" << std::endl;
|
||||
std::cout << GridLogMessage << "# # # #" << std::endl;
|
||||
std::cout << GridLogMessage << std::endl;
|
||||
|
||||
std::string name = "SpTa";
|
||||
std::cout << GridLogMessage << "Testing " << name << std::endl;
|
||||
std::cout << GridLogMessage << "Apply to deformed matrix" << std::endl;
|
||||
|
||||
U = U + Delta * identity;
|
||||
U = SpTa(U);
|
||||
assert(is_element_of_sp2n_algebra(U));
|
||||
|
||||
name = "TaProj";
|
||||
std::cout << GridLogMessage << "Testing " << name << std::endl;
|
||||
std::cout << GridLogMessage << "Apply to deformed matrix" << std::endl;
|
||||
|
||||
U = U + Delta * identity;
|
||||
Sp<Nc>::taProj(U, tmp);
|
||||
U = tmp;
|
||||
assert(is_element_of_sp2n_algebra(U));
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
Grid_init(&argc, &argv);
|
||||
|
||||
Coordinate latt_size = GridDefaultLatt();
|
||||
Coordinate simd_layout = GridDefaultSimd(Nd, vComplex::Nsimd());
|
||||
Coordinate mpi_layout = GridDefaultMpi();
|
||||
|
||||
GridCartesian Grid(latt_size, simd_layout, mpi_layout);
|
||||
|
||||
LatticeGaugeField Umu(&Grid);
|
||||
LatticeColourMatrixD U(&Grid);
|
||||
|
||||
// Will test resimplectification-related functionalities (from
|
||||
// ProjectOnGeneralGroup, ProjectOnSpGroup, ProjectOnSpecialGroup) and projection on the
|
||||
// algebra (from SpTa)
|
||||
// ProjectOnGeneralGroup, ProjectOnSpGroup project on the non-special group allowi for complex determinants of module 1
|
||||
// ProjectOnSpecialGroup projects on the full gauge group providing a determinant equals to 1
|
||||
|
||||
std::vector<int> pseeds({1, 2, 3, 4, 5});
|
||||
GridParallelRNG pRNG(&Grid);
|
||||
pRNG.SeedFixedIntegers(pseeds);
|
||||
|
||||
SU<Nc>::HotConfiguration(pRNG, Umu);
|
||||
U = PeekIndex<LorentzIndex>(Umu, 0);
|
||||
test_group_projections(U);
|
||||
U = PeekIndex<LorentzIndex>(Umu, 1);
|
||||
test_algebra_projections(U);
|
||||
|
||||
Grid_finalize();
|
||||
}
|
65
tests/sp2n/Test_sp2n_lie_gen.cc
Normal file
65
tests/sp2n/Test_sp2n_lie_gen.cc
Normal file
@ -0,0 +1,65 @@
|
||||
#include <Grid/Grid.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace Grid;
|
||||
|
||||
template <int ngroup>
|
||||
std::ostream& operator<<(std::ostream& o, Sp<ngroup> g) {
|
||||
return o << "Sp(" << ngroup << ") Fundamental";
|
||||
}
|
||||
|
||||
template <int ngroup, TwoIndexSymmetry S>
|
||||
std::ostream& operator<<(std::ostream& o, Sp_TwoIndex<ngroup, S> g) {
|
||||
return o << "Sp(" << ngroup << ") TwoIndex "
|
||||
<< (S == Symmetric ? "Symmetric" : "AntiSymmetric");
|
||||
}
|
||||
|
||||
template <class Group>
|
||||
void run_check_on(bool print_generators = false) {
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
std::cout << GridLogMessage << "* Generators for " << Group() << std::endl;
|
||||
std::cout << GridLogMessage << "*********************************************"
|
||||
<< std::endl;
|
||||
|
||||
if (print_generators) {
|
||||
Group::printGenerators();
|
||||
}
|
||||
Group::testGenerators();
|
||||
}
|
||||
|
||||
template <int ngroup>
|
||||
void run_checks() {
|
||||
run_check_on<Sp<ngroup>>();
|
||||
run_check_on<Sp_TwoIndex<ngroup, Symmetric>>();
|
||||
run_check_on<Sp_TwoIndex<ngroup, AntiSymmetric>>();
|
||||
}
|
||||
|
||||
template <>
|
||||
void run_checks<2>() {
|
||||
// Print generators because they are small enough to be actually helpful.
|
||||
run_check_on<Sp<2>>(true);
|
||||
run_check_on<Sp_TwoIndex<2, Symmetric>>(true);
|
||||
// The AntiSymmetric representation is 0 dimensional. This makes problems in
|
||||
// device code.
|
||||
}
|
||||
|
||||
template <>
|
||||
void run_checks<4>() {
|
||||
// Print generators because they are small enough to be actually helpful.
|
||||
run_check_on<Sp<4>>(true);
|
||||
run_check_on<Sp_TwoIndex<4, Symmetric>>(true);
|
||||
run_check_on<Sp_TwoIndex<4, AntiSymmetric>>(true);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
Grid_init(&argc, &argv);
|
||||
|
||||
run_checks<2>();
|
||||
run_checks<4>();
|
||||
run_checks<6>();
|
||||
run_checks<8>();
|
||||
|
||||
Grid_finalize();
|
||||
}
|
Reference in New Issue
Block a user