1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-07-12 11:17:07 +01:00

specflow evec I/O added,

This commit is contained in:
Chulwoo Jung
2025-07-11 15:57:23 -04:00
parent 2cc6deb8e0
commit 8419cc5c64
4 changed files with 49 additions and 5 deletions

View File

@ -28,6 +28,11 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
/* END LEGAL */
#pragma once
#ifndef MIN
#define MIN(x,y) ((x)>(y)?(y):(x))
#endif
// Introduce a class to gain deterministic bit reproducible reduction.
// make static; perhaps just a namespace is required.
NAMESPACE_BEGIN(Grid);

View File

@ -33,9 +33,13 @@ using namespace std;
using namespace Grid;
;
//typedef WilsonFermionD FermionOp;
#if 0
typedef DomainWallFermionD FermionOp;
typedef typename DomainWallFermionD::FermionField FermionField;
#else
typedef MobiusFermionD FermionOp;
typedef typename MobiusFermionD::FermionField FermionField;
#endif
RealD AllZero(RealD x) { return 0.; }
@ -170,10 +174,11 @@ int main(int argc, char** argv) {
int Nm = Nk + Np;
int MaxIt = 10000;
RealD resid = 1.0e-5;
RealD mob_b=1.5;
//while ( mass > - 5.0){
FermionOp Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
// FermionOp Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
FermionOp Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,mob_b,mob_b-1.);
MdagMLinearOperator<FermionOp,FermionField> HermOp(Ddwf); /// <-----
// Gamma5HermitianLinearOperator <FermionOp,LatticeFermion> HermOp2(WilsonOperator); /// <-----
Gamma5R5HermitianLinearOperator<FermionOp, LatticeFermion> G5R5Herm(Ddwf);

View File

@ -113,6 +113,9 @@ struct LanczosParameters: Serializable {
GRID_SERIALIZABLE_CLASS_MEMBERS(LanczosParameters,
RealD, mass ,
RealD, resid,
Integer, Nstop,
Integer, Nk,
Integer, Np,
RealD, ChebyLow,
RealD, ChebyHigh,
Integer, ChebyOrder)
@ -204,7 +207,6 @@ int main(int argc, char** argv) {
int Nstop = 5;
int Nk = 10;
int Np = 90;
int Nm = Nk + Np;
int MaxIt = 10000;
RealD resid = 1.0e-5;
@ -226,10 +228,14 @@ int main(int argc, char** argv) {
XmlWriter HMCwr("LanParams.xml.out");
write(HMCwr,"LanczosParameters",LanParams);
}
Nstop=LanParams.Nstop;
Nk=LanParams.Nk;
Np=LanParams.Np;
mass=LanParams.mass;
resid=LanParams.resid;
int Nm = Nk + Np;
while ( mass > - 5.0){
FermionOp WilsonOperator(Umu,*FGrid,*FrbGrid,2.+mass);

View File

@ -27,6 +27,7 @@ directory
*************************************************************************************/
/* END LEGAL */
#include <Grid/Grid.h>
#include <Grid/parallelIO/IldgIOtypes.h>
using namespace std;
using namespace Grid;
@ -38,11 +39,28 @@ typedef typename WilsonFermionD::FermionField FermionField;
RealD AllZero(RealD x) { return 0.; }
template <class T> void writeFile(T& in, std::string const fname){
#if 1
// Ref: https://github.com/paboyle/Grid/blob/feature/scidac-wp1/tests/debug/Test_general_coarse_hdcg_phys48.cc#L111
std::cout << Grid::GridLogMessage << "Writes to: " << fname << std::endl;
Grid::emptyUserRecord record;
Grid::ScidacWriter WR(in.Grid()->IsBoss());
WR.open(fname);
WR.writeScidacFieldRecord(in,record,0);
WR.close();
#endif
// What is the appropriate way to throw error?
}
namespace Grid {
struct LanczosParameters: Serializable {
GRID_SERIALIZABLE_CLASS_MEMBERS(LanczosParameters,
RealD, mass ,
Integer, Nstop,
Integer, Nk,
Integer, Np,
RealD, ChebyLow,
RealD, ChebyHigh,
Integer, ChebyOrder)
@ -158,6 +176,10 @@ int main(int argc, char** argv) {
}
mass=LanParams.mass;
Nstop=LanParams.Nstop;
Nk=LanParams.Nk;
Np=LanParams.Np;
Nm = Nk + Np;
while ( mass > - 5.0){
@ -202,6 +224,12 @@ while ( mass > - 5.0){
tmp = g5*evec[i];
dot = innerProduct(tmp,evec[i]);
std::cout << mass << " : " << eval[i] << " " << real(dot) << " " << imag(dot) << std::endl ;
// if ( i<1)
{
std::string evfile ("./evec_"+std::to_string(mass)+"_"+std::to_string(i));
auto evdensity = localInnerProduct(evec[i],evec[i] );
writeFile(evdensity,evfile);
}
}
src = evec[0]+evec[1]+evec[2];
mass += -0.1;