Skip to content

Rework using edge crossing defects - #66

Open
Lucasroele wants to merge 8 commits into
patrickfuchs:mainfrom
Lucasroele:main
Open

Lucasroele wants to merge 8 commits into
patrickfuchs:mainfrom
Lucasroele:main

Conversation

@Lucasroele

@Lucasroele Lucasroele commented Oct 16, 2026 •

Copy link
Copy Markdown

Computes packing defect constants that are generally ~1 nm2 larger using defects that span across periodic boundaries.

Of note:

  • Documentation included
  • All atoms have to be wrapped into the box for analysis
  • there is now a real binary array for labelling
  • Progress bar fixed and uses tqdm
  • histogram in analysis.py doesn't truncate the final bin
  • type annotations added

removed from testing the warning:
    `Warning: r_squared is low...`

Added testing for `packmem2.py` edge handling

Removed superfluous mean x,y mean calculation in `packmem2.py`

Added a .yml for reproducibility

Moved some constants into `core/constansts.py`

`matrix.binarize_matrix_without0()` now actually binarizes

Removed the MDAnalysis warning suppression
Using wrapping

Using wraparound meshgrids

slow tests failed though
matrix.py is proper
`connected_components.get_connected_components()` respects edges

`cc.find_label_neighbors()` respects edges

These could be factored into seperate functions to skip conditional logic inside the functions
`connected_components.connect_labels_in_matrix()` connects labels accross edges

All tests inside `test_launch_packmem2.py` fail.
    The new algorithm finds more defects since `matrix.fill_matrix()` no longer uses
    shifted indices produced by `matrix.check_edges()`.

The core logic of raidus-cell overlap is not defined rigorously anywhere.
The last row/column of cells expands beyond the box. The fixed cell size grid makes it
impossible to align the two. Defects at the edge are therefore ill defined and assigned.
If the box size varies sufficiently accross frames this effect is averaged out.

Another approach is to skip the periodic image interaction and use a grid that is
`MAX_GRID_SEARCH_CELLS` smaller than the box border on all sides. Defect size is best
estimated using periodic images however.

Could consider using some form of sicpy.ndimage.label instead of
`get_connected_components()` with `find_neighbours()`.
`test_launch_DMPC_protein` used to rely on raising a TypeError, it now
raises an OverflowError. This doesn't seem to be a very meaningfull
test.
fixed some error/warning reporting

fixed the progress bar to use tqdm

test_analysis.py no longer passes since a problem with the bins in `analysis.compute_decay()` is patched.
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