Skip to content

Investigate binning: should it scale better and run faster? #225

Description

@ojeda-e

On small fixtures like the ones used in #200, or in tests, curvature analysis is already fast (~0.6 ms/frame according to the benchmark results). However, I have been working on large systems (5 microsec simulation time) using MC and I noticed the binning method takes longer than I expected. This problem shows up only when scale increases. This makes sense, because cost scales ~ n_frames × n_atoms. A 5 microsec trajectory with thousands of frames on a large bilayer runs a bit slow, at least from what I expect from binning.

I am wondering if, with a fixed grid size, 2x the number of reference atoms roughly runs in 2x runtime is an indication that binning accumulation is contributing to the runtime. If runtime scales linearly with reference atom count at fixed grid size, per-atom binning accumulation is likely a major cost, then profiling get_z_surface vs the rest of the binning pipeline will confirm this before implementing a solution.

If the per-atom calculation is a significant contributor to binning cost, a likely candidate is the accumulation loop in get_z_surface:

for index_l, index_m, index_z in zip(cell_x_floor, cell_y_floor, z_coords):
try:
# negative coordinates
if index_l < 0 or index_m < 0:
negative_coord_warning.warn(index_l, index_m)
continue

Even though surface_method='fourier' is the default, and in the benchmarks binning is faster than fourier (expected), an improvement for the binning method is still worth it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions