Skip to content

Commit

Permalink
Merge pull request #19 from ACEsuit/co/fix#18
Browse files Browse the repository at this point in the history
Fix #18
  • Loading branch information
cortner authored Jul 31, 2024
2 parents 9bb9854 + 2f3335f commit bb62760
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/defaults.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,12 @@ function _get_r0(kwargs, z1, z2)
error("Unable to determine r0($z1, $z2) from the arguments provided.")
end

function _get_elements(kwargs)
return [ kwargs[:elements]... ]
end

function _get_all_r0(kwargs)
elements = kwargs[:elements]
elements = _get_elements(kwargs)
r0 = Dict( [ (s1, s2) => _get_r0(kwargs, s1, s2)
for s1 in elements, s2 in elements]... )
end
Expand All @@ -164,14 +168,14 @@ function _get_all_rcut(kwargs; _rcut = kwargs[:rcut])
if _rcut isa Number
return _rcut
end
elements = kwargs[:elements]
elements = _get_elements(kwargs)
rcut = Dict( [ (s1, s2) => _get_rcut(kwargs, s1, s2; _rcut = _rcut)
for s1 in elements, s2 in elements]... )
return rcut
end

function _transform(kwargs; transform = kwargs[:transform])
elements = kwargs[:elements]
elements = _get_elements(kwargs)

if transform isa Tuple
if transform[1] == :agnesi
Expand Down Expand Up @@ -256,7 +260,7 @@ end

function _pair_basis(kwargs)
rbasis = kwargs[:pair_basis]
elements = kwargs[:elements]
elements = _get_elements(kwargs)
#elements has to be sorted becuase PolyPairBasis (see end of function) assumes sorted.
if kwargs[:variable_cutoffs]
elements = [chemical_symbol(z) for z in JuLIP.Potentials.ZList(elements, static=true).list]
Expand Down Expand Up @@ -313,7 +317,7 @@ end


function mb_ace_basis(kwargs)
elements = kwargs[:elements]
elements = _get_elements(kwargs)
cor_order = _get_order(kwargs)
Deg, maxdeg, maxn = _get_degrees(kwargs)
rbasis = _radial_basis(kwargs)
Expand Down
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ using Test
@testset "Purify-single" begin include("test_purify.jl"); end
@testset "Purify-multi" begin include("test_purify_multi.jl"); end
@testset "acemodel" begin include("test_acemodel.jl"); end
@testset "Weird Bugs" begin include("test_bugs.jl"); end
end
14 changes: 14 additions & 0 deletions test/test_bugs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

using ACE1x, Test

model1 = acemodel(elements = [:Si,],
order = 3,
totaldegree = 6,
rcut = 5.5, )

model2 = acemodel(elements = (:Si,),
order = 3,
totaldegree = 6,
rcut = 5.5, )

@test model1.basis == model2.basis

0 comments on commit bb62760

Please sign in to comment.