ACEsuit / ACE.jl

Parameterisation of Equivariant Properties of Particle Systems
66 stars 15 forks source link

Derivatives for `EuclideanMatrix` #101

Open MatthiasSachs opened 2 years ago

MatthiasSachs commented 2 years ago

The test

@info(" ... derivatives")
_rrval(x::ACE.XState) = x.rr
for ntest = 1:30
   Us = randn(SMatrix{3, 3, Float64,9 }, length(Xs))
   C = randn(typeof(φ.val), length(basis))
   F = t -> sum( sum(c .* b.val)
                 for (c, b) in zip(C, ACE.evaluate(basis, ACEConfig(Xs + t[1] * Us))) )
   dF = t -> [ sum( sum(c .* db)
                    for (c, db) in zip(C, _rrval.(ACE.evaluate_d(basis, ACEConfig(Xs + t[1] * Us))) * Us) ) ]
   print_tf(@test fdtest(F, dF, [0.0], verbose=false))
end
println()

needs to be adapted for EuclideanMatrix ? That is, if we want to implement/use derivatives of matrix-valued equivariant functions w.r.t. to position ...

cortner commented 2 years ago

Let's not make that a requirement for the current PR, but leave it open so that at some point it can be addressed.