1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-11-16 03:29:31 +00:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Chulwoo Jung
2bf9179d2c Adding mass step 2025-08-06 16:52:51 +00:00
Chulwoo Jung
c606f5dca0 Move out src initialization for re-use / Adding antiperiodic BC 2025-08-06 16:51:14 +00:00
Chulwoo Jung
8419cc5c64 specflow evec I/O added, 2025-07-11 15:57:23 -04:00
Chulwoo Jung
2cc6deb8e0 Merge branch 'develop' of https://github.com/paboyle/Grid into ic2 2025-04-25 10:48:41 -04:00
Chulwoo Jung
19d0590579 Checking in for merging 2025-04-25 10:48:22 -04:00
6 changed files with 68 additions and 17 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

@@ -873,7 +873,7 @@ int main (int argc, char ** argv)
int do_su4=0;
int do_memory=1;
int do_comms =1;
int do_blas =1;
int do_blas =0;
int do_dslash=1;
int sel=4;

View File

@@ -1,14 +1,15 @@
<?xml version="1.0"?>
<grid>
<LanczosParameters>
<mass>0.00107</mass>
<mass>-1.025</mass>
<mstep>-0.025</mstep>
<M5>1.8</M5>
<Ls>48</Ls>
<Nstop>10</Nstop>
<Nk>15</Nk>
<Np>85</Np>
<ChebyLow>0.003</ChebyLow>
<ChebyHigh>60</ChebyHigh>
<ChebyOrder>201</ChebyOrder>
<Nk>12</Nk>
<Np>30</Np>
<ChebyLow>0.1</ChebyLow>
<ChebyHigh>50</ChebyHigh>
<ChebyOrder>51</ChebyOrder>
</LanczosParameters>
</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,29 @@ 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 ,
RealD, mstep ,
Integer, Nstop,
Integer, Nk,
Integer, Np,
RealD, ChebyLow,
RealD, ChebyHigh,
Integer, ChebyOrder)
@@ -158,10 +177,19 @@ int main(int argc, char** argv) {
}
mass=LanParams.mass;
Nstop=LanParams.Nstop;
Nk=LanParams.Nk;
Np=LanParams.Np;
Nm = Nk + Np;
FermionField src(FGrid);
gaussian(RNG5, src);
std::vector<Complex> boundary = {1,1,1,-1};
FermionOp::ImplParams Params(boundary);
while ( mass > - 5.0){
FermionOp WilsonOperator(Umu,*FGrid,*FrbGrid,mass);
while ( mass > - 2.5){
FermionOp WilsonOperator(Umu,*FGrid,*FrbGrid,mass,Params);
MdagMLinearOperator<FermionOp,FermionField> HermOp(WilsonOperator); /// <-----
//SchurDiagTwoOperator<FermionOp,FermionField> HermOp(WilsonOperator);
Gamma5HermitianLinearOperator <FermionOp,LatticeFermion> HermOp2(WilsonOperator); /// <-----
@@ -182,8 +210,6 @@ while ( mass > - 5.0){
ImplicitlyRestartedLanczos<FermionField> IRL(OpCheby, Op2, Nstop, Nk, Nm, resid, MaxIt);
std::vector<RealD> eval(Nm);
FermionField src(FGrid);
gaussian(RNG5, src);
std::vector<FermionField> evec(Nm, FGrid);
for (int i = 0; i < 1; i++) {
std::cout << i << " / " << Nm << " grid pointer " << evec[i].Grid()
@@ -202,9 +228,17 @@ 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;
src += evec[3]+evec[4]+evec[5];
src += evec[6]+evec[7]+evec[8];
mass += LanParams.mstep;
}
Grid_finalize();