Class Scine::Utils::AtomCollection¶
-
class
AtomCollection
¶ 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 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.
-
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>¶ Custom iterator typename for AtomCollection.
-