Skip to content

Commit

Permalink
add restricted_localpdistinds(): like localpdistinds, but only on sel…
Browse files Browse the repository at this point in the history
…ected atoms
  • Loading branch information
axsk committed Aug 21, 2024
1 parent 4346c0d commit 5ea4ae9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/pairdists.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ end

localpdistinds(coords::Vector, radius) = localpdistinds(hcat(coords), radius)

""" restricted_localpdistinds(coords, radius, atoms)
Like `localdists`, but consider only the atoms with index in `atoms`
"""
function restricted_localpdistinds(coords, radius, atoms)
rc = reshape(reshape(coords, 3, :, size(coords, 2))[:, atoms, :], :, size(coords, 2))
@show size(rc)
pairs = localpdistinds(rc, radius)
map(pairs) do (a, b)
(atoms[a], atoms[b])
end
end


"""
pdists(coords::AbstractArray, inds::Vector{<:Tuple})
Expand Down

0 comments on commit 5ea4ae9

Please sign in to comment.