Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ACEsuit committed May 26, 2024
1 parent 7f1c983 commit ab0414f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@ EmpiricalPotentials = "38527215-9240-4c91-a638-d4250620c9e2"
LineSearches = "d3d80556-e9d4-5f37-9878-2ab0fcc64255"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

[compat]
AtomsBase = "0.3.5"
AtomsCalculators = "0.1"
DecoratedParticles = "0.0.4"
LineSearches = "7"
LinearAlgebra = "1.10"
LinearAlgebra = "1.9, 1.10"
Random = "1.9, 1.10"
Optim = "1.9"
StaticArrays = "1.9"
Unitful = "1.20"
julia = "1.9, 1.10"
DecoratedParticles = "0.0.4"

[extras]
EmpiricalPotentials = "38527215-9240-4c91-a638-d4250620c9e2"
Expand Down
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ using Test

@testset "GeomOpt.jl" begin
@testset "DofManager" begin include("test_dofmgr.jl") end
@testset "Optim" begin include("test_optim.jl") end
end
7 changes: 6 additions & 1 deletion test/test_optim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ using AtomsCalculators: virial, forces
GO = GeomOpt
DP = DecoratedParticles

import Random
Random.seed!(100)

##
#
# Test 1 : equilibrate a perturbed Si crystal with frozen cell
Expand Down Expand Up @@ -48,5 +51,7 @@ sys2, result = GO.minimise(sys1, sw; variablecell=true,
@test result.g_residual < 1e-3
f = ustrip.(forces(sys2, sw))
@test maximum(norm.(f)) < 1e-3
@test norm( ustrip.(virial(sys2, sw)) ) < 1e-3
@test norm( ustrip.(virial(sys2, sw)) ) < 2e-3
# 2e-3 is ok here because the virial is not actually the gradient
# the relationships is a little tricky

0 comments on commit ab0414f

Please sign in to comment.