-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Neighbor list information #68
base: main
Are you sure you want to change the base?
Conversation
Haven't looked in detail at your code, but with an eye on #28, which has a minimal neighborlist implementation, it is very important that we can access the neighborlist without memory allocations. I think your implementation does that, but I would also define iterators such that you can say for |
My Implementation introduces The usage looks something like this: for (iatom, neihgs) in find_pair_neighlist(lmp, "zero")
for jatom in neighs
# do something
end
end I think It's a good idea to have this as an example as well. What I could also imagine implementing, is providing a combined iterator over the atom pairs for (iatom, jatom) in eachpair(find_pair_neighlist(lmp, "zero"))
# do something
end I think we should also remove the Here's the default find_pair_neighlist(lmp, "zero")
27-element LAMMPS.NeighList:
1 => Int32[2, 4, 10]
2 => Int32[3, 5, 11]
3 => Int32[28, 6, 12]
4 => Int32[5, 7, 13]
5 => Int32[6, 8, 14]
6 => Int32[30, 9, 15]
... |
Looking at https://docs.julialang.org/en/v1/manual/interfaces/#man-interface-iteration I think you are missing |
I'm following https://docs.julialang.org/en/v1/manual/interfaces/#man-interface-array. my structs are defined like this: struct NeighListVec <: AbstractVector{Int32}
numneigh::Int
neighbors::Ptr{Int32}
end
struct NeighList <: AbstractVector{Pair{Int32, NeighListVec}}
lmp::LMP
idx::Int
end so Edit: I shoud probably move these to the top of the file though |
Co-authored-by: Valentin Churavy <[email protected]>
@Joroks you should be able to create branches in this repository, if you do so the Documenter action will generate a preview. |
I took the liberty to pack each neighbor list entry into a single vector. I think that's easier to handle. Alternatively, we could also have each entry as a pair
ìatom => neighbors
.Edit: Actually, I think it makes more sense to use Pairs. This makes looping over each neighbour of
iatom
way easier. This then also has a pretty clean syntax, because you can doiatom, neighs = list[i]
and then loop overneihgs