Add check based on maximum number of pairs#104
Conversation
Luthaf
left a comment
There was a problem hiding this comment.
Thanks, this looks very good! I think the example with cutoff=4 and 100 points should work, so we might have to also increase VESIN_CUDA_MAX_PAIRS_PER_POINT anyway.
|
Thant can be done easily. What do you think would be a reasonable threshold? In this case the length of the neighbor list was about 100k. |
|
So thinking a bit more about it, the density in this example was kinda insane. A more reasonable example, with the density of osmium, gives me around 200 pairs per atom for a cutoff equal to the cell size. Since the number of pairs will scale with the cutoff cube, I guess something like Should be fine? It seems to always be larger than the number of pairs for some tests I ran. |
|
And then we can change the example to use a cell of 11A, with a cutoff of 14 A |
Yes, exactly. But was not sure what your requirement are (like doing some crazy high-pressure stuff...).
Currently, |
I think this makes more sense, no? This way we don't waste VRAM when we have a small cutoff, but we don't crash unless something very wrong is going on |
Luthaf
left a comment
There was a problem hiding this comment.
Merging this for now, and we can add a dynamic max_pair in a separate PR
The maximum number of pairs that can be handled is limited by
VESIN_CUDA_MAX_PAIRS_PER_POINT. The following tests was failing with a large cutoff:This PR introduces bound checks preventing out of bound accesses.