Skip to content

Commit

Permalink
gradient tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
ACEsuit committed Nov 16, 2023
1 parent cd915f9 commit ffe8de8
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test/test_import_ace1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ println()

## check gradient

Rs, Zs, z0 = rand_env()
v1, dv1 = evaluate_ed(uf_ace, Rs, Zs, z0)
U = randn(SVector{3, Float64}, length(dv1))

F(t) = evaluate(uf_ace, Rs + t * U, Zs, z0)
dF(t) = (dV = evaluate_ed(uf_ace, Rs + t * U, Zs, z0)[2];
sum( dot(dv, u) for (dv, u) in zip(dV, U) ) )
ACEbase.Testing.fdtest(F, dF, 0.0)
for ntest = 1:30
Rs, Zs, z0 = rand_env()
v1, dv1 = evaluate_ed(uf_ace, Rs, Zs, z0)
U = randn(SVector{3, Float64}, length(dv1))

F = t -> evaluate(uf_ace, Rs + t * U, Zs, z0)
dF = t -> (dV = evaluate_ed(uf_ace, Rs + t * U, Zs, z0)[2];
sum( dot(dv, u) for (dv, u) in zip(dV, U) ) )
print_tf(@test ACEbase.Testing.fdtest(F, dF, 0.0; verbose=false))
end

0 comments on commit ffe8de8

Please sign in to comment.