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

Contains repeatedly used functions in the KSDFT calculations. More...

Classes

class  CompositeData
 
class  constraintMatrixInfo
 Overloads dealii's distribute and distribute_local_to_global functions associated with constraints class. Stores the dealii's constraint matrix data into STL vectors for faster memory access costs. More...
 
class  MPIWriteOnFile
 
class  NodalData
 
class  Pool
 
class  QuadDataCompositeWrite
 

Functions

template<typename ValueType>
void distributeDevice (const unsigned int contiguousBlockSize, ValueType *xVec, const unsigned int *constraintLocalRowIdsUnflattened, const unsigned int numConstraints, const unsigned int *constraintRowSizes, const unsigned int *constraintRowSizesAccumulated, const unsigned int *constraintLocalColumnIdsAllRowsUnflattened, const double *constraintColumnValuesAllRowsUnflattened, const double *inhomogenities)
 
template<typename ValueType>
void distributeSlaveToMasterAtomicAddDevice (const unsigned int contiguousBlockSize, ValueType *xVec, const unsigned int *constraintLocalRowIdsUnflattened, const unsigned int numConstraints, const unsigned int *constraintRowSizes, const unsigned int *constraintRowSizesAccumulated, const unsigned int *constraintLocalColumnIdsAllRowsUnflattened, const double *constraintColumnValuesAllRowsUnflattened)
 
template<typename ValueType>
void setzeroDevice (const unsigned int contiguousBlockSize, ValueType *xVec, const unsigned int *constraintLocalRowIdsUnflattened, const unsigned int numConstraints)
 
void scaleConstraintsDevice (const double *xVec, const unsigned int *constraintLocalRowIdsUnflattened, const unsigned int numConstraints, const unsigned int *constraintRowSizes, const unsigned int *constraintRowSizesAccumulated, const unsigned int *constraintLocalColumnIdsAllRowsUnflattened, double *constraintColumnValuesAllRowsUnflattened)
 
void dgesv_ (int *N, int *NRHS, double *A, int *LDA, int *IPIV, double *B, int *LDB, int *INFO)
 
double smearedCharge (double r, double rc)
 
double smearedChargeDr (double r, double rc)
 
double smearedPot (double r, double rc)
 
double smearedPotDr (double r, double rc)
 
std::vector< double > getFractionalCoordinates (const std::vector< double > &latticeVectorsFlattened, const std::vector< double > &coordWithRespectToCellCorner)
 
double getCompositeGeneratorVal (const double rc, const double r, const double a0, const double power)
 Calculates value of composite generator.
 
dealii::BoundingBox< 3 > createBoundingBoxForSphere (const dealii::Point< 3 > &center, const double sphereRadius)
 Create bounding box around a sphere.
 
double getPartialOccupancy (const double eigenValue, const double fermiEnergy, const double kb, const double T)
 Calculates partial occupancy of the atomic orbital using Fermi-Dirac smearing.
 
double getPartialOccupancyDer (const double eigenValue, const double fermiEnergy, const double kb, const double T)
 Calculates the derivative of the partial occupancy of the atomic orbital with respect to (x=eigenvalue-fermiEnergy) using Fermi-Dirac smearing.
 
void cross_product (const std::vector< double > &a, const std::vector< double > &b, std::vector< double > &crossProductVector)
 Calculates cross product of two vectors.
 
void transformDomainBoundingVectors (std::vector< std::vector< double > > &domainBoundingVectors, const dealii::Tensor< 2, 3, double > &deformationGradient)
 Applies an affine transformation to the domain bounding vectors.
 
void writeDataVTUParallelLowestPoolId (const dealii::DoFHandler< 3 > &dofHandler, const dealii::DataOut< 3 > &dataOut, const MPI_Comm &mpiCommParent, const MPI_Comm &mpiCommDomain, const MPI_Comm &interpoolcomm, const MPI_Comm &interBandGroupComm, const std::string &folderName, const std::string &fileName)
 Writes to vtu file only from the lowest pool id.
 
void createBandParallelizationIndices (const MPI_Comm &interBandGroupComm, const unsigned int numBands, std::vector< unsigned int > &bandGroupLowHighPlusOneIndices)
 Create index vector which is used for band parallelization.
 
void createKpointParallelizationIndices (const MPI_Comm &interKptPoolComm, const int numberIndices, std::vector< int > &kptGroupLowHighPlusOneIndices)
 
void printCurrentMemoryUsage (const MPI_Comm &mpiComm, const std::string message)
 Wrapper to print current memory usage (prints only the maximum across mpiComm) using PetscMemoryGetCurrentUsage.
 
 DeclExceptionMsg (ExcNotImplementedYet, "This functionality is not implemented yet or not needed to be implemented.")
 Exception handler for not implemented functionality.
 
 DeclExceptionMsg (ExcInternalError, "DFT-FE internal error.")
 Exception handler for DFT-FE internal error.
 
void readFile (const unsigned int numColumns, std::vector< std::vector< double > > &data, const std::string &fileName)
 Read from file containing only double data in columns.
 
void readFile (std::vector< std::vector< double > > &data, const std::string &fileName)
 Read from file containing only double data in columns.
 
int readPsiFile (const unsigned int numColumns, std::vector< std::vector< double > > &data, const std::string &fileName)
 Read from file containing only double data in columns.
 
void writeDataIntoFile (const std::vector< std::vector< double > > &data, const std::string &fileName, const MPI_Comm &mpi_comm_parent)
 Write data into file containing only double data in rows and columns.
 
void writeDataIntoFile (const std::vector< std::vector< double > > &data, const std::string &fileName)
 Write data into file containing only double data in rows and columns.
 
void readRelaxationFlagsFile (const unsigned int numColumns, std::vector< std::vector< int > > &data, std::vector< std::vector< double > > &forceData, const std::string &fileName)
 Read from file containing only integer data in columns.
 
void moveFile (const std::string &old_name, const std::string &new_name)
 Move/rename checkpoint file.
 
void copyFile (const std::string &pathold, const std::string &pathnew)
 copy file.
 
void verifyCheckpointFileExists (const std::string &filename)
 Verify if checkpoint file exists.
 

Detailed Description

Contains repeatedly used functions in the KSDFT calculations.

Author
Sambit Das, Krishnendu Ghosh, Phani Motamarri

Function Documentation

◆ copyFile()

void dftfe::dftUtils::copyFile ( const std::string & pathold,
const std::string & pathnew )

copy file.

◆ createBandParallelizationIndices()

void dftfe::dftUtils::createBandParallelizationIndices ( const MPI_Comm & interBandGroupComm,
const unsigned int numBands,
std::vector< unsigned int > & bandGroupLowHighPlusOneIndices )

Create index vector which is used for band parallelization.

@[in]param interBandGroupComm mpi communicator across band groups @[in]param numBands @[out]param bandGroupLowHighPlusOneIndices

◆ createBoundingBoxForSphere()

dealii::BoundingBox< 3 > dftfe::dftUtils::createBoundingBoxForSphere ( const dealii::Point< 3 > & center,
const double sphereRadius )

Create bounding box around a sphere.

Parameters
spherecenter
sphereradius
Returns
bounding box

◆ createKpointParallelizationIndices()

void dftfe::dftUtils::createKpointParallelizationIndices ( const MPI_Comm & interKptPoolComm,
const int numberIndices,
std::vector< int > & kptGroupLowHighPlusOneIndices )

◆ cross_product()

void dftfe::dftUtils::cross_product ( const std::vector< double > & a,
const std::vector< double > & b,
std::vector< double > & crossProductVector )

Calculates cross product of two vectors.

Parameters
afirst vector
bsecond vector
crossProductVectorcross product of a and b
Returns
void

◆ DeclExceptionMsg() [1/2]

dftfe::dftUtils::DeclExceptionMsg ( ExcInternalError ,
"DFT-FE internal error."  )

Exception handler for DFT-FE internal error.

◆ DeclExceptionMsg() [2/2]

dftfe::dftUtils::DeclExceptionMsg ( ExcNotImplementedYet ,
"This functionality is not implemented yet or not needed to be implemented."  )

Exception handler for not implemented functionality.

◆ dgesv_()

void dftfe::dftUtils::dgesv_ ( int * N,
int * NRHS,
double * A,
int * LDA,
int * IPIV,
double * B,
int * LDB,
int * INFO )

◆ distributeDevice()

template<typename ValueType>
void dftfe::dftUtils::distributeDevice ( const unsigned int contiguousBlockSize,
ValueType * xVec,
const unsigned int * constraintLocalRowIdsUnflattened,
const unsigned int numConstraints,
const unsigned int * constraintRowSizes,
const unsigned int * constraintRowSizesAccumulated,
const unsigned int * constraintLocalColumnIdsAllRowsUnflattened,
const double * constraintColumnValuesAllRowsUnflattened,
const double * inhomogenities )

◆ distributeSlaveToMasterAtomicAddDevice()

template<typename ValueType>
void dftfe::dftUtils::distributeSlaveToMasterAtomicAddDevice ( const unsigned int contiguousBlockSize,
ValueType * xVec,
const unsigned int * constraintLocalRowIdsUnflattened,
const unsigned int numConstraints,
const unsigned int * constraintRowSizes,
const unsigned int * constraintRowSizesAccumulated,
const unsigned int * constraintLocalColumnIdsAllRowsUnflattened,
const double * constraintColumnValuesAllRowsUnflattened )

◆ getCompositeGeneratorVal()

double dftfe::dftUtils::getCompositeGeneratorVal ( const double rc,
const double r,
const double a0,
const double power )

Calculates value of composite generator.

◆ getFractionalCoordinates()

std::vector< double > dftfe::dftUtils::getFractionalCoordinates ( const std::vector< double > & latticeVectorsFlattened,
const std::vector< double > & coordWithRespectToCellCorner )
inline

◆ getPartialOccupancy()

double dftfe::dftUtils::getPartialOccupancy ( const double eigenValue,
const double fermiEnergy,
const double kb,
const double T )

Calculates partial occupancy of the atomic orbital using Fermi-Dirac smearing.

Parameters
eigenValue
fermiEnergy
kbBoltzmann constant
Tsmearing temperature
Returns
double The partial occupancy of the orbital

◆ getPartialOccupancyDer()

double dftfe::dftUtils::getPartialOccupancyDer ( const double eigenValue,
const double fermiEnergy,
const double kb,
const double T )

Calculates the derivative of the partial occupancy of the atomic orbital with respect to (x=eigenvalue-fermiEnergy) using Fermi-Dirac smearing.

Parameters
eigenValue
fermiEnergy
kbBoltzmann constant
Tsmearing temperature
Returns
double The partial occupancy derivative of the orbital

◆ moveFile()

void dftfe::dftUtils::moveFile ( const std::string & old_name,
const std::string & new_name )

Move/rename checkpoint file.

◆ printCurrentMemoryUsage()

void dftfe::dftUtils::printCurrentMemoryUsage ( const MPI_Comm & mpiComm,
const std::string message )

Wrapper to print current memory usage (prints only the maximum across mpiComm) using PetscMemoryGetCurrentUsage.

@[in]param mpiComm mpi communicator across which the memory printing will be synchronized @[in]param message message to be printed alongwith the memory usage

◆ readFile() [1/2]

void dftfe::dftUtils::readFile ( const unsigned int numColumns,
std::vector< std::vector< double > > & data,
const std::string & fileName )

Read from file containing only double data in columns.

Parameters
[in]numColumnsnumber of data columsn in the file to be read
[out]dataoutput double data in [rows][columns] format
[in]fileName

◆ readFile() [2/2]

void dftfe::dftUtils::readFile ( std::vector< std::vector< double > > & data,
const std::string & fileName )

Read from file containing only double data in columns.

Parameters
[out]dataoutput double data in [rows][columns] format
[in]fileName

◆ readPsiFile()

int dftfe::dftUtils::readPsiFile ( const unsigned int numColumns,
std::vector< std::vector< double > > & data,
const std::string & fileName )

Read from file containing only double data in columns.

◆ readRelaxationFlagsFile()

void dftfe::dftUtils::readRelaxationFlagsFile ( const unsigned int numColumns,
std::vector< std::vector< int > > & data,
std::vector< std::vector< double > > & forceData,
const std::string & fileName )

Read from file containing only integer data in columns.

◆ scaleConstraintsDevice()

void dftfe::dftUtils::scaleConstraintsDevice ( const double * xVec,
const unsigned int * constraintLocalRowIdsUnflattened,
const unsigned int numConstraints,
const unsigned int * constraintRowSizes,
const unsigned int * constraintRowSizesAccumulated,
const unsigned int * constraintLocalColumnIdsAllRowsUnflattened,
double * constraintColumnValuesAllRowsUnflattened )

◆ setzeroDevice()

template<typename ValueType>
void dftfe::dftUtils::setzeroDevice ( const unsigned int contiguousBlockSize,
ValueType * xVec,
const unsigned int * constraintLocalRowIdsUnflattened,
const unsigned int numConstraints )

◆ smearedCharge()

double dftfe::dftUtils::smearedCharge ( double r,
double rc )
inline

◆ smearedChargeDr()

double dftfe::dftUtils::smearedChargeDr ( double r,
double rc )
inline

◆ smearedPot()

double dftfe::dftUtils::smearedPot ( double r,
double rc )
inline

◆ smearedPotDr()

double dftfe::dftUtils::smearedPotDr ( double r,
double rc )
inline

◆ transformDomainBoundingVectors()

void dftfe::dftUtils::transformDomainBoundingVectors ( std::vector< std::vector< double > > & domainBoundingVectors,
const dealii::Tensor< 2, 3, double > & deformationGradient )

Applies an affine transformation to the domain bounding vectors.

Parameters
d_domainBoundingVectorsthe bounding vectors of the domain given as a 2d array
deformationGradient
Returns
void.

◆ verifyCheckpointFileExists()

void dftfe::dftUtils::verifyCheckpointFileExists ( const std::string & filename)

Verify if checkpoint file exists.

◆ writeDataIntoFile() [1/2]

void dftfe::dftUtils::writeDataIntoFile ( const std::vector< std::vector< double > > & data,
const std::string & fileName )

Write data into file containing only double data in rows and columns.

Parameters
[in]datainput double data in [rows][columns] format
[in]fileName

◆ writeDataIntoFile() [2/2]

void dftfe::dftUtils::writeDataIntoFile ( const std::vector< std::vector< double > > & data,
const std::string & fileName,
const MPI_Comm & mpi_comm_parent )

Write data into file containing only double data in rows and columns.

Parameters
[in]datainput double data in [rows][columns] format
[in]fileName
[in]mpi_comm_parentparent communicator

◆ writeDataVTUParallelLowestPoolId()

void dftfe::dftUtils::writeDataVTUParallelLowestPoolId ( const dealii::DoFHandler< 3 > & dofHandler,
const dealii::DataOut< 3 > & dataOut,
const MPI_Comm & mpiCommParent,
const MPI_Comm & mpiCommDomain,
const MPI_Comm & interpoolcomm,
const MPI_Comm & interBandGroupComm,
const std::string & folderName,
const std::string & fileName )

Writes to vtu file only from the lowest pool id.

Parameters
dataOutDataOut class object
mpiCommParentparent mpi communicator
mpiCommDomainmpi communicator of domain decomposition inside each pool
interpoolcommmpi communicator across k point pools
interBandGroupCommmpi communicator across band groups
fileName