Repository navigation
perf: Start using cells for bonding calculation - #2621
Merged
Merged
Conversation
rprospero
requested review from
RobBuchananCompPhys and
trisyoungs
and removed request for
trisyoungs
September 24, 2026 14:59
rprospero
force-pushed
the
dissolve2/bonding-with-cells
branch
2 times, most recently
from
October 6, 2026 10:47
abc9ea5 to
4e2065a
Compare
| template <typename> constexpr bool is_optional = false; | ||
| template <typename T> constexpr bool is_optional<std::optional<T>> = true; | ||
|
|
||
| // View that statically cast |
Contributor
There was a problem hiding this comment.
I think this comment may require some clarification, not quite sure what it's meant to mean
rprospero
force-pushed
the
dissolve2/bonding-with-cells
branch
from
October 8, 2026 10:28
f23322d to
3aea339
Compare
|
|
||
| // Get StructureAtom 'i' and its radius | ||
| auto radiusI = AtomicRadii::radius(i->Z()); | ||
| // Get StructureAtom 'j' |
Contributor
There was a problem hiding this comment.
Is something missing here??
RobBuchananCompPhys
approved these changes
Oct 8, 2026
RobBuchananCompPhys
left a comment
Contributor
There was a problem hiding this comment.
This looks good, though there are one or two code comments that could do with cleaning up/clarification.
rprospero
force-pushed
the
dissolve2/bonding-with-cells
branch
from
October 12, 2026 09:05
3aea339 to
473e95b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This uses cells to split up the bonding calculation. Instead of parallelising across atoms, we run in parallel across neighbouring cell pairs, which isn't quite as efficient, but hopefully the cell splitting makes up for the loss. One place to pay extra special attention is in line 58 of
calculateBondingNode.cpp. I have been doing a dynamic calculation of the size of the box based on the inscribed radius, but this was somehow creating 1000 cells on linux and 2³² cells on Mac. I've now hard coded the cell size, but I would appreciate suggestions on a better way of handling this. At the time I'm writing this, the Mac build is failing due to a server failure for one of our dependencies, so I cannot check whether or not the hard coded size fixed the issue.To do this, I've added an extra method to cell array that gives all the pairs along with all of the self pairings, which was behind the bug I was dealing with in the standup this morning.
There's also a change switching cells to just store an AtomBase pointer and then adjusting the existing call sites for CellArray.
As future work, we could write a cell atom-pair iterator that would allow us to iterate through the atom pairs in same or neighbouring cells. This would both simplify the code (likely in multiple places) and prevent waiting on the thread with the most populated cell to finish.