Chemellia / ChemistryFeaturization.jl

Interface package for featurizing atomic structures
https://chemistryfeaturization.chemellia.org/dev/
MIT License
41 stars 14 forks source link

make `featurization` in `FeaturizedAtoms` a `const` once Julia 1.8 is released #137

Open thazhemadam opened 2 years ago

thazhemadam commented 2 years ago

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))