Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes for bulk #12

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/bulk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 2 additions & 5 deletions test/test_bulk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ for D in test_systems
end
@test compare_system(sys_f, D["sys"])
end


##

Expand Down Expand Up @@ -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