Skip to content

Commit

Permalink
Merge branch 'master' into remove_cell_vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
mfherbst authored Nov 2, 2024
2 parents 6fbf208 + c4aaa54 commit 598092e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/AtomsBaseTesting/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AtomsBaseTesting"
uuid = "ed7c10db-df7e-4efa-a7be-4f4190f7f227"
authors = ["JuliaMolSim community"]
version = "0.3.0"
version = "0.3.1"

[deps]
AtomsBase = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a"
Expand Down
4 changes: 3 additions & 1 deletion lib/AtomsBaseTesting/src/AtomsBaseTesting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ function test_approx_eq(s::AbstractSystem, t::AbstractSystem;
end

# Test some things on cell objects
@test typeof(cell(s)) == typeof(cell(t))
if cell(s) isa PeriodicCell
@test maximum(map(rnorm, bounding_box(cell(s)), bounding_box(cell(t)))) < rtol
end
@test periodicity(cell(s)) == periodicity(cell(t))
@test n_dimensions(cell(s)) == n_dimensions(cell(t))

Expand Down
12 changes: 12 additions & 0 deletions lib/AtomsBaseTesting/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,17 @@ include("testmacros.jl")
test_approx_eq(hydrogen, hydrogen)
end

@testset "Identical systems with just different units" begin
box = 10.26 / 2 * [[0, 0, 1], [1, 0, 1], [1, 1, 0]]u"bohr"
box_A = [[uconvert.(u"Å", i[j]) for j in 1:3] for i in box]
silicon = AtomsBase.periodic_system([:Si => ones(3)/8,
:Si => -ones(3)/8],
box, fractional=true)
silicon_A = AtomsBase.periodic_system([:Si => ones(3)/8,
:Si => -ones(3)/8],
box_A, fractional=true)
@testpass AtomsBaseTesting.test_approx_eq(silicon, silicon_A)
end

# TODO More tests would be useful
end

0 comments on commit 598092e

Please sign in to comment.