File MolecularTrajectory.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
MolecularTrajectory
- #include <MolecularTrajectory.h>
A container class for Scine::Utils::PositionCollection classes.
Mainly an override of std::vector<PositionCollection>, plus Element Type information. Generally used for storing the positions of several consecutive molecular structures.
Public Types
-
using
Container
= std::vector<PositionCollection>¶
-
using
EnergyContainer
= std::vector<double>¶
Public Functions
-
MolecularTrajectory
() Default constructor.
-
void
setElementType
(int index, ElementType e) Set a single element type.
- Parameters
index
: The index of the atom to be alterede
: The element type to be set.
-
void
setElementTypes
(const ElementTypeCollection &elements) Set the all element types.
- Parameters
elements
: The new element types.
-
const ElementTypeCollection &
getElementTypes
() const Get all the element types.
- Return
const ElementTypeCollection& A reference to all element types.
-
void
setEnergies
(const EnergyContainer &energies) Setter for the energies.
Energies can only be set if the size of the energy vector matches the size of the structure vector.
- Parameters
energies
: The energies.
-
EnergyContainer
getEnergies
() Getter for the vector of energies corresponding to the structures.
- Return
The vector of energies.
-
void
clearEnergies
() Clears the energy container.
-
void
clear
() Clears all steps in the trajectory, element information is retained.
-
void
resize
(int n) Resets the number of PositionCollections.
- Parameters
n
: Number of PositionCollections.
-
void
push_back
(PositionCollection p) Adds a new set of positions (a frame)
This function is only usable if no energies have been previously added, thus the energy vector has to be empty.
- Parameters
p
: The new positions to be added.
-
void
push_back
(PositionCollection p, double e) Adds a new set of positions (a frame) with a corresponding energy.
This function is only usable if the energy vector already has the same size as the structure vector. Therefore, if a few structures are added without an energy, the energies have to be first set for the other structures, before this function becomes applicable.
- Parameters
p
: The new positions to be added.e
: The corresponding energy.
-
bool
empty
() const Checks if there are structures present.
- Return
true If no PositionCollections are stored.
false If any PositionCollections are present.
-
int
size
() const Getter for the number of structures.
- Return
int Returns the number of stored structures/frames/PositionCollections.
-
int
molecularSize
() const Getter for the size of the structure.
- Return
int Returns number of atoms in the structure.
-
iterator
begin
() An iterator pointing to the start of the structures (not the elements!).
- Return
iterator The iterator.
-
const_iterator
begin
() const The const version of the start() iterator.
- Return
const_iterator The iterator.
-
iterator
erase
(iterator position) Erases one PositionCollection from the stored list.
- Return
iterator An iterator to the nex position in the new list.
- Parameters
position
: The position to erase.
-
iterator
end
() An iterator pointing to the end of the structures (not the elements!).
- Return
iterator The iterator.
-
const_iterator
end
() const The const version of the end() iterator.
- Return
const_iterator The iterator.
-
reference
operator[]
(int i) The access operator.
- Return
reference A reference to the structure at index i.
- Parameters
i
: The index to be accessed.
-
const_reference
operator[]
(int i) const The const version of the access operator.
- Return
const_reference A const reference to the structure at index i.
- Parameters
i
: The index to be accessed.
-
reference
at
(int i) The at() function to access single structures in the trajectory.
- Return
reference A reference to the structure at index i.
- Parameters
i
: The index to be accessed.
-
const_reference
at
(int i) const The const version of the at() function.
- Return
const_reference A const reference to the structure at index i.
- Parameters
i
: The index to be accessed.
-
reference
front
() A function referencing the front of the list of structure.
- Return
reference A reference to the first entry in the list of structures.
-
const_reference
front
() const The const version of the front() function.
- Return
const_reference A const reference to the first entry in the list of structures.
-
reference
back
() A function referencing the back of the list of structure.
- Return
reference A reference to the last entry in the list of structures.
-
const_reference
back
() const The const version of the back() function.
- Return
const_reference A const reference to the last entry in the list of structures.
-
const MolecularTrajectory &
operator*=
(double f) Multiplication assignment operator (for example for unit conversion)
- Return
const MolecularTrajectory& The trajectory, in-place.
- Parameters
f
: The scalar to multiply with.
-
const MolecularTrajectory &
operator/=
(double f) Division assignment operator (for example for unit conversion)
- Return
const MolecularTrajectory& The trajectory, in-place.
- Parameters
f
: The scalar to divide by.
-
MolecularTrajectory
operator*
(double f) const Multiplication operator (for example for unit conversion)
- Return
MolecularTrajectory The resulting trajectory.
- Parameters
f
: The scalar to multiply with.
-
MolecularTrajectory
operator/
(double f) const Division operator (for example for unit conversion)
- Return
MolecularTrajectory The resulting trajectory.
- Parameters
f
: The scalar to divide by.
Private Functions
-
bool
resettingElementTypeCollectionIsAllowed
(const ElementTypeCollection &ec) const¶ Checks if a reset of the elements with a given collection is allowed.
- Return
true If the reset is allowed.
false If the reset is not allowed.
- Parameters
ec
: The Element collection.
-
bool
additionOfPositionCollectionIsAllowed
(const PositionCollection &p) const¶ Checks if the addition of a given collection of positionsis allowed.
- Return
true If the addition is allowed.
false If the addition is not allowed.
- Parameters
ec
: The collection of positions.
-
using
-
class
-
namespace