Skip to content

Commit

Permalink
Merge pull request #58 from mfherbst/updates
Browse files Browse the repository at this point in the history
Add some extra tests
  • Loading branch information
jameskermode authored Dec 3, 2024
2 parents 153a9b2 + 2cad702 commit 225e964
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/atoms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function Atoms(system::AbstractSystem{D})
atom_data = Dict{Symbol,Any}(
:atomic_symbol => atomic_symbols,
:atomic_number => Int.(atomic_number(system, :)), # gets messy if not Int
:species => s,
:species => s,
:mass => mass(system, :)
)
atom_data[:position] = map(1:n_atoms) do at
Expand Down
7 changes: 4 additions & 3 deletions test/atomsbase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ end
end

@testset "Warning about setting invalid data" begin
species = ChemicalSpecies.([:D, :H, :C, :N, :He])
system = make_test_system(; extra_sysprop=(md=3u"u", symboldata=:abc),
extra_atprop=(massdata=3ones(5)u"u",
atomic_symbol=[:D, :H, :C, :N, :He])).system
extra_atprop=(massdata=3ones(5)u"u", species)).system
atoms = @test_logs((:warn, r"Unitful quantity massdata is not yet"),
(:warn, r"Writing quantities of type Symbol"),
(:warn, r"Unitful quantity md is not yet"),
(:warn, r"Mismatch between atomic numbers and atomic symbols"),
match_mode=:any, ExtXYZ.write_dict(Atoms(system)))

@test atoms["arrays"]["species"] == ["H", "H", "C", "N", "He"]
Expand Down Expand Up @@ -188,4 +189,4 @@ end
finally
isfile(fname) && rm(fname)
end
end
end

0 comments on commit 225e964

Please sign in to comment.