(git:21ef868)
Loading...
Searching...
No Matches
nnp_neighbor_interface Module Reference

Per-nnp persistent neighbour-interface state for the NNP hot path. Separates neighbour bookkeeping from the ACSF and network loops: species-pair routing is precomputed once and per-element work buffers are reused. State lives on the parent nnp_type, so each &NNP force_eval keeps its own copy and the lifetime tracks nnp_env_release. More...

Functions/Subroutines

subroutine, public nnp_neighbor_interface_prepare (nnp)
 Ensure pair-routing metadata and reusable workspaces are ready for the current NNP model.
 
subroutine, public nnp_neighbor_interface_reset_neighbor (nnp, ind)
 Reset per-group neighbour counters for one central element before refilling the reusable buffers. Zeroes n_rad/n_ang1/n_ang2; the (ind, dist) slabs are kept allocated and overwritten in place by the next push.
 
subroutine, public nnp_grp_grow_dgdr (grp, n_needed)
 Ensure a per-group dG/dr buffer holds n_needed neighbours, growing by 1.5x (with an additive floor) so reallocation amortizes to O(1) over a trajectory. grpdata is allocated on return (cap >= 1), so callers can ASSOCIATE-bind it even for a zero-trip loop.
 
subroutine, public nnp_neigh_grp_grow (grp, n_needed)
 Ensure a per-group (ind, dist) neighbour buffer holds n_needed entries. Called from inside the linked-cell push loop, so existing entries are preserved on grow via MOVE_ALLOC. 1.5x growth amortizes reallocation to O(1) over a trajectory.
 
subroutine, public nnp_workspace_grow_caches (workspace, n_needed)
 Ensure the four per-element angular cutoff caches hold at least n_needed entries. These 1D scratch arrays are reused across angular groups within one nnp_calc_acsf call, so the peak is MAX_s(n_ang1) and MAX_s(n_ang2). 1.5x lazy growth.
 

Detailed Description

Per-nnp persistent neighbour-interface state for the NNP hot path. Separates neighbour bookkeeping from the ACSF and network loops: species-pair routing is precomputed once and per-element work buffers are reused. State lives on the parent nnp_type, so each &NNP force_eval keeps its own copy and the lifetime tracks nnp_env_release.

Author
Dhruv Sharma (ds217.nosp@m.3@ca.nosp@m.m.ac..nosp@m.uk)
Christoph Schran (chris.nosp@m.toph.nosp@m..schr.nosp@m.an@r.nosp@m.ub.de)
Date
2026-05-21

Function/Subroutine Documentation

◆ nnp_neighbor_interface_prepare()

subroutine, public nnp_neighbor_interface::nnp_neighbor_interface_prepare ( type(nnp_type), intent(inout)  nnp)

Ensure pair-routing metadata and reusable workspaces are ready for the current NNP model.

Parameters
nnpNNP environment whose neighbor_interface_state will be (re)built if needed.
Author
Dhruv Sharma (ds217.nosp@m.3@ca.nosp@m.m.ac..nosp@m.uk)

Definition at line 46 of file nnp_neighbor_interface.F.

Here is the call graph for this function:

◆ nnp_neighbor_interface_reset_neighbor()

subroutine, public nnp_neighbor_interface::nnp_neighbor_interface_reset_neighbor ( type(nnp_type), intent(inout)  nnp,
integer, intent(in)  ind 
)

Reset per-group neighbour counters for one central element before refilling the reusable buffers. Zeroes n_rad/n_ang1/n_ang2; the (ind, dist) slabs are kept allocated and overwritten in place by the next push.

Parameters
nnpNNP environment whose neighbor_interface_state will have its counters cleared.
indcentral-element index (1..nnpn_ele) whose workspace is reset.
Author
Dhruv Sharma (ds217.nosp@m.3@ca.nosp@m.m.ac..nosp@m.uk)

Definition at line 77 of file nnp_neighbor_interface.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nnp_grp_grow_dgdr()

subroutine, public nnp_neighbor_interface::nnp_grp_grow_dgdr ( type(nnp_dgdr_grp_type), intent(inout)  grp,
integer, intent(in)  n_needed 
)

Ensure a per-group dG/dr buffer holds n_needed neighbours, growing by 1.5x (with an additive floor) so reallocation amortizes to O(1) over a trajectory. grpdata is allocated on return (cap >= 1), so callers can ASSOCIATE-bind it even for a zero-trip loop.

Parameters
grpper-element dGdr group whose data slab is reallocated if undersized
n_neededminimum required capacity (third dim of grpdata)
Author
Dhruv Sharma (ds217.nosp@m.3@ca.nosp@m.m.ac..nosp@m.uk)

Definition at line 378 of file nnp_neighbor_interface.F.

Here is the caller graph for this function:

◆ nnp_neigh_grp_grow()

subroutine, public nnp_neighbor_interface::nnp_neigh_grp_grow ( type(nnp_neigh_grp_type), intent(inout)  grp,
integer, intent(in)  n_needed 
)

Ensure a per-group (ind, dist) neighbour buffer holds n_needed entries. Called from inside the linked-cell push loop, so existing entries are preserved on grow via MOVE_ALLOC. 1.5x growth amortizes reallocation to O(1) over a trajectory.

Parameters
grpper-species-pair neighbour group whose (ind, dist) buffers grow
n_neededminimum required entry count
Author
Dhruv Sharma (ds217.nosp@m.3@ca.nosp@m.m.ac..nosp@m.uk)

Definition at line 402 of file nnp_neighbor_interface.F.

◆ nnp_workspace_grow_caches()

subroutine, public nnp_neighbor_interface::nnp_workspace_grow_caches ( type(nnp_neighbor_workspace_type), intent(inout)  workspace,
integer, intent(in)  n_needed 
)

Ensure the four per-element angular cutoff caches hold at least n_needed entries. These 1D scratch arrays are reused across angular groups within one nnp_calc_acsf call, so the peak is MAX_s(n_ang1) and MAX_s(n_ang2). 1.5x lazy growth.

Parameters
workspaceper-element workspace whose fc_cache1/dfc_cache1/fc_cache2/dfc_cache2 grow
n_neededminimum required cache length
Author
Dhruv Sharma (ds217.nosp@m.3@ca.nosp@m.m.ac..nosp@m.uk)

Definition at line 442 of file nnp_neighbor_interface.F.

Here is the caller graph for this function: