From 97335379b9b09115b7acaa0c08ba5e00c428ad04 Mon Sep 17 00:00:00 2001 From: "Michael F. Herbst" Date: Thu, 21 Nov 2024 07:01:09 +0100 Subject: [PATCH 1/2] Some fixes for bulk Not yet tested. --- src/bulk.jl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/bulk.jl b/src/bulk.jl index e170021..b6ab040 100644 --- a/src/bulk.jl +++ b/src/bulk.jl @@ -57,11 +57,21 @@ specify the kwargs `a` or `c` to determine the lattice constants. """ function bulk(sym::Symbol; T=Float64, cubic = false, pbc = (true,true,true), a=nothing, c=nothing) # , x=nothing, y=nothing, z=nothing) - symm = Chemistry.symmetry(sym) + symm = try + Chemistry.symmetry(sym) + catch e + if e isa KeyError + throw(ArgumentError("No symmetry information known for element $sym")) + else + rethrow() + end + end if symm in _simple_structures X, C = _simple_bulk(sym, cubic; a=a) elseif symm == :hcp X, C = _bulk_hcp(sym; a=a, c=c) # cubic parameter is irrelevant for hcp + else + throw(ArgumentError("Currently bulk not immplemented for symmetry $symm")) end m = Chemistry.atomic_mass(sym) Z = Chemistry.atomic_number(sym) From 555841007a6612c6f299cb1632ad576850374073 Mon Sep 17 00:00:00 2001 From: "Michael F. Herbst" Date: Fri, 22 Nov 2024 09:29:34 +0100 Subject: [PATCH 2/2] Add test --- test/test_bulk.jl | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/test_bulk.jl b/test/test_bulk.jl index 0f8e661..127109b 100644 --- a/test/test_bulk.jl +++ b/test/test_bulk.jl @@ -27,7 +27,6 @@ for D in test_systems end @test compare_system(sys_f, D["sys"]) end - ## @@ -56,7 +55,5 @@ deleteat!(sys4, 1:5) @test atomic_number.(pold[6:end]) == atomic_number(sys4, :) - - - - +@test_throws ArgumentError bulk(:Og) # Case where no bulk structure is known +@test_throws ArgumentError bulk(:B) # Tetragonal, which is currently not implemented