ACEsuit / ACEpotentials.jl

Machine Learning Interatomic Potentials with the Atomic Cluster Expansion
MIT License
46 stars 12 forks source link

Updated runfits and acecompat #223

Closed iamveronika closed 1 month ago

iamveronika commented 1 month ago

For debugging, you can use 'fitting_params.json'.

To creata a JSON file, you can use 'make_json.jl'.

fitting_params.json make_json.txt

If "model_name" not equals "ACE1", you will receive an error message. If "model_name" equals "ACE1", model will be created.

julia> model = make_acemodel(args_dict["model"])
ERROR: Unknown model: ACE2. This function only supports 'ACE1'.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] make_acemodel(model_dict::Dict{String, Any})
   @ Main ~/ACEpotentials.jl/src/ace1_compat.jl:249
 [3] top-level scope
   @ REPL[52]:1

julia> model = make_acemodel(args_dict["model"])
ACEModel(
    rbasis = ACEpotentials.Models.LearnableRnlrzzBasis{1, Polynomials4ML.OrthPolyBasis1D3T{Float64}, ACEpotentials.Models.NormalizedTransform{Float64, ACEpotentials.Models.GeneralizedAgnesiTransform{Float64}}, ACEpotentials.Models.PolyEnvelope2sX{Float64}, Float64}((14,), OrthPolyBasis1D3T(maxn = 15), ACEpotentials.Models.NormalizedTransform{Float64, ACEpotentials.Models.GeneralizedAgnesiTransform{Float64}}[ACEpotentials.Models.NormalizedTransform{Float64, ACEpotentials.Models.GeneralizedAgnesiTransform{Float64}}(ACEpotentials.Models.GeneralizedAgnesiTransform{Float64}(2, 2, 0.6666666666666666, 0.0, 2.4), 1.0, 0.32432432432432434, 0.0, 6.0);;], ACEpotentials.Models.PolyEnvelope2sX{Float64}[ACEpotentials.Models.PolyEnvelope2sX{Float64}(-1.0, 1.0, 2, 2, 1.0, Dict{String, Any}());;], @NamedTuple{rin::Float64, r0::Float64, rcut::Float64}[(rin = 0.0, r0 = 2.4, rcut = 6.0);;], @NamedTuple{n::Int64, l::Int64}[(n = 1, l = 0), (n = 2, l = 0), (n = 3, l = 0), (n = 4, l = 0), (n = 5, l = 0), (n = 6, l = 0), (n = 7, l = 0), (n = 8, l = 0), (n = 9, l = 0), (n = 10, l = 0)  …  (n = 1, l = 3), (n = 2, l = 3), (n = 3, l = 3), (n = 4, l = 3), (n = 5, l = 3), (n = 1, l = 4), (n = 2, l = 4), (n = 3, l = 4), (n = 1, l = 5), (n = 2, l = 5)], Dict{String, Any}("Winit" => "linear")),  # 510 parameters
)         # Total: 102 parameters,
          #        plus 0 states.

Command Line JSON julia ACEpotentials.jl/scripts/runfit.jl --params fittng_params.json results:

bash-4.4$ julia ACEpotentials.jl/scripts/runfit.jl --params fittng_params.json
  Activating project at `~/ACEpotentials.jl/scripts`
WARNING: Method definition rrule(typeof(Base.merge), NamedTuple{F1, T} where T<:Tuple, NamedTuple{F2, T} where T<:Tuple) where {F1, F2} in module ChainRules at /home/vekondra/.julia/packages/ChainRules/hShjJ/src/rulesets/Base/base.jl:313 overwritten in module Lux at /home/vekondra/.julia/packages/Lux/NFy1T/src/chainrules.jl:17.
ERROR: Method overwriting is not permitted during Module precompilation. Use `__precompile__(false)` to opt-out of precompilation.
WARNING: Method definition rrule(typeof(Base.merge), T1, T2) where {T1<:(NamedTuple{names, T} where T<:Tuple where names), T2<:(NamedTuple{names, T} where T<:Tuple where names)} in module Lux at /home/vekondra/.julia/packages/Lux/NFy1T/src/chainrules.jl:17 overwritten in module ChainRules at /home/vekondra/.julia/packages/ChainRules/hShjJ/src/rulesets/Base/base.jl:313.
ERROR: Method overwriting is not permitted during Module precompilation. Use `__precompile__(false)` to opt-out of precompilation.
WARNING: Method definition rrule(typeof(Base.merge), NamedTuple{F1, T} where T<:Tuple, NamedTuple{F2, T} where T<:Tuple) where {F1, F2} in module ChainRules at /home/vekondra/.julia/packages/ChainRules/hShjJ/src/rulesets/Base/base.jl:313 overwritten in module Lux at /home/vekondra/.julia/packages/Lux/NFy1T/src/chainrules.jl:17.
ERROR: Method overwriting is not permitted during Module precompilation. Use `__precompile__(false)` to opt-out of precompilation.
  Activating project at `~/ACEpotentials.jl/scripts`
{
   "model": {
      "pair_basis": "legendre",
      "elements": [
         "Si"
      ],
      "pair_rin": 0.0,
      "pure": false,
      "pair_transform": [
         "agnesi",
         1,
         3
      ],
      "totaldegree": 10,
      "delete2b": false,
      "wL": 1.5,
      "pair_degree": 10,
      "rbasis": "legendre",
      "pure2b": false,
      "pair_rcut": 6.7,
      "rcut": 6.7,
      "variable_cutoffs": false,
      "rin": 0.0,
      "order": 3,
      "r0": 2.5,
      "model_name": "ACE1",
      "Eref": null,
      "transform": [
         "agnesi",
         2,
         4
      ]
   },
   "solve": {
      "weights": {
         "FLD_TiAl": {
            "V": 1.0,
            "E": 30.0,
            "F": 1.0
         },
         "TiAl_T5000": {
            "V": 1.0,
            "E": 5.0,
            "F": 1.0
         }
      },
      "prior": {
         "name": "algebraic",
         "param": 4
      },
      "solver": {
         "name": "BLR",
         "param": {
            "factorization": "svd",
            "committee_size": 20
         }
      }
   },
   "data": {
      "in_data": {
         "train_file": "Zuo20_$Z0",
         "force_key": "force",
         "test_file": "Zuo20_$Z0",
         "energy_key": "energy",
         "virial_key": "virial"
      },
      "out_data": {
         "results": "res.json",
         "model_fname": "ACE.json"
      }
   }
}
[ Info: making ACEmodel
size(A) = (13383, 102)
       |      E    |    F  
 train | 4.00e-03  |  3.50e-01  
  test | 1.69e-02  |  3.86e-01   
cortner commented 1 month ago

So the JSON interface for ACE1-like models is essentially ready? Then maybe the next step would be to revive and update the relevant documentation pages?

cortner commented 1 month ago

I also notice there seem to be some spurious @show commands during model construction. Can those be removed please?

cortner commented 1 month ago

Finally, please post results as plain text in triple-backticks instead of screenshots.

cortner commented 1 month ago

@iamveronika can you please merge the main branch into this PR?

iamveronika commented 1 month ago

Done

@iamveronika can you please merge the main branch into this PR?

cortner commented 1 month ago

I'll try to take a closer look before Monday. Do you think this is getting ready to merge? It would be great if we can use your work and a few other things that have been happening to get rid of ACE1 and ACE1x this coming week.

iamveronika commented 1 month ago

replaced by #231