Commit 8d906155 authored by Remi Perenon's avatar Remi Perenon
Browse files

Fix bug in parallepipedic universe trajectory

parent 4b54c244
......@@ -297,20 +297,29 @@ parallelepipedic_trajectory(vector3 *x, vector3 *b, int nsteps,
{
double ud[19];
int i, j;
double temp0, temp1, temp2;
if (to_box)
for (i = 0; i < nsteps; i++) {
for (j = 0; j < 9; j++)
ud[j] = data[9*i+j];
parallelepiped_invert(ud);
b[i][0] = ud[0+9]*x[i][0] + ud[1+9]*x[i][1] + ud[2+9]*x[i][2];
b[i][1] = ud[3+9]*x[i][0] + ud[4+9]*x[i][1] + ud[5+9]*x[i][2];
b[i][2] = ud[6+9]*x[i][0] + ud[7+9]*x[i][1] + ud[8+9]*x[i][2];
// Need to store values considering x and b design the same array
temp0 = x[i][0];
temp1 = x[i][1];
temp2 = x[i][2];
b[i][0] = ud[0+9]*temp0 + ud[1+9]*temp1 + ud[2+9]*temp2;
b[i][1] = ud[3+9]*temp0 + ud[4+9]*temp1 + ud[5+9]*temp2;
b[i][2] = ud[6+9]*temp0 + ud[7+9]*temp1 + ud[8+9]*temp2;
}
else
for (i = 0; i < nsteps; i++) {
x[i][0] = data[9*i+0]*b[i][0] + data[9*i+1]*b[i][1] + data[9*i+2]*b[i][2];
x[i][1] = data[9*i+3]*b[i][0] + data[9*i+4]*b[i][1] + data[9*i+5]*b[i][2];
x[i][2] = data[9*i+6]*b[i][0] + data[9*i+7]*b[i][1] + data[9*i+8]*b[i][2];
// Need to store values considering x and b design the same array
temp0 = b[i][0];
temp1 = b[i][1];
temp2 = b[i][2];
x[i][0] = data[9*i+0]*temp0 + data[9*i+1]*temp1 + data[9*i+2]*temp2;
x[i][1] = data[9*i+3]*temp0 + data[9*i+4]*temp1 + data[9*i+5]*temp2;
x[i][2] = data[9*i+6]*temp0 + data[9*i+7]*temp1 + data[9*i+8]*temp2;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment