commit b5de5eea187fbabfd6fe7c57c8dbdd31ad29255c
parent a97a6f3ef90bc23dda77ad60991fe53ecd24b2e9
Author: Bakar Chargeishvili <bakar@bcharge.de>
Date: Thu, 28 Apr 2022 09:59:00 +0200
Correct the leg indices
Diffstat:
M | webs.c | | | 29 | ++++++++++++++++++----------- |
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/webs.c b/webs.c
@@ -32,8 +32,8 @@ generate_legs(char **init, size_t n_init, char **fin, size_t n_fin, size_t nLoop
if (!strcmp("g", init[i]))
isGluon = 1;
Vertex *Vertices = (Vertex*)ecalloc(nLoops+1, sizeof(Vertex));
- Vertices[0] = (Vertex){i,0};
- Legs[i] = (Leg){init[i], 1, i, 0, isGluon, Vertices};
+ Vertices[0] = (Vertex){i+1,0};
+ Legs[i+1] = (Leg){init[i], 1, i, 0, isGluon, Vertices};
}
for (int i=0; i<n_fin; ++i) {
@@ -42,7 +42,7 @@ generate_legs(char **init, size_t n_init, char **fin, size_t n_fin, size_t nLoop
isGluon = 1;
Vertex *Vertices = (Vertex *)ecalloc(nLoops+1, sizeof(Vertex));
Vertices[0] = (Vertex){n_init+i,0};
- Legs[n_init+i] = (Leg){init[i], 1, n_init+i, 0, isGluon,Vertices};
+ Legs[n_init+i+1] = (Leg){init[i], 1, n_init+i, 0, isGluon,Vertices};
}
}
@@ -53,7 +53,7 @@ generate_vertices(Leg *Legs, size_t nLegs, int nLoops, Vertex *Vertices)
for (int j=0; j<nLoops; ++j) {
/* TODO: Don't forget to add vertices for self-energies later */
Vertices[j+nLoops*i] = (Vertex){i+1, 1+j};
- Legs[i].Vertices[j+1] = Vertices[j+nLoops*i];
+ Legs[i+1].Vertices[j+1] = Vertices[j+nLoops*i];
}
}
@@ -65,19 +65,26 @@ generate_vertices(Leg *Legs, size_t nLegs, int nLoops, Vertex *Vertices)
}
void
-generate_loops(Vertex *Vertices, int *deletedVertices, Link *Graphs, size_t nVx, int nLoops, int nGenLoops)
+generate_loops(Vertex *Vertices, Leg *Legs, Link *Graphs, size_t nVx, size_t nLegs, int nLoops, int nGenLoops)
{
for (int iVx = 0; iVx < nVx; ++iVx) {
+ Vertex V = Vertices[iVx];
+ printf("V%d%d\n", V.legId, V.id);
+ for (int iLeg = V.legId+1; iLeg <= nLegs; ++iLeg) {
+ printf("%d ", iLeg);
+ }
+ printf("\n");
+ /*
Link *Graph = (Link *)ecalloc(nLoops, sizeof(Link));
int iEdge = -1;
for (int jVx = 0; jVx < nVx; ++jVx) {
if (iVx == jVx) {
continue;
}
- /* Add a connection */
Graph[++iEdge] = (Link){Vertices[iVx], Vertices[jVx]};
printf("V%d%d\n", iVx, jVx);
}
+ */
}
/* Find the first non-deleted vertex */
//int mVx = -1;
@@ -168,7 +175,7 @@ main(int argc, char *argv[])
int nLoops = 1;
size_t nLegs = NELEMS(initial) + NELEMS(final);
- Leg Legs[nLegs];
+ Leg Legs[nLegs+1];
generate_legs(initial,NELEMS(initial), final, NELEMS(final), nLoops, Legs);
size_t nVx = nLegs*nLoops;
@@ -179,12 +186,12 @@ main(int argc, char *argv[])
printf("V%d%d\n",Vertices[i].legId,Vertices[i].id);
}
- int *deletedVertices = (int *)ecalloc(nVx, sizeof(int));
+ /*int *deletedVertices = (int *)ecalloc(nVx, sizeof(int));*/
Link *Graphs = (Link *)ecalloc(300*nLoops, sizeof(Link));
Link *Skeleton = (Link *)ecalloc(300*nLoops, sizeof(Link));
int iEdge = -1;
- for (int iLeg = 0; iLeg < nLegs; ++iLeg) {
+ for (int iLeg = 1; iLeg <= nLegs; ++iLeg) {
Vertex* LegVertices = Legs[iLeg].Vertices;
Skeleton[++iEdge] = (Link){LegVertices[0],LegVertices[1]};
for (int iVx = 1; iVx < nLoops; ++iVx) {
@@ -200,9 +207,9 @@ main(int argc, char *argv[])
}
printf("Edge count: %d\n", iEdge);
- return 0;
- generate_loops(Vertices, deletedVertices, Graphs, nVx, nLoops, 0);
+ generate_loops(Vertices, Legs, Graphs, nVx, nLegs, nLoops, 0);
+ return 0;
for (int iVx=0; iVx<300; ++iVx) {
printf("Graph ID: %d\n",iVx);