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

Make some functions more AD friendly #91

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ should be a vector of vectors each containing `D` elements that are
`<:Unitful.Length`. If an index is passed or the action is on a `species`,
return only the position of the referenced `species` / species on that index.
"""
position(sys::AbstractSystem) = position.(sys) # in Cartesian coordinates!
position(sys::AbstractSystem) = map(position, sys.particles) # in Cartesian coordinates!
position(sys::AbstractSystem, index) = position(sys[index])


Expand All @@ -151,7 +151,7 @@ type should be a vector of vectors each containing `D` elements that are
return only the velocity of the referenced `species`. Returned value of the function
may be `missing`.
"""
velocity(sys::AbstractSystem) = velocity.(sys) # in Cartesian coordinates!
velocity(sys::AbstractSystem) = map(velocity, sys.particles) # in Cartesian coordinates!
velocity(sys::AbstractSystem, index) = velocity(sys[index])


Expand All @@ -163,7 +163,7 @@ velocity(sys::AbstractSystem, index) = velocity(sys[index])
Vector of atomic masses in the system `sys` or the atomic mass of a particular `species` /
the `i`th species in `sys`. The elements are `<: Unitful.Mass`.
"""
atomic_mass(sys::AbstractSystem) = atomic_mass.(sys)
atomic_mass(sys::AbstractSystem) = map(atomic_mass, sys.particles)
atomic_mass(sys::AbstractSystem, index) = atomic_mass(sys[index])


Expand All @@ -180,7 +180,7 @@ of identifying the type of a `species` (e.g. the element for the case of an atom
[`atomic_symbol`](@ref) may return a more unique identifier. For example for a deuterium atom
this may be `:D` while `atomic_number` is still `1`.
"""
atomic_symbol(sys::AbstractSystem) = atomic_symbol.(sys)
atomic_symbol(sys::AbstractSystem) = map(atomic_symbol, sys.particles)
atomic_symbol(sys::AbstractSystem, index) = atomic_symbol(sys[index])


Expand All @@ -197,7 +197,7 @@ of identifying the type of a `species` (e.g. the element for the case of an atom
[`atomic_symbol`](@ref) may return a more unique identifier. For example for a deuterium atom
this may be `:D` while `atomic_number` is still `1`.
"""
atomic_number(sys::AbstractSystem) = atomic_number.(sys)
atomic_number(sys::AbstractSystem) = map(atomic_number, sys.particles)
atomic_number(sys::AbstractSystem, index) = atomic_number(sys[index])

"""
Expand Down