Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfixes for element dependent cutoffs #17

Merged
merged 3 commits into from
Apr 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading