kups.core.neighborlist.common
¶
Shared algorithmic helpers for neighbor list selectors and masks.
Contains:
num_cells— per-axis spatial bin counts (used by the cell-list selector and byparameters.estimate).Candidates— private intermediate struct used inside individual selector algorithms while raw(lhs, rhs)index arrays are being built. Not the pipeline carrier (seeCandidateBatch)._generate_image_offsets,_get_candidate_images— image-expansion primitives.replicate_for_images— adapts rawCandidatesinto aCandidateBatchwith shifts andis_minimum_imageset, replicating per image multiplicity whencutoff > perp/2.make_batch_with_mic— pack raw candidates with minimum-image shifts andis_minimum_image=all-True(used by selectors that don't replicate).real_distance_sq— squared real-space distance between candidate pairs given fractional shifts; used byDistanceCutoffMask.
Candidates
¶
Private intermediate produced inside selector algorithms.
Not the pipeline carrier — selectors convert Candidates into a
CandidateBatch (via replicate_for_images or
make_batch_with_mic) before returning.
Source code in src/kups/core/neighborlist/common.py
candidates_to_batch(candidates, shifts, is_minimum_image)
¶
Pack (candidates, flat shifts, is_min) into a CandidateBatch[2].
Source code in src/kups/core/neighborlist/common.py
make_batch_with_mic(candidates, lh, rh, systems)
¶
Pack raw candidates with minimum-image shifts; is_minimum_image=all-True.
Source code in src/kups/core/neighborlist/common.py
real_distance_sq(lh, rh, systems, lh_idx, rh_idx, shifts)
¶
Squared real-space distance between candidate pairs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lh, rh, systems
|
Pipeline tables (positions in fractional coords). |
required | |
lh_idx, rh_idx
|
|
required | |
shifts
|
Array
|
|
required |
Returns:
| Type | Description |
|---|---|
Array
|
|
Source code in src/kups/core/neighborlist/common.py
replicate_for_images(candidates, lh, rh, systems, cutoffs, max_image_candidates)
¶
Replicate candidates by image multiplicity, attaching shifts and is-min flag.
For each candidate pair:
- If max(cutoff[sys] / perp_axes) <= 0.5: emit 1 copy with MIC shifts.
- Otherwise: emit per-image copies with replicated shifts; the
is_minimum_image flag is set per copy so ExclusionMask can keep
non-minimum image periodic copies of excluded pairs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candidates
|
Candidates
|
Raw candidate pair indices. |
required |
lh, rh, systems
|
Pipeline tables (fractional coords). |
required | |
cutoffs
|
Table[SystemId, Array]
|
Per-system cutoff. |
required |
max_image_candidates
|
Capacity[int] | None
|
Capacity for replicated-candidates buffer.
When |
required |
Returns:
| Type | Description |
|---|---|
CandidateBatch[Literal[2]]
|
|