Patch vecorised pair interactions
Implements:
- Small optimisations to
runner_dopair1_density_vec
.
Merge request reports
Activity
Added 1 commit:
- 854c66b9 - Formatting.
mentioned in issue #354 (closed)
Added 1 commit:
- ee6316b8 - Sign change bug.
While we are at it: Any reason why we shift both cells to the frame of
ci->loc
? Wouldn'tcj->loc
be a better choice given that's where we compute the shift for in the case of periodic BC?Edited by Matthieu Schaller2 separate things, sorry for the confusion.
- Just thinking that the same will have to be done for the cache construction in DOPAIR2.
- For the other aspect I am not 100% sure yet. Let me try to detail this.
The idea of changing frame is that we want to be somewhere where the particle coordinates are close to 0, leaving as many digits as possible for the differences in particle distance within the PAIR. If the two cells are actual neighbours then either
ci
orcj
's position is fine as they are basically the same. Now, if we want to apply periodic BC, we start by moving the particles from one side of the box to the other. If I am not mistaken, we do this by moving the particles inci
to the frame ofcj
using theshift
vector. At this stage the positions are commensurate with the position ofcj
. So removingcj->loc
from them would bring all positions inci
andcj
to something close to 0, leaving all digits for precise position differences. If we instead removeci->loc
, it is still correct, but we are burning some digits unnecessarily I think. Does that make sense ? Basically, all the positions in the cache should ideally be in the range [0, 2*c->width]. And I am not sure this is the case now with periodic BCs.ci->loc[7.000000,7.000000,0.000000], cj->loc[0.000000,0.000000,0.000000] shift[8.000000,8.000000,-0.000000] Error: cj->loc[7.000000,7.000000,0.000000] Particle 0 x pos is not within [-ci->width, ci->width]. x=-7.083333, ci->width[0]=1.000000
That's the first case, but I throw an error so I'm not sure how many more there are.
I get an error in
test125cells
now though:ci->loc[0.000000,0.000000,1.000000], cj->loc[0.000000,1.000000,0.000000] shift[0.000000,0.000000,0.000000] Error: cj->loc[0.000000,1.000000,0.000000] Particle 0 z pos is not within [-ci->width, ci->width]. z=1.916667, ci->width[2]=1.000000
but there are no periodic conditions in effect.
Added 4 commits:
- e7e6c6c6 - Updated tolerances when cj->loc is removed from particle positions.
- 26622f44 - Shift the particle positions in the cache by cj instead of ci to prevent loss of…
- 88b2163a - Compute h_max correctly for cells.
- 2be912fe - Defined a dimension variable and used it in loops and to allocate memory.
Toggle commit listAdded 1 commit:
- 0fd2b62e - Formatting.
Added 1 commit:
- 966bed0c - Missed sqrt(3) term in error message.
Of course EAGLE_25 throws an error.
Error: cj->loc[11.148849,16.597804,12.040922] Particle 0 z pos is not within [-sqrt(3)*ci->width, 2*sqrt(3)*ci->width]. z=-0.002415, ci->width[2]=0.001379
after the 67th step. The values are closeish, z=-0.002415 sqrt(3)*ci->width = -0.002388498.
Edited by James WillisI think it should be between: [-2*sqrt(3)ci->width, 2sqrt(3)*ci->width], shouldn't it? That updated condition still fails:
Error: cj->loc[11.148849,16.597804,12.040922] Particle 0 z pos is not within [-2*sqrt(3)*ci->width, 2*sqrt(3)*ci->width]. z=-0.004795, ci->width[2]=0.001379
The values are closer, z=-0.004795 2*sqrt(3)*ci->width = -0.004776996.
z=-0.005564, ci->width[2]=0.001379. So -0.005564 vs -0.005516
Edited by James Willis@jwillis actually, it can be more than that. Check
cell_need_rebuild_for_pair()
to see what the maximal motion of a particle outside of its starting cell can be.Okay, so:
-
[-2*sqrt(3) * ci->width[0] * (1. + 2.*space_maxreldx), 2*sqrt(3) * ci->width[0] * (1. + 2.*space_maxreldx)]
fails EAGLE_25, -
[-4 * ci->width[0] * (1. + 2.*space_maxreldx), 4 * ci->width[0] * (1. + 2.*space_maxreldx)]
passes EAGLE_25, -
[-2 * ci->width[0] * (1. + 2.*space_maxreldx), 4 * ci->width[0] * (1. + 2.*space_maxreldx)]
fails EAGLE_25.
-