Skip to content

Commit b023f54

Browse files
Merge pull request #4 from maurergroup/data-save
Fix issue with model reassembly functions
2 parents e721b84 + 9ca7763 commit b023f54

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/matrixmodels/matrixmodels.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ struct NoZ2Sym <: Z2Symmetry end
5757
function ACEfrictionCore.write_dict(z2s::Z2S) where {Z2S<:Z2Symmetry}
5858
return Dict("__id__" => string("ACEfriction_Z2Symmetry"), "z2s"=>typeof(z2s))
5959
end
60+
6061
function ACEfrictionCore.read_dict(::Val{:ACEfriction_Z2Symmetry}, D::Dict)
61-
z2s = getfield(ACEfriction.MatrixModels, Symbol(D["z2s"]))
62+
z2s = getfield(ACEfriction.MatrixModels, Symbol(split(D["z2s"], ".")[end])) # This was exporting it's full type, whereas we just need the last node.
6263
return z2s()
6364
end
6465
abstract type SpeciesCoupling end
@@ -69,8 +70,9 @@ struct SpeciesUnCoupled <: SpeciesCoupling end
6970
function ACEfrictionCore.write_dict(sc::SC) where {SC<:SpeciesCoupling}
7071
return Dict("__id__" => string("ACEfriction_SpeciesCoupling"), "sc"=>typeof(sc))
7172
end
73+
7274
function ACEfrictionCore.read_dict(::Val{:ACEfriction_SpeciesCoupling}, D::Dict)
73-
sc = getfield(ACEfriction.MatrixModels, Symbol(D["sc"]))
75+
sc = getfield(ACEfriction.MatrixModels, Symbol(split(D["sc"], ".")[end]))
7476
return sc()
7577
end
7678

@@ -82,8 +84,9 @@ struct AtomCentered <: EvaluationCenter end
8284
function ACEfrictionCore.write_dict(evalcenter::EVALCENTER) where {EVALCENTER<:EvaluationCenter}
8385
return Dict("__id__" => string("ACEfriction_EvaluationMode"), "evalcenter"=>typeof(evalcenter))
8486
end
87+
8588
function ACEfrictionCore.read_dict(::Val{:ACEfriction_EvaluationMode}, D::Dict)
86-
evalcenter = getfield(ACEfriction.MatrixModels, Symbol(D["evalcenter"]))
89+
evalcenter = getfield(ACEfriction.MatrixModels, Symbol(split(D["evalcenter"], ".")[end]))
8790
return evalcenter()
8891
end
8992

@@ -703,5 +706,4 @@ include("./pwcmatrixmodels.jl")
703706
# Omsite-only matrix models:
704707
include("./onsiteonlymatrixmodels.jl")
705708

706-
707-
end
709+
end

0 commit comments

Comments
 (0)