ACEsuit / ACE.jl

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

isapprox for State and DState #47

Closed andresrossb closed 3 years ago

andresrossb commented 3 years ago

For testing purposes we want to compare weather or not two states are equivalent. Then we want to overload isapprox such that for two states or DStates A and B we could simply test them by using: A ≈ B.

cortner commented 3 years ago

I checked and it seems this is already defined in states.jl:

isapprox(X1::TX, X2::TX, args...; kwargs...
         ) where {TX <: XState{SYMS}} where {SYMS} = 
   all( isapprox( getproperty(_x(X1), sym), getproperty(_x(X2), sym), 
                  args...; kwargs...) for sym in SYMS )

Not sure why it isn't working as expected. Maybe isapprox and ≈ are different?

andresrossb commented 3 years ago

I tried again using ≈ and it worked fine. It must have been a small bug with the returns. It works fine now.

cortner commented 3 years ago

that's great.