Skip to content

Commit

Permalink
Merge pull request #17 from ACEsuit/variable_cutoff
Browse files Browse the repository at this point in the history
bugfixes for element dependent cutoffs
  • Loading branch information
cortner authored Apr 5, 2024
2 parents d7ff188 + 3b279c7 commit f874951
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/defaults.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ const _kw_defaults = Dict(:elements => nothing,
:pair_basis => :legendre,
:pair_envelope => (:r, 2),
#
:Eref => missing
:Eref => missing,
#temporary variable to specify whether using the variable cutoffs or not
:variable_cutoffs => false,
)

const _kw_aliases = Dict( :N => :order,
Expand Down Expand Up @@ -177,13 +179,18 @@ function _transform(kwargs; transform = kwargs[:transform])
q = transform[3]
r0 = _get_all_r0(kwargs)
rcut = _get_all_rcut(kwargs)
if rcut isa Number || ! kwargs[:variable_cutoffs]
cutoffs = nothing
else
cutoffs = Dict([ (s1, s2) => (0.0, rcut[(s1, s2)]) for s1 in elements, s2 in elements]...)
end
rcut = maximum(values(rcut)) # multitransform wants a single cutoff.

if ( (length(transform) == 3) ||
(length(transform) == 4 && transform[end] == :free) )
transforms = Dict([ (s1, s2) => agnesi_transform(r0[(s1, s2)], p, q)
for s1 in elements, s2 in elements]... )
trans_ace = multitransform(transforms; rin = 0.0, rcut = rcut)
trans_ace = multitransform(transforms; rin = 0.0, rcut = rcut, cutoffs=cutoffs)
return trans_ace

elseif length(transform) == 4
Expand Down Expand Up @@ -250,6 +257,10 @@ end
function _pair_basis(kwargs)
rbasis = kwargs[:pair_basis]
elements = kwargs[:elements]
#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]
end

if rbasis isa ACE1.ScalarBasis
return rbasis
Expand Down

0 comments on commit f874951

Please sign in to comment.