SimonEnsemble/Xtals.jl

Bond assignment is not fast enough

Opened this issue · 1 comments

Bonding needs to be faster. To bond a 6*6*7 UiO-66, for example, takes about 90 minutes. Bonding the 1*1*1 cell takes 18 seconds.

Four ways to increase speed:

  • Parallelism. Find adjacency lists for subsets of atoms on different processes and build the graph for the complete crystal by combining them (map-reduce).
  • Less branching. Using Boolean algebra instead of conditional logic can probably give a speed boost in the nearest-image distance calculation.
  • Fewer calculations. If any one coordinate's nearest-image distance is too large, there is no need to calculate the 3D vector displacement. Pro: would avoid many square-root operations. Con: may be incompatible with previous point about branching.
  • Implement replication of bonded cells. Doesn't solve the problem directly, but enables avoidance of the problem. Replicating the 111 cell's graph to 667 should be possible in much less time than calculating the 667 graph directly.

Also, can bonding rules be handled via a matrix, instead of a huge list of structs? Deciding if two atoms are bonded currently means searching over 4k rules. Instead, the bond rule matrix could be constructed ahead of time, and then it would just be a matter of looking up the value at the correct indices.