DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
dftfe::nudgedElasticBandClass Class Reference

#include <nudgedElasticBandClass.h>

Inheritance diagram for dftfe::nudgedElasticBandClass:
dftfe::nonlinearSolverProblem

Public Member Functions

 nudgedElasticBandClass (const std::string parameter_file, const std::string restartFilesPath, const MPI_Comm &mpi_comm_parent, const bool restart, const int verbosity, const bool useDevice, const int d_numberOfImages, const bool imageFreeze, double Kmax, double Kmin, const double pathThreshold, const int maximumNEBIteration, const unsigned int _maxLineSearchIterCGPRP, const unsigned int _lbfgsNumPastSteps, const std::string &_bfgsStepMethod, const double optimizermaxIonUpdateStep, const std::string &optimizationSolver, const std::string &coordinatesFileNEB, const std::string &domainVectorsFileNEB, const std::string &ionRelaxFlagsFile)
 First, sets the nebRestart path. Second, creates Step0 folder with coordinaes and domainVectors file. Third, creates the array of pointers of dftClass for each image. If in restart mode, calls function to read coordinates and initialise parameters Sets solvermode: CGPT, LBFGS, BFGS.
 
int findMEP ()
 Calls optimizer(nonLinearClass) solve. Prints the Final NEB energies and forces. References: 1. https://pubs.aip.org/aip/jcp/article/113/22/9978/184858/Improved-tangent-estimate-in-the-nudged-elastic 2. https://pubs.aip.org/aip/jcp/article/128/13/134106/977389/Optimization-methods-for-finding-minimum-energy.
 
void ReturnNormedVector (std::vector< double > &, int)
 Returns the Normed vetor satistfying ||v||_2 = 1.
 
void LNorm (double &, std::vector< double >, int, int)
 Calculates the L-norm of a vector.
 
void gradient (std::vector< double > &gradient)
 Identifies the images to freeze, calculates gradient. First prints the Image No., free energy and force error of each image Prints activation energy of current step.
 
unsigned int getNumberUnknowns () const
 Returns the total DoFs of the optimizer problem.
 
void update (const std::vector< double > &solution, const bool computeForces=true, const bool useSingleAtomSolutionsInitialGuess=false)
 Updates the positions of atoms and the total step count. Calls dftPtr colve to compute eenergy and force for current step.
 
void save ()
 Saves the output files for restart.
 
void init ()
 initializes the data member d_relaxationFlags, nonlinearSolver,
 
void value (std::vector< double > &functionValue)
 Not working. Finds the saddle point energy.
 
void precondition (std::vector< double > &s, const std::vector< double > &gradient)
 not implemented
 
void solution (std::vector< double > &solution)
 not implemented
 
std::vector< unsigned int > getUnknownCountFlag () const
 not implemented
 
- Public Member Functions inherited from dftfe::nonlinearSolverProblem
 nonlinearSolverProblem ()
 Constructor.
 
virtual ~nonlinearSolverProblem ()=0
 Destructor.
 

Public Attributes

double d_kmax = 0.1
 
double d_kmin = 0.1
 
int d_NEBImageno
 

Private Member Functions

const MPI_Comm & getMPICommunicator ()
 get MPI communicator.
 
void CalculatePathTangent (int, std::vector< double > &)
 Calculate the tangent between each image.
 
void CalculateForceparallel (int, std::vector< double > &, const std::vector< double > &)
 Calculates the force on atom along the tangent between images.
 
void CalculateForceperpendicular (int, std::vector< double > &, const std::vector< double > &, const std::vector< double > &)
 Calculates force perpendicular to the tangent.
 
void CalculateSpringForce (int, std::vector< double > &, std::vector< double >)
 Calculates the force due to the spring.
 
void CalculateForceonImage (const std::vector< double > &, const std::vector< double > &, std::vector< double > &)
 Calculates F_NEB = G_per+ F_spring.
 
double CalculatePathLength (bool flag) const
 Calculate path length: max diaplacement of atoms.
 
void WriteRestartFiles (int step)
 Write Restart files.
 
void CalculateSpringConstant (int, double &)
 Find spring constant based on k_max and k_min.
 
void ImageError (int image, double &Force)
 Calculate F_per norm.
 
void set ()
 set() initalises all the private datamembers of nudgedElasticBandClass object from the parameters declared by user.
 
bool isConverged () const
 check for convergence.
 
int checkRestart (bool &periodic)
 Check the restart files.
 

Private Attributes

std::vector< std::unique_ptr< dftfeWrapper > > d_dftfeWrapper
 
dftBased_dftPtr
 
std::unique_ptr< nonLinearSolverd_nonLinearSolverPtr
 
const MPI_Comm d_mpiCommParent
 
const unsigned int d_this_mpi_process
 
dealii::ConditionalOStream pcout
 
int d_verbosity
 
std::string d_restartFilesPath
 
std::string d_solverRestartPath
 
bool d_imageFreeze
 
int d_totalUpdateCalls
 total number of calls to update()
 
int d_startStep
 
int d_solver
 
bool d_isRestart
 
bool d_solverRestart
 
unsigned int d_restartFlag
 
unsigned int d_numberGlobalCharges
 
double d_maximumAtomForceToBeRelaxed
 
unsigned int d_numberOfImages
 
unsigned int d_countrelaxationFlags
 
unsigned int d_maximumNEBIteration
 
double d_optimizertolerance
 
unsigned int maxLineSearchIterCGPRP
 
std::string bfgsStepMethod
 
double d_optimizermaxIonUpdateStep
 
unsigned int lbfgsNumPastSteps
 
std::string d_optimizationSolver
 
std::string d_ionRelaxFlagsFile
 
std::map< int, std::vector< std::vector< double > > > d_atomLocationsInitial
 
std::vector< unsigned int > d_relaxationFlags
 
std::vector< double > d_externalForceOnAtom
 
std::vector< double > d_ImageError
 
std::vector< double > d_Length
 
std::string d_coordinatesFileNEB
 
std::string d_domainVectorsFileNEB
 

Constructor & Destructor Documentation

◆ nudgedElasticBandClass()

dftfe::nudgedElasticBandClass::nudgedElasticBandClass ( const std::string parameter_file,
const std::string restartFilesPath,
const MPI_Comm & mpi_comm_parent,
const bool restart,
const int verbosity,
const bool useDevice,
const int d_numberOfImages,
const bool imageFreeze,
double Kmax,
double Kmin,
const double pathThreshold,
const int maximumNEBIteration,
const unsigned int _maxLineSearchIterCGPRP,
const unsigned int _lbfgsNumPastSteps,
const std::string & _bfgsStepMethod,
const double optimizermaxIonUpdateStep,
const std::string & optimizationSolver,
const std::string & coordinatesFileNEB,
const std::string & domainVectorsFileNEB,
const std::string & ionRelaxFlagsFile )

First, sets the nebRestart path. Second, creates Step0 folder with coordinaes and domainVectors file. Third, creates the array of pointers of dftClass for each image. If in restart mode, calls function to read coordinates and initialise parameters Sets solvermode: CGPT, LBFGS, BFGS.

Member Function Documentation

◆ CalculateForceonImage()

void dftfe::nudgedElasticBandClass::CalculateForceonImage ( const std::vector< double > & ,
const std::vector< double > & ,
std::vector< double > &  )
private

Calculates F_NEB = G_per+ F_spring.

◆ CalculateForceparallel()

void dftfe::nudgedElasticBandClass::CalculateForceparallel ( int ,
std::vector< double > & ,
const std::vector< double > &  )
private

Calculates the force on atom along the tangent between images.

◆ CalculateForceperpendicular()

void dftfe::nudgedElasticBandClass::CalculateForceperpendicular ( int ,
std::vector< double > & ,
const std::vector< double > & ,
const std::vector< double > &  )
private

Calculates force perpendicular to the tangent.

◆ CalculatePathLength()

double dftfe::nudgedElasticBandClass::CalculatePathLength ( bool flag) const
private

Calculate path length: max diaplacement of atoms.

◆ CalculatePathTangent()

void dftfe::nudgedElasticBandClass::CalculatePathTangent ( int ,
std::vector< double > &  )
private

Calculate the tangent between each image.

◆ CalculateSpringConstant()

void dftfe::nudgedElasticBandClass::CalculateSpringConstant ( int ,
double &  )
private

Find spring constant based on k_max and k_min.

◆ CalculateSpringForce()

void dftfe::nudgedElasticBandClass::CalculateSpringForce ( int ,
std::vector< double > & ,
std::vector< double >  )
private

Calculates the force due to the spring.

◆ checkRestart()

int dftfe::nudgedElasticBandClass::checkRestart ( bool & periodic)
private

Check the restart files.

◆ findMEP()

int dftfe::nudgedElasticBandClass::findMEP ( )

◆ getMPICommunicator()

const MPI_Comm & dftfe::nudgedElasticBandClass::getMPICommunicator ( )
privatevirtual

get MPI communicator.

Implements dftfe::nonlinearSolverProblem.

◆ getNumberUnknowns()

unsigned int dftfe::nudgedElasticBandClass::getNumberUnknowns ( ) const
virtual

Returns the total DoFs of the optimizer problem.

Implements dftfe::nonlinearSolverProblem.

◆ getUnknownCountFlag()

std::vector< unsigned int > dftfe::nudgedElasticBandClass::getUnknownCountFlag ( ) const
virtual

not implemented

Implements dftfe::nonlinearSolverProblem.

◆ gradient()

void dftfe::nudgedElasticBandClass::gradient ( std::vector< double > & gradient)
virtual

Identifies the images to freeze, calculates gradient. First prints the Image No., free energy and force error of each image Prints activation energy of current step.

Implements dftfe::nonlinearSolverProblem.

◆ ImageError()

void dftfe::nudgedElasticBandClass::ImageError ( int image,
double & Force )
private

Calculate F_per norm.

◆ init()

void dftfe::nudgedElasticBandClass::init ( )

initializes the data member d_relaxationFlags, nonlinearSolver,

◆ isConverged()

bool dftfe::nudgedElasticBandClass::isConverged ( ) const
privatevirtual

check for convergence.

Implements dftfe::nonlinearSolverProblem.

◆ LNorm()

void dftfe::nudgedElasticBandClass::LNorm ( double & ,
std::vector< double > ,
int ,
int  )

Calculates the L-norm of a vector.

◆ precondition()

void dftfe::nudgedElasticBandClass::precondition ( std::vector< double > & s,
const std::vector< double > & gradient )
virtual

not implemented

Implements dftfe::nonlinearSolverProblem.

◆ ReturnNormedVector()

void dftfe::nudgedElasticBandClass::ReturnNormedVector ( std::vector< double > & ,
int  )

Returns the Normed vetor satistfying ||v||_2 = 1.

◆ save()

void dftfe::nudgedElasticBandClass::save ( )
virtual

Saves the output files for restart.

Implements dftfe::nonlinearSolverProblem.

◆ set()

void dftfe::nudgedElasticBandClass::set ( )
private

set() initalises all the private datamembers of nudgedElasticBandClass object from the parameters declared by user.

◆ solution()

void dftfe::nudgedElasticBandClass::solution ( std::vector< double > & solution)
virtual

not implemented

Implements dftfe::nonlinearSolverProblem.

◆ update()

void dftfe::nudgedElasticBandClass::update ( const std::vector< double > & solution,
const bool computeForces = true,
const bool useSingleAtomSolutionsInitialGuess = false )
virtual

Updates the positions of atoms and the total step count. Calls dftPtr colve to compute eenergy and force for current step.

Implements dftfe::nonlinearSolverProblem.

◆ value()

void dftfe::nudgedElasticBandClass::value ( std::vector< double > & functionValue)
virtual

Not working. Finds the saddle point energy.

Implements dftfe::nonlinearSolverProblem.

◆ WriteRestartFiles()

void dftfe::nudgedElasticBandClass::WriteRestartFiles ( int step)
private

Write Restart files.

Member Data Documentation

◆ bfgsStepMethod

std::string dftfe::nudgedElasticBandClass::bfgsStepMethod
private

◆ d_atomLocationsInitial

std::map<int, std::vector<std::vector<double> > > dftfe::nudgedElasticBandClass::d_atomLocationsInitial
private

◆ d_coordinatesFileNEB

std::string dftfe::nudgedElasticBandClass::d_coordinatesFileNEB
private

◆ d_countrelaxationFlags

unsigned int dftfe::nudgedElasticBandClass::d_countrelaxationFlags
private

◆ d_dftfeWrapper

std::vector<std::unique_ptr<dftfeWrapper> > dftfe::nudgedElasticBandClass::d_dftfeWrapper
private

◆ d_dftPtr

dftBase* dftfe::nudgedElasticBandClass::d_dftPtr
private

◆ d_domainVectorsFileNEB

std::string dftfe::nudgedElasticBandClass::d_domainVectorsFileNEB
private

◆ d_externalForceOnAtom

std::vector<double> dftfe::nudgedElasticBandClass::d_externalForceOnAtom
private

◆ d_ImageError

std::vector<double> dftfe::nudgedElasticBandClass::d_ImageError
private

◆ d_imageFreeze

bool dftfe::nudgedElasticBandClass::d_imageFreeze
private

◆ d_ionRelaxFlagsFile

std::string dftfe::nudgedElasticBandClass::d_ionRelaxFlagsFile
private

◆ d_isRestart

bool dftfe::nudgedElasticBandClass::d_isRestart
private

◆ d_kmax

double dftfe::nudgedElasticBandClass::d_kmax = 0.1

◆ d_kmin

double dftfe::nudgedElasticBandClass::d_kmin = 0.1

◆ d_Length

std::vector<double> dftfe::nudgedElasticBandClass::d_Length
private

◆ d_maximumAtomForceToBeRelaxed

double dftfe::nudgedElasticBandClass::d_maximumAtomForceToBeRelaxed
private

◆ d_maximumNEBIteration

unsigned int dftfe::nudgedElasticBandClass::d_maximumNEBIteration
private

◆ d_mpiCommParent

const MPI_Comm dftfe::nudgedElasticBandClass::d_mpiCommParent
private

◆ d_NEBImageno

int dftfe::nudgedElasticBandClass::d_NEBImageno

◆ d_nonLinearSolverPtr

std::unique_ptr<nonLinearSolver> dftfe::nudgedElasticBandClass::d_nonLinearSolverPtr
private

◆ d_numberGlobalCharges

unsigned int dftfe::nudgedElasticBandClass::d_numberGlobalCharges
private

◆ d_numberOfImages

unsigned int dftfe::nudgedElasticBandClass::d_numberOfImages
private

◆ d_optimizationSolver

std::string dftfe::nudgedElasticBandClass::d_optimizationSolver
private

◆ d_optimizermaxIonUpdateStep

double dftfe::nudgedElasticBandClass::d_optimizermaxIonUpdateStep
private

◆ d_optimizertolerance

double dftfe::nudgedElasticBandClass::d_optimizertolerance
private

◆ d_relaxationFlags

std::vector<unsigned int> dftfe::nudgedElasticBandClass::d_relaxationFlags
private

◆ d_restartFilesPath

std::string dftfe::nudgedElasticBandClass::d_restartFilesPath
private

◆ d_restartFlag

unsigned int dftfe::nudgedElasticBandClass::d_restartFlag
private

◆ d_solver

int dftfe::nudgedElasticBandClass::d_solver
private

◆ d_solverRestart

bool dftfe::nudgedElasticBandClass::d_solverRestart
private

◆ d_solverRestartPath

std::string dftfe::nudgedElasticBandClass::d_solverRestartPath
private

◆ d_startStep

int dftfe::nudgedElasticBandClass::d_startStep
private

◆ d_this_mpi_process

const unsigned int dftfe::nudgedElasticBandClass::d_this_mpi_process
private

◆ d_totalUpdateCalls

int dftfe::nudgedElasticBandClass::d_totalUpdateCalls
private

total number of calls to update()

◆ d_verbosity

int dftfe::nudgedElasticBandClass::d_verbosity
private

◆ lbfgsNumPastSteps

unsigned int dftfe::nudgedElasticBandClass::lbfgsNumPastSteps
private

◆ maxLineSearchIterCGPRP

unsigned int dftfe::nudgedElasticBandClass::maxLineSearchIterCGPRP
private

◆ pcout

dealii::ConditionalOStream dftfe::nudgedElasticBandClass::pcout
private

The documentation for this class was generated from the following file: