From 8424b36524d624223140e985a6989915050d4fb0 Mon Sep 17 00:00:00 2001 From: MatthiasSachs Date: Mon, 30 Oct 2023 11:38:32 +0000 Subject: [PATCH] read_dict and write_dict for EllipsoidCutoff added --- src/ACEbonds.jl | 1 + src/bondcutoffs.jl | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/ACEbonds.jl b/src/ACEbonds.jl index 9abf073..19f20ae 100644 --- a/src/ACEbonds.jl +++ b/src/ACEbonds.jl @@ -14,4 +14,5 @@ include("iterator.jl") include("bondpot.jl") include("utils.jl") + end diff --git a/src/bondcutoffs.jl b/src/bondcutoffs.jl index 6a3913d..7804b22 100644 --- a/src/bondcutoffs.jl +++ b/src/bondcutoffs.jl @@ -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 @@ -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 \ No newline at end of file