Open Qmin
0.8.0
GPU-accelerated Q-tensor-based liquid crystal simulations
|
Implement energy minimization via the FIRE algorithm. More...
#include <energyMinimizerFIRE.h>
Public Member Functions | |
energyMinimizerFIRE () | |
The basic constructor. More... | |
energyMinimizerFIRE (shared_ptr< simpleModel > system) | |
The basic constructor that feeds in a target system to minimize. More... | |
virtual void | initializeParameters () |
Sets a bunch of default parameters that do not depend on the number of degrees of freedom. More... | |
void | initializeFromModel () |
Set a bunch of default initialization parameters (if the State is available to determine the size of vectors) More... | |
void | setFIREParameters (scalar deltaT, scalar alphaStart, scalar deltaTMax, scalar deltaTInc, scalar deltaTDec, scalar alphaDec, int nMin, scalar forceCutoff, scalar _alphaMin=0.75) |
Set a lot of parameters! More... | |
void | setForceCutoff (scalar fc) |
Set the force cutoff. More... | |
void | setDeltaT (scalar dt) |
set the initial value of deltaT More... | |
void | setAlphaStart (scalar as) |
set the initial value of alpha and alphaStart More... | |
void | setDeltaTMax (scalar tmax) |
Set the maximum deltaT. More... | |
void | setDeltaTInc (scalar dti) |
Set the fraction by which delta increments. More... | |
void | setDeltaTDec (scalar dtc) |
Set the fraction by which delta decrements. More... | |
void | setAlphaDec (scalar ad) |
Set the fraction by which alpha decrements. More... | |
void | setNMin (int nm) |
Set the number of consecutive steps P must be non-negative before increasing delatT. More... | |
void | fireStep () |
an interface to call either the CPU or GPU FIRE algorithm More... | |
void | fireStepCPU () |
Perform a velocity Verlet step on the CPU. More... | |
void | fireStepGPU () |
Perform a velocity Verlet step on the GPU. More... | |
void | minimize () |
Minimize to either the force tolerance or the maximum number of iterations. More... | |
virtual void | performUpdate () |
The "intergate equatios of motion just calls minimize. More... | |
virtual scalar | getMaxForce () |
Return the maximum force. More... | |
virtual scalar | getClassSize () |
virtual void | integrateEOMGPU () |
virtual void | integrateEOMCPU () |
virtual void | integrateEquationOfMotion () |
virtual void | Update (int timestep) |
The fundamental function that a controlling Simulation can call. More... | |
void | setSimulation (shared_ptr< basicSimulation > _sim) |
set the simulation More... | |
virtual void | setModel (shared_ptr< simpleModel > _model) |
virtual function to allow the model to be a derived class More... | |
void | setPeriod (int _p) |
set the period More... | |
void | setPhase (int _p) |
set the phase More... | |
virtual void | spatialSorting () |
allow for spatial sorting to be called if necessary... More... | |
virtual void | setReproducible (bool rep) |
Allow for a reproducibility call to be made. More... | |
virtual void | setGPU (bool _useGPU=true) |
Enforce GPU operation. More... | |
int | getNdof () |
Get the number of degrees of freedom of the equation of motion. More... | |
void | setNdof (int _n) |
Set the number of degrees of freedom of the equation of motion. More... | |
virtual void | setNThreads (int n) |
allow for setting multiple threads More... | |
void | setMaximumIterations (int maxIt) |
Set the maximum number of iterations before terminating (or set to -1 to ignore) More... | |
int | getCurrentIterations () |
int | getMaxIterations () |
void | setCurrentIterations (int newIterations) |
int | getNTotal () |
communicate the number of non-object sites across ranks More... | |
Public Attributes | |
GPUArray< dVec > | displacement |
an array of displacements More... | |
shared_ptr< basicSimulation > | sim |
A pointer to the governing simulation. More... | |
shared_ptr< simpleModel > | model |
A pointer to a simpleModel that the updater acts on. More... | |
vector< scalar > | updaterData |
int | iterations |
The number of iterations performed. More... | |
Protected Attributes | |
scalar | forceMax |
sqrt(force.force) / N_{dof} More... | |
scalar | forceCutoff |
The cutoff value of the maximum force. More... | |
int | NMin |
The numer of consecutive time steps the power must be positive before increasing deltaT. More... | |
int | NSinceNegativePower |
The numer of consecutive time since the power has be negative. More... | |
scalar | deltaTMin |
The minimum time step size. More... | |
scalar | deltaTMax |
The maximum time step size. More... | |
scalar | deltaTInc |
The fraction by which deltaT can get bigger. More... | |
scalar | deltaTDec |
The fraction by which deltaT can get smaller. More... | |
scalar | Power |
The internal value of the "power". More... | |
scalar | alpha |
The alpha parameter of the minimization routine. More... | |
scalar | alphaStart |
The initial value of the alpha parameter. More... | |
scalar | alphaDec |
The fraction by which alpha can decrease. More... | |
scalar | alphaMin |
The smallest value of alpha. More... | |
scalar | scaling |
a multiplicative factor More... | |
GPUArray< scalar > | sumReductionIntermediate |
Utility array for simple reductions. More... | |
GPUArray< scalar > | sumReductionIntermediate2 |
GPUArray< scalar > | sumReductions |
Utility array for simple reductions. More... | |
shared_ptr< kernelTuner > | dotProductTuner |
kernel tuner for performance More... | |
int | nThreads =1 |
number of threads to use More... | |
int | Period |
The period of the updater... the updater will work every Period timesteps. More... | |
int | Phase |
The phase of the updater... the updater will work every Period timesteps offset by a phase. More... | |
bool | useGPU |
whether the updater does its work on the GPU or not More... | |
bool | neverGPU |
whether the updater never does work on the GPU More... | |
int | Ndof |
some measure of the number of degrees of freedom the equations of motion might need to know about locally More... | |
int | nTotal |
the total number of non-object sites across all ranks More... | |
bool | reproducible |
whether the RNGs give reproducible results More... | |
scalar | deltaT |
The internal time step size. More... | |
int | maxIterations |
The maximum number of iterations allowed. More... | |
Implement energy minimization via the FIRE algorithm.
This class uses the "FIRE" algorithm to perform an energy minimization. The class is in the same framework as the simpleEquationOfMotion class, so it is called by calling performTimestep on a Simulation object that has been given the FIRE minimizer and the configuration to minimize. Each timestep, though, is a complete minimization (i.e. will run for the maximum number of iterations, or until a target tolerance has been acheived, or whatever stopping condition the user sets.
|
inline |
The basic constructor.
References initializeParameters().
energyMinimizerFIRE::energyMinimizerFIRE | ( | shared_ptr< simpleModel > | system | ) |
The basic constructor that feeds in a target system to minimize.
Initialize the minimizer with a reference to a target system, set a bunch of default parameters. Of note, the current default is CPU operation
References initializeFromModel(), initializeParameters(), and updater::setModel().
|
virtual |
Sets a bunch of default parameters that do not depend on the number of degrees of freedom.
Initialize the minimizer with some default parameters. that do not depend on Ndof
References alphaMin, dotProductTuner, forceMax, updater::iterations, updater::Ndof, NSinceNegativePower, updater::nTotal, Power, setAlphaDec(), setAlphaStart(), setDeltaT(), setDeltaTDec(), setDeltaTInc(), setDeltaTMax(), setForceCutoff(), updater::setGPU(), updater::setMaximumIterations(), setNMin(), and updater::updaterData.
Referenced by energyMinimizerFIRE().
|
virtual |
Set a bunch of default initialization parameters (if the State is available to determine the size of vectors)
Initialize the minimizer with some default parameters.
Reimplemented from equationOfMotion.
References equationOfMotion::displacement, updater::model, updater::Ndof, updater::neverGPU, GPUArray< T >::noGPU, GPUArray< T >::resize(), sumReductionIntermediate, sumReductionIntermediate2, and sumReductions.
Referenced by energyMinimizerFIRE(), and minimize().
void energyMinimizerFIRE::setFIREParameters | ( | scalar | deltaT, |
scalar | alphaStart, | ||
scalar | deltaTMax, | ||
scalar | deltaTInc, | ||
scalar | deltaTDec, | ||
scalar | alphaDec, | ||
int | nMin, | ||
scalar | forceCutoff, | ||
scalar | _alphaMin = 0.75 |
||
) |
Set a lot of parameters!
References alphaDec, alphaMin, alphaStart, updater::deltaT, deltaTDec, deltaTInc, deltaTMax, forceCutoff, setAlphaDec(), setAlphaStart(), setDeltaT(), setDeltaTDec(), setDeltaTInc(), setDeltaTMax(), setForceCutoff(), and setNMin().
|
inline |
Set the force cutoff.
References forceCutoff.
Referenced by initializeParameters(), and setFIREParameters().
|
inlinevirtual |
set the initial value of deltaT
Reimplemented from updater.
References updater::deltaT, and deltaTMin.
Referenced by initializeParameters(), and setFIREParameters().
|
inline |
set the initial value of alpha and alphaStart
References alpha, and alphaStart.
Referenced by initializeParameters(), and setFIREParameters().
|
inline |
Set the maximum deltaT.
References deltaTMax.
Referenced by initializeParameters(), and setFIREParameters().
|
inline |
Set the fraction by which delta increments.
References deltaTInc.
Referenced by initializeParameters(), and setFIREParameters().
|
inline |
Set the fraction by which delta decrements.
References deltaTDec.
Referenced by initializeParameters(), and setFIREParameters().
|
inline |
Set the fraction by which alpha decrements.
References alphaDec.
Referenced by initializeParameters(), and setFIREParameters().
|
inline |
Set the number of consecutive steps P must be non-negative before increasing delatT.
References NMin.
Referenced by initializeParameters(), and setFIREParameters().
void energyMinimizerFIRE::fireStep | ( | ) |
an interface to call either the CPU or GPU FIRE algorithm
Call the correct FIRE step routine
References fireStepCPU(), fireStepGPU(), and updater::useGPU.
Referenced by minimize().
void energyMinimizerFIRE::fireStepCPU | ( | ) |
Perform a velocity Verlet step on the CPU.
Perform a FIRE minimization step on the CPU
References alpha, alphaDec, alphaMin, alphaStart, ArrayHandle< T >::data, updater::deltaT, deltaTDec, deltaTInc, deltaTMax, deltaTMin, dot(), forceMax, access_location::host, updater::iterations, make_dVec(), updater::model, updater::Ndof, NMin, NSinceNegativePower, updater::nTotal, Power, access_mode::read, scalar, scaling, updater::sim, and updater::updaterData.
Referenced by fireStep().
void energyMinimizerFIRE::fireStepGPU | ( | ) |
Perform a velocity Verlet step on the GPU.
Perform a FIRE minimization step on the GPU
References alpha, alphaDec, alphaMin, alphaStart, updater::deltaT, deltaTDec, deltaTInc, deltaTMax, deltaTMin, access_location::device, forceMax, gpu_gpuarray_dVec_dot_products(), gpu_set_array(), gpu_update_velocity_FIRE(), updater::iterations, updater::model, updater::Ndof, NMin, NSinceNegativePower, updater::nTotal, access_mode::overwrite, Power, access_mode::read, access_mode::readwrite, scalar, scaling, updater::sim, sumReductionIntermediate, sumReductionIntermediate2, and updater::updaterData.
Referenced by fireStep().
void energyMinimizerFIRE::minimize | ( | ) |
Minimize to either the force tolerance or the maximum number of iterations.
Perform a FIRE minimization step on the CPU...attempts to get attain: (1/N)\sum_i|f_i|^2 < forceCutoff
References alpha, updater::deltaT, fireStep(), forceCutoff, forceMax, initializeFromModel(), equationOfMotion::integrateEquationOfMotion(), updater::iterations, updater::model, updater::Ndof, Power, scaling, and updater::sim.
Referenced by performUpdate().
|
inlinevirtual |
The "intergate equatios of motion just calls minimize.
Reimplemented from equationOfMotion.
References minimize().
|
inlinevirtual |
|
inlinevirtual |
Reimplemented from equationOfMotion.
References equationOfMotion::getClassSize(), GPUArray< T >::getNumElements(), scalar, sumReductionIntermediate, sumReductionIntermediate2, and sumReductions.
|
virtualinherited |
Reimplemented from equationOfMotion.
References ArrayHandle< T >::data, updater::deltaT, access_location::device, equationOfMotion::displacement, gpu_displacement_velocity_verlet(), gpu_update_velocity(), updater::model, updater::Ndof, access_mode::overwrite, access_mode::read, access_mode::readwrite, and updater::sim.
|
virtualinherited |
Reimplemented from equationOfMotion.
References ArrayHandle< T >::data, updater::deltaT, equationOfMotion::displacement, updater::model, updater::Ndof, and updater::sim.
|
inlinevirtualinherited |
|
inlinevirtualinherited |
The fundamental function that a controlling Simulation can call.
References updater::performUpdate(), updater::Period, and updater::Phase.
|
inlineinherited |
set the simulation
References updater::sim.
|
inlinevirtualinherited |
virtual function to allow the model to be a derived class
References updater::initializeFromModel(), and updater::model.
Referenced by energyMinimizerFIRE(), energyMinimizerGradientDescent::energyMinimizerGradientDescent(), energyMinimizerLoLBFGS::energyMinimizerLoLBFGS(), and energyMinimizerNesterovAG::energyMinimizerNesterovAG().
|
inlineinherited |
set the period
References updater::Period.
|
inlineinherited |
set the phase
References updater::Phase.
|
inlinevirtualinherited |
allow for spatial sorting to be called if necessary...
|
inlinevirtualinherited |
Allow for a reproducibility call to be made.
References updater::reproducible.
|
inlinevirtualinherited |
Enforce GPU operation.
References updater::useGPU.
Referenced by energyMinimizerNesterovAG::initializeParameters(), energyMinimizerLoLBFGS::initializeParameters(), energyMinimizerGradientDescent::initializeParameters(), and initializeParameters().
|
inlineinherited |
Get the number of degrees of freedom of the equation of motion.
References updater::Ndof.
|
inlineinherited |
Set the number of degrees of freedom of the equation of motion.
References updater::Ndof.
|
inlinevirtualinherited |
allow for setting multiple threads
References n, and updater::nThreads.
|
inlineinherited |
Set the maximum number of iterations before terminating (or set to -1 to ignore)
References updater::maxIterations.
Referenced by energyMinimizerNesterovAG::initializeParameters(), energyMinimizerLoLBFGS::initializeParameters(), energyMinimizerGradientDescent::initializeParameters(), and initializeParameters().
|
inlineinherited |
References updater::iterations.
|
inlineinherited |
References updater::maxIterations.
|
inlineinherited |
References updater::iterations.
|
inherited |
communicate the number of non-object sites across ranks
References access_location::host, updater::model, updater::Ndof, updater::nTotal, access_mode::read, updater::sim, and updater::updaterData.
|
protected |
sqrt(force.force) / N_{dof}
Referenced by fireStepCPU(), fireStepGPU(), getMaxForce(), initializeParameters(), and minimize().
|
protected |
The cutoff value of the maximum force.
Referenced by minimize(), setFIREParameters(), and setForceCutoff().
|
protected |
The numer of consecutive time steps the power must be positive before increasing deltaT.
Referenced by fireStepCPU(), fireStepGPU(), and setNMin().
|
protected |
The numer of consecutive time since the power has be negative.
Referenced by fireStepCPU(), fireStepGPU(), and initializeParameters().
|
protected |
The minimum time step size.
Referenced by fireStepCPU(), fireStepGPU(), and setDeltaT().
|
protected |
The maximum time step size.
Referenced by fireStepCPU(), fireStepGPU(), setDeltaTMax(), and setFIREParameters().
|
protected |
The fraction by which deltaT can get bigger.
Referenced by fireStepCPU(), fireStepGPU(), setDeltaTInc(), and setFIREParameters().
|
protected |
The fraction by which deltaT can get smaller.
Referenced by fireStepCPU(), fireStepGPU(), setDeltaTDec(), and setFIREParameters().
|
protected |
The internal value of the "power".
Referenced by fireStepCPU(), fireStepGPU(), initializeParameters(), and minimize().
|
protected |
The alpha parameter of the minimization routine.
Referenced by fireStepCPU(), fireStepGPU(), minimize(), and setAlphaStart().
|
protected |
The initial value of the alpha parameter.
Referenced by fireStepCPU(), fireStepGPU(), setAlphaStart(), and setFIREParameters().
|
protected |
The fraction by which alpha can decrease.
Referenced by fireStepCPU(), fireStepGPU(), setAlphaDec(), and setFIREParameters().
|
protected |
The smallest value of alpha.
Referenced by fireStepCPU(), fireStepGPU(), initializeParameters(), and setFIREParameters().
|
protected |
a multiplicative factor
Referenced by fireStepCPU(), fireStepGPU(), and minimize().
Utility array for simple reductions.
Referenced by fireStepGPU(), getClassSize(), and initializeFromModel().
Referenced by fireStepGPU(), getClassSize(), and initializeFromModel().
Utility array for simple reductions.
Referenced by getClassSize(), and initializeFromModel().
|
protected |
kernel tuner for performance
Referenced by initializeParameters().
|
inherited |
an array of displacements
Referenced by energyMinimizerAdam::adamStepCPU(), energyMinimizerAdam::adamStepGPU(), equationOfMotion::getClassSize(), energyMinimizerAdam::initializeFromModel(), equationOfMotion::initializeFromModel(), energyMinimizerGradientDescent::initializeFromModel(), initializeFromModel(), velocityVerlet::integrateEOMCPU(), and velocityVerlet::integrateEOMGPU().
|
inherited |
A pointer to the governing simulation.
Referenced by energyMinimizerAdam::adamStepCPU(), energyMinimizerAdam::adamStepGPU(), fireStepCPU(), fireStepGPU(), updater::getNTotal(), energyMinimizerGradientDescent::gradientDescentCPU(), energyMinimizerGradientDescent::gradientDescentGPU(), velocityVerlet::integrateEOMCPU(), velocityVerlet::integrateEOMGPU(), energyMinimizerLoLBFGS::lineSearchCPU(), energyMinimizerLoLBFGS::LoLBFGSStepCPU(), energyMinimizerLoLBFGS::LoLBFGSStepGPU(), energyMinimizerAdam::minimize(), energyMinimizerNesterovAG::minimize(), energyMinimizerGradientDescent::minimize(), minimize(), energyMinimizerNesterovAG::nesterovStepCPU(), energyMinimizerNesterovAG::nesterovStepGPU(), updater::performUpdate(), and updater::setSimulation().
|
inherited |
A pointer to a simpleModel that the updater acts on.
Referenced by energyMinimizerAdam::adamStepCPU(), energyMinimizerAdam::adamStepGPU(), fireStepCPU(), fireStepGPU(), updater::getNTotal(), energyMinimizerGradientDescent::gradientDescentCPU(), energyMinimizerGradientDescent::gradientDescentGPU(), energyMinimizerAdam::initializeFromModel(), energyMinimizerNesterovAG::initializeFromModel(), energyMinimizerLoLBFGS::initializeFromModel(), equationOfMotion::initializeFromModel(), energyMinimizerGradientDescent::initializeFromModel(), initializeFromModel(), updater::initializeFromModel(), velocityVerlet::integrateEOMCPU(), velocityVerlet::integrateEOMGPU(), equationOfMotion::integrateEquationOfMotion(), energyMinimizerLoLBFGS::lineSearchCPU(), energyMinimizerLoLBFGS::LoLBFGSStepCPU(), energyMinimizerLoLBFGS::LoLBFGSStepGPU(), energyMinimizerAdam::minimize(), energyMinimizerNesterovAG::minimize(), energyMinimizerLoLBFGS::minimize(), energyMinimizerGradientDescent::minimize(), minimize(), energyMinimizerNesterovAG::nesterovStepCPU(), energyMinimizerNesterovAG::nesterovStepGPU(), and updater::setModel().
|
inherited |
|
inherited |
The number of iterations performed.
Referenced by fireStepCPU(), fireStepGPU(), updater::getCurrentIterations(), energyMinimizerAdam::initializeFromModel(), energyMinimizerNesterovAG::initializeParameters(), energyMinimizerLoLBFGS::initializeParameters(), energyMinimizerGradientDescent::initializeParameters(), initializeParameters(), energyMinimizerLoLBFGS::LoLBFGSStepCPU(), energyMinimizerLoLBFGS::LoLBFGSStepGPU(), energyMinimizerAdam::minimize(), energyMinimizerNesterovAG::minimize(), energyMinimizerLoLBFGS::minimize(), energyMinimizerGradientDescent::minimize(), minimize(), and updater::setCurrentIterations().
|
protectedinherited |
number of threads to use
Referenced by updater::setNThreads().
|
protectedinherited |
The period of the updater... the updater will work every Period timesteps.
Referenced by updater::setPeriod(), updater::Update(), and updater::updater().
|
protectedinherited |
The phase of the updater... the updater will work every Period timesteps offset by a phase.
Referenced by updater::setPhase(), updater::Update(), and updater::updater().
|
protectedinherited |
whether the updater does its work on the GPU or not
Referenced by fireStep(), energyMinimizerGradientDescent::gradientDescentStep(), equationOfMotion::integrateEquationOfMotion(), energyMinimizerAdam::minimize(), energyMinimizerNesterovAG::minimize(), energyMinimizerLoLBFGS::minimize(), updater::setGPU(), and updater::updater().
|
protectedinherited |
whether the updater never does work on the GPU
Referenced by equationOfMotion::initializeFromModel(), energyMinimizerGradientDescent::initializeFromModel(), and initializeFromModel().
|
protectedinherited |
some measure of the number of degrees of freedom the equations of motion might need to know about locally
Referenced by energyMinimizerAdam::adamStepCPU(), energyMinimizerAdam::adamStepGPU(), fireStepCPU(), fireStepGPU(), updater::getNdof(), updater::getNTotal(), energyMinimizerGradientDescent::gradientDescentCPU(), energyMinimizerGradientDescent::gradientDescentGPU(), energyMinimizerAdam::initializeFromModel(), energyMinimizerNesterovAG::initializeFromModel(), energyMinimizerLoLBFGS::initializeFromModel(), equationOfMotion::initializeFromModel(), energyMinimizerGradientDescent::initializeFromModel(), initializeFromModel(), updater::initializeFromModel(), initializeParameters(), velocityVerlet::integrateEOMCPU(), velocityVerlet::integrateEOMGPU(), equationOfMotion::integrateEquationOfMotion(), energyMinimizerLoLBFGS::lineSearchCPU(), energyMinimizerLoLBFGS::LoLBFGSStepCPU(), energyMinimizerLoLBFGS::LoLBFGSStepGPU(), energyMinimizerAdam::minimize(), energyMinimizerNesterovAG::minimize(), energyMinimizerLoLBFGS::minimize(), energyMinimizerGradientDescent::minimize(), minimize(), energyMinimizerNesterovAG::nesterovStepCPU(), energyMinimizerNesterovAG::nesterovStepGPU(), and updater::setNdof().
|
protectedinherited |
the total number of non-object sites across all ranks
Referenced by fireStepCPU(), fireStepGPU(), updater::getNTotal(), energyMinimizerGradientDescent::gradientDescentCPU(), energyMinimizerGradientDescent::gradientDescentGPU(), and initializeParameters().
|
protectedinherited |
whether the RNGs give reproducible results
Referenced by updater::setReproducible(), and updater::updater().
|
protectedinherited |
The internal time step size.
Referenced by energyMinimizerAdam::adamStepCPU(), energyMinimizerAdam::adamStepGPU(), fireStepCPU(), fireStepGPU(), energyMinimizerGradientDescent::gradientDescentCPU(), energyMinimizerGradientDescent::gradientDescentGPU(), velocityVerlet::integrateEOMCPU(), velocityVerlet::integrateEOMGPU(), energyMinimizerLoLBFGS::minimize(), minimize(), energyMinimizerNesterovAG::nesterovStepCPU(), energyMinimizerNesterovAG::nesterovStepGPU(), energyMinimizerAdam::setAdamParameters(), setDeltaT(), updater::setDeltaT(), setFIREParameters(), energyMinimizerGradientDescent::setGradientDescentParameters(), energyMinimizerLoLBFGS::setLoLBFGSParameters(), and energyMinimizerNesterovAG::setNesterovAGParameters().
|
protectedinherited |
The maximum number of iterations allowed.
Referenced by updater::getMaxIterations(), energyMinimizerAdam::minimize(), energyMinimizerNesterovAG::minimize(), energyMinimizerLoLBFGS::minimize(), and updater::setMaximumIterations().