18#ifndef dftfeWrapper_H_
19#define dftfeWrapper_H_
62 const MPI_Comm &mpi_comm_parent,
63 const bool printParams =
false,
64 const bool setDeviceToMPITaskBindingInternally =
false,
65 const std::string solverMode =
"GS",
66 const std::string restartFilesPath =
".",
68 const bool useDevice =
false);
75 const std::string restartCoordsFile,
76 const std::string restartDomainVectorsFile,
77 const MPI_Comm &mpi_comm_parent,
78 const bool printParams =
false,
79 const bool setDeviceToMPITaskBindingInternally =
false,
80 const std::string solverMode =
"GS",
81 const std::string restartFilesPath =
".",
83 const bool useDevice =
false,
84 const bool isScfRestart =
true);
143 const MPI_Comm &mpi_comm_parent,
144 const bool useDevice,
145 const std::vector<std::vector<double>> atomicPositionsCart,
146 const std::vector<dftfe::uInt> atomicNumbers,
147 const std::vector<std::vector<double>> cell,
148 const std::vector<bool> pbc,
149 const std::vector<dftfe::uInt> mpGrid = std::vector<dftfe::uInt>{1, 1, 1},
150 const std::vector<bool> mpGridShift = std::vector<bool>{
false,
153 const bool spinPolarizedDFT =
false,
154 const double startMagnetization = 0.0,
155 const double fermiDiracSmearingTemp = 500.0,
157 const double meshSize = 0.8,
158 const double scfMixingParameter = 0.2,
160 const bool setDeviceToMPITaskBindingInternally =
false);
170 const MPI_Comm &mpi_comm_parent,
171 const bool printParams =
false,
172 const bool setDeviceToMPITaskBindingInternally =
false,
173 const std::string solverMode =
"GS",
174 const std::string restartFilesPath =
".",
176 const bool useDevice =
false);
184 const std::string restartCoordsFile,
185 const std::string restartDomainVectorsFile,
186 const MPI_Comm &mpi_comm_parent,
187 const bool printParams =
false,
188 const bool setDeviceToMPITaskBindingInternally =
false,
189 const std::string solverMode =
"GS",
190 const std::string restartFilesPath =
".",
192 const bool useDevice =
false,
193 const bool isScfRestart =
true);
197 const bool useDevice,
198 const std::vector<std::vector<double>> atomicPositionsCart,
199 const std::vector<dftfe::uInt> atomicNumbers,
200 const std::vector<std::vector<double>> cell,
201 const std::vector<bool> pbc,
202 const std::vector<dftfe::uInt> mpGrid = std::vector<dftfe::uInt>{1,
205 const std::vector<bool> mpGridShift = std::vector<bool>{
false,
208 const bool spinPolarizedDFT =
false,
209 const double startMagnetization = 0.0,
210 const double fermiDiracSmearingTemp = 500.0,
212 const double meshSize = 0.8,
213 const double scfMixingParameter = 0.2,
215 const bool setDeviceToMPITaskBindingInternally =
false);
240 std::tuple<double, bool, double>
242 const bool computeCellStress =
false);
268 std::vector<std::vector<double>>
280 std::vector<std::vector<double>>
291 const std::vector<std::vector<double>> atomsDisplacements);
302 deformCell(
const std::vector<std::vector<double>> deformationGradient);
310 std::vector<std::vector<double>>
321 std::vector<std::vector<double>>
332 std::vector<std::vector<double>>
349 std::vector<dftfe::Int>
358 std::vector<dftfe::Int>
386 const bool useDevice);
abstract base class for dft
Definition dftBase.h:34
Namespace which declares the input parameters and the functions to parse them from the input paramete...
Definition dftParameters.h:36
void reinit(const MPI_Comm &mpi_comm_parent, const bool useDevice, const std::vector< std::vector< double > > atomicPositionsCart, const std::vector< dftfe::uInt > atomicNumbers, const std::vector< std::vector< double > > cell, const std::vector< bool > pbc, const std::vector< dftfe::uInt > mpGrid=std::vector< dftfe::uInt >{1, 1, 1}, const std::vector< bool > mpGridShift=std::vector< bool >{false, false, false}, const bool spinPolarizedDFT=false, const double startMagnetization=0.0, const double fermiDiracSmearingTemp=500.0, const dftfe::uInt npkpt=0, const double meshSize=0.8, const double scfMixingParameter=0.2, const dftfe::Int verbosity=-1, const bool setDeviceToMPITaskBindingInternally=false)
std::vector< std::vector< double > > getAtomPositionsFrac() const
Gets the current atom Positions in fractional form (only applicable for periodic and semi-periodic BC...
dftParameters * getDftfeParamsPtr()
void reinit(const std::string parameter_file, const MPI_Comm &mpi_comm_parent, const bool printParams=false, const bool setDeviceToMPITaskBindingInternally=false, const std::string solverMode="GS", const std::string restartFilesPath=".", const dftfe::Int _verbosity=1, const bool useDevice=false)
clear and reinitialize based on input parameter_file
std::vector< dftfe::Int > getValenceElectronNumbers() const
Gets the number of valence electrons for each atom.
dftfeWrapper(const std::string parameter_file, const MPI_Comm &mpi_comm_parent, const bool printParams=false, const bool setDeviceToMPITaskBindingInternally=false, const std::string solverMode="GS", const std::string restartFilesPath=".", const dftfe::Int _verbosity=1, const bool useDevice=false)
constructor based on input parameter_file
void updateAtomPositions(const std::vector< std::vector< double > > atomsDisplacements)
update atom positions and reinitialize all related data-structures
void initialize(const bool setDeviceToMPITaskBindingInternally, const bool useDevice)
void run()
Legacy function (to be deprecated)
static void globalHandlesInitialize(const MPI_Comm &mpi_comm_world)
must be called only once at start of program from all processors after calling MPI_Init
std::vector< std::vector< double > > getCellStress() const
Get cell stress: negative of gradient of DFT free energy with respect to affine strain components sca...
void writeMesh()
Calls dftBasepointer public function writeMesh(). Here the inital density and mesh are stored in a fi...
dftBase * getDftfeBasePtr()
std::vector< bool > getPBC() const
Gets the boundary conditions for each cell vector direction.
dftfeWrapper(const std::string parameter_file, const std::string restartCoordsFile, const std::string restartDomainVectorsFile, const MPI_Comm &mpi_comm_parent, const bool printParams=false, const bool setDeviceToMPITaskBindingInternally=false, const std::string solverMode="GS", const std::string restartFilesPath=".", const dftfe::Int _verbosity=1, const bool useDevice=false, const bool isScfRestart=true)
constructor based on input parameter_file and restart coordinates and domain vectors file paths
static void globalHandlesFinalize()
must be called only once at end of program from all processors but before calling MPI_Finalize
dftfeWrapper()
empty constructor
std::vector< dftfe::Int > getAtomicNumbers() const
Gets the atomic numbers vector.
void createScratchFolder()
std::string d_scratchFolderName
Definition dftfeWrapper.h:391
void deformCell(const std::vector< std::vector< double > > deformationGradient)
Deforms the cell by applying the given affine deformation gradient and reinitializes the underlying d...
double getDFTFreeEnergy() const
Get DFT free energy (in Hartree units). This function can only be called after calling computeDFTFree...
std::vector< std::vector< double > > getForcesAtoms() const
Get ionic forces: negative of gradient of DFT free energy with respect to ionic positions (in Hartree...
dftfeWrapper(const MPI_Comm &mpi_comm_parent, const bool useDevice, const std::vector< std::vector< double > > atomicPositionsCart, const std::vector< dftfe::uInt > atomicNumbers, const std::vector< std::vector< double > > cell, const std::vector< bool > pbc, const std::vector< dftfe::uInt > mpGrid=std::vector< dftfe::uInt >{1, 1, 1}, const std::vector< bool > mpGridShift=std::vector< bool >{false, false, false}, const bool spinPolarizedDFT=false, const double startMagnetization=0.0, const double fermiDiracSmearingTemp=500.0, const dftfe::uInt npkpt=0, const double meshSize=0.8, const double scfMixingParameter=0.2, const dftfe::Int verbosity=-1, const bool setDeviceToMPITaskBindingInternally=false)
constructor based on input list of atomic coordinates, list of atomic numbers,cell,...
dftParameters * d_dftfeParamsPtr
Definition dftfeWrapper.h:390
void writeDomainAndAtomCoordinates(const std::string Path) const
writes the current domain bounding vectors and atom coordinates to files for structural optimization ...
dftBase * d_dftfeBasePtr
Definition dftfeWrapper.h:389
std::vector< std::vector< double > > getCell() const
Gets the current cell vectors.
std::vector< std::vector< double > > getAtomPositionsCart() const
Gets the current atom Positions in cartesian form (in Bohr units) (origin at corner of cell against w...
void reinit(const std::string parameter_file, const std::string restartCoordsFile, const std::string restartDomainVectorsFile, const MPI_Comm &mpi_comm_parent, const bool printParams=false, const bool setDeviceToMPITaskBindingInternally=false, const std::string solverMode="GS", const std::string restartFilesPath=".", const dftfe::Int _verbosity=1, const bool useDevice=false, const bool isScfRestart=true)
clear and reinitialize based on input parameter_file and restart coordinates and domain vectors file ...
MPI_Comm d_mpi_comm_parent
Definition dftfeWrapper.h:388
double getElectronicEntropicEnergy() const
Get electronic entropic energy (in Hartree units). This function can only be called after calling com...
std::tuple< double, bool, double > computeDFTFreeEnergy(const bool computeIonForces=true, const bool computeCellStress=false)
solve ground-state and return DFT free energy which is sum of internal energy and negative of electro...
bool d_isDeviceToMPITaskBindingSetInternally
Definition dftfeWrapper.h:392
Definition pseudoPotentialToDftfeConverter.cc:34
std::uint32_t uInt
Definition TypeConfig.h:10
std::int32_t Int
Definition TypeConfig.h:11