API reference
Index
AtomsBase.AbstractSystem
AtomsBase.Atom
AtomsBase.AtomView
AtomsBase.ChemicalSpecies
AtomsBase.FastSystem
AtomsBase.FlexibleSystem
AtomsBase.IsolatedCell
AtomsBase.PeriodicCell
AtomsBase.atomic_number
AtomsBase.atomic_symbol
AtomsBase.atomic_system
AtomsBase.atomkeys
AtomsBase.bounding_box
AtomsBase.cell
AtomsBase.chemical_formula
AtomsBase.element
AtomsBase.element_symbol
AtomsBase.hasatomkey
AtomsBase.isolated_system
AtomsBase.mass
AtomsBase.n_dimensions
AtomsBase.periodic_system
AtomsBase.periodicity
AtomsBase.set_bounding_box!
AtomsBase.set_cell!
AtomsBase.set_mass!
AtomsBase.set_periodicity!
AtomsBase.set_position!
AtomsBase.set_species!
AtomsBase.set_velocity!
AtomsBase.species
AtomsBase.velocity
AtomsBase.visualize_ascii
Base.position
Types
AtomsBase.AbstractSystem
— TypeAbstractSystem{D}
A D
-dimensional particle system.
AtomsBase.IsolatedCell
— Type IsolatedCell{D, T}
Defines a computational domain / cell describing an open system.
AtomsBase.PeriodicCell
— TypeImplementation of a computational cell for particle systems within AtomsBase.jl. PeriodicCell
specifies a parallepiped shaped cell with choice of open or periodic boundary condition in each cell vector direction.
AtomsBase.AtomView
— TypeTODO: reintroduce the original docs (failing docstest...)
AtomsBase.ChemicalSpecies
— TypeEncodes a chemical species by wrapping an integer that represents the atomic number, the number of protons, and additional unspecified information as a UInt32
.
Constructors for standard chemical elements
ChemicalSpecies(Z::Integer)
ChemicalSpecies(sym::Symbol)
# for example
ChemicalSpecies(:C)
ChemicalSpecies(6)
Constructors for isotopes
# standard carbon = C-12
ChemicalSpecies(:C)
ChemicalSpecies(:C; n_neutrons = 6)
# three equivalent constructors for C-13
ChemicalSpecies(:C; n_neutrons = 7)
ChemicalSpecies(6; n_neutrons = 7)
ChemicalSpecies(:C13)
# deuterium
ChemicalSpecies(:D)
System properties
AtomsBase.bounding_box
— Functionbounding_box(sys::AbstractSystem{D})
Return a tuple of length D
of vectors of length D
that describe the "box" in which the system sys
is defined.
AtomsBase.set_bounding_box!
— Functionset_bounding_box!(sys::AbstractSystem{D}, bb::NTuple{D, SVector{D, L}})
AtomsBase.periodicity
— Functionperiodicity(sys::AbstractSystem{D})
Return a NTuple{D, Bool}
indicating whether the system is periodic along a cell vector as specified by bounding_box
.
AtomsBase.set_periodicity!
— Functionset_periodicity!(sys::AbstractSystem{D}, pbc::NTuple{D, Bool})
AtomsBase.cell
— Functioncell(sys::AbstractSystem)
Returns the computational cell (domain). See e.g. PeriodicCell
and IsolatedCell
.
AtomsBase.set_cell!
— Functionset_cell!(sys, cell)
AtomsBase.n_dimensions
— Functionn_dimensions(::AbstractSystem)
Return number of dimensions.
AtomsBase.atomkeys
— Functionatomkeys(sys::AbstractSystem)
Return the atomic properties, which are available in all atoms of the system.
AtomsBase.hasatomkey
— Functionhasatomkey(system::AbstractSystem, x::Symbol)
Returns true whether the passed property available in all atoms of the passed system.
AtomsBase.chemical_formula
— FunctionReturns the chemical formula of an AbstractSystem as a string.
AtomsBase.visualize_ascii
— FunctionBuild an ASCII representation of the passed atomistic structure. The string may be empty if the passed structure could not be represented (structure not supported or invalid).
Species / atom properties
Base.position
— Functionposition(sys::AbstractSystem, i)
Return the position of the ith particle if i
is an Integer
, a vector of positions if i
is a vector of integers, or a vector of all positions if i == :
.
The return type should be a vector of vectors each containing D
elements that are <:Unitful.Length
.
AtomsBase.set_position!
— Functionset_position!(sys::AbstractSystem{D}, i, x)
- If
i
is an integer thenx
is anSVector{D, L}
withL <: Unitful.Length
- If
i
is anAbstractVector{<: Integer}
or:
thenx
is anAbstractVector{SVector{D, L}}
AtomsBase.mass
— Functionmass(sys::AbstractSystem, i)
Mass of a particle if i::Integer
, vector of masses if i
is a vector of integers or :
. The elements are <: Unitful.Mass
.
AtomsBase.set_mass!
— Functionset_mass!(sys::AbstractSystem, i, m)
- If
i
is an integer thenm
is aUnitful.Mass
- If
i
is anAbstractVector{<: Integer}
or:
thenx
is anAbstractVector{<: Unitful.Mass}
AtomsBase.species
— Functionspecies(::AbstractSystem, i)
Return the species (type, category, ...) of a particle or particles.
AtomsBase.set_species!
— Functionset_species!(sys::AbstractSystem, i, s)
- If
i
is an integer thens
is an object describing the particle species, e.g.,ChemicalSpecies
- If
i
is anAbstractVector{<: Integer}
or:
thenx
is anAbstractVector
of species objects.
AtomsBase.velocity
— Functionvelocity(sys::AbstractSystem, i)
Return a velocity vector if i::Integer
, a vector of velocities if i
is a vector of integers or :
. Return type should be a vector of vectors each containing D
elements that are <:Unitful.Velocity
. Returned value of the function may be missing
.
AtomsBase.set_velocity!
— Functionset_velocity!(sys::AbstractSystem, i, v)
AtomsBase.atomic_number
— Functionatomic_number(sys::AbstractSystem, i)
atomic_number(species)
Vector of atomic numbers in the system sys
or the atomic number of a particular species
/ the i
th species in sys
.
The intention is that atomic_number
carries the meaning of identifying the type of a species
(e.g. the element for the case of an atom), whereas atomic_symbol
may return a more unique identifier. For example for a deuterium atom this may be :D
while atomic_number
is still 1
.
AtomsBase.atomic_symbol
— Functionatomic_symbol(sys::AbstractSystem, i)
atomic_symbol(species)
Vector of atomic symbols in the system sys
or the atomic symbol of a particular species
/ the i
th species in sys
.
The intention is that atomic_number
carries the meaning of identifying the type of a species
(e.g. the element for the case of an atom), whereas atomic_symbol
may return a more unique identifier. For example for a deuterium atom this may be :D
while atomic_number
is still 1
.
AtomsBase.element_symbol
— Functionelement_symbol(system, index)
element_symbol(species)
Return the symbols corresponding to the elements of the atoms. Note that this may be different than atomic_symbol
for cases where atomic_symbol
is chosen to be more specific (i.e. designate a special atom).
AtomsBase.element
— FunctionThe element corresponding to a species/atom (or missing).
Prototype Implementation
AtomsBase.Atom
— TypeAtom(identifier::AtomId, position::AbstractVector; kwargs...)
Atom(identifier::AtomId, position::AbstractVector, velocity::AbstractVector; kwargs...)
Atom(; atomic_number, position, velocity=zeros(D)u"bohr/s", kwargs...)
Construct an atomic located at the cartesian coordinates position
with (optionally) the given cartesian velocity
. Note that AtomId = Union{Symbol,AbstractString,Integer,ChemicalSymbol}
.
Supported kwargs
include species
, mass
, as well as user-specific custom properties.
Atom(atom::Atom; kwargs...)
Update constructor. Construct a new Atom
, by amending the data contained in the passed atom
object. Supported kwargs
include species
, mass
, as well as user-specific custom properties.
Examples
Construct a standard hydrogen atom located at the origin
julia> hydrogen = Atom(:H, zeros(3)u"Å")
and now amend its charge and atomic mass
julia> Atom(atom; mass=1.0u"u", charge=-1.0u"e_au")
AtomsBase.FlexibleSystem
— TypeFlexibleSystem(particles, bounding_box, periodicity; kwargs...)
FlexibleSystem(particles; bounding_box, periodicity, kwargs...)
FlexibleSystem(particles, cell; kwargs...)
Construct a flexible system, a versatile data structure for atomistic systems, which puts an emphasis on flexibility rather than speed.
FlexibleSystem(system; kwargs...)
Update constructor. See AbstractSystem
for details.
AtomsBase.FastSystem
— TypeFastSystem
A struct of arrays style prototype implementation of the AtomsBase interface.
AtomsBase.atomic_system
— Functionatomic_system(atoms::AbstractVector, bounding_box, periodicity; kwargs...)
Construct a FlexibleSystem
using the passed atoms
and boundary box and conditions. Extra kwargs
are stored as custom system properties.
Examples
Construct a hydrogen molecule in a box, which is periodic only in the first two dimensions
julia> bounding_box = [[10.0, 0.0, 0.0], [0.0, 10.0, 0.0], [0.0, 0.0, 10.0]]u"Å"
julia> pbcs = (true, true, false)
julia> hydrogen = atomic_system([:H => [0, 0, 1.]u"bohr",
:H => [0, 0, 3.]u"bohr"],
bounding_box, pbcs)
AtomsBase.isolated_system
— Functionisolated_system(atoms::AbstractVector; kwargs...)
Construct a FlexibleSystem
by placing the passed atoms
into an infinite vacuum (standard setup for modelling molecular systems). Extra kwargs
are stored as custom system properties.
Examples
Construct a hydrogen molecule
julia> hydrogen = isolated_system([:H => [0, 0, 1.]u"bohr", :H => [0, 0, 3.]u"bohr"])
AtomsBase.periodic_system
— Functionperiodic_system(atoms::AbstractVector, box; fractional=false, kwargs...)
Construct a FlexibleSystem
with all boundaries of the box
periodic (standard setup for modelling solid-state systems). If fractional
is true, atom coordinates are given in fractional (and not in Cartesian) coordinates. Extra kwargs
are stored as custom system properties.
Examples
Setup a hydrogen molecule inside periodic BCs:
julia> bounding_box = ([10.0, 0.0, 0.0]u"Å", [0.0, 10.0, 0.0]u"Å", [0.0, 0.0, 10.0]u"Å")
julia> hydrogen = periodic_system([:H => [0, 0, 1.]u"bohr",
:H => [0, 0, 3.]u"bohr"],
bounding_box)
Setup a silicon unit cell using fractional positions
julia> box = 10.26 / 2 * [[0, 0, 1], [1, 0, 1], [1, 1, 0]]u"bohr"
julia> silicon = periodic_system([:Si => ones(3)/8,
:Si => -ones(3)/8],
box, fractional=true)