diff --git a/src/atoms.jl b/src/atoms.jl index 04fa3ad..07ac1ae 100644 --- a/src/atoms.jl +++ b/src/atoms.jl @@ -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 diff --git a/test/atomsbase.jl b/test/atomsbase.jl index d22be43..70e794b 100644 --- a/test/atomsbase.jl +++ b/test/atomsbase.jl @@ -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"] @@ -188,4 +189,4 @@ end finally isfile(fname) && rm(fname) end -end \ No newline at end of file +end