-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from JuliaMolSim/less_abstract
simplify types
- Loading branch information
Showing
9 changed files
with
226 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
module AtomsBase | ||
|
||
include("interface.jl") | ||
include("atoms.jl") | ||
include("implementation_soa.jl") | ||
include("implementation_aos.jl") | ||
|
||
# Write your package code here. | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# | ||
# Extra stuff only for Systems composed of atoms | ||
# | ||
|
||
export StaticAtom, AbstractAtomicSystem | ||
export atomic_mass, atomic_number, atomic_symbol, atomic_property | ||
|
||
struct StaticAtom{D,L<:Unitful.Length} | ||
position::SVector{D,L} | ||
element::Element | ||
end | ||
StaticAtom(position, element) = StaticAtom{length(position)}(position, element) | ||
position(atom::StaticAtom) = atom.position | ||
species(atom::StaticAtom) = atom.element | ||
|
||
function StaticAtom(position, symbol::Union{Integer,AbstractString,Symbol,AbstractVector}) | ||
StaticAtom(position, elements[symbol]) | ||
end | ||
|
||
function Base.show(io::IO, a::StaticAtom) | ||
print(io, "StaticAtom: $(a.element.symbol)") | ||
end | ||
|
||
const AbstractAtomicSystem{D} = AbstractSystem{D,Element} | ||
|
||
atomic_symbol(a::StaticAtom) = a.element.symbol | ||
atomic_mass(a::StaticAtom) = a.element.atomic_mass | ||
atomic_number(a::StaticAtom) = a.element.number | ||
atomic_property(a::StaticAtom, property::Symbol) = getproperty(a.element, property) | ||
|
||
atomic_symbol(sys::AbstractAtomicSystem) = atomic_symbol.(sys) | ||
atomic_number(sys::AbstractAtomicSystem) = atomic_number.(sys) | ||
atomic_mass(sys::AbstractAtomicSystem) = atomic_mass.(sys) | ||
atomic_property(sys::AbstractAtomicSystem, property::Symbol)::Vector{Any} = | ||
atomic_property.(sys, property) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.