Skip to content
Snippets Groups Projects
Commit 9229de8f authored by Heikki Mäntysaari's avatar Heikki Mäntysaari
Browse files

Add methods to refer to Wilson lines using lattice indices

Also new way of computing the lattice index from the coordinate.
Indices differ from previous version ones by 1 unit, no effect
in continuum limit/when averaging over configurations
parent 61cd1342
No related branches found
No related tags found
No related merge requests found
......@@ -143,22 +143,20 @@ WilsonLine& IPGlasma::GetWilsonLine(double x, double y)
ApplyPeriodicBoundaryConditions(q);
x=q[0];
y=q[1];
int xind = FindIndex(x, xcoords);
int yind = FindIndex(y, ycoords);
std::vector<int> coords = LatticeCoordinates(x,y);
// Handle edges
if (xind < 0)
xind = 0;
if (xind >= xcoords.size())
xind = xcoords.size()-1;
if (yind < 0)
yind = 0;
if (yind >= ycoords.size())
yind = ycoords.size()-1;
//cout << "Coordinates " << x << ", " << y << " indeces " << xind << ", " << yind << endl;
if (coords[0] < 0)
coords[0] = 0;
if (coords[0] >= xcoords.size())
coords[0] = xcoords.size()-1;
if (coords[1] < 0)
coords[1] = 0;
if (coords[1] >= ycoords.size())
coords[1] = ycoords.size()-1;
return wilsonlines[ xind*xcoords.size() + yind];
return GetWilsonLine( WilsonLineCoordinate(coords[0],coords[1]));
}
......@@ -452,38 +450,23 @@ void IPGlasma::SetSchwinger(bool s, double rc)
}
}
/* Returns index i for which
* vec[i]<=val
* Assumes that vec[i]<vec[i+1]
* If such index can't be found, returns -1
*/
int FindIndex(double val, std::vector<double> &vec)
std::vector<int> IPGlasma::LatticeCoordinates(double x, double y)
{
if (val < vec[0]) return -1;
int ind=-1;
uint start=0; uint end=vec.size()-1;
while(end-start>5)
{
int tmp = static_cast<int>((start+end)/2.0);
if (vec[tmp]>=val)
end=tmp;
else
start=tmp;
}
for (uint i=start; i<=end; i++)
{
if (vec[i]<=val and vec[i+1]>val)
{
ind=i;
break;
}
}
if (ind == -1) return vec.size()-1;
return ind;
std::vector<int> ret;
// Note: My lattice is from -L/2 to L/2, so I need to shift the coordinates
x = x + xcoords[xcoords.size()-1];
y = y + ycoords[ycoords.size()-1];
double lattice_spacing = xcoords[1]-xcoords[0];
int ix = x/lattice_spacing;
int iy = y/lattice_spacing;
return std::vector<int> {ix, iy};
}
int IPGlasma::WilsonLineCoordinate(int xind, int yind)
{
return xcoords.size()*xind + yind;
}
......@@ -32,7 +32,7 @@ public:
double Amplitude(double xpom, double q1[2], double q2[2]);
double AmplitudeImaginaryPart(double xpom, double q1[2], double q2[2] );
WilsonLine& GetWilsonLine( double x, double y); // Find Wilson line that corresponds to the coordinate
WilsonLine& GetWilsonLine( double x, double y); // Find Wilson line at the given point (x,y) [GeV^-1]
std::string InfoStr();
......@@ -48,6 +48,13 @@ public:
void SetSchwinger(bool s, double rc=0);
void ApplyPeriodicBoundaryConditions(double q[2]);
std::vector<int> LatticeCoordinates(double x, double y);
int WilsonLineCoordinate(int xind, int yind);
WilsonLine& GetWilsonLine(int i) { return wilsonlines[i]; }
double X(int ix) { return xcoords[ix]; }
double Y(int iy) { return ycoords[iy]; }
private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment