-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:JuliaMolSim/NeighbourLists.jl
- Loading branch information
Showing
6 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using AtomsBase | ||
using StaticArrays: SVector | ||
using Unitful | ||
|
||
|
||
function PairList(ab::AtomsBase.AbstractSystem, cutoff::Unitful.Length; length_unit=unit(cutoff)) | ||
cell = ustrip.(length_unit, hcat( bounding_box(ab)... )' ) | ||
pbc = map( boundary_conditions(ab) ) do x | ||
x == Periodic() | ||
end | ||
r = map( 1:length(ab)) do i | ||
# Need to have SVector here for PairList to work | ||
# if position does not give SVector | ||
SVector( ustrip.(length_unit, position(ab,i))...) | ||
end | ||
nlist = PairList(r, ustrip(length_unit, cutoff), cell, pbc; int_type=Int) | ||
return nlist | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[deps] | ||
ASEconvert = "3da9722f-58c2-4165-81be-b4d7253e8fd2" | ||
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7" | ||
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
NearestNeighbors = "b8a86587-4115-5ab1-83bc-aa920d37bbce" | ||
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" | ||
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using ASEconvert | ||
using NeighbourLists | ||
using Test | ||
using Unitful | ||
|
||
@testset "AtomsBase PairList" begin | ||
cu = ase.build.bulk("Cu") * pytuple((4, 2, 3)) | ||
sys = pyconvert(AbstractSystem, cu) | ||
|
||
nlist = PairList(sys, 3.5u"Å") | ||
|
||
id, r = neigs(nlist,1) | ||
|
||
@test length(id) == 12 | ||
end | ||
|
||
|
||
|
||
|