diff --git a/cpp/particles/p2p/p2p_ghost_collisions.hpp b/cpp/particles/p2p/p2p_ghost_collisions.hpp index 8f119077b06ad294e16e35082db6a616b3602f05..12e499e7c9df6ea51a73e2c41e831bffbea7b50a 100644 --- a/cpp/particles/p2p/p2p_ghost_collisions.hpp +++ b/cpp/particles/p2p/p2p_ghost_collisions.hpp @@ -218,7 +218,7 @@ public: real_number /*rhs_part2*/[], const real_number dist_pow2, const real_number /*cutoff*/, - const real_number xseparation, + const real_number xseparation, /* This separation is x1-x2 */ const real_number yseparation, const real_number zseparation){ switch(this->current_particle_shape) @@ -250,8 +250,8 @@ public: xq = x * pos_part2[IDXC_X+3] + y * pos_part2[IDXC_Y+3] + z * pos_part2[IDXC_Z+3]; /* t and s parametrize the two rods. Find min distance: */ assert(this->cylinder_length > 0); - t = 2.0/(this->cylinder_length*(pq*pq-1.0))*(-xp+pq*xq); - s = 2.0/(this->cylinder_length*(pq*pq-1.0))*(-pq*xp+xq); + t = 2.0/(this->cylinder_length*(pq*pq-1.0))*(xp-pq*xq); + s = 2.0/(this->cylinder_length*(pq*pq-1.0))*(pq*xp-xq); /* Test if -1<s<1 and -1<t<1 */ if( abs(t)<=1.0 and abs(s)<=1.0 ) {