API reference
Index
AtomsBase.AbstractSystemAtomsBase.AtomAtomsBase.AtomViewAtomsBase.ChemicalSpeciesAtomsBase.FastSystemAtomsBase.FlexibleSystemAtomsBase.IsolatedCellAtomsBase.PeriodicCellAtomsBase.atom_nameAtomsBase.atomic_numberAtomsBase.atomic_symbolAtomsBase.atomic_systemAtomsBase.atomkeysAtomsBase.cellAtomsBase.cell_vectorsAtomsBase.chemical_formulaAtomsBase.elementAtomsBase.element_symbolAtomsBase.hasatomkeyAtomsBase.isolated_systemAtomsBase.massAtomsBase.n_dimensionsAtomsBase.periodic_systemAtomsBase.periodicityAtomsBase.set_cell!AtomsBase.set_cell_vectors!AtomsBase.set_mass!AtomsBase.set_periodicity!AtomsBase.set_position!AtomsBase.set_species!AtomsBase.set_velocity!AtomsBase.speciesAtomsBase.velocityAtomsBase.visualize_asciiBase.position
Types
AtomsBase.AbstractSystem — Type
AbstractSystem{D}A D-dimensional particle system.
AtomsBase.IsolatedCell — Type
IsolatedCell{D, T}Defines a computational domain / cell describing an open system.
AtomsBase.PeriodicCell — Type
Implementation 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 — Type
TODO: reintroduce the original docs (failing docstest...)
AtomsBase.ChemicalSpecies — Type
Encodes a chemical species by wrapping an integer that represents the atomic number, the number of protons, and additional name as max 4 characters.
The name variable can be used as atom name in PDB format or some other way to mark same kind of atoms from one another.
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)Constructors for names
ChemicalSpecies(:C; atom_name=:MyC)
ChemicalSpecies(:C13; atom_name=:MyC)Comparisons with different isotopes and names
# true
ChemicalSpecies(:C13) == ChemicalSpecies(:C)
# false
ChemicalSpecies(:C12) == ChemicalSpecies(:C13)
# true
ChemicalSpecies(:C; atom_name=:MyC) == ChemicalSpecies(:C)
# true
ChemicalSpecies(:C12; atom_name=:MyC) == ChemicalSpecies(:C12)
# false
ChemicalSpecies(:C; atom_name=:MyC) == ChemicalSpecies(:C12)
# true
ChemicalSpecies(:C12; atom_name=:MyC) == ChemicalSpecies(:C)
# true
ChemicalSpecies(:C; atom_name=:MyC) == ChemicalSpecies(:C12; atom_name=:MyC)System properties
AtomsBase.cell_vectors — Function
cell_vectors(sys::AbstractSystem{D})Return a tuple of length D of vectors of length D that describe the cell in which the system sys is defined.
AtomsBase.set_cell_vectors! — Function
set_cell_vectors!(sys::AbstractSystem{D}, bb::NTuple{D, SVector{D, L}})AtomsBase.periodicity — Function
periodicity(sys::AbstractSystem{D})Return a NTuple{D, Bool} indicating whether the system is periodic along a cell vector as specified by cell_vectors.
AtomsBase.set_periodicity! — Function
set_periodicity!(sys::AbstractSystem{D}, pbc::NTuple{D, Bool})AtomsBase.cell — Function
cell(sys::AbstractSystem)Returns the computational cell (domain). See e.g. PeriodicCell and IsolatedCell.
AtomsBase.set_cell! — Function
set_cell!(sys, cell)AtomsBase.n_dimensions — Function
n_dimensions(::AbstractSystem)Return number of dimensions.
AtomsBase.atomkeys — Function
atomkeys(sys::AbstractSystem)Return the atomic properties, which are available in all atoms of the system.
AtomsBase.hasatomkey — Function
hasatomkey(system::AbstractSystem, x::Symbol)Returns true whether the passed property available in all atoms of the passed system.
AtomsBase.chemical_formula — Function
Returns the chemical formula of an AbstractSystem as a string.
AtomsBase.visualize_ascii — Function
Build 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 — Function
position(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! — Function
set_position!(sys::AbstractSystem{D}, i, x)- If
iis an integer thenxis anSVector{D, L}withL <: Unitful.Length - If
iis anAbstractVector{<: Integer}or:thenxis anAbstractVector{SVector{D, L}}
AtomsBase.mass — Function
mass(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! — Function
set_mass!(sys::AbstractSystem, i, m)- If
iis an integer thenmis aUnitful.Mass - If
iis anAbstractVector{<: Integer}or:thenxis anAbstractVector{<: Unitful.Mass}
AtomsBase.species — Function
species(::AbstractSystem, i)Return the species (type, category, ...) of a particle or particles.
AtomsBase.set_species! — Function
set_species!(sys::AbstractSystem, i, s)- If
iis an integer thensis an object describing the particle species, e.g.,ChemicalSpecies - If
iis anAbstractVector{<: Integer}or:thenxis anAbstractVectorof species objects.
AtomsBase.velocity — Function
velocity(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! — Function
set_velocity!(sys::AbstractSystem, i, v)AtomsBase.atomic_number — Function
atomic_number(sys::AbstractSystem, i)
atomic_number(species)Vector of atomic numbers in the system sys or the atomic number of a particular species / the ith 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 — Function
atomic_symbol(sys::AbstractSystem, i)
atomic_symbol(species)Vector of atomic symbols in the system sys or the atomic symbol of a particular species / the ith 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.atom_name — Function
atom_name(species)
atom_name(sys::AbstractSystem, i)Return atomic name (Symbol) for species or vector of names for sys.
Defaults to atomic_symbol, if name field is zero or not defined.
AtomsBase.element_symbol — Function
element_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 — Function
The element corresponding to a species/atom (or missing).
Prototype Implementation
AtomsBase.Atom — Type
Atom(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 — Type
FlexibleSystem(particles, cell_vectors, periodicity; kwargs...)
FlexibleSystem(particles; cell_vectors, 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 — Type
FastSystemA struct of arrays style prototype implementation of the AtomsBase interface.
AtomsBase.atomic_system — Function
atomic_system(atoms::AbstractVector, cell_vectors, 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> cell_vectors = [[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"],
cell_vectors, pbcs)AtomsBase.isolated_system — Function
isolated_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 — Function
periodic_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> cell_vectors = ([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"],
cell_vectors)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)