With Julia 1.8, we'll be able to declare const fields in mutable structs. We should use this to make featurization in FeaturizedAtoms a const, since the featurization assigned to a FeaturizedAtoms object shouldn't change.
diff --git a/src/featurizedatoms.jl b/src/featurizedatoms.jl
index 983cde3..b36050a 100644
--- a/src/featurizedatoms.jl
+++ b/src/featurizedatoms.jl
@@ -14,7 +14,7 @@ Container object for an atomic structure object, a featurization, and the result
"""
struct FeaturizedAtoms{A,F<:AbstractFeaturization}
atoms::A
- featurization::F
+ const featurization::F
encoded_features::Any
FeaturizedAtoms{A,F}(atoms, featurization) where {A,F<:AbstractFeaturization} =
new(atoms, featurization, encode(atoms, featurization))
With Julia 1.8, we'll be able to declare
const
fields inmutable
structs. We should use this to makefeaturization
inFeaturizedAtoms
aconst
, since thefeaturization
assigned to aFeaturizedAtoms
object shouldn't change.