DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
dft.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (c) 2017-2025 The Regents of the University of Michigan and DFT-FE
4// authors.
5//
6// This file is part of the DFT-FE code.
7//
8// The DFT-FE code is free software; you can use it, redistribute
9// it, and/or modify it under the terms of the GNU Lesser General
10// Public License as published by the Free Software Foundation; either
11// version 2.1 of the License, or (at your option) any later version.
12// The full text of the license can be found in the file LICENSE at
13// the top level of the DFT-FE distribution.
14//
15// ---------------------------------------------------------------------
16//
17
18#ifndef dft_H_
19#define dft_H_
20#include <constants.h>
22#include <elpaScalaManager.h>
23#include <headers.h>
24#include <MemorySpaceType.h>
25#include <MemoryStorage.h>
26#include <FEBasisOperations.h>
27#include <BLASWrapper.h>
28#include <AuxDensityMatrix.h>
29
30#include <complex>
31#include <deque>
32#include <iomanip>
33#include <iostream>
34#include <numeric>
35#include <sstream>
36
37#ifdef DFTFE_WITH_DEVICE
39# include "deviceKernelsGeneric.h"
42# include <linearSolverCGDevice.h>
44#endif
45
46// ************* For debugging purposes only. Remove afterwards
47#include "hubbardClass.h"
48
50#include <dealiiLinearSolver.h>
51#include <dftParameters.h>
52#include <eigenSolver.h>
53#include <interpolation.h>
54#include <kerkerSolverProblem.h>
61#include <vselfBinsManager.h>
62#include <excManager.h>
63#include <dftd.h>
64#include <force.h>
65#include "dftBase.h"
66#ifdef USE_PETSC
67# include <petsc.h>
68
69# include <slepceps.h>
70#endif
71
72#include <mixingClass.h>
73#include <oncvClass.h>
74#include <AuxDensityMatrix.h>
77
78namespace dftfe
79{
80 //
81 // Initialize Namespace
82 //
83
84
85
86#ifndef DOXYGEN_SHOULD_SKIP_THIS
87
88 struct orbital
89 {
90 dftfe::uInt atomID;
91 dftfe::uInt waveID;
92 dftfe::uInt Z, n, l;
93 dftfe::Int m;
94 alglib::spline1dinterpolant psi;
95 };
96
97 /* code that must be skipped by Doxygen */
98 // forward declarations
99 template <dftfe::uInt T1, dftfe::uInt T2, dftfe::utils::MemorySpace memory>
100 class symmetryClass;
101 template <dftfe::uInt T1, dftfe::uInt T2, dftfe::utils::MemorySpace memory>
102 class forceClass;
103#endif /* DOXYGEN_SHOULD_SKIP_THIS */
104
105 /**
106 * @brief This class is the primary interface location of all other parts of the DFT-FE code
107 * for all steps involved in obtaining the Kohn-Sham DFT ground-state
108 * solution.
109 *
110 * @author Shiva Rudraraju, Phani Motamarri, Sambit Das
111 */
112 template <dftfe::uInt FEOrder,
113 dftfe::uInt FEOrderElectro,
114 dftfe::utils::MemorySpace memorySpace>
115 class dftClass : public dftBase
116 {
117 friend class forceClass<FEOrder, FEOrderElectro, memorySpace>;
118
119 friend class symmetryClass<FEOrder, FEOrderElectro, memorySpace>;
120
121 public:
122 /**
123 * @brief dftClass constructor
124 *
125 * @param[in] mpi_comm_parent parent communicator
126 * @param[in] mpi_comm_domain mpi_communicator for domain decomposition
127 * parallelization
128 * @param[in] interpoolcomm mpi_communicator for parallelization over k
129 * points
130 * @param[in] interBandGroupComm mpi_communicator for parallelization over
131 * bands
132 * @param[in] scratchFolderName scratch folder name
133 * @param[in] dftParams dftParameters object containg parameter values
134 * parsed from an input parameter file in dftfeWrapper class
135 */
136 dftClass(const MPI_Comm &mpiCommParent,
137 const MPI_Comm &mpi_comm_domain,
138 const MPI_Comm &interpoolcomm,
139 const MPI_Comm &interBandGroupComm,
140 const std::string &scratchFolderName,
141 dftParameters &dftParams);
142
143 /**
144 * @brief dftClass destructor
145 */
147
148 /**
149 * @brief atomic system pre-processing steps.
150 *
151 * Reads the coordinates of the atoms.
152 * If periodic calculation, reads fractional coordinates of atoms in the
153 * unit-cell, lattice vectors, kPoint quadrature rules to be used and also
154 * generates image atoms. Also determines orbital-ordering
155 */
156 void
158
159 /**
160 * @brief Does KSDFT problem pre-processing steps including mesh generation calls.
161 */
162 void
164
165 /**
166 * @brief Does KSDFT problem pre-processing steps but without remeshing.
167 */
168 void
169 initNoRemesh(const bool updateImagesAndKPointsAndVselfBins = true,
170 const bool checkSmearedChargeWidthsForOverlap = true,
171 const bool useSingleAtomSolutionOverride = false,
172 const bool isMeshDeformed = false);
173
174
175
176 /**
177 * @brief FIXME: legacy call, move to main.cc
178 */
179 void
181
182
183 void
185
186 /**
187 * @brief Writes inital density and mesh to file.
188 */
189 void
191
192 /**
193 * @brief compute approximation to ground-state without solving the SCF iteration
194 */
195 void
197 /**
198 * @brief compute bands without solving the SCF iteration
199 */
200 void
202 /**
203 * @brief Kohn-Sham ground-state solve using SCF iteration
204 *
205 * @return tuple of boolean flag on whether scf converged,
206 * and L2 norm of residual electron-density of the last SCF iteration step
207 *
208 */
209 std::tuple<bool, double>
210 solve(const bool computeForces = true,
211 const bool computestress = true,
212 const bool restartGroundStateCalcFromChk = false);
213
214 void
216
217 void
219
220
221 void
224 const distributedCPUVec<double> &vSpin0,
225 const distributedCPUVec<double> &vSpin1,
229
230 /**
231 * @brief Copies the residual residualValues=outValues-inValues
232 */
233 double
236 &outValues,
238 &inValues,
240 &residualValues,
242 &JxW,
243 const bool computeNorm);
244
245
246 double
248 const distributedCPUVec<double> &inValues,
249 distributedCPUVec<double> &residualValues);
250
251
252 /**
253 * @brief Computes the diagonal mass matrix for rho nodal grid, used for nodal mixing
254 */
255 void
258 &massVec);
259
260 void
261 initializeKohnShamDFTOperator(const bool initializeCublas = true);
262
263
264 void
266
267
268 void
270
271
272 double
274
275 double
277
278 double
280
283
286
287 double
289
290 void
292
293 virtual void
295
296 /**
297 * @brief Number of Kohn-Sham eigen values to be computed
298 */
300
301
302 /**
303 * @brief Number of random wavefunctions
304 */
306
307 void
309
310 /**
311 *@brief Get local dofs global indices real
312 */
313 const std::vector<dealii::types::global_dof_index> &
315
316 /**
317 *@brief Get local dofs global indices imag
318 */
319 const std::vector<dealii::types::global_dof_index> &
321
322 /**
323 *@brief Get local dofs local proc indices real
324 */
325 const std::vector<dealii::types::global_dof_index> &
327
328 /**
329 *@brief Get local dofs local proc indices imag
330 */
331 const std::vector<dealii::types::global_dof_index> &
333
334 /**
335 *@brief Get matrix free data object
336 */
337 const dealii::MatrixFree<3, double> &
339
340
341 /** @brief Updates atom positions, remeshes/moves mesh and calls appropriate reinits.
342 *
343 * Function to update the atom positions and mesh based on the provided
344 * displacement input. Depending on the maximum displacement magnitude this
345 * function decides wether to do auto remeshing or move mesh using Gaussian
346 * functions. Additionaly this function also wraps the atom position across
347 * the periodic boundary if the atom moves across it beyond a certain
348 * magnitude. In case of floating atoms, only the atomic positions are
349 * updated keeping the mesh fixed. This function also calls initNoRemesh to
350 * reinitialize all the required FEM and KSDFT objects.
351 *
352 * @param[in] globalAtomsDisplacements vector containing the displacements
353 * (from current position) of all atoms (global).
354 * @return void.
355 */
356 void
358 const std::vector<dealii::Tensor<1, 3, double>> &globalAtomsDisplacements,
359 const double maxJacobianRatioFactor = 1.25,
360 const bool useSingleAtomSolutionsOverride = false);
361
362
363 /**
364 * @brief writes the current domain bounding vectors and atom coordinates to files, which are required for
365 * geometry relaxation restart
366
367 */
368 void
370
371 /**
372 * @brief writes the current domain bounding vectors and atom coordinates to files for
373 * structural optimization and dynamics restarts. The coordinates are stored
374 * as: 1. fractional for semi-periodic/periodic 2. Cartesian for
375 * non-periodic.
376 * @param[in] Path The folder path to store the atom coordinates required
377 * during restart.
378 */
379 void
380 writeDomainAndAtomCoordinates(const std::string Path) const;
381
382 /**
383 * @brief writes atomistics data for subsequent post-processing. Related to
384 * WRITE STRUCTURE ENERGY FORCES DATA POST PROCESS input parameter.
385 * @param[in] Path The folder path to store the atomistics data.
386 */
387 void
388 writeStructureEnergyForcesDataPostProcess(const std::string Path) const;
389
390 /**
391 * @brief writes quadrature grid information and associated spin-up
392 * and spin-down electron-density for post-processing
393 * @param[in] Path The folder path to store the atomistics data.
394 */
395 virtual void
396 writeGSElectronDensity(const std::string Path) const;
397
398
399 /**
400 * @brief Gets the current atom Locations in cartesian form
401 * (origin at center of domain) from dftClass
402 */
403 const std::vector<std::vector<double>> &
405
406 /**
407 * @brief Gets the nearest atom distance for each atom
408 */
409 const std::vector<double> &
411
412 /**
413 * @brief Gets the current image atom Locations in cartesian form
414 * (origin at center of domain) from dftClass
415 */
416 const std::vector<std::vector<double>> &
418
419 /**
420 * @brief Gets the current image atom ids from dftClass
421 */
422 const std::vector<dftfe::Int> &
424
425 /**
426 * @brief Gets the current atom Locations in fractional form
427 * from dftClass (only applicable for periodic and semi-periodic BCs)
428 */
429 const std::vector<std::vector<double>> &
431
432
433
434 /**
435 * @brief Gets the current cell lattice vectors
436 *
437 * @return std::vector<std::vector<double>> 3 \times 3 matrix,lattice[i][j]
438 * corresponds to jth component of ith lattice vector
439 */
440 const std::vector<std::vector<double>> &
441 getCell() const;
442
443 /**
444 * @brief Gets the current cell volume
445 *
446 */
447 double
449
450 /**
451 * @brief Gets the current atom types from dftClass
452 */
453 const std::set<dftfe::uInt> &
455
456 /**
457 * @brief Gets the current atomic forces from dftClass
458 */
459 const std::vector<double> &
461
462 /**
463 * @brief Gets the current cell stress from dftClass
464 */
465 const dealii::Tensor<2, 3, double> &
467
468 /**
469 * @brief Get reference to dftParameters object
470 */
473
474
475 /**
476 * @brief Get reference the memorySpace templated eigen vectors
477 */
480
481 /**
482 * @brief Get reference the host eigen vectors
483 */
487
488 /**
489 * @brief Get reference to the eigen values
490 */
491 const std::vector<std::vector<double>> &
493
494 /**
495 * @brief Get the value of fermi energy
496 */
497 double
499
500 /**
501 * @brief Get the number of electrons
502 */
503 double
505
506 void
507 setNumElectrons(dftfe::uInt inputNumElectrons);
508
511#ifdef DFTFE_WITH_DEVICE
512
513 /**
514 * @brief Get the Ptr to Chebyshev solver in device
515 */
516 chebyshevOrthogonalizedSubspaceIterationSolverDevice *
517 getSubspaceIterationSolverDevice();
518#endif
519 /**
520 * @brief Get the Ptr to Chebyshev solver in host
521 */
524
525 /**
526 * @brief Function that computes the Eigen space for the Kohn Sham operator.
527 */
528 void
530 const dftfe::uInt s,
531 const dftfe::uInt kPointIndex,
533 &kohnShamDFTEigenOperator,
534 elpaScalaManager &elpaScala,
535 chebyshevOrthogonalizedSubspaceIterationSolver &subspaceIterationSolver,
536 std::vector<double> &residualNormWaveFunctions,
537 const bool computeResidual,
538 const bool useMixedPrec = false,
539 const bool isFirstScf = false);
540
541
542#ifdef DFTFE_WITH_DEVICE
543 /**
544 * @brief Function that computes the Eigen space for the Kohn Sham operator in device.
545 */
546 void
548 const dftfe::uInt s,
549 const dftfe::uInt kPointIndex,
551 &kohnShamDFTEigenOperator,
552 elpaScalaManager &elpaScala,
553 chebyshevOrthogonalizedSubspaceIterationSolverDevice
554 &subspaceIterationSolverDevice,
555 std::vector<double> &residualNormWaveFunctions,
556 const bool computeResidual,
557 const dftfe::uInt numberRayleighRitzAvoidancePasses = 0,
558 const bool useMixedPrec = false,
559 const bool isFirstScf = false);
560#endif
561
562 /**
563 *@brief Computes Fermi-energy obtained by imposing constraint on the number of electrons
564 */
565 void
567 const std::vector<std::vector<double>> &eigenValuesInput,
568 const double numElectronsInput);
569
570 /**
571 *@brief find HOMO eigenvalue for pure state
572 */
573 void
575 const std::vector<std::vector<double>> &eigenValuesInput,
576 const double numElectronsInput);
577
578 /**
579 *@brief Computes the kinetic energy
580 */
581 double
584 &kineticEnergyDensityValues);
585
586 /**
587 *@brief get the Ptr to the operator class ( Kohn Sham Base Operator)
588 */
591
592 /**
593 *@brief get the index of the DoF Handler corresponding to
594 *
595 */
598
601
602 const std::vector<double> &
604
607
610
611 const dealii::MatrixFree<3, double> &
613
614 dealii::AffineConstraints<double> *
616
619
622
625
626
627 std::shared_ptr<
629 double,
632
633 std::shared_ptr<
636
637 std::shared_ptr<
638 dftfe::basis::
639 FEBasisOperations<double, double, dftfe::utils::MemorySpace::HOST>>
641
642 std::shared_ptr<
645
646 std::shared_ptr<dftfe::linearAlgebra::BLASWrapper<memorySpace>>
648
649
650 std::shared_ptr<
653
654 std::vector<
657
658 std::vector<
661
662 /**
663 *@brief l2 projection
664 */
665 void
667 const std::shared_ptr<
669 FEBasisOperations<double, double, dftfe::utils::MemorySpace::HOST>>
670 &basisOperationsPtr,
671 const dealii::AffineConstraints<double> &constraintMatrix,
672 const dftfe::uInt dofHandlerId,
673 const dftfe::uInt quadratureId,
675 &quadratureValueData,
676 distributedCPUVec<double> &nodalField);
677
678 /**
679 *@brief interpolate nodal data to quadrature data using FEEvaluation
680 *
681 *@param[in] matrixFreeData matrix free data object
682 *@param[in] nodalField nodal data to be interpolated
683 *@param[out] quadratureValueData to be computed at quadrature points
684 *@param[out] quadratureGradValueData to be computed at quadrature points
685 *@param[in] isEvaluateGradData denotes a flag to evaluate gradients or not
686 */
687 void
689 const std::shared_ptr<
691 FEBasisOperations<double, double, dftfe::utils::MemorySpace::HOST>>
692 &basisOperationsPtr,
693 const dftfe::uInt dofHandlerId,
694 const dftfe::uInt quadratureId,
695 const distributedCPUVec<double> &nodalField,
697 &quadratureValueData,
699 &quadratureGradValueData,
700 const bool isEvaluateGradData = false);
701
702 /// map of atom node number and atomic weight
703 std::map<dealii::types::global_dof_index, double> &
705
706 /// non-intersecting smeared charges of all atoms at quad points
707 std::map<dealii::CellId, std::vector<double>> &
709
712
713 const dealii::AffineConstraints<double> *
715
716 const std::vector<std::vector<double>> &
718
719 const MPI_Comm &
720 getMPIDomain() const override;
721
722 const MPI_Comm &
723 getMPIParent() const override;
724
725 const MPI_Comm &
726 getMPIInterPool() const override;
727
728 const MPI_Comm &
729 getMPIInterBand() const override;
730
731 const std::map<dealii::CellId, std::vector<dftfe::uInt>> &
733
734 void
736
737 void
739 const std::shared_ptr<
741 FEBasisOperations<double, double, dftfe::utils::MemorySpace::HOST>>
742 &basisOperationsPtr,
743 const dftfe::uInt densityQuadratureId,
745 &rhoQuadValues,
746 const std::map<dealii::CellId, std::vector<double>> *bQuadValues);
747
750
751 /**
752 *@brief Returns the shared ptr to hubbard class
753 */
754 std::shared_ptr<hubbard<dataTypes::number, memorySpace>>
756
757 /**
758 *@brief Function to check if hubbard corrections is being used
759 */
760 bool
762
763 /**
764 *@brief write wavefunction solution fields
765 */
766 void
767 outputWfc(const std::string outputFileName = "wfcOutput");
768
769 /**
770 *@brief return the pseudo potential field
771 */
772 const std::map<dealii::CellId, std::vector<double>> &
774
775 private:
776 /**
777 * @brief generate image charges and update k point cartesian coordinates based
778 * on current lattice vectors
779 */
780 void
782
783 /**
784 * @brief Checks if the Exc functional requires Hubbard correction
785 * and sets up the Hubbard class if required.
786 */
787 void
789
790 void
792 const std::vector<std::vector<double>> &atomCoordinates);
793
794
795 /**
796 *@brief project ground state electron density from previous mesh into
797 * the new mesh to be used as initial guess for the new ground state solve
798 */
799 void
801
802 /**
803 *@brief save triangulation information and rho quadrature data to checkpoint file for restarts
804 */
805 void
807
808 /**
809 *@brief load triangulation information rho quadrature data from checkpoint file for restarted run
810 */
811 void
813 /**
814 * @brief save data of quad points to checkpoint file. Used for restart calculations, nscf and bands.
815 *
816 * @param[in] basisOperationsPtr basisoperationsPtr object
817 * @param[in] quadratureId quadrature Id of quad point used in checkpoint
818 * file
819 * @param[out] quadratureValueData quadrature data of field that is to be
820 * saved
821 * @param[in] fieldDimension dimension of field.
822 * @param[in] fieldName file name of checkpoint data to be saved
823 * @param[in] folderPath restart folder name
824 * @param[in] mpi_comm_parent parent communicator
825 * @param[in] mpi_comm_domain mpi_communicator for domain decomposition
826 * parallelization
827 * @param[in] interpoolcomm mpi_communicator for parallelization over k
828 * points
829 * @param[in] interBandGroupComm mpi_communicator for parallelization over
830 * bands
831 */
832 void
834 const std::shared_ptr<
836 double,
838 &basisOperationsPtr,
839 const dftfe::uInt quadratureId,
841 &quadratureValueData,
842 const dftfe::uInt fieldDimension,
843 const std::string &fieldName,
844 const std::string &folderPath,
845 const MPI_Comm &mpi_comm_parent,
846 const MPI_Comm &mpi_comm_domain,
847 const MPI_Comm &interpoolcomm,
848 const MPI_Comm &interBandGroupComm);
849 /**
850 * @brief loads data from quad points of checkpoint file. Used for restart calculations, nscf and bands.
851 *
852 * @param[in] basisOperationsPtr basisoperationsPtr object
853 * @param[in] quadratureId quadrature Id of quad point used in checkpoint
854 * file
855 * @param[out] quadratureValueData quadrature data of field that is to be
856 * loaded
857 * @param[in] fieldDimension dimension of field.
858 * @param[in] fieldName file name containing checkpoint data
859 * @param[in] folderPath restart folder name
860 * @param[in] mpi_comm_parent parent communicator
861 * @param[in] mpi_comm_domain mpi_communicator for domain decomposition
862 * parallelization
863 * @param[in] interpoolcomm mpi_communicator for parallelization over k
864 * points
865 * @param[in] interBandGroupComm mpi_communicator for parallelization over
866 * bands
867 */
868 void
870 const std::shared_ptr<
872 double,
874 &basisOperationsPtr,
875 const dftfe::uInt quadratureId,
877 &quadratureValueData,
878 const dftfe::uInt fieldDimension,
879 const std::string &fieldName,
880 const std::string &folderPath,
881 const MPI_Comm &mpi_comm_parent,
882 const MPI_Comm &mpi_comm_domain,
883 const MPI_Comm &interpoolcomm,
884 const MPI_Comm &interBandGroupComm);
885
886 void
888 void
889 writeMesh(std::string meshFileName);
890
891 /// creates datastructures related to periodic image charges
892 void
893 generateImageCharges(const double pspCutOff,
894 std::vector<dftfe::Int> &imageIds,
895 std::vector<double> &imageCharges,
896 std::vector<std::vector<double>> &imagePositions);
897
898 void
900 const double pspCutOff,
901 const std::vector<dftfe::Int> &imageIds,
902 const std::vector<std::vector<double>> &imagePositions,
903 std::vector<std::vector<dftfe::Int>> &globalChargeIdToImageIdMap);
904
905 void
907
908 //
909 // generate mesh using a-posteriori error estimates
910 //
911 void
914 computeTraceXtHX(dftfe::uInt numberWaveFunctionsEstimate);
915 double
916 computeTraceXtKX(dftfe::uInt numberWaveFunctionsEstimate);
917
918
919 /**
920 *@brief moves the triangulation vertices using Gaussians such that the all atoms are on triangulation vertices
921 */
922 void
923 moveMeshToAtoms(dealii::Triangulation<3, 3> &triangulationMove,
924 dealii::Triangulation<3, 3> &triangulationSerial,
925 bool reuseFlag = false,
926 bool moveSubdivided = false);
927
928 /**
929 *@brief a
930 */
931 void
933
934 /**
935 *@brief a
936 */
937 void
939
940 /**
941 * Initializes the guess of electron-density and single-atom wavefunctions
942 * on the mesh, maps finite-element nodes to given atomic positions,
943 * initializes pseudopotential files and exchange-correlation functionals to
944 * be used based on user-choice. In periodic problems, periodic faces are
945 * mapped here. Further finite-element nodes to be pinned for solving the
946 * Poisson problem electro-static potential is set here
947 */
948 void
950 dealii::parallel::distributed::Triangulation<3> &triangulation);
951 void
952 initBoundaryConditions(const bool recomputeBasisData = true,
953 const bool meshOnlyDeformed = false,
954 const bool vselfPerturbationUpdateForStress = false);
955 void
957 void
958 initPseudoPotentialAll(const bool updateNonlocalSparsity = true);
959
960 /**
961 * create a dofHandler containing finite-element interpolating polynomial
962 * twice of the original polynomial required for Kerker mixing and
963 * initialize various objects related to this refined dofHandler
964 */
965 void
967 dealii::parallel::distributed::Triangulation<3> &triangulation);
968 void
969 initpRefinedObjects(const bool recomputeBasisData,
970 const bool meshOnlyDeformed,
971 const bool vselfPerturbationUpdateForStress = false);
972
973
974 /**
975 *@brief Sets inhomegeneous dirichlet boundary conditions upto quadrupole for total potential constraints on
976 * non-periodic boundary (boundary id==0).
977 *
978 * @param[in] dofHandler
979 * @param[out] constraintMatrix dealii::AffineConstraints<double> object
980 *with inhomogeneous Dirichlet boundary condition entries added
981 */
982 void
984 const dealii::DoFHandler<3> &_dofHandler,
985 const dealii::AffineConstraints<double> &onlyHangingNodeConstraints,
986 dealii::AffineConstraints<double> &constraintMatrix);
987
988
989 /**
990 *@brief interpolate rho nodal data to quadrature data using FEEvaluation
991 *
992 *@param[in] basisOperationsPtr basisoperationsPtr object
993 *@param[in] nodalField nodal data to be interpolated
994 *@param[out] quadratureValueData to be computed at quadrature points
995 *@param[out] quadratureGradValueData to be computed at quadrature points
996 *@param[in] isEvaluateGradData denotes a flag to evaluate gradients or not
997 */
998 void
1000 const std::shared_ptr<
1001 dftfe::basis::
1002 FEBasisOperations<double, double, dftfe::utils::MemorySpace::HOST>>
1003 &basisOperationsPtr,
1004 const dftfe::uInt dofHandlerId,
1005 const dftfe::uInt quadratureId,
1006 const distributedCPUVec<double> &nodalField,
1008 &quadratureValueData,
1010 &quadratureGradValueData,
1012 &quadratureTauValueData,
1014 &quadratureHessianValueData,
1015 const bool isEvaluateGradData = false,
1016 const bool isEvaluateTauData = false,
1017 const bool isEvaluateHessianData = false);
1018
1019
1020
1021 /**
1022 *@brief interpolate rho nodal data to quadrature data using FEEvaluation
1023 *
1024 *@param[in] basisOperationsPtr basisoperationsPtr object
1025 *@param[in] nodalField nodal data to be interpolated
1026 *@param[out] quadratureValueData to be computed at quadrature points
1027 *@param[out] quadratureGradValueData to be computed at quadrature points
1028 *@param[in] isEvaluateGradData denotes a flag to evaluate gradients or not
1029 */
1030 void
1032 const std::shared_ptr<
1033 dftfe::basis::
1034 FEBasisOperations<double, double, dftfe::utils::MemorySpace::HOST>>
1035 &basisOperationsPtr,
1036 const dftfe::uInt dofHandlerId,
1037 const dftfe::uInt quadratureId,
1038 const distributedCPUVec<double> &nodalField,
1040 &quadratureValueData,
1042 &quadratureGradValueData,
1043 const bool isEvaluateGradData);
1044
1045
1046 /**
1047 *@brief add atomic densities at quadrature points
1048 *
1049 */
1050 void
1053 &quadratureValueData,
1055 &quadratureGradValueData,
1056 const bool isConsiderGradData = false);
1057
1058
1059 /**
1060 *@brief Finds the global dof ids of the nodes containing atoms.
1061 *
1062 * @param[in] dofHandler
1063 * @param[out] atomNodeIdToChargeValueMap local map of global dof id to atom
1064 *charge id
1065 */
1066 void
1067 locateAtomCoreNodes(const dealii::DoFHandler<3> &_dofHandler,
1068 std::map<dealii::types::global_dof_index, double>
1069 &atomNodeIdToChargeValueMap);
1070
1071 /**
1072 *@brief Sets homogeneous dirichlet boundary conditions on a node farthest from
1073 * all atoms (pinned node). This is only done in case of periodic boundary
1074 *conditions to get an unique solution to the total electrostatic potential
1075 *problem.
1076 *
1077 * @param[in] dofHandler
1078 * @param[in] constraintMatrixBase base dealii::AffineConstraints<double>
1079 *object
1080 * @param[out] constraintMatrix dealii::AffineConstraints<double> object
1081 *with homogeneous Dirichlet boundary condition entries added
1082 */
1083 void
1085 const dealii::DoFHandler<3> &_dofHandler,
1086 const dealii::AffineConstraints<double> &constraintMatrixBase,
1087 dealii::AffineConstraints<double> &constraintMatrix);
1088
1089 void
1091
1093
1094 void
1096
1097 void
1099 void
1101 void
1103 std::vector<std::vector<distributedCPUVec<double>>> eigenVectors);
1104 void
1106
1107
1108 /**
1109 *@brief computes density nodal data from wavefunctions
1110 */
1111 void
1113
1114
1115 void
1119 distributedCPUVec<double> &fvSpin1);
1120
1121 void
1123 void
1125 void
1127 void
1129 dftfe::uInt n,
1130 dftfe::uInt l,
1131 dftfe::uInt &flag);
1132 void
1134 const dealii::DoFHandler<3> &_dofHandler,
1135 const dftfe::uInt lpspQuadratureId,
1136 const dealii::MatrixFree<3, double> &_matrix_free_data,
1137 const dftfe::uInt _phiExtDofHandlerIndex,
1138 const dealii::AffineConstraints<double> &phiExtConstraintMatrix,
1139 const std::map<dealii::types::global_dof_index, dealii::Point<3>>
1140 &supportPoints,
1141 const vselfBinsManager<FEOrder, FEOrderElectro> &vselfBinManager,
1143 std::map<dealii::CellId, std::vector<double>> &_pseudoValues,
1144 std::map<dftfe::uInt, std::map<dealii::CellId, std::vector<double>>>
1145 &_pseudoValuesAtoms);
1146
1147
1148
1149 /**
1150 *@brief Sets homegeneous dirichlet boundary conditions for total potential constraints on
1151 * non-periodic boundary (boundary id==0).
1152 *
1153 * @param[in] dofHandler
1154 * @param[out] constraintMatrix dealii::AffineConstraints<double> object
1155 *with homogeneous Dirichlet boundary condition entries added
1156 */
1157 void
1159 const dealii::DoFHandler<3> &_dofHandler,
1160 const dealii::AffineConstraints<double> &onlyHangingNodeConstraints,
1161 dealii::AffineConstraints<double> &constraintMatrix);
1162
1163
1164
1165 /**
1166 *@brief Computes total charge by integrating the electron-density
1167 */
1168 double
1169 totalCharge(const dealii::DoFHandler<3> &dofHandlerOfField,
1170 const distributedCPUVec<double> &rhoNodalField);
1171
1172
1173 double
1175 const dealii::DoFHandler<3> &dofHandlerOfField,
1176 const std::map<dealii::CellId, std::vector<double>> *rhoQuadValues);
1177
1178 double
1180 const dealii::DoFHandler<3> &dofHandlerOfField,
1182 &rhoQuadValues);
1183
1184
1185 double
1186 totalCharge(const dealii::MatrixFree<3, double> &matrixFreeDataObject,
1187 const distributedCPUVec<double> &rhoNodalField);
1188
1189
1190
1191 double
1192 rhofieldl2Norm(const dealii::MatrixFree<3, double> &matrixFreeDataObject,
1193 const distributedCPUVec<double> &rhoNodalField,
1194 const dftfe::uInt dofHandlerId,
1195 const dftfe::uInt quadratureId);
1196
1197 double
1199 const dealii::MatrixFree<3, double> &matrixFreeDataObject,
1200 const distributedCPUVec<double> &rhoNodalField1,
1201 const distributedCPUVec<double> &rhoNodalField2,
1202 const dftfe::uInt dofHandlerId,
1203 const dftfe::uInt quadratureId);
1204
1205
1206 double
1207 fieldGradl2Norm(const dealii::MatrixFree<3, double> &matrixFreeDataObject,
1208 const distributedCPUVec<double> &field);
1209
1210
1211 /**
1212 *@brief l2 projection
1213 */
1214 void
1216 const std::shared_ptr<
1217 dftfe::basis::
1218 FEBasisOperations<double, double, dftfe::utils::MemorySpace::HOST>>
1219 &basisOperationsPtr,
1220 const dealii::AffineConstraints<double> &constraintMatrix,
1221 const dftfe::uInt dofHandlerId,
1222 const dftfe::uInt quadratureId,
1224 &quadratureValueData,
1225 distributedCPUVec<double> &nodalField);
1226
1227 /**
1228 *@brief Computes net magnetization from the difference of local spin densities
1229 */
1230 void
1233 &magQuadValues);
1234
1235 /**
1236 *@brief normalize the input electron density
1237 */
1238 void
1240
1241 /**
1242 *@brief normalize input mag electron density to total magnetization
1243 *for use in constraint magnetization case (only for initial guess)
1244 */
1245 void
1247
1248
1249 /**
1250 *@brief normalize the output total electron density in each scf
1251 */
1252 void
1254
1255 /**
1256 *@brief normalize the electron density
1257 */
1258 void
1260
1261 /**
1262 *@brief Computes output electron-density from wavefunctions
1263 */
1264 void
1265 compute_rhoOut(const bool isGroundState = false);
1266
1267 /**
1268 *@brief Mixing schemes for mixing electron-density
1269 */
1270
1271 void
1273#ifdef DFTFE_WITH_DEVICE
1274 kerkerSolverProblemDevice<C_rhoNodalPolyOrder<FEOrder, FEOrderElectro>()>
1275 &kerkerPreconditionedResidualSolverProblemDevice,
1276 linearSolverCGDevice &CGSolverDevice,
1277#endif
1279 &kerkerPreconditionedResidualSolverProblem,
1280 dealiiLinearSolver &CGSolver,
1281 const distributedCPUVec<double> &residualRho,
1282 distributedCPUVec<double> &preCondTotalDensityResidualVector);
1283
1284 double
1286
1287 double
1289 /**
1290 *@brief Computes Fermi-energy obtained by imposing separate constraints on the number of spin-up and spin-down electrons
1291 */
1292 void
1294 const std::vector<std::vector<double>> &eigenValuesInput);
1295
1296
1297 /**
1298 *@brief Find spin-up and spin-down channel HOMO eigenvalues
1299 */
1300 void
1302 const std::vector<std::vector<double>> &eigenValuesInput);
1303
1304
1305 /**
1306 *@brief compute density of states and local density of states
1307 */
1308 void
1309 compute_tdos(const std::vector<std::vector<double>> &eigenValuesInput,
1310 const std::string &fileName);
1311
1312 void
1313 compute_ldos(const std::vector<std::vector<double>> &eigenValuesInput,
1314 const std::string &fileName);
1315
1316 /**
1317 *@brief compute localization length
1318 */
1319 void
1320 compute_localizationLength(const std::string &locLengthFileName);
1321
1322 /**
1323 *@brief write electron density solution fields
1324 */
1325 void
1327
1328 /**
1329 *@brief write the KS eigen values for given BZ sampling/path
1330 */
1331 void
1333
1334 /**
1335 *@brief Computes the volume of the domain
1336 */
1337 double
1338 computeVolume(const dealii::DoFHandler<3> &_dofHandler);
1339
1340 /**
1341 *@brief Deforms the domain by the given deformation gradient and reinitializes the
1342 * dftClass datastructures.
1343 */
1344 void
1345 deformDomain(const dealii::Tensor<2, 3, double> &deformationGradient,
1346 const bool vselfPerturbationUpdateForStress = false,
1347 const bool useSingleAtomSolutionsOverride = false,
1348 const bool print = true);
1349
1350 /**
1351 *@brief Computes inner Product and Y = alpha*X + Y for complex vectors used during
1352 * periodic boundary conditions
1353 */
1354
1355#ifdef USE_COMPLEX
1356 std::complex<double>
1358
1359 void
1360 alphaTimesXPlusY(std::complex<double> alpha,
1363
1364#endif
1365 /**
1366 *@brief Sets dirichlet boundary conditions for total potential constraints on
1367 * non-periodic boundary (boundary id==0). Currently setting homogeneous bc
1368 *
1369 */
1370 void
1372
1373
1374 void
1376 const std::vector<
1378 &densityQuadValues,
1379 const std::vector<
1381 &gradDensityQuadValues,
1382 const std::vector<
1384 &tauQuadValues,
1385 const std::map<dealii::CellId, std::vector<double>> &rhoCore,
1386 const std::map<dealii::CellId, std::vector<double>> &gradRhoCore,
1388 &eigenVectorsFlattenedMemSpace,
1389 const std::vector<std::vector<double>> &eigenValues,
1390 const double fermiEnergy_,
1391 const double fermiEnergyUp_,
1392 const double fermiEnergyDown_,
1393 std::shared_ptr<AuxDensityMatrix<memorySpace>> auxDensityMatrixXCPtr);
1394
1395 std::shared_ptr<excManager<memorySpace>> d_excManagerPtr;
1397
1398 /**
1399 * stores required data for Kohn-Sham problem
1400 */
1403 std::set<dftfe::uInt> atomTypes;
1404
1405 /// FIXME: eventually it should be a map of atomic number to struct-
1406 /// {valence number, mesh input etc}
1407 std::map<dftfe::uInt, dftfe::uInt> d_atomTypeAtributes;
1408
1409 /// FIXME: remove atom type atributes from atomLocations
1410 std::vector<std::vector<double>> atomLocations, atomLocationsFractional,
1412 std::vector<std::vector<double>> d_atomLocationsInterestPseudopotential;
1413 std::map<dftfe::uInt, dftfe::uInt>
1415 std::vector<std::vector<double>> d_atomLocationsAutoMesh;
1416 std::vector<std::vector<double>> d_imagePositionsAutoMesh;
1417
1418 /// Gaussian displacements of atoms read from file
1419 std::vector<dealii::Tensor<1, 3, double>> d_atomsDisplacementsGaussianRead;
1420
1421 ///
1423
1424 ///
1426
1428
1429 /// Gaussian generator parameter for force computation and Gaussian
1430 /// deformation of atoms and FEM mesh Gaussian generator: Gamma(r)=
1431 /// exp(-(r/d_gaussianConstant)^2) Stored for all domain atoms
1432 std::vector<double> d_gaussianConstantsForce;
1433
1434 /// Gaussian constants for automesh mesh movement stored for all domain
1435 /// atoms
1436 std::vector<double> d_gaussianConstantsAutoMesh;
1437
1438 /// composite generator flat top widths for all domain atoms
1439 std::vector<double> d_generatorFlatTopWidths;
1440
1441 /// flat top widths for all domain atoms in case of automesh mesh movement
1442 /// composite gaussian
1443 std::vector<double> d_flatTopWidthsAutoMeshMove;
1444
1445 /// smeared charge widths for all domain atoms
1446 std::vector<double> d_smearedChargeWidths;
1447
1448 /// smeared charge normalization scaling for all domain atoms
1449 std::vector<double> d_smearedChargeScaling;
1450
1451 /// nearest atom ids for all domain atoms
1452 std::vector<dftfe::uInt> d_nearestAtomIds;
1453
1454 /// nearest atom distances for all domain atoms
1455 std::vector<double> d_nearestAtomDistances;
1456
1457 ///
1459
1460 /// vector of lendth number of periodic image charges with corresponding
1461 /// master chargeIds
1462 std::vector<dftfe::Int> d_imageIds;
1463 // std::vector<dftfe::Int> d_imageIdsAutoMesh;
1464
1465
1466 /// vector of length number of periodic image charges with corresponding
1467 /// charge values
1468 std::vector<double> d_imageCharges;
1469
1470 /// vector of length number of periodic image charges with corresponding
1471 /// positions in cartesian coordinates
1472 std::vector<std::vector<double>> d_imagePositions;
1473
1474 /// globalChargeId to ImageChargeId Map
1475 std::vector<std::vector<dftfe::Int>> d_globalChargeIdToImageIdMap;
1476
1477 /// vector of lendth number of periodic image charges with corresponding
1478 /// master chargeIds , generated with a truncated pspCutoff
1479 std::vector<dftfe::Int> d_imageIdsTrunc;
1480
1481 /// vector of length number of periodic image charges with corresponding
1482 /// charge values , generated with a truncated pspCutoff
1483 std::vector<double> d_imageChargesTrunc;
1484
1485 /// vector of length number of periodic image charges with corresponding
1486 /// positions in cartesian coordinates, generated with a truncated pspCutOff
1487 std::vector<std::vector<double>> d_imagePositionsTrunc;
1488
1489 /// globalChargeId to ImageChargeId Map generated with a truncated pspCutOff
1490 std::vector<std::vector<dftfe::Int>> d_globalChargeIdToImageIdMapTrunc;
1491
1492 /// distance from the domain till which periodic images will be considered
1493 double d_pspCutOff = 15.0;
1494
1495 /// distance from the domain till which periodic images will be considered
1496 const double d_pspCutOffTrunc = 15.0;
1497
1498 /// cut-off distance from atom till which non-local projectors are
1499 /// non-trivial
1500 double d_nlPSPCutOff = 8.0;
1501
1502 /// non-intersecting smeared charges of all atoms at quad points
1503 std::map<dealii::CellId, std::vector<double>> d_bQuadValuesAllAtoms;
1504
1505 /// non-intersecting smeared charge gradients of all atoms at quad points
1506 std::map<dealii::CellId, std::vector<double>> d_gradbQuadValuesAllAtoms;
1507
1508 /// non-intersecting smeared charges atom ids of all atoms at quad points
1509 std::map<dealii::CellId, std::vector<dftfe::Int>> d_bQuadAtomIdsAllAtoms;
1510
1511 /// non-intersecting smeared charges atom ids of all atoms (with image atom
1512 /// ids separately accounted) at quad points
1513 std::map<dealii::CellId, std::vector<dftfe::Int>>
1515
1516 /// map of cell and non-trivial global atom ids (no images) for smeared
1517 /// charges for each bin
1518 std::map<dealii::CellId, std::vector<dftfe::uInt>> d_bCellNonTrivialAtomIds;
1519
1520 /// map of cell and non-trivial global atom ids (no images) for smeared
1521 /// charge for each bin
1522 std::vector<std::map<dealii::CellId, std::vector<dftfe::uInt>>>
1524
1525 /// map of cell and non-trivial global atom and image ids for smeared
1526 /// charges for each bin
1527 std::map<dealii::CellId, std::vector<dftfe::uInt>>
1529
1530 /// map of cell and non-trivial global atom and image ids for smeared charge
1531 /// for each bin
1532 std::vector<std::map<dealii::CellId, std::vector<dftfe::uInt>>>
1534
1535 /// minimum smeared charge width
1536 const double d_smearedChargeWidthMin = 0.4;
1537
1538 std::vector<orbital> waveFunctionsVector;
1539 std::map<
1541 std::map<dftfe::uInt, std::map<dftfe::uInt, alglib::spline1dinterpolant>>>
1543 std::map<dftfe::uInt, std::map<dftfe::uInt, std::map<dftfe::uInt, double>>>
1545
1546 /**
1547 * meshGenerator based object
1548 */
1550
1553
1554
1555 /// affine transformation object
1557
1558 /// meshMovementGaussianClass object
1560
1561 std::vector<dealii::Tensor<1, 3, double>>
1563 std::vector<dealii::Point<3>> d_controlPointLocationsCurrentMove;
1564
1565 /// volume of the domain
1567
1568 /// init wfc trunctation radius
1570
1571 /**
1572 * dealii based FE data structres
1573 */
1574 dealii::FESystem<3> FE, FEEigen;
1599 dealii::MatrixFree<3, double> matrix_free_data, d_matrixFreeDataPRefined;
1600 std::shared_ptr<
1602 double,
1605 std::shared_ptr<
1606 dftfe::basis::
1607 FEBasisOperations<double, double, dftfe::utils::MemorySpace::HOST>>
1609#if defined(DFTFE_WITH_DEVICE)
1610 std::shared_ptr<
1612 double,
1614 d_basisOperationsPtrDevice;
1615 std::shared_ptr<
1616 dftfe::basis::
1617 FEBasisOperations<double, double, dftfe::utils::MemorySpace::DEVICE>>
1618 d_basisOperationsPtrElectroDevice;
1619#endif
1620
1621 std::shared_ptr<
1624
1625 std::shared_ptr<dftfe::oncvClass<dataTypes::number, memorySpace>>
1627
1628 std::shared_ptr<
1631
1632 std::shared_ptr<
1633#if defined(DFTFE_WITH_DEVICE)
1635#else
1637#endif
1639
1640 std::map<dealii::types::global_dof_index, dealii::Point<3>> d_supportPoints,
1642 std::vector<const dealii::AffineConstraints<double> *> d_constraintsVector;
1643 std::vector<const dealii::AffineConstraints<double> *>
1645
1646 /**
1647 * parallel objects
1648 */
1649 const MPI_Comm mpi_communicator;
1650#if defined(DFTFE_WITH_DEVICE)
1651 utils::DeviceCCLWrapper *d_devicecclMpiCommDomainPtr;
1652#endif
1653 const MPI_Comm d_mpiCommParent;
1654 const MPI_Comm interpoolcomm;
1655 const MPI_Comm interBandGroupComm;
1661 std::vector<dealii::types::global_dof_index> local_dof_indicesReal,
1663 std::vector<dealii::types::global_dof_index> localProc_dof_indicesReal,
1665 std::vector<bool> selectedDofsHanging;
1666
1669
1671
1673
1675#ifdef DFTFE_WITH_DEVICE
1676 poissonSolverProblemDevice<FEOrder, FEOrderElectro>
1677 d_phiTotalSolverProblemDevice;
1678
1679 poissonSolverProblemDevice<FEOrder, FEOrderElectro>
1680 d_phiPrimeSolverProblemDevice;
1681#endif
1682
1684
1686
1687 const std::string d_dftfeScratchFolderName;
1688
1689 /**
1690 * chebyshev subspace iteration solver objects
1691 *
1692 */
1694#ifdef DFTFE_WITH_DEVICE
1695 chebyshevOrthogonalizedSubspaceIterationSolverDevice
1696 d_subspaceIterationSolverDevice;
1697#endif
1698
1699 /**
1700 * constraint Matrices
1701 */
1702
1703 /**
1704 *object which is used to store dealii constraint matrix information
1705 *using STL vectors. The relevant dealii constraint matrix
1706 *has hanging node constraints and periodic constraints(for periodic
1707 *problems) used in eigen solve
1708 */
1711
1712
1713 /**
1714 *object which is used to store dealii constraint matrix information
1715 *using STL vectors. The relevant dealii constraint matrix
1716 *has hanging node constraints used in Poisson problem solution
1717 *
1718 */
1721
1722
1723#ifdef DFTFE_WITH_DEVICE
1725 d_constraintsNoneDataInfoDevice;
1726#endif
1727
1728
1729 dealii::AffineConstraints<double> constraintsNone, constraintsNoneEigen,
1731
1732 dealii::AffineConstraints<double> d_constraintsForTotalPotentialElectro;
1733
1734 dealii::AffineConstraints<double> d_constraintsForPhiPrimeElectro;
1735
1736 dealii::AffineConstraints<double> d_constraintsForHelmholtzRhoNodal;
1737
1738 dealii::AffineConstraints<double> d_constraintsPRefined;
1739
1740 dealii::AffineConstraints<double> d_constraintsPRefinedOnlyHanging;
1741
1742 dealii::AffineConstraints<double> d_constraintsRhoNodal;
1743
1744 dealii::AffineConstraints<double> d_constraintsRhoNodalOnlyHanging;
1745
1748
1749 /**
1750 * data storage for Kohn-Sham eigenvalues and partial occupancies
1751 */
1752 std::vector<std::vector<double>> eigenValues;
1753 std::vector<std::vector<double>> d_partialOccupancies;
1754
1755 /**
1756 * data storage for the occupancy of Kohn-Sham wavefunctions
1757 */
1758 std::vector<std::vector<double>> d_fracOccupancy;
1759
1760 std::vector<std::vector<double>> d_densityMatDerFermiEnergy;
1761
1762 /**
1763 * The indexing of d_eigenVectorsFlattenedHost and
1764 * d_eigenVectorsFlattenedDevice [kPoint * numSpinComponents *
1765 * numLocallyOwnedNodes * numWaveFunctions + iSpin * numLocallyOwnedNodes *
1766 * numWaveFunctions + iNode * numWaveFunctions + iWaveFunction]
1767 */
1771
1775
1776 /// device eigenvectors
1777#ifdef DFTFE_WITH_DEVICE
1780 d_eigenVectorsFlattenedDevice;
1783 d_eigenVectorsDensityMatrixPrimeFlattenedDevice;
1784#endif
1785
1786 /// parallel message stream
1787 dealii::ConditionalOStream pcout;
1788
1789 /// compute-time logger
1790 dealii::TimerOutput computing_timer;
1791 dealii::TimerOutput computingTimerStandard;
1792
1793 /// A plain global timer to track only the total elapsed time after every
1794 /// ground-state solve
1795 dealii::Timer d_globalTimer;
1796
1797 // dft related objects
1798 std::vector<
1802 std::vector<distributedCPUVec<double>> d_densityInNodalValues,
1804
1805 std::vector<
1808 std::vector<
1811
1812
1813 // std::map<dealii::CellId, std::vector<double>> d_phiInValues,
1814 // d_phiOutValues;
1820
1824
1825
1827
1828
1832
1833 std::shared_ptr<AuxDensityMatrix<memorySpace>> d_auxDensityMatrixXCInPtr;
1834 std::shared_ptr<AuxDensityMatrix<memorySpace>> d_auxDensityMatrixXCOutPtr;
1835
1836 // For multipole boundary conditions
1838 std::vector<double> d_dipole;
1839 std::vector<double> d_quadrupole;
1840 std::vector<double> d_smearedChargeMoments;
1842
1843
1844 /// for low rank jacobian inverse approximation
1845 std::deque<distributedCPUVec<double>> d_vcontainerVals;
1846 std::deque<distributedCPUVec<double>> d_fvcontainerVals;
1847 std::deque<distributedCPUVec<double>> d_vSpin0containerVals;
1848 std::deque<distributedCPUVec<double>> d_fvSpin0containerVals;
1849 std::deque<distributedCPUVec<double>> d_vSpin1containerVals;
1850 std::deque<distributedCPUVec<double>> d_fvSpin1containerVals;
1856
1857 /// for xl-bomd
1858 std::map<dealii::CellId, std::vector<double>> d_rhoAtomsValues,
1860 std::map<dftfe::uInt, std::map<dealii::CellId, std::vector<double>>>
1863
1864 std::vector<
1868
1869 // storage for total electrostatic potential solution vector corresponding
1870 // to input scf electron density
1872
1873 // storage for total electrostatic potential solution vector corresponding
1874 // to output scf electron density
1876
1877 // storage for electrostatic potential Gateaux derivate corresponding
1878 // to electron number preserving electron-density peturbation (required for
1879 // LRDM)
1881
1882 // storage for sum of nuclear electrostatic potential
1884
1885 // storage of densities for xl-bomd
1886 std::deque<distributedCPUVec<double>> d_groundStateDensityHistory;
1887
1888 std::map<dealii::CellId, std::vector<double>> d_pseudoVLoc;
1889
1890 /// Internal data:: map for cell id to Vpseudo local of individual atoms.
1891 /// Only for atoms whose psp tail intersects the local domain.
1892 std::map<dftfe::uInt, std::map<dealii::CellId, std::vector<double>>>
1894
1895
1896 std::vector<std::vector<double>> d_localVselfs;
1897
1898 // nonlocal pseudopotential related objects used only for pseudopotential
1899 // calculation
1900 std::map<dealii::CellId, std::vector<double>> d_rhoCore;
1901
1902 std::map<dealii::CellId, std::vector<double>> d_gradRhoCore;
1903
1904 std::map<dftfe::uInt, std::map<dealii::CellId, std::vector<double>>>
1906
1907 std::map<dealii::CellId, std::vector<double>> d_hessianRhoCore;
1908
1909 std::map<dftfe::uInt, std::map<dealii::CellId, std::vector<double>>>
1911
1912
1913
1914 /// map of atom node number and atomic weight
1915 std::map<dealii::types::global_dof_index, double> d_atomNodeIdToChargeMap;
1916
1917 /// vselfBinsManager object
1919
1920 /// Gateaux derivative of vself field with respect to affine strain tensor
1921 /// components using central finite difference. This is used for cell stress
1922 /// computation
1923 std::vector<distributedCPUVec<double>> d_vselfFieldGateauxDerStrainFDBins;
1924
1925 /// Compute Gateaux derivative of vself field in bins with respect to affine
1926 /// strain tensor components
1927 void
1929
1930 /// dftParameters object
1932
1933 /// kPoint cartesian coordinates
1934 std::vector<double> d_kPointCoordinates;
1935
1936 /// k point crystal coordinates
1937 std::vector<double> kPointReducedCoordinates;
1938
1939 /// k point weights
1940 std::vector<double> d_kPointWeights;
1941
1942 /// closest tria vertex
1943 std::vector<dealii::Point<3>> d_closestTriaVertexToAtomsLocation;
1944 std::vector<dealii::Tensor<1, 3, double>> d_dispClosestTriaVerticesToAtoms;
1945
1946 /// global k index of lower bound of the local k point set
1948 /**
1949 * Recomputes the k point cartesian coordinates from the crystal k point
1950 * coordinates and the current lattice vectors, which can change in each
1951 * ground state solve dutring cell optimization.
1952 */
1953 void
1955
1956 /// fermi energy
1958
1960
1962
1963 /// entropic energy
1965
1966 // chebyshev filter variables and functions
1967 // dftfe::Int numPass ; // number of filter passes
1968
1969 std::vector<double> a0;
1970 std::vector<double> bLow;
1971
1972 /// stores flag for first ever call to chebyshev filtering for a given FEM
1973 /// mesh vector for each k point and spin
1974 std::vector<bool> d_isFirstFilteringCall;
1975
1977
1979
1981
1982
1983 /**
1984 * @ nscf variables
1985 */
1987 void
1989 KohnShamDFTBaseOperator<memorySpace> &kohnShamDFTEigenOperator,
1990 chebyshevOrthogonalizedSubspaceIterationSolver &subspaceIterationSolver);
1991 void
1993 KohnShamDFTBaseOperator<memorySpace> &kohnShamDFTEigenOperator,
1994 poissonSolverProblem<FEOrder, FEOrderElectro> &phiTotalSolverProblem,
1995 dealiiLinearSolver &CGSolver);
1996
1997 /**
1998 * @brief compute the maximum of the residual norm of the highest occupied state among all k points
1999 */
2000 double
2002 const std::vector<std::vector<double>>
2003 &residualNormWaveFunctionsAllkPoints,
2004 const std::vector<std::vector<double>> &eigenValuesAllkPoints,
2005 const double _fermiEnergy,
2006 std::vector<double> &maxResidualsAllkPoints);
2007
2008
2009 /**
2010 * @brief compute the maximum of the residual norm of the highest state of interest among all k points
2011 */
2012 double
2014 const std::vector<std::vector<double>>
2015 &residualNormWaveFunctionsAllkPoints,
2016 const std::vector<std::vector<double>> &eigenValuesAllkPoints,
2017 const dftfe::uInt highestState,
2018 std::vector<double> &maxResidualsAllkPoints);
2019
2020
2021
2022#ifdef DFTFE_WITH_DEVICE
2023 void
2025 const dftfe::uInt s,
2026 const dftfe::uInt kPointIndex,
2028 &kohnShamDFTEigenOperator,
2029 elpaScalaManager &elpaScala,
2030 chebyshevOrthogonalizedSubspaceIterationSolverDevice
2031 &subspaceIterationSolverDevice);
2032
2033#endif
2034
2035 void
2037 const dftfe::uInt s,
2038 const dftfe::uInt kPointIndex,
2040 &kohnShamDFTEigenOperator,
2041 elpaScalaManager &elpaScala);
2042
2044 std::shared_ptr<hubbard<dataTypes::number, memorySpace>> d_hubbardClassPtr;
2046 };
2047
2048} // namespace dftfe
2049
2050#endif
Definition AuxDensityMatrix.h:40
Definition KohnShamDFTBaseOperator.h:36
This class performs the anderson mixing in a variable agnostic way This class takes can take differen...
Definition mixingClass.h:50
Definition atomCenteredPostProcessing.h:30
Definition FEBasisOperations.h:85
Concrete class implementing Chebyshev filtered orthogonalized subspace iteration solver.
Definition chebyshevOrthogonalizedSubspaceIterationSolver.h:38
dealii linear solver class wrapper
Definition dealiiLinearSolver.h:32
abstract base class for dft
Definition dftBase.h:34
std::deque< distributedCPUVec< double > > d_vSpin0containerVals
Definition dft.h:1847
double d_atomicRhoScalingFac
Definition dft.h:1092
const std::string d_dftfeScratchFolderName
Definition dft.h:1687
dftfe::uInt d_nonAtomicWaveFunctions
Number of random wavefunctions.
Definition dft.h:305
double d_freeEnergy
Definition dft.h:1961
std::vector< dftfe::Int > d_imageIdsTrunc
Definition dft.h:1479
std::map< dftfe::uInt, std::map< dealii::CellId, std::vector< double > > > d_hessianRhoAtomsValuesSeparate
Definition dft.h:1862
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > d_tauInQuadValues
Definition dft.h:1807
const std::vector< std::vector< double > > & getLocalVselfs() const
const MPI_Comm & getMPIInterPool() const override
dftfe::uInt d_densityDofHandlerIndex
Definition dft.h:1579
std::vector< double > d_upperBoundUnwantedSpectrumValues
Definition dft.h:1976
const MPI_Comm d_mpiCommParent
Definition dft.h:1653
distributedCPUVec< double > d_phiTotRhoOut
Definition dft.h:1875
std::vector< std::vector< double > > atomLocationsFractional
Definition dft.h:1410
void compute_tdos(const std::vector< std::vector< double > > &eigenValuesInput, const std::string &fileName)
compute density of states and local density of states
double d_entropicEnergy
entropic energy
Definition dft.h:1964
std::vector< double > d_gaussianConstantsAutoMesh
Definition dft.h:1436
const distributedCPUVec< double > & getRhoNodalOut() const
void initBoundaryConditions(const bool recomputeBasisData=true, const bool meshOnlyDeformed=false, const bool vselfPerturbationUpdateForStress=false)
void loadPSIFiles(dftfe::uInt Z, dftfe::uInt n, dftfe::uInt l, dftfe::uInt &flag)
double lowrankApproxScfDielectricMatrixInvSpinPolarized(const dftfe::uInt scfIter)
std::vector< std::vector< double > > d_fracOccupancy
Definition dft.h:1758
void initAtomicRho()
void createMasterChargeIdToImageIdMaps(const double pspCutOff, const std::vector< dftfe::Int > &imageIds, const std::vector< std::vector< double > > &imagePositions, std::vector< std::vector< dftfe::Int > > &globalChargeIdToImageIdMap)
std::map< dealii::CellId, std::vector< double > > d_hessianRhoCore
Definition dft.h:1907
void locateAtomCoreNodes(const dealii::DoFHandler< 3 > &_dofHandler, std::map< dealii::types::global_dof_index, double > &atomNodeIdToChargeValueMap)
Finds the global dof ids of the nodes containing atoms.
void l2ProjectionQuadDensityMinusAtomicDensity(const std::shared_ptr< dftfe::basis::FEBasisOperations< double, double, dftfe::utils::MemorySpace::HOST > > &basisOperationsPtr, const dealii::AffineConstraints< double > &constraintMatrix, const dftfe::uInt dofHandlerId, const dftfe::uInt quadratureId, const dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureValueData, distributedCPUVec< double > &nodalField)
l2 projection
void writeMesh()
Writes inital density and mesh to file.
void setNumElectrons(dftfe::uInt inputNumElectrons)
void initHubbardOperator()
Checks if the Exc functional requires Hubbard correction and sets up the Hubbard class if required.
std::vector< dealii::types::global_dof_index > local_dof_indicesImag
Definition dft.h:1662
const std::vector< double > & getKPointWeights() const
double lowrankApproxScfDielectricMatrixInv(const dftfe::uInt scfIter)
const MPI_Comm mpi_communicator
Definition dft.h:1649
const dftfe::utils::MemoryStorage< dataTypes::number, dftfe::utils::MemorySpace::HOST > & getEigenVectorsHost() const
Get reference the host eigen vectors.
double d_monopole
Definition dft.h:1837
const std::vector< double > & getNearestAtomDistance() const
Gets the nearest atom distance for each atom.
dealii::IndexSet locally_owned_dofs
Definition dft.h:1658
void loadDensityFromQuadratureValues()
dealii::DoFHandler< 3 > d_dofHandlerRhoNodal
Definition dft.h:1576
double computeMaximumHighestOccupiedStateResidualNorm(const std::vector< std::vector< double > > &residualNormWaveFunctionsAllkPoints, const std::vector< std::vector< double > > &eigenValuesAllkPoints, const dftfe::uInt highestState, std::vector< double > &maxResidualsAllkPoints)
compute the maximum of the residual norm of the highest state of interest among all k points
void generateMPGrid()
const std::map< dealii::CellId, std::vector< double > > & getPseudoVLoc() const
return the pseudo potential field
double numElectronsUp
Definition dft.h:1402
double getFreeEnergy() const
void saveTriaInfoAndRhoNodalData()
save triangulation information and rho quadrature data to checkpoint file for restarts
std::vector< std::vector< double > > d_domainBoundingVectors
Definition dft.h:1411
dealii::AffineConstraints< double > constraintsNone
Definition dft.h:1729
const dealii::Tensor< 2, 3, double > & getCellStress() const
Gets the current cell stress from dftClass.
void applyHomogeneousDirichletBC(const dealii::DoFHandler< 3 > &_dofHandler, const dealii::AffineConstraints< double > &onlyHangingNodeConstraints, dealii::AffineConstraints< double > &constraintMatrix)
Sets homegeneous dirichlet boundary conditions for total potential constraints on non-periodic bounda...
const distributedCPUVec< double > & getRhoNodalSplitOut() const
double computeResidualNodalData(const distributedCPUVec< double > &outValues, const distributedCPUVec< double > &inValues, distributedCPUVec< double > &residualValues)
dealii::DoFHandler< 3 > d_dofHandlerPRefined
Definition dft.h:1575
void locatePeriodicPinnedNodes(const dealii::DoFHandler< 3 > &_dofHandler, const dealii::AffineConstraints< double > &constraintMatrixBase, dealii::AffineConstraints< double > &constraintMatrix)
Sets homogeneous dirichlet boundary conditions on a node farthest from all atoms (pinned node)....
void writeDomainAndAtomCoordinates(const std::string Path) const
writes the current domain bounding vectors and atom coordinates to files for structural optimization ...
double totalCharge(const dealii::DoFHandler< 3 > &dofHandlerOfField, const dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &rhoQuadValues)
dealii::IndexSet locally_owned_dofsEigen
Definition dft.h:1658
std::map< dealii::CellId, std::vector< dftfe::uInt > > d_bCellNonTrivialAtomImageIds
Definition dft.h:1528
double rhofieldl2Norm(const dealii::MatrixFree< 3, double > &matrixFreeDataObject, const distributedCPUVec< double > &rhoNodalField, const dftfe::uInt dofHandlerId, const dftfe::uInt quadratureId)
std::vector< dealii::Point< 3 > > d_closestTriaVertexToAtomsLocation
closest tria vertex
Definition dft.h:1943
void l2ProjectionQuadToNodal(const std::shared_ptr< dftfe::basis::FEBasisOperations< double, double, dftfe::utils::MemorySpace::HOST > > &basisOperationsPtr, const dealii::AffineConstraints< double > &constraintMatrix, const dftfe::uInt dofHandlerId, const dftfe::uInt quadratureId, const dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureValueData, distributedCPUVec< double > &nodalField)
l2 projection
std::deque< distributedCPUVec< double > > d_fvcontainerVals
Definition dft.h:1846
dataTypes::number computeTraceXtHX(dftfe::uInt numberWaveFunctionsEstimate)
double fermiEnergyUp
Definition dft.h:1957
std::vector< std::vector< double > > d_densityMatDerFermiEnergy
Definition dft.h:1760
poissonSolverProblem< FEOrder, FEOrderElectro > d_phiTotalSolverProblem
Definition dft.h:1672
void initnscf(KohnShamDFTBaseOperator< memorySpace > &kohnShamDFTEigenOperator, poissonSolverProblem< FEOrder, FEOrderElectro > &phiTotalSolverProblem, dealiiLinearSolver &CGSolver)
dealii::AffineConstraints< double > * getDensityConstraint()
void writeStructureEnergyForcesDataPostProcess(const std::string Path) const
writes atomistics data for subsequent post-processing. Related to WRITE STRUCTURE ENERGY FORCES DATA ...
std::map< dealii::CellId, std::vector< double > > d_bQuadValuesAllAtoms
non-intersecting smeared charges of all atoms at quad points
Definition dft.h:1503
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > d_gradDensityResidualQuadValues
Definition dft.h:1867
double computeMaximumHighestOccupiedStateResidualNorm(const std::vector< std::vector< double > > &residualNormWaveFunctionsAllkPoints, const std::vector< std::vector< double > > &eigenValuesAllkPoints, const double _fermiEnergy, std::vector< double > &maxResidualsAllkPoints)
compute the maximum of the residual norm of the highest occupied state among all k points
const MPI_Comm interBandGroupComm
Definition dft.h:1655
std::vector< dealii::types::global_dof_index > local_dof_indicesReal
Definition dft.h:1661
std::vector< std::vector< double > > atomLocations
FIXME: remove atom type atributes from atomLocations.
Definition dft.h:1410
void applyPeriodicBCHigherOrderNodes()
Computes inner Product and Y = alpha*X + Y for complex vectors used during periodic boundary conditio...
std::vector< double > d_kPointCoordinates
kPoint cartesian coordinates
Definition dft.h:1934
double fermiEnergyDown
Definition dft.h:1957
void compute_fermienergy_constraintMagnetization_purestate(const std::vector< std::vector< double > > &eigenValuesInput)
Find spin-up and spin-down channel HOMO eigenvalues.
dftUtils::constraintMatrixInfo< dftfe::utils::MemorySpace::HOST > constraintsNoneEigenDataInfo
Definition dft.h:1710
void deformDomain(const dealii::Tensor< 2, 3, double > &deformationGradient, const bool vselfPerturbationUpdateForStress=false, const bool useSingleAtomSolutionsOverride=false, const bool print=true)
Deforms the domain by the given deformation gradient and reinitializes the dftClass datastructures.
std::shared_ptr< dftfe::basis::FEBasisOperations< double, double, memorySpace > > getBasisOperationsElectroMemSpace()
void outputDensity()
write electron density solution fields
std::shared_ptr< dftfe::basis::FEBasisOperations< double, double, dftfe::utils::MemorySpace::HOST > > getBasisOperationsElectroHost()
dftfe::uInt getElectroDofHandlerIndex() const
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > d_tauInNodalValues
Definition dft.h:1810
dealii::AffineConstraints< double > d_constraintsRhoNodal
Definition dft.h:1742
dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > d_gradPhiResQuadValues
Definition dft.h:1818
dftfe::uInt d_rankCurrentLRD
Definition dft.h:1852
double d_residualNormPredicted
Definition dft.h:1854
std::map< dealii::CellId, std::vector< dftfe::uInt > > d_bCellNonTrivialAtomIds
Definition dft.h:1518
std::map< dealii::CellId, std::vector< dftfe::Int > > d_bQuadAtomIdsAllAtoms
non-intersecting smeared charges atom ids of all atoms at quad points
Definition dft.h:1509
std::shared_ptr< excManager< memorySpace > > d_excManagerPtr
Definition dft.h:1395
std::vector< double > bLow
Definition dft.h:1970
void writeDomainAndAtomCoordinates()
writes the current domain bounding vectors and atom coordinates to files, which are required for geom...
symmetryClass< FEOrder, FEOrderElectro, memorySpace > * symmetryPtr
Definition dft.h:1668
std::vector< std::vector< double > > d_imagePositionsTrunc
Definition dft.h:1487
double d_wfcInitTruncation
init wfc trunctation radius
Definition dft.h:1569
std::vector< double > d_smearedChargeWidths
smeared charge widths for all domain atoms
Definition dft.h:1446
double d_groundStateEnergy
Definition dft.h:1957
void updateAtomPositionsAndMoveMesh(const std::vector< dealii::Tensor< 1, 3, double > > &globalAtomsDisplacements, const double maxJacobianRatioFactor=1.25, const bool useSingleAtomSolutionsOverride=false)
Updates atom positions, remeshes/moves mesh and calls appropriate reinits.
dealii::FESystem< 3 > FEEigen
Definition dft.h:1574
distributedCPUVec< double > d_rhoOutNodalValuesSplit
Definition dft.h:1821
const std::vector< dealii::types::global_dof_index > & getLocalProcDofIndicesReal() const
Get local dofs local proc indices real.
dftfe::uInt getDensityQuadratureId()
double computeVolume(const dealii::DoFHandler< 3 > &_dofHandler)
Computes the volume of the domain.
void nscf(KohnShamDFTBaseOperator< memorySpace > &kohnShamDFTEigenOperator, chebyshevOrthogonalizedSubspaceIterationSolver &subspaceIterationSolver)
std::map< dealii::CellId, std::vector< double > > d_hessianRhoAtomsValues
Definition dft.h:1859
void trivialSolveForStress()
std::tuple< bool, double > solve(const bool computeForces=true, const bool computestress=true, const bool restartGroundStateCalcFromChk=false)
Kohn-Sham ground-state solve using SCF iteration.
dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > d_phiOutQuadValues
Definition dft.h:1816
std::vector< distributedCPUVec< double > > d_densityInNodalValues
Definition dft.h:1802
double totalCharge(const dealii::DoFHandler< 3 > &dofHandlerOfField, const std::map< dealii::CellId, std::vector< double > > *rhoQuadValues)
std::vector< const dealii::AffineConstraints< double > * > d_constraintsVector
Definition dft.h:1642
const std::vector< double > & getForceonAtoms() const
Gets the current atomic forces from dftClass.
dftfe::uInt d_lpspQuadratureId
Definition dft.h:1586
double computeAndPrintKE(dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &kineticEnergyDensityValues)
Computes the kinetic energy.
void readPSIRadialValues()
~dftClass()
dftClass destructor
distributedCPUVec< double > d_rhoNodalFieldRefined
Definition dft.h:1822
void loadQuadratureData(const std::shared_ptr< dftfe::basis::FEBasisOperations< dataTypes::number, double, dftfe::utils::MemorySpace::HOST > > &basisOperationsPtr, const dftfe::uInt quadratureId, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureValueData, const dftfe::uInt fieldDimension, const std::string &fieldName, const std::string &folderPath, const MPI_Comm &mpi_comm_parent, const MPI_Comm &mpi_comm_domain, const MPI_Comm &interpoolcomm, const MPI_Comm &interBandGroupComm)
loads data from quad points of checkpoint file. Used for restart calculations, nscf and bands.
std::vector< bool > d_isFirstFilteringCall
Definition dft.h:1974
std::vector< bool > selectedDofsHanging
Definition dft.h:1665
void run()
FIXME: legacy call, move to main.cc.
std::vector< const dealii::AffineConstraints< double > * > d_constraintsVectorElectro
Definition dft.h:1644
const std::vector< std::vector< double > > & getAtomLocationsCart() const
Gets the current atom Locations in cartesian form (origin at center of domain) from dftClass.
dftfe::uInt d_sparsityPatternQuadratureId
Definition dft.h:1597
double d_nlPSPCutOff
Definition dft.h:1500
std::map< dealii::types::global_dof_index, double > & getAtomNodeToChargeMap()
map of atom node number and atomic weight
std::map< dealii::types::global_dof_index, dealii::Point< 3 > > d_supportPointsPRefined
Definition dft.h:1641
std::vector< distributedCPUVec< double > > d_densityOutNodalValues
Definition dft.h:1803
void writeMesh(std::string meshFileName)
dealii::DoFHandler< 3 > dofHandler
Definition dft.h:1575
virtual void resetRhoNodalSplitIn(distributedCPUVec< double > &OutDensity)
vselfBinsManager< FEOrder, FEOrderElectro > d_vselfBinsManager
vselfBinsManager object
Definition dft.h:1918
double rhofieldInnerProduct(const dealii::MatrixFree< 3, double > &matrixFreeDataObject, const distributedCPUVec< double > &rhoNodalField1, const distributedCPUVec< double > &rhoNodalField2, const dftfe::uInt dofHandlerId, const dftfe::uInt quadratureId)
const dealii::MatrixFree< 3, double > & getMatrixFreeDataElectro() const
void computeRhoInitialGuessFromPSI(std::vector< std::vector< distributedCPUVec< double > > > eigenVectors)
dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > d_gradDensityTotalInValuesLpspQuad
Definition dft.h:1831
void finalizeKohnShamDFTOperator()
dftfe::uInt d_densityQuadratureIdElectro
Definition dft.h:1596
void updateAuxDensityXCMatrix(const std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > &densityQuadValues, const std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > &gradDensityQuadValues, const std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > &tauQuadValues, const std::map< dealii::CellId, std::vector< double > > &rhoCore, const std::map< dealii::CellId, std::vector< double > > &gradRhoCore, const dftfe::utils::MemoryStorage< dataTypes::number, memorySpace > &eigenVectorsFlattenedMemSpace, const std::vector< std::vector< double > > &eigenValues, const double fermiEnergy_, const double fermiEnergyUp_, const double fermiEnergyDown_, std::shared_ptr< AuxDensityMatrix< memorySpace > > auxDensityMatrixXCPtr)
bool d_isAtomsGaussianDisplacementsReadFromFile
Definition dft.h:1427
std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< dftfe::utils::MemorySpace::HOST > > d_BLASWrapperPtr
Definition dft.h:1638
double d_relativeErrorJacInvApproxPrevScfLRD
Definition dft.h:1853
dftfe::uInt d_phiPrimeDofHandlerIndexElectro
Definition dft.h:1591
void interpolateElectroNodalDataToQuadratureDataGeneral(const std::shared_ptr< dftfe::basis::FEBasisOperations< double, double, dftfe::utils::MemorySpace::HOST > > &basisOperationsPtr, const dftfe::uInt dofHandlerId, const dftfe::uInt quadratureId, const distributedCPUVec< double > &nodalField, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureValueData, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureGradValueData, const bool isEvaluateGradData=false)
interpolate nodal data to quadrature data using FEEvaluation
std::vector< double > d_dipole
Definition dft.h:1838
std::shared_ptr< hubbard< dataTypes::number, memorySpace > > d_hubbardClassPtr
Definition dft.h:2044
const std::vector< std::vector< double > > & getEigenValues() const
Get reference to the eigen values.
std::vector< double > d_gaussianConstantsForce
Definition dft.h:1432
std::shared_ptr< hubbard< dataTypes::number, memorySpace > > getHubbardClassPtr()
Returns the shared ptr to hubbard class.
dftfe::uInt d_gllQuadratureId
Definition dft.h:1589
triangulationManager * getTriangulationManager()
std::vector< double > d_smearedChargeMoments
Definition dft.h:1840
std::map< dealii::CellId, std::vector< double > > d_rhoAtomsValues
for xl-bomd
Definition dft.h:1858
dftfe::uInt d_phiExtDofHandlerIndexElectro
Definition dft.h:1577
bool d_smearedChargeMomentsComputed
Definition dft.h:1841
std::vector< double > d_imageCharges
Definition dft.h:1468
dealii::MatrixFree< 3, double > d_matrixFreeDataPRefined
Definition dft.h:1599
void updatePRefinedConstraints()
double numElectrons
Definition dft.h:1402
std::vector< orbital > waveFunctionsVector
Definition dft.h:1538
double totalCharge(const dealii::MatrixFree< 3, double > &matrixFreeDataObject, const distributedCPUVec< double > &rhoNodalField)
std::deque< distributedCPUVec< double > > d_groundStateDensityHistory
Definition dft.h:1886
void runFunctionalTest()
void addAtomicRhoQuadValuesGradients(dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureValueData, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureGradValueData, const bool isConsiderGradData=false)
add atomic densities at quadrature points
const MPI_Comm interpoolcomm
Definition dft.h:1654
void computeVselfFieldGateauxDerFD()
distributedCPUVec< double > d_rhoInNodalValuesRead
Definition dft.h:1821
dealii::TimerOutput computing_timer
compute-time logger
Definition dft.h:1790
std::vector< std::vector< dftfe::Int > > d_globalChargeIdToImageIdMapTrunc
globalChargeId to ImageChargeId Map generated with a truncated pspCutOff
Definition dft.h:1490
std::vector< double > d_imageChargesTrunc
Definition dft.h:1483
std::map< dftfe::uInt, std::map< dealii::CellId, std::vector< double > > > d_gradRhoCoreAtoms
Definition dft.h:1905
void initpRefinedObjects(const bool recomputeBasisData, const bool meshOnlyDeformed, const bool vselfPerturbationUpdateForStress=false)
std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< memorySpace > > getBLASWrapperMemSpace()
const MPI_Comm & getMPIParent() const override
const std::map< dealii::CellId, std::vector< dftfe::uInt > > & getbCellNonTrivialAtomIds() const
dftfe::uInt getNumEigenValues() const
void createpRefinedDofHandler(dealii::parallel::distributed::Triangulation< 3 > &triangulation)
const std::vector< dealii::types::global_dof_index > & getLocalDofIndicesReal() const
Get local dofs global indices real.
void solveNoSCF()
compute approximation to ground-state without solving the SCF iteration
dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > d_gradPhiOutQuadValues
Definition dft.h:1818
void applyKerkerPreconditionerToTotalDensityResidual(kerkerSolverProblem< C_rhoNodalPolyOrder< FEOrder, FEOrderElectro >()> &kerkerPreconditionedResidualSolverProblem, dealiiLinearSolver &CGSolver, const distributedCPUVec< double > &residualRho, distributedCPUVec< double > &preCondTotalDensityResidualVector)
Mixing schemes for mixing electron-density.
std::vector< dealii::types::global_dof_index > localProc_dof_indicesImag
Definition dft.h:1664
std::vector< std::vector< double > > d_atomLocationsAutoMesh
Definition dft.h:1415
double d_autoMeshMaxJacobianRatio
Definition dft.h:1551
const MPI_Comm & getMPIInterBand() const override
dftfe::uInt d_binsStartDofHandlerIndexElectro
Definition dft.h:1594
void compute_localizationLength(const std::string &locLengthFileName)
compute localization length
std::shared_ptr< dftfe::basis::FEBasisOperations< dataTypes::number, double, dftfe::utils::MemorySpace::HOST > > getBasisOperationsHost()
std::shared_ptr< dftfe::oncvClass< dataTypes::number, memorySpace > > d_oncvClassPtr
Definition dft.h:1626
std::vector< double > kPointReducedCoordinates
k point crystal coordinates
Definition dft.h:1937
std::shared_ptr< AuxDensityMatrix< memorySpace > > d_auxDensityMatrixXCInPtr
Definition dft.h:1833
std::vector< std::vector< double > > d_imagePositions
Definition dft.h:1472
triangulationManager d_mesh
Definition dft.h:1549
std::map< dealii::types::global_dof_index, dealii::Point< 3 > > d_supportPointsEigen
Definition dft.h:1641
dealii::AffineConstraints< double > d_constraintsPRefined
Definition dft.h:1738
double d_freeEnergyInitial
Definition dft.h:1959
std::map< dftfe::uInt, std::map< dealii::CellId, std::vector< double > > > d_gradRhoAtomsValuesSeparate
Definition dft.h:1861
std::vector< dftfe::uInt > d_nearestAtomIds
nearest atom ids for all domain atoms
Definition dft.h:1452
dealii::AffineConstraints< double > d_constraintsForPhiPrimeElectro
Definition dft.h:1734
void normalizeRhoInQuadValues()
normalize the input electron density
std::map< dftfe::uInt, dftfe::uInt > d_atomTypeAtributes
Definition dft.h:1407
dftfe::uInt d_phiTotAXQuadratureIdElectro
Definition dft.h:1592
void normalizeAtomicRhoQuadValues()
normalize the electron density
chebyshevOrthogonalizedSubspaceIterationSolver d_subspaceIterationSolver
Definition dft.h:1693
std::shared_ptr< dftfe::atomCenteredOrbitalsPostProcessing< dataTypes::number, memorySpace > > d_atomCenteredOrbitalsPostProcessingPtr
Definition dft.h:1630
std::vector< double > d_kPointWeights
k point weights
Definition dft.h:1940
void kohnShamEigenSpaceFirstOrderDensityMatResponse(const dftfe::uInt s, const dftfe::uInt kPointIndex, KohnShamDFTBaseOperator< dftfe::utils::MemorySpace::HOST > &kohnShamDFTEigenOperator, elpaScalaManager &elpaScala)
dftClass(const MPI_Comm &mpiCommParent, const MPI_Comm &mpi_comm_domain, const MPI_Comm &interpoolcomm, const MPI_Comm &interBandGroupComm, const std::string &scratchFolderName, dftParameters &dftParams)
dftClass constructor
std::shared_ptr< dftfe::basis::FEBasisOperations< dataTypes::number, double, memorySpace > > getBasisOperationsMemSpace()
void initImageChargesUpdateKPoints(bool flag=true)
generate image charges and update k point cartesian coordinates based on current lattice vectors
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > d_tauOutNodalValues
Definition dft.h:1810
std::map< dealii::types::global_dof_index, dealii::Point< 3 > > d_supportPoints
Definition dft.h:1640
elpaScalaManager * getElpaScalaManager() const
double getFermiEnergy() const
Get the value of fermi energy.
void kohnShamEigenSpaceCompute(const dftfe::uInt s, const dftfe::uInt kPointIndex, KohnShamDFTBaseOperator< dftfe::utils::MemorySpace::HOST > &kohnShamDFTEigenOperator, elpaScalaManager &elpaScala, chebyshevOrthogonalizedSubspaceIterationSolver &subspaceIterationSolver, std::vector< double > &residualNormWaveFunctions, const bool computeResidual, const bool useMixedPrec=false, const bool isFirstScf=false)
Function that computes the Eigen space for the Kohn Sham operator.
double fieldGradl2Norm(const dealii::MatrixFree< 3, double > &matrixFreeDataObject, const distributedCPUVec< double > &field)
std::map< dftfe::uInt, std::map< dealii::CellId, std::vector< double > > > d_hessianRhoCoreAtoms
Definition dft.h:1910
distributedCPUVec< double > d_preCondTotalDensityResidualVector
Definition dft.h:1822
distributedCPUVec< double > d_magInNodalValuesRead
Definition dft.h:1826
bool d_useHubbard
Definition dft.h:2045
std::deque< distributedCPUVec< double > > d_vcontainerVals
for low rank jacobian inverse approximation
Definition dft.h:1845
void readkPointData()
distributedCPUVec< double > d_residualPredicted
Definition dft.h:1851
std::vector< double > a0
Definition dft.h:1969
dealii::Timer d_globalTimer
Definition dft.h:1795
void noRemeshRhoDataInit()
std::vector< double > d_flatTopWidthsAutoMeshMove
Definition dft.h:1443
std::map< dealii::CellId, std::vector< double > > & getBQuadValuesAllAtoms()
non-intersecting smeared charges of all atoms at quad points
std::shared_ptr< dftfe::basis::FEBasisOperations< double, double, dftfe::utils::MemorySpace::HOST > > d_basisOperationsPtrElectroHost
Definition dft.h:1608
std::map< dealii::types::global_dof_index, double > d_atomNodeIdToChargeMap
map of atom node number and atomic weight
Definition dft.h:1915
std::vector< dealii::Tensor< 1, 3, double > > d_atomsDisplacementsGaussianRead
Gaussian displacements of atoms read from file.
Definition dft.h:1419
void interpolateDensityNodalDataToQuadratureDataLpsp(const std::shared_ptr< dftfe::basis::FEBasisOperations< double, double, dftfe::utils::MemorySpace::HOST > > &basisOperationsPtr, const dftfe::uInt dofHandlerId, const dftfe::uInt quadratureId, const distributedCPUVec< double > &nodalField, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureValueData, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureGradValueData, const bool isEvaluateGradData)
interpolate rho nodal data to quadrature data using FEEvaluation
double d_domainVolume
volume of the domain
Definition dft.h:1566
bool d_isRestartGroundStateCalcFromChk
Definition dft.h:1980
void compute_rhoOut(const bool isGroundState=false)
Computes output electron-density from wavefunctions.
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > d_densityOutQuadValues
Definition dft.h:1800
dealii::IndexSet d_locallyRelevantDofsRhoNodal
Definition dft.h:1660
dealii::ConditionalOStream pcout
device eigenvectors
Definition dft.h:1787
void calculateNearestAtomDistances()
a
std::map< dftfe::uInt, std::map< dealii::CellId, std::vector< double > > > d_rhoAtomsValuesSeparate
Definition dft.h:1861
void initUnmovedTriangulation(dealii::parallel::distributed::Triangulation< 3 > &triangulation)
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > d_tauOutQuadValues
Definition dft.h:1807
const std::set< dftfe::uInt > & getAtomTypes() const
Gets the current atom types from dftClass.
KohnShamDFTBaseOperator< memorySpace > * d_kohnShamDFTOperatorPtr
Definition dft.h:1685
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > d_gradDensityOutQuadValues
Definition dft.h:1866
std::map< dealii::CellId, std::vector< double > > d_gradRhoCore
Definition dft.h:1902
distributedCPUVec< double > d_phiExt
Definition dft.h:1883
dftfe::uInt getSmearedChargeQuadratureIdElectro()
dftfe::uInt d_phiTotDofHandlerIndexElectro
Definition dft.h:1590
dealii::AffineConstraints< double > d_constraintsPRefinedOnlyHanging
Definition dft.h:1740
const std::vector< std::vector< double > > & getCell() const
Gets the current cell lattice vectors.
const dftfe::uInt this_mpi_process
Definition dft.h:1657
void totalMagnetization(const dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &magQuadValues)
Computes net magnetization from the difference of local spin densities.
dftfe::uInt getElectroQuadratureAxId() const
dealii::IndexSet d_locallyRelevantDofsPRefined
Definition dft.h:1660
const double d_smearedChargeWidthMin
minimum smeared charge width
Definition dft.h:1536
double getEntropicEnergy() const
std::vector< double > d_nearestAtomDistances
nearest atom distances for all domain atoms
Definition dft.h:1455
std::vector< std::vector< double > > d_localVselfs
Definition dft.h:1896
dealii::AffineConstraints< double > d_constraintsRhoNodalOnlyHanging
Definition dft.h:1744
std::vector< distributedCPUVec< double > > d_densityResidualNodalValues
Definition dft.h:1803
poissonSolverProblem< FEOrder, FEOrderElectro > d_phiPrimeSolverProblem
Definition dft.h:1674
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > & getDensityInValues()
std::vector< dftfe::Int > d_imageIds
Definition dft.h:1462
void calculateSmearedChargeWidths()
a
bool d_kohnShamDFTOperatorsInitialized
Definition dft.h:1683
dftfe::uInt d_nOMPThreads
Definition dft.h:1598
const std::vector< dftfe::Int > & getImageAtomIDs() const
Gets the current image atom ids from dftClass.
void projectPreviousGroundStateRho()
project ground state electron density from previous mesh into the new mesh to be used as initial gues...
void aposterioriMeshGenerate()
dftfe::utils::MemoryStorage< dataTypes::number, dftfe::utils::MemorySpace::HOST > d_eigenVectorsDensityMatrixPrimeHost
Definition dft.h:1774
std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< dftfe::utils::MemorySpace::HOST > > d_BLASWrapperPtrHost
Definition dft.h:1623
std::vector< std::map< dealii::CellId, std::vector< dftfe::uInt > > > d_bCellNonTrivialAtomIdsBins
Definition dft.h:1523
void recomputeKPointCoordinates()
std::vector< std::vector< double > > d_meshSizes
Definition dft.h:1411
double totalCharge(const dealii::DoFHandler< 3 > &dofHandlerOfField, const distributedCPUVec< double > &rhoNodalField)
Computes total charge by integrating the electron-density.
std::map< dealii::CellId, std::vector< double > > d_gradRhoAtomsValues
Definition dft.h:1859
void initNoRemesh(const bool updateImagesAndKPointsAndVselfBins=true, const bool checkSmearedChargeWidthsForOverlap=true, const bool useSingleAtomSolutionOverride=false, const bool isMeshDeformed=false)
Does KSDFT problem pre-processing steps but without remeshing.
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > d_densityResidualQuadValues
Definition dft.h:1801
std::deque< distributedCPUVec< double > > d_fvSpin1containerVals
Definition dft.h:1850
double fermiEnergy
fermi energy
Definition dft.h:1957
dftParameters & getParametersObject() const
Get reference to dftParameters object.
std::vector< double > d_netFloatingDispSinceLastCheckForSmearedChargeOverlaps
Definition dft.h:1425
void generateImageCharges(const double pspCutOff, std::vector< dftfe::Int > &imageIds, std::vector< double > &imageCharges, std::vector< std::vector< double > > &imagePositions)
creates datastructures related to periodic image charges
std::vector< double > d_netFloatingDispSinceLastBinsUpdate
Definition dft.h:1422
dealii::AffineConstraints< double > d_constraintsForHelmholtzRhoNodal
Definition dft.h:1736
std::set< dftfe::uInt > atomTypes
Definition dft.h:1403
void initializeKohnShamDFTOperator(const bool initializeCublas=true)
dftUtils::constraintMatrixInfo< dftfe::utils::MemorySpace::HOST > d_constraintsRhoNodalInfo
Definition dft.h:1747
dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > d_phiInQuadValues
Definition dft.h:1816
dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > d_densityTotalInValuesLpspQuad
Definition dft.h:1830
dftfe::uInt d_forceDofHandlerIndex
Definition dft.h:1578
dealii::MatrixFree< 3, double > matrix_free_data
Definition dft.h:1599
void applyMultipoleDirichletBC(const dealii::DoFHandler< 3 > &_dofHandler, const dealii::AffineConstraints< double > &onlyHangingNodeConstraints, dealii::AffineConstraints< double > &constraintMatrix)
Sets inhomegeneous dirichlet boundary conditions upto quadrupole for total potential constraints on n...
void compute_fermienergy(const std::vector< std::vector< double > > &eigenValuesInput, const double numElectronsInput)
Computes Fermi-energy obtained by imposing constraint on the number of electrons.
const double d_pspCutOffTrunc
distance from the domain till which periodic images will be considered
Definition dft.h:1496
double getInternalEnergy() const
double numElectronsDown
Definition dft.h:1402
chebyshevOrthogonalizedSubspaceIterationSolver * getSubspaceIterationSolverHost()
Get the Ptr to Chebyshev solver in host.
std::vector< std::vector< double > > d_partialOccupancies
Definition dft.h:1753
dftfe::uInt numLevels
Definition dft.h:1401
dealii::AffineConstraints< double > d_noConstraints
Definition dft.h:1730
meshMovementGaussianClass d_gaussianMovePar
meshMovementGaussianClass object
Definition dft.h:1559
std::map< dealii::CellId, std::vector< double > > d_pseudoVLoc
Definition dft.h:1888
dftfe::utils::MemoryStorage< dataTypes::number, dftfe::utils::MemorySpace::HOST > d_eigenVectorsFlattenedHost
Definition dft.h:1770
dftfe::uInt d_baseDofHandlerIndexElectro
Definition dft.h:1582
dftfe::uInt d_smearedChargeQuadratureIdElectro
Definition dft.h:1584
std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< dftfe::utils::MemorySpace::HOST > > getBLASWrapperHost()
dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > d_gradPhiInQuadValues
Definition dft.h:1818
void initElectronicFields()
void compute_fermienergy_purestate(const std::vector< std::vector< double > > &eigenValuesInput, const double numElectronsInput)
find HOMO eigenvalue for pure state
dealii::AffineConstraints< double > d_constraintsForTotalPotentialElectro
Definition dft.h:1732
dispersionCorrection d_dispersionCorr
Definition dft.h:1396
void reInitializeKohnShamDFTOperator()
std::vector< std::vector< double > > d_atomLocationsInterestPseudopotential
Definition dft.h:1412
std::vector< std::vector< double > > d_imagePositionsAutoMesh
Definition dft.h:1416
dealii::TimerOutput computingTimerStandard
Definition dft.h:1791
meshMovementAffineTransform d_affineTransformMesh
affine transformation object
Definition dft.h:1556
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > d_gradDensityInQuadValues
Definition dft.h:1866
dftfe::uInt d_lpspQuadratureIdElectro
Definition dft.h:1588
elpaScalaManager * d_elpaScala
Definition dft.h:1670
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > d_densityInQuadValues
Definition dft.h:1800
std::map< dftfe::uInt, std::map< dealii::CellId, std::vector< double > > > d_pseudoVLocAtoms
Definition dft.h:1893
void interpolateDensityNodalDataToQuadratureDataGeneral(const std::shared_ptr< dftfe::basis::FEBasisOperations< double, double, dftfe::utils::MemorySpace::HOST > > &basisOperationsPtr, const dftfe::uInt dofHandlerId, const dftfe::uInt quadratureId, const distributedCPUVec< double > &nodalField, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureValueData, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureGradValueData, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureTauValueData, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureHessianValueData, const bool isEvaluateGradData=false, const bool isEvaluateTauData=false, const bool isEvaluateHessianData=false)
interpolate rho nodal data to quadrature data using FEEvaluation
std::map< dealii::CellId, std::vector< double > > d_rhoCore
Definition dft.h:1900
distributedCPUVec< double > d_phiPrime
Definition dft.h:1880
std::map< dealii::CellId, std::vector< dftfe::Int > > d_bQuadAtomIdsAllAtomsImages
Definition dft.h:1514
void resetRhoNodalIn(distributedCPUVec< double > &OutDensity)
bool scfConverged
Definition dft.h:1986
distributedCPUVec< double > d_rhoOutNodalValuesDistributed
Definition dft.h:1823
const std::vector< std::vector< double > > & getAtomLocationsFrac() const
Gets the current atom Locations in fractional form from dftClass (only applicable for periodic and se...
const dftfe::utils::MemoryStorage< dataTypes::number, memorySpace > & getEigenVectors() const
Get reference the memorySpace templated eigen vectors.
const std::vector< std::vector< double > > & getImageAtomLocationsCart() const
Gets the current image atom Locations in cartesian form (origin at center of domain) from dftClass.
const dealii::AffineConstraints< double > * getConstraintsVectorElectro()
double computeResidualQuadData(const dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &outValues, const dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &inValues, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &residualValues, const dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &JxW, const bool computeNorm)
Copies the residual residualValues=outValues-inValues.
void computeRhoNodalFirstOrderResponseFromPSIAndPSIPrime(distributedCPUVec< double > &fv, distributedCPUVec< double > &fvSpin0, distributedCPUVec< double > &fvSpin1)
void computeRhoNodalMassVector(dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &massVec)
Computes the diagonal mass matrix for rho nodal grid, used for nodal mixing.
dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > d_densityTotalOutValuesLpspQuad
Definition dft.h:1830
void determineOrbitalFilling()
distributedCPUVec< double > d_phiTotRhoIn
Definition dft.h:1871
std::vector< dealii::Point< 3 > > d_controlPointLocationsCurrentMove
Definition dft.h:1563
dftfe::uInt d_autoMesh
Definition dft.h:1552
dftfe::uInt d_nonPeriodicDensityDofHandlerIndexElectro
Definition dft.h:1581
void computeOutputDensityDirectionalDerivative(const distributedCPUVec< double > &v, const distributedCPUVec< double > &vSpin0, const distributedCPUVec< double > &vSpin1, distributedCPUVec< double > &fv, distributedCPUVec< double > &fvSpin0, distributedCPUVec< double > &fvSpin1)
dealii::AffineConstraints< double > constraintsNoneEigen
Definition dft.h:1729
void saveQuadratureData(const std::shared_ptr< dftfe::basis::FEBasisOperations< dataTypes::number, double, dftfe::utils::MemorySpace::HOST > > &basisOperationsPtr, const dftfe::uInt quadratureId, const dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureValueData, const dftfe::uInt fieldDimension, const std::string &fieldName, const std::string &folderPath, const MPI_Comm &mpi_comm_parent, const MPI_Comm &mpi_comm_domain, const MPI_Comm &interpoolcomm, const MPI_Comm &interBandGroupComm)
save data of quad points to checkpoint file. Used for restart calculations, nscf and bands.
dftfe::uInt d_densityDofHandlerIndexElectro
Definition dft.h:1580
KohnShamDFTBaseOperator< memorySpace > * getKohnShamDFTBaseOperatorClass()
get the Ptr to the operator class ( Kohn Sham Base Operator)
std::vector< double > d_generatorFlatTopWidths
composite generator flat top widths for all domain atoms
Definition dft.h:1439
const dealii::MatrixFree< 3, double > & getMatrixFreeData() const
Get matrix free data object.
const std::vector< dealii::types::global_dof_index > & getLocalDofIndicesImag() const
Get local dofs global indices imag.
std::vector< std::vector< double > > eigenValues
Definition dft.h:1752
dftfe::uInt d_numEigenValues
Number of Kohn-Sham eigen values to be computed.
Definition dft.h:299
void compute_fermienergy_constraintMagnetization(const std::vector< std::vector< double > > &eigenValuesInput)
Computes Fermi-energy obtained by imposing separate constraints on the number of spin-up and spin-dow...
std::vector< dealii::Tensor< 1, 3, double > > d_gaussianMovementAtomsNetDisplacements
Definition dft.h:1562
void determineAtomsOfInterstPseudopotential(const std::vector< std::vector< double > > &atomCoordinates)
void init()
Does KSDFT problem pre-processing steps including mesh generation calls.
void computeStress()
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > & getDensityOutValues()
void outputWfc(const std::string outputFileName="wfcOutput")
write wavefunction solution fields
std::vector< std::vector< double > > d_reciprocalLatticeVectors
Definition dft.h:1411
void compute_ldos(const std::vector< std::vector< double > > &eigenValuesInput, const std::string &fileName)
double d_minDist
Definition dft.h:1458
void solveBands()
compute bands without solving the SCF iteration
dftfe::uInt d_helmholtzDofHandlerIndexElectro
Definition dft.h:1593
std::vector< dealii::types::global_dof_index > localProc_dof_indicesReal
Definition dft.h:1663
dftfe::uInt getElectroQuadratureRhsId() const
distributedCPUVec< double > d_tempEigenVec
Definition dft.h:1978
forceClass< FEOrder, FEOrderElectro, memorySpace > * forcePtr
Definition dft.h:1667
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > d_tauResidualNodalValues
Definition dft.h:1810
void writeBands()
write the KS eigen values for given BZ sampling/path
bool d_tolReached
Definition dft.h:1855
void normalizeRhoOutQuadValues()
normalize the output total electron density in each scf
void moveMeshToAtoms(dealii::Triangulation< 3, 3 > &triangulationMove, dealii::Triangulation< 3, 3 > &triangulationSerial, bool reuseFlag=false, bool moveSubdivided=false)
moves the triangulation vertices using Gaussians such that the all atoms are on triangulation vertice...
double d_pspCutOff
distance from the domain till which periodic images will be considered
Definition dft.h:1493
double getCellVolume() const
Gets the current cell volume.
void loadTriaInfoAndRhoNodalData()
load triangulation information rho quadrature data from checkpoint file for restarted run
std::vector< distributedCPUVec< double > > d_vselfFieldGateauxDerStrainFDBins
Definition dft.h:1923
std::deque< distributedCPUVec< double > > d_fvSpin0containerVals
Definition dft.h:1848
virtual void writeGSElectronDensity(const std::string Path) const
writes quadrature grid information and associated spin-up and spin-down electron-density for post-pro...
dftfe::uInt d_forceDofHandlerIndexElectro
Definition dft.h:1583
const MPI_Comm & getMPIDomain() const override
const expConfiningPotential & getConfiningPotential() const
const std::vector< dealii::types::global_dof_index > & getLocalProcDofIndicesImag() const
Get local dofs local proc indices imag.
dealii::IndexSet locally_relevant_dofsEigen
Definition dft.h:1659
dealii::IndexSet locally_relevant_dofs
Definition dft.h:1659
dftfe::uInt d_densityQuadratureId
Definition dft.h:1595
double computeTraceXtKX(dftfe::uInt numberWaveFunctionsEstimate)
dftfe::uInt d_feOrderPlusOneQuadratureId
Definition dft.h:1587
int lowerBoundKindex
global k index of lower bound of the local k point set
Definition dft.h:1947
void initPseudoPotentialAll(const bool updateNonlocalSparsity=true)
void computeMultipoleMoments(const std::shared_ptr< dftfe::basis::FEBasisOperations< double, double, dftfe::utils::MemorySpace::HOST > > &basisOperationsPtr, const dftfe::uInt densityQuadratureId, const dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &rhoQuadValues, const std::map< dealii::CellId, std::vector< double > > *bQuadValues)
dftfe::uInt d_nlpspQuadratureId
Definition dft.h:1585
void computeRhoNodalFromPSI()
computes density nodal data from wavefunctions
const dftfe::uInt n_mpi_processes
Definition dft.h:1656
void initLocalPseudoPotential(const dealii::DoFHandler< 3 > &_dofHandler, const dftfe::uInt lpspQuadratureId, const dealii::MatrixFree< 3, double > &_matrix_free_data, const dftfe::uInt _phiExtDofHandlerIndex, const dealii::AffineConstraints< double > &phiExtConstraintMatrix, const std::map< dealii::types::global_dof_index, dealii::Point< 3 > > &supportPoints, const vselfBinsManager< FEOrder, FEOrderElectro > &vselfBinManager, distributedCPUVec< double > &phiExt, std::map< dealii::CellId, std::vector< double > > &_pseudoValues, std::map< dftfe::uInt, std::map< dealii::CellId, std::vector< double > > > &_pseudoValuesAtoms)
dftParameters * d_dftParamsPtr
dftParameters object
Definition dft.h:1931
std::map< dftfe::uInt, std::map< dftfe::uInt, std::map< dftfe::uInt, alglib::spline1dinterpolant > > > radValues
Definition dft.h:1542
std::deque< distributedCPUVec< double > > d_vSpin1containerVals
Definition dft.h:1849
double getTotalChargeforRhoSplit()
MixingScheme d_mixingScheme
Definition dft.h:1819
dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > d_gradDensityTotalOutValuesLpspQuad
Definition dft.h:1831
std::map< dealii::CellId, std::vector< double > > d_gradbQuadValuesAllAtoms
non-intersecting smeared charge gradients of all atoms at quad points
Definition dft.h:1506
dftfe::uInt d_eigenDofHandlerIndex
Definition dft.h:1577
std::vector< dealii::Tensor< 1, 3, double > > d_dispClosestTriaVerticesToAtoms
Definition dft.h:1944
std::shared_ptr< AuxDensityMatrix< memorySpace > > d_auxDensityMatrixXCOutPtr
Definition dft.h:1834
dealii::FESystem< 3 > FE
Definition dft.h:1574
dftfe::uInt getDensityDofHandlerIndex()
get the index of the DoF Handler corresponding to
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > d_tauResidualQuadValues
Definition dft.h:1807
std::vector< double > d_smearedChargeScaling
smeared charge normalization scaling for all domain atoms
Definition dft.h:1449
expConfiningPotential d_expConfiningPot
Definition dft.h:2043
std::vector< std::map< dealii::CellId, std::vector< dftfe::uInt > > > d_bCellNonTrivialAtomImageIdsBins
Definition dft.h:1533
std::map< dftfe::uInt, dftfe::uInt > d_atomIdPseudopotentialInterestToGlobalId
Definition dft.h:1414
void normalizeRhoMagInInitialGuessQuadValues()
normalize input mag electron density to total magnetization for use in constraint magnetization case ...
void set()
atomic system pre-processing steps.
std::map< dftfe::uInt, std::map< dftfe::uInt, std::map< dftfe::uInt, double > > > outerValues
Definition dft.h:1544
dftUtils::constraintMatrixInfo< dftfe::utils::MemorySpace::HOST > constraintsNoneDataInfo
Definition dft.h:1720
double getNumElectrons() const
Get the number of electrons.
std::shared_ptr< dftfe::basis::FEBasisOperations< dataTypes::number, double, dftfe::utils::MemorySpace::HOST > > d_basisOperationsPtrHost
Definition dft.h:1604
bool isHubbardCorrectionsUsed()
Function to check if hubbard corrections is being used.
std::vector< std::vector< dftfe::Int > > d_globalChargeIdToImageIdMap
globalChargeId to ImageChargeId Map
Definition dft.h:1475
dealii::DoFHandler< 3 > dofHandlerEigen
Definition dft.h:1575
std::vector< double > d_quadrupole
Definition dft.h:1839
Namespace which declares the input parameters and the functions to parse them from the input paramete...
Definition dftParameters.h:36
Overloads dealii's distribute and distribute_local_to_global functions associated with constraints cl...
Definition constraintMatrixInfo.h:43
Calculates dispersion correction to energy, force and stress.
Definition dftd.h:37
Manager class for ELPA and ScaLAPACK.
Definition elpaScalaManager.h:38
Definition expConfiningPotential.h:29
computes configurational forces in KSDFT
Definition force.h:52
poisson solver problem class template. template parameter FEOrderElectro is the finite element polyno...
Definition kerkerSolverProblem.h:35
Definition BLASWrapper.h:35
Class to update triangulation under affine transformation.
Definition meshMovementAffineTransform.h:30
Class to move triangulation nodes using Gaussian functions attached to control points.
Definition meshMovementGaussian.h:30
poisson solver problem class template. template parameter FEOrderElectro is the finite element polyno...
Definition poissonSolverProblem.h:38
density symmetrization based on irreducible Brillouin zone calculation, only relevant for calculation...
Definition symmetry.h:41
This class generates and stores adaptive finite element meshes for the real-space dft problem.
Definition triangulationManager.h:42
Definition MemoryStorage.h:33
Categorizes atoms into bins for efficient solution of nuclear electrostatic self-potential....
Definition vselfBinsManager.h:36
Definition FEBasisOperations.h:30
double number
Definition dftfeDataTypes.h:42
MemorySpace
Definition MemorySpaceType.h:33
@ HOST
Definition MemorySpaceType.h:34
@ DEVICE
Definition MemorySpaceType.h:36
Definition pseudoPotentialToDftfeConverter.cc:34
dealii::LinearAlgebra::distributed::Vector< elem_type, dealii::MemorySpace::Host > distributedCPUVec
Definition headers.h:92
std::uint32_t uInt
Definition TypeConfig.h:10
constexpr dftfe::uInt C_rhoNodalPolyOrder()
rho nodal polynomial order
Definition constants.h:134
std::int32_t Int
Definition TypeConfig.h:11