Skip to content

Commit

Permalink
AtomsBase v0.4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
tjjarvinen committed Sep 11, 2024
1 parent 590b5f1 commit 53eea39
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ACE1 = "0.12.1"
ACE1x = "0.1.8"
ACEbase = "0.4.3"
ACEfit = "0.1.4, 0.2.0"
AtomsBase = "0.3"
AtomsBase = "0.3, 0.4"
AtomsCalculators = "0.2"
ChunkSplitters = "2"
Folds = "0.2"
Expand Down
12 changes: 1 addition & 11 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,7 @@ end


function neighborlist(ab, cutoff; length_unit=default_length, kwargs...)
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
return PairList(ab, cutoff)
end


Expand Down
6 changes: 3 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ end
@testset "AtomsBase" begin
pot = load_ace_model(fname_ace)
julip_data = read_extxyz(fname_xyz)[end]
ab_data = FastSystem(ExtXYZ.Atoms(read_frame(fname_xyz)))
ab_data = ExtXYZ.Atoms(read_frame(fname_xyz))

@test ace_energy(pot, julip_data) ace_energy(pot, ab_data)
@test all( ace_forces(pot, julip_data) .≈ ace_forces(pot, ab_data) )
Expand Down Expand Up @@ -104,7 +104,7 @@ end

@testset "Units" begin
pot = load_ace_model(fname_ace; energy_unit=u"eV", length_unit=u"pm")
data = FastSystem(ExtXYZ.Atoms(read_frame(fname_xyz)))
data = ExtXYZ.Atoms(read_frame(fname_xyz))

@test unit( ace_energy(pot, data) ) == u"eV"
@test unit( ace_forces(pot, data)[1][1] ) == u"eV" / u"pm"
Expand All @@ -128,7 +128,7 @@ end

@testset "Combination interface" begin
pot = load_ace_model(fname_ace)
data = FastSystem(ExtXYZ.Atoms(read_frame(fname_xyz)))
data = ExtXYZ.Atoms(read_frame(fname_xyz))

E = ace_energy(pot, data)
F = ace_forces(pot, data)
Expand Down

0 comments on commit 53eea39

Please sign in to comment.