Neighbor Lists
Construction of neighbor lists and callback helpers bridging to the KIM-API.
KIM_API.@cast_as_kim_neigh_fptr — Macro@cast_as_kim_neigh_fptr(func)Macro to create a C function pointer for KIM-API neighbor list callbacks. This macro converts a Julia function into a C-compatible function pointer for use with KIM-API's neighbor list interface.
KIM_API.NeighborListContainer — TypeNeighborListContainerContainer for neighbor list data with KIMNeighborList backend.
This mutable struct stores the neighbor list query function for efficient access during KIM-API callback queries. It includes the query function and temporary storage for index conversions.
Fields
neighbors::Vector{Vector{Int32}}: Pre-computed neighbors for each atomtemp_storage::Vector{Int32}: Reusable storage for current neighbor query
Notes
The temp_storage field is used to convert between Julia's 1-based indexing and KIM-API's 0-based indexing during callback execution, avoiding memory allocations in the hot path.
KIM_API.create_kim_neighborlists — MethodCreate neighbor lists for KIM-API using KIMNeighborList C++ backend. It uses the lower level API of KIMNeighborList to return all required information. Below is the copy pasted code from the KIMNeighborList package
TODO: Add the desired function in KIMNeighborLists, so that here it is blank call to the neighlist library?
Returns: (nlcontainer, allcoordinates, allspecies, contributing, atomindices)
- nl_container: Neighbor list data for each cutoff
- all_coordinates: Positions including ghost atoms
- all_species: Species including ghost atoms
- contributing: 1 for real atoms, 0 for ghosts
- atom_indices: Original atom index for each position
The function creates neighbor lists for each cutoff using the KIMNeighborList backend and handles ghost atom generation for periodic boundary conditions.
KIM_API.kim_neighbors_callback — Methodkimneighborscallback(...)
KIM-API callback for neighbor queries. All indices are 0-based from KIM.