Skip to content

Commit

Permalink
read_dict and write_dict for EllipsoidCutoff added
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasSachs committed Oct 30, 2023
1 parent 856a567 commit 8424b36
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/ACEbonds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ include("iterator.jl")
include("bondpot.jl")

include("utils.jl")

end
19 changes: 18 additions & 1 deletion src/bondcutoffs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ using JuLIP: AtomicNumber, chemical_symbol
using StaticArrays
using LinearAlgebra: norm, I

import ACE: write_dict, read_dict

export write_dict, read_dict, EllipsoidCutoff, CylindricalCutoff



Expand Down Expand Up @@ -122,6 +125,20 @@ rrule_env_transform(rrij::SVector, Zi, Zj,

include("ellipsoid_trans.jl") # contains rrules for ellipsoid2sphere and other auxiliary functions


function ACE.write_dict(cutoff::EllipsoidCutoff{T}) where {T}
Dict("__id__" => "ACEbonds_EllipsoidCutoff",
"rcutbond" => cutoff.rcutbond,
"rcutenv" => cutoff.rcutenv,
"zcutenv" => cutoff.zcutenv,
"T" => T)
end

function ACE.read_dict(::Val{:ACEbonds_EllipsoidCutoff}, D::Dict)
rcutbond = D["rcutbond"]
rcutenv = D["rcutenv"]
zcutenv = D["zcutenv"]
T = D["T"]
return EllipsoidCutoff{T}(rcutbond,rcutenv,zcutenv)
end

end

0 comments on commit 8424b36

Please sign in to comment.