Skip to content

perf: Start using cells for bonding calculation - #2621

Open
rprospero wants to merge 4 commits into
develop2from
dissolve2/bonding-with-cells
Open

rprospero wants to merge 4 commits into
develop2from
dissolve2/bonding-with-cells

Conversation

@rprospero

@rprospero rprospero commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

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.

@rprospero
rprospero requested review from RobBuchananCompPhys and trisyoungs and removed request for trisyoungs September 24, 2026 14:59
@rprospero
rprospero force-pushed the dissolve2/bonding-with-cells branch from 939e394 to 4e2065a Compare October 5, 2026 09:23

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant