Namespace Scine::Utils::Geometry

namespace Geometry

Functionalities working with an entire geometry (PositionCollection).

Functions

PositionCollection translatePositions(const PositionCollection &positions, const Displacement &translation)

Translates a set of postions by a given displacement.

Return

PositionCollection Returns the translated positions.

Parameters
  • positions: The original positions.

  • translation: The displacement to be added.

void translatePositions(PositionCollection &positions, const Displacement &translation)

Translates a set of postions by a given displacement.

The translatrion happend in-place.

Parameters
  • positions: The initial positions, will be transformed in-place.

  • translation: The displacement to be added.

unsigned int getIndexOfClosestAtom(const PositionCollection &positions, const Position &targetPosition)

Get the index of closest position (atom) to a given position in space.

Return

unsigned int The index of the closest atom to the given target.

Parameters
  • positions: A set of positions to be traversed.

  • targetPosition: The target position.

Eigen::MatrixXd positionVectorToMatrix(const Eigen::VectorXd &v)

Transforms a 3N-dimensional vector {x0, y0, z0, x1, y1, z1, …} to a Nx3 matrix.

Return

Eigen::MatrixXd Returns the final Nx3 matrix.

Parameters
  • v: The positions in vector form.

Eigen::VectorXd positionMatrixToVector(const Eigen::MatrixXd &m)

Transforms a Nx3 matrix to a 3N-dimensional vector {x0, y0, z0, x1, y1, z1, …}.

Return

Eigen::VectorXd Returns the final vector.

Parameters
  • m: The positions in matrix form.

void alignPositions(const PositionCollection &reference, PositionCollection &positions)

Rotate and translate positions so that it is as close as possible to referencePositions.

Parameters
  • reference: The reference positions.

  • positions: The positions to be aligned, will be transformed in place.

std::vector<double> getMasses(const ElementTypeCollection &elements)

Get a vector of all masses (in a.u.).

Return

std::vector<double> Returns the masses listed in a vector.

Parameters
  • elements: A collection of elements.

Position getCenterOfMass(const PositionCollection &positions, const std::vector<double> &masses)

Get the center of mass.

Return

Position Returns the center of mass (COM).

Parameters
  • positions: The positions.

  • masses: The masses (sorted according to the positions).

Position getCenterOfMass(const AtomCollection &structure)

Get the center of mass.

Return

Position Returns the center of mass (COM).

Parameters
  • structure: The structure (positions and masses are relevant).

Position getAveragePosition(const PositionCollection &positions)

Get the average Position.

(The average Position is identical to the center of mass if all masses are identical)

Return

Position Returns the average position.

Parameters
  • positions: The positions.

Eigen::Matrix3d calculateInertiaTensor(const PositionCollection &positions, const std::vector<double> &masses, const Position &centerOfMass)

Calculates the inertia tensor.

Return

Eigen::Matrix3d Returns the inertia tensor.

Parameters
  • positions: The positions.

  • masses: The masses (sorted according to the positions).

  • centerOfMass: The center of mass.

PrincipalMomentsOfInertia calculatePrincipalMoments(const PositionCollection &positions, const std::vector<double> &masses, const Position &centerOfMass)

Calculates the principal moments of inertia.

Return

PrincipalMomentsOfInertia Returns the principal moments of inertia.

Parameters
  • positions: The positions.

  • masses: The masses (sorted according to the positions).

  • centerOfMass: The center of mass.

Eigen::MatrixXd calculateTranslationAndRotationModes(const PositionCollection &positions, const ElementTypeCollection &elements)

Calculated the cartesion modes correspoding to translations and rotations of the entire system.

Return

Eigen::MatrixXd The rotation and translation modes. Translation modes (x,y,z) first-third column, rotation modes 3-final column (depending on the geometry)

Parameters
  • positions: The positions of all atoms.

  • elements: The ElemenetTypes of all atoms.

Eigen::MatrixXd calculateRotTransFreeTransformMatrix(const PositionCollection &positions, const ElementTypeCollection &elements)

Generates the matrix removing rotation and translation modes from the given geometry if applied.

Return

Eigen::MatrixXd The transformation matrix (applied as X^T*H*X to the Hessian).

Parameters
  • positions: The positions of all atoms.

  • elements: The ElemenetTypes of all atoms.

class PrincipalMomentsOfInertia
#include <Geometry.h>

The principal moments of inertia stored.