File MDIntegrator.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 MDIntegrator

Subclassed by Scine::Utils::EulerMD, Scine::Utils::LeapFrogMD, Scine::Utils::VelocityVerletMD

Public Functions

MDIntegrator()

Constructor that sets the default time step of 1 fs.

virtual Utils::DisplacementCollection calculateDisplacements(const Utils::GradientCollection &gradients) = 0

Calculates the displacements from the gradients.

void setElementTypes(const Utils::ElementTypeCollection &elements)

Sets the masses, initializes the velocities and accelerations to zero.

Parameters
  • elements: The element types of the molecular system.

void resetVelocities()

Resets velocities to zero.

void setVelocities(const Utils::DisplacementCollection &velocities)

Setter for the velocities.

Utils::DisplacementCollection getVelocities() const

Getter for the velocities.

void setTimeStepInFemtoseconds(double fs)

Sets the time step in the unit femtoseconds.

void setRelaxationTimeFactor(double factor)

The temperature bath relaxation time in units of the chosen time step.

void setTargetTemperatureInKelvin(double T)

Sets the target temperature in Kelvin.

void setSeed(int seed)

Sets a seed for the random initial velocities.

void removeCenterOfMassLinearMomentum(const Eigen::MatrixX3d &positions)

Removes the center of mass motion.

void removeCenterOfMassAngularMomentum(const Eigen::MatrixX3d &positions)

Removes the center of mass motion.

virtual ~MDIntegrator()

Protected Functions

void calculateAccelerationsFromGradients(const Utils::GradientCollection &gradients)

Updates the accelerations according to the given gradients.

void rescaleVelocitiesForTemperatureBath()

Berendsen thermostat.

void sampleVelocitiesFromBoltzmannDistribution()

Method to sample initial velocities from a Maxwell-Boltzmann distribution.

Protected Attributes

std::vector<double> masses_
Utils::DisplacementCollection velocities_
Utils::DisplacementCollection accelerations_
int nAtoms_
double timeStep_
int seed_ = 42

Private Functions

void resetAccelerations()
double getCurrentTemperature()

Private Members

bool temperatureBath_ = false
double temperatureRelaxationTime_
double targetTemperature_
double relaxationTimeFactor_