File AtomCollection.h¶
- Copyright
This code is licensed under the 3-clause BSD license.
Copyright ETH Zurich, Laboratory for Physical Chemistry, Reiher Group.
See LICENSE.txt for details.
-
namespace
Scine This header file contains functions that allow for common notation for common things that can be done at a different degree of derivatives.
This header contains alias definitions defining which classes to use for the different degrees of derivatives.
-
namespace
Utils -
class
AtomCollection - #include <AtomCollection.h>
A Collection of Atoms.
Has the same functionality as a std::vector<Atom>, but is implemented as a composition of a ElementTypeCollection and a PositionCollection.
Public Types
-
using
iterator= AtomCollectionIterator¶
Public Functions
-
AtomCollection(int N = 0) Construct a new AtomCollection object.
All atoms will be created and as type: None and be placed at (0,0,0).
- Parameters
N: The number of atoms.
-
AtomCollection(ElementTypeCollection elements, PositionCollection positions) Construct a new AtomCollection object.
- Parameters
elements: The elements of the atoms.positions: The positions of the atoms.
-
void
setElements(ElementTypeCollection elements) Update all Elements.
The new data must have the correct size, this function does not resize the data objects.
- Parameters
elements: The new collection of Elements.
-
void
setPositions(PositionCollection positions) Update all positions.
The new data must have the correct size, this function does not resize the data objects.
- Parameters
positions: The new positions.
-
const ElementTypeCollection &
getElements() const Get the Elements object.
- Return
const ElementTypeCollection&
-
const PositionCollection &
getPositions() const Get the Positions object.
- Return
const PositionCollection&
-
void
setElement(int i, ElementType e) Set the Element of one existing atom.
This function can not access/create new atoms that are not present yet.
- Parameters
i: The index of the atom.e: The new Element.
-
void
setPosition(int i, const Position &p) Set the Position of one existing atom.
This function can not access/create new atoms that are not present yet.
- Parameters
i: The index of the atom.p: The new Position.
-
ElementType
getElement(int i) const Get the Element of a single atom.
- Return
ElementType The Element of atom i.
- Parameters
i: The index of the atom.
-
int
size() const Getter for thw collection size.
- Return
int Returns the number of atoms in the collection.
-
iterator
begin() const The start of the collection iterator.
- Return
iterator The iterator.
-
iterator
end() const The end of the collection iterator.
- Return
iterator The iterator.
-
void
clear() Clears all content and resizes data objects to size 0;.
-
void
resize(int n) Resizes the data obejects to the given size.
- Parameters
n: The number of atoms to resize to.
-
void
push_back(const Atom &atom) Appends one atom to the collectio via copy.
- Parameters
atom: The atom.
-
Atom
operator[](int i) const Operator overlaod, getter by position.
- Return
Atom That atom at position i.
- Parameters
i: The position.
-
Atom
at(int i) const Getter by position.
- Return
Atom That atom at position i.
- Parameters
i: The position.
-
bool
operator==(const AtomCollection &other) const Performs in-order comparison of both the contained element types and positions.
- Note
The positions are fuzzy-compared with Eigen’s isApprox function and must therefore not be exactly equal.
- Return
Whether both atomcollection contain the same information
- Parameters
other: The AtomCollection to compare against
-
bool
operator!=(const AtomCollection &other) const Negates.
- See
operator ==
-
class
AtomCollectionIterator: public std::iterator<std::bidirectional_iterator_tag, Atom> - #include <AtomCollection.h>
Custom iterator typename for AtomCollection.
Public Functions
-
AtomCollectionIterator(AtomCollection const *ac = nullptr, int num = 0)¶
-
AtomCollectionIterator &
operator++()¶
-
AtomCollectionIterator
operator++(int)¶
-
AtomCollectionIterator &
operator--()¶
-
AtomCollectionIterator
operator--(int)¶
-
bool
operator==(AtomCollectionIterator other) const¶
-
bool
operator!=(AtomCollectionIterator other) const¶
-
value_type
operator*() const¶
-
-
using
-
class
-
namespace