Skip to content

Commit 962a622

Browse files
committed
add mising atomic_symbol and species fn
1 parent f01bb85 commit 962a622

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SimpleCrystals"
22
uuid = "64031d72-e220-11ed-1a7e-43a2532b2fa8"
33
authors = ["Ethan Meitz <emeitz@andrew.cmu.edu>"]
4-
version = "0.4.3"
4+
version = "0.4.4"
55

66
[deps]
77
AtomsBase = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a"

src/Crystal.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ AtomsBase.n_dimensions(sys::Crystal) = length(sys.N_unit_cells)
9595
AtomsBase.atomkeys(sys::Crystal) = keys(sys.atoms[1])
9696
AtomsBase.hasatomkey(sys::Crystal, x::Symbol) = haskey(sys.atoms[1], x)
9797

98-
# AtomsBase.species_type(sys::Crystal) = typeof(sys.atoms[1])
99-
10098
AtomsBase.position(sys::Crystal) = position.(sys.atoms)
10199
AtomsBase.position(sys::Crystal, i::Integer) = sys.atoms[i].position
102100
AtomsBase.position(sys::Crystal, ::Colon) = position.(sys.atoms)
@@ -111,11 +109,16 @@ AtomsBase.mass(sys::Crystal, ::Colon) = mass.(sys.atoms)
111109

112110
AtomsBase.atomic_symbol(sys::Crystal) = atomic_symbol.(sys.atoms)
113111
AtomsBase.atomic_symbol(sys::Crystal, i::Integer) = atomic_symbol(sys.atoms[i])
112+
AtomsBase.atomic_symbol(sys::Crystal, ::Colon) = atomic_symbol.(sys.atoms)
114113

115114
AtomsBase.atomic_number(sys::Crystal, ::Colon) = atomic_number.(sys.atoms)
116115
AtomsBase.atomic_number(sys::Crystal) = atomic_number.(sys.atoms)
117116
AtomsBase.atomic_number(sys::Crystal, i::Integer) = atomic_number(sys.atoms[i])
118117

118+
AtomsBase.species(sys::Crystal, i::Integer) = species(sys[i])
119+
AtomsBase.species(sys::Crystal) = species.(sys.atoms)
120+
AtomsBase.species(sys::Crystal, ::Colon) = species.(sys.atoms)
121+
119122
AtomsBase.visualize_ascii(sys::Crystal) = ""
120123

121124
function Base.show(io::IO, sys::Crystal)

src/atom.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ AtomsBase.position(atom::Atom) = atom.position
3434
AtomsBase.velocity(atom::Atom) = missing
3535
AtomsBase.n_dimensions(::Atom{D}) where D = D
3636

37+
AtomsBase.species(atom::Atom) = atom.atomic_symbol
38+
3739
function Base.show(io::IO, atom::Atom)
3840
print(io, "Atom at $(round.(ustrip.(atom.position), digits = 3)), with charge: $(charge(atom)) and mass : $(mass(atom)) ")
3941
end

0 commit comments

Comments
 (0)