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>
60#include <vselfBinsManager.h>
61#include <excManager.h>
62#include <dftd.h>
63#include <force.h>
64#include "dftBase.h"
65#ifdef USE_PETSC
66# include <petsc.h>
67
68# include <slepceps.h>
69#endif
70
71#include <mixingClass.h>
72#include <oncvClass.h>
73#include <AuxDensityMatrix.h>
76
77namespace dftfe
78{
79 //
80 // Initialize Namespace
81 //
82
83
84
85#ifndef DOXYGEN_SHOULD_SKIP_THIS
86
87 struct orbital
88 {
89 unsigned int atomID;
90 unsigned int waveID;
91 unsigned int Z, n, l;
92 int m;
93 alglib::spline1dinterpolant psi;
94 };
95
96 /* code that must be skipped by Doxygen */
97 // forward declarations
98 template <unsigned int T1, unsigned int T2, dftfe::utils::MemorySpace memory>
99 class symmetryClass;
100 template <unsigned int T1, unsigned int T2, dftfe::utils::MemorySpace memory>
101 class forceClass;
102#endif /* DOXYGEN_SHOULD_SKIP_THIS */
103
104 /**
105 * @brief This class is the primary interface location of all other parts of the DFT-FE code
106 * for all steps involved in obtaining the Kohn-Sham DFT ground-state
107 * solution.
108 *
109 * @author Shiva Rudraraju, Phani Motamarri, Sambit Das
110 */
111 template <unsigned int FEOrder,
112 unsigned int FEOrderElectro,
113 dftfe::utils::MemorySpace memorySpace>
114 class dftClass : public dftBase
115 {
116 friend class forceClass<FEOrder, FEOrderElectro, memorySpace>;
117
118 friend class symmetryClass<FEOrder, FEOrderElectro, memorySpace>;
119
120 public:
121 /**
122 * @brief dftClass constructor
123 *
124 * @param[in] mpi_comm_parent parent communicator
125 * @param[in] mpi_comm_domain mpi_communicator for domain decomposition
126 * parallelization
127 * @param[in] interpoolcomm mpi_communicator for parallelization over k
128 * points
129 * @param[in] interBandGroupComm mpi_communicator for parallelization over
130 * bands
131 * @param[in] scratchFolderName scratch folder name
132 * @param[in] dftParams dftParameters object containg parameter values
133 * parsed from an input parameter file in dftfeWrapper class
134 */
135 dftClass(const MPI_Comm & mpiCommParent,
136 const MPI_Comm & mpi_comm_domain,
137 const MPI_Comm & interpoolcomm,
138 const MPI_Comm & interBandGroupComm,
139 const std::string &scratchFolderName,
140 dftParameters & dftParams);
141
142 /**
143 * @brief dftClass destructor
144 */
146
147 /**
148 * @brief atomic system pre-processing steps.
149 *
150 * Reads the coordinates of the atoms.
151 * If periodic calculation, reads fractional coordinates of atoms in the
152 * unit-cell, lattice vectors, kPoint quadrature rules to be used and also
153 * generates image atoms. Also determines orbital-ordering
154 */
155 void
157
158 /**
159 * @brief Does KSDFT problem pre-processing steps including mesh generation calls.
160 */
161 void
163
164 /**
165 * @brief Does KSDFT problem pre-processing steps but without remeshing.
166 */
167 void
168 initNoRemesh(const bool updateImagesAndKPointsAndVselfBins = true,
169 const bool checkSmearedChargeWidthsForOverlap = true,
170 const bool useSingleAtomSolutionOverride = false,
171 const bool isMeshDeformed = false);
172
173
174
175 /**
176 * @brief FIXME: legacy call, move to main.cc
177 */
178 void
180
181
182 void
184
185 /**
186 * @brief Writes inital density and mesh to file.
187 */
188 void
190
191 /**
192 * @brief compute approximation to ground-state without solving the SCF iteration
193 */
194 void
196 /**
197 * @brief Kohn-Sham ground-state solve using SCF iteration
198 *
199 * @return tuple of boolean flag on whether scf converged,
200 * and L2 norm of residual electron-density of the last SCF iteration step
201 *
202 */
203 std::tuple<bool, double>
204 solve(const bool computeForces = true,
205 const bool computestress = true,
206 const bool restartGroundStateCalcFromChk = false);
207
208 void
210
211 void
213
214
215 void
218 const distributedCPUVec<double> &vSpin0,
219 const distributedCPUVec<double> &vSpin1,
222 distributedCPUVec<double> & fvSpin1);
223
224 /**
225 * @brief Copies the residual residualValues=outValues-inValues
226 */
227 double
230 &outValues,
232 &inValues,
234 &residualValues,
236 & JxW,
237 const bool computeNorm);
238
239
240 double
242 const distributedCPUVec<double> &inValues,
243 distributedCPUVec<double> & residualValues);
244
245
246 /**
247 * @brief Computes the diagonal mass matrix for rho nodal grid, used for nodal mixing
248 */
249 void
252 &massVec);
253
254 void
255 initializeKohnShamDFTOperator(const bool initializeCublas = true);
256
257
258 void
260
261
262 void
264
265
266 double
268
269 double
271
272 double
274
277
280
281 double
283
284 void
286
287 virtual void
289
290 /**
291 * @brief Number of Kohn-Sham eigen values to be computed
292 */
293 unsigned int d_numEigenValues;
295
296
297 /**
298 * @brief Number of random wavefunctions
299 */
301
302 void
304
305 /**
306 *@brief Get local dofs global indices real
307 */
308 const std::vector<dealii::types::global_dof_index> &
310
311 /**
312 *@brief Get local dofs global indices imag
313 */
314 const std::vector<dealii::types::global_dof_index> &
316
317 /**
318 *@brief Get local dofs local proc indices real
319 */
320 const std::vector<dealii::types::global_dof_index> &
322
323 /**
324 *@brief Get local dofs local proc indices imag
325 */
326 const std::vector<dealii::types::global_dof_index> &
328
329 /**
330 *@brief Get matrix free data object
331 */
332 const dealii::MatrixFree<3, double> &
334
335
336 /** @brief Updates atom positions, remeshes/moves mesh and calls appropriate reinits.
337 *
338 * Function to update the atom positions and mesh based on the provided
339 * displacement input. Depending on the maximum displacement magnitude this
340 * function decides wether to do auto remeshing or move mesh using Gaussian
341 * functions. Additionaly this function also wraps the atom position across
342 * the periodic boundary if the atom moves across it beyond a certain
343 * magnitude. In case of floating atoms, only the atomic positions are
344 * updated keeping the mesh fixed. This function also calls initNoRemesh to
345 * reinitialize all the required FEM and KSDFT objects.
346 *
347 * @param[in] globalAtomsDisplacements vector containing the displacements
348 * (from current position) of all atoms (global).
349 * @return void.
350 */
351 void
353 const std::vector<dealii::Tensor<1, 3, double>> &globalAtomsDisplacements,
354 const double maxJacobianRatioFactor = 1.25,
355 const bool useSingleAtomSolutionsOverride = false);
356
357
358 /**
359 * @brief writes the current domain bounding vectors and atom coordinates to files, which are required for
360 * geometry relaxation restart
361
362 */
363 void
365
366 /**
367 * @brief writes the current domain bounding vectors and atom coordinates to files for
368 * structural optimization and dynamics restarts. The coordinates are stored
369 * as: 1. fractional for semi-periodic/periodic 2. Cartesian for
370 * non-periodic.
371 * @param[in] Path The folder path to store the atom coordinates required
372 * during restart.
373 */
374 void
375 writeDomainAndAtomCoordinates(const std::string Path) const;
376
377 /**
378 * @brief writes atomistics data for subsequent post-processing. Related to
379 * WRITE STRUCTURE ENERGY FORCES DATA POST PROCESS input parameter.
380 * @param[in] Path The folder path to store the atomistics data.
381 */
382 void
383 writeStructureEnergyForcesDataPostProcess(const std::string Path) const;
384
385 /**
386 * @brief writes quadrature grid information and associated spin-up
387 * and spin-down electron-density for post-processing
388 * @param[in] Path The folder path to store the atomistics data.
389 */
390 virtual void
391 writeGSElectronDensity(const std::string Path) const;
392
393
394 /**
395 * @brief Gets the current atom Locations in cartesian form
396 * (origin at center of domain) from dftClass
397 */
398 const std::vector<std::vector<double>> &
400
401 /**
402 * @brief Gets the nearest atom distance for each atom
403 */
404 const std::vector<double> &
406
407 /**
408 * @brief Gets the current image atom Locations in cartesian form
409 * (origin at center of domain) from dftClass
410 */
411 const std::vector<std::vector<double>> &
413
414 /**
415 * @brief Gets the current image atom ids from dftClass
416 */
417 const std::vector<int> &
419
420 /**
421 * @brief Gets the current atom Locations in fractional form
422 * from dftClass (only applicable for periodic and semi-periodic BCs)
423 */
424 const std::vector<std::vector<double>> &
426
427
428
429 /**
430 * @brief Gets the current cell lattice vectors
431 *
432 * @return std::vector<std::vector<double>> 3 \times 3 matrix,lattice[i][j]
433 * corresponds to jth component of ith lattice vector
434 */
435 const std::vector<std::vector<double>> &
436 getCell() const;
437
438 /**
439 * @brief Gets the current cell volume
440 *
441 */
442 double
444
445 /**
446 * @brief Gets the current atom types from dftClass
447 */
448 const std::set<unsigned int> &
450
451 /**
452 * @brief Gets the current atomic forces from dftClass
453 */
454 const std::vector<double> &
456
457 /**
458 * @brief Gets the current cell stress from dftClass
459 */
460 const dealii::Tensor<2, 3, double> &
462
463 /**
464 * @brief Get reference to dftParameters object
465 */
468
469
470 /**
471 * @brief Get reference the memorySpace templated eigen vectors
472 */
475
476 /**
477 * @brief Get reference the host eigen vectors
478 */
482
483 /**
484 * @brief Get reference to the eigen values
485 */
486 const std::vector<std::vector<double>> &
488
489 /**
490 * @brief Get the value of fermi energy
491 */
492 double
494
495 /**
496 * @brief Get the number of electrons
497 */
498 double
500
501 void
502 setNumElectrons(unsigned int inputNumElectrons);
503
506#ifdef DFTFE_WITH_DEVICE
507
508 /**
509 * @brief Get the Ptr to Chebyshev solver in device
510 */
511 chebyshevOrthogonalizedSubspaceIterationSolverDevice *
512 getSubspaceIterationSolverDevice();
513#endif
514 /**
515 * @brief Get the Ptr to Chebyshev solver in host
516 */
519
520 /**
521 * @brief Function that computes the Eigen space for the Kohn Sham operator.
522 */
523 void
525 const unsigned int s,
526 const unsigned int kPointIndex,
528 & kohnShamDFTEigenOperator,
529 elpaScalaManager & elpaScala,
530 chebyshevOrthogonalizedSubspaceIterationSolver &subspaceIterationSolver,
531 std::vector<double> & residualNormWaveFunctions,
532 const bool computeResidual,
533 const bool useMixedPrec = false,
534 const bool isFirstScf = false);
535
536
537#ifdef DFTFE_WITH_DEVICE
538 /**
539 * @brief Function that computes the Eigen space for the Kohn Sham operator in device.
540 */
541 void
543 const unsigned int s,
544 const unsigned int kPointIndex,
546 & kohnShamDFTEigenOperator,
547 elpaScalaManager &elpaScala,
548 chebyshevOrthogonalizedSubspaceIterationSolverDevice
549 & subspaceIterationSolverDevice,
550 std::vector<double> &residualNormWaveFunctions,
551 const bool computeResidual,
552 const unsigned int numberRayleighRitzAvoidancePasses = 0,
553 const bool useMixedPrec = false,
554 const bool isFirstScf = false);
555#endif
556
557 /**
558 *@brief Computes Fermi-energy obtained by imposing constraint on the number of electrons
559 */
560 void
562 const std::vector<std::vector<double>> &eigenValuesInput,
563 const double numElectronsInput);
564
565 /**
566 *@brief find HOMO eigenvalue for pure state
567 */
568 void
570 const std::vector<std::vector<double>> &eigenValuesInput,
571 const double numElectronsInput);
572
573 /**
574 *@brief Computes the kinetic energy
575 */
576 double
579 &kineticEnergyDensityValues);
580
581 /**
582 *@brief get the Ptr to the operator class ( Kohn Sham Operator)
583 */
586
587 /**
588 *@brief get the index of the DoF Handler corresponding to
589 *
590 */
591 unsigned int
593
594 unsigned int
596
597 const std::vector<double> &
599
600 unsigned int
602
605
606 const dealii::MatrixFree<3, double> &
608
609 dealii::AffineConstraints<double> *
611
612 unsigned int
614
615 unsigned int
617
618 unsigned int
620
621
622 std::shared_ptr<
624 double,
627
628 std::shared_ptr<
631
632 std::shared_ptr<
633 dftfe::basis::
634 FEBasisOperations<double, double, dftfe::utils::MemorySpace::HOST>>
636
637 std::shared_ptr<
640
641 std::shared_ptr<dftfe::linearAlgebra::BLASWrapper<memorySpace>>
643
644
645 std::shared_ptr<
648
649 std::vector<
652
653 std::vector<
656
657 /**
658 *@brief l2 projection
659 */
660 void
662 const std::shared_ptr<
664 FEBasisOperations<double, double, dftfe::utils::MemorySpace::HOST>>
665 & basisOperationsPtr,
666 const dealii::AffineConstraints<double> &constraintMatrix,
667 const unsigned int dofHandlerId,
668 const unsigned int quadratureId,
670 & quadratureValueData,
671 distributedCPUVec<double> &nodalField);
672
673 /**
674 *@brief interpolate nodal data to quadrature data using FEEvaluation
675 *
676 *@param[in] matrixFreeData matrix free data object
677 *@param[in] nodalField nodal data to be interpolated
678 *@param[out] quadratureValueData to be computed at quadrature points
679 *@param[out] quadratureGradValueData to be computed at quadrature points
680 *@param[in] isEvaluateGradData denotes a flag to evaluate gradients or not
681 */
682 void
684 const std::shared_ptr<
686 FEBasisOperations<double, double, dftfe::utils::MemorySpace::HOST>>
687 & basisOperationsPtr,
688 const unsigned int dofHandlerId,
689 const unsigned int quadratureId,
690 const distributedCPUVec<double> &nodalField,
692 &quadratureValueData,
694 & quadratureGradValueData,
695 const bool isEvaluateGradData = false);
696
697 /// map of atom node number and atomic weight
698 std::map<dealii::types::global_dof_index, double> &
700
701 /// non-intersecting smeared charges of all atoms at quad points
702 std::map<dealii::CellId, std::vector<double>> &
704
705 unsigned int
707
708 const dealii::AffineConstraints<double> *
710
711 const std::vector<std::vector<double>> &
713
714 const MPI_Comm &
715 getMPIDomain() const override;
716
717 const MPI_Comm &
718 getMPIParent() const override;
719
720 const MPI_Comm &
721 getMPIInterPool() const override;
722
723 const MPI_Comm &
724 getMPIInterBand() const override;
725
726 const std::map<dealii::CellId, std::vector<unsigned int>> &
728
729 void
731
732 void
734 const std::shared_ptr<
736 FEBasisOperations<double, double, dftfe::utils::MemorySpace::HOST>>
737 & basisOperationsPtr,
738 const unsigned int densityQuadratureId,
740 & rhoQuadValues,
741 const std::map<dealii::CellId, std::vector<double>> *bQuadValues);
742
745
746 /**
747 *@brief Returns the shared ptr to hubbard class
748 */
749 std::shared_ptr<hubbard<dataTypes::number, memorySpace>>
751
752 /**
753 *@brief Function to check if hubbard corrections is being used
754 */
755 bool
757
758 /**
759 *@brief write wavefunction solution fields
760 */
761 void
762 outputWfc(const std::string outputFileName = "wfcOutput");
763
764 /**
765 *@brief return the pseudo potential field
766 */
767 const std::map<dealii::CellId, std::vector<double>> &
769
770 private:
771 /**
772 * @brief generate image charges and update k point cartesian coordinates based
773 * on current lattice vectors
774 */
775 void
777
778 /**
779 * @brief Checks if the Exc functional requires Hubbard correction
780 * and sets up the Hubbard class if required.
781 */
782 void
784
785 void
787 const std::vector<std::vector<double>> &atomCoordinates);
788
789
790 /**
791 *@brief project ground state electron density from previous mesh into
792 * the new mesh to be used as initial guess for the new ground state solve
793 */
794 void
796
797 /**
798 *@brief save triangulation information and rho quadrature data to checkpoint file for restarts
799 */
800 void
802
803 /**
804 *@brief load triangulation information rho quadrature data from checkpoint file for restarted run
805 */
806 void
808
809 void
811 void
812 writeMesh(std::string meshFileName);
813
814 /// creates datastructures related to periodic image charges
815 void
816 generateImageCharges(const double pspCutOff,
817 std::vector<int> & imageIds,
818 std::vector<double> & imageCharges,
819 std::vector<std::vector<double>> &imagePositions);
820
821 void
823 const double pspCutOff,
824 const std::vector<int> & imageIds,
825 const std::vector<std::vector<double>> &imagePositions,
826 std::vector<std::vector<int>> & globalChargeIdToImageIdMap);
827
828 void
830
831 //
832 // generate mesh using a-posteriori error estimates
833 //
834 void
837 computeTraceXtHX(unsigned int numberWaveFunctionsEstimate);
838 double
839 computeTraceXtKX(unsigned int numberWaveFunctionsEstimate);
840
841
842 /**
843 *@brief moves the triangulation vertices using Gaussians such that the all atoms are on triangulation vertices
844 */
845 void moveMeshToAtoms(dealii::Triangulation<3, 3> &triangulationMove,
846 dealii::Triangulation<3, 3> &triangulationSerial,
847 bool reuseFlag = false,
848 bool moveSubdivided = false);
849
850 /**
851 *@brief a
852 */
853 void
855
856 /**
857 *@brief a
858 */
859 void
861
862 /**
863 * Initializes the guess of electron-density and single-atom wavefunctions
864 * on the mesh, maps finite-element nodes to given atomic positions,
865 * initializes pseudopotential files and exchange-correlation functionals to
866 * be used based on user-choice. In periodic problems, periodic faces are
867 * mapped here. Further finite-element nodes to be pinned for solving the
868 * Poisson problem electro-static potential is set here
869 */
871 dealii::parallel::distributed::Triangulation<3> &triangulation);
872 void
873 initBoundaryConditions(const bool recomputeBasisData = true,
874 const bool meshOnlyDeformed = false,
875 const bool vselfPerturbationUpdateForStress = false);
876 void
878 void
879 initPseudoPotentialAll(const bool updateNonlocalSparsity = true);
880
881 /**
882 * create a dofHandler containing finite-element interpolating polynomial
883 * twice of the original polynomial required for Kerker mixing and
884 * initialize various objects related to this refined dofHandler
885 */
887 dealii::parallel::distributed::Triangulation<3> &triangulation);
888 void
889 initpRefinedObjects(const bool recomputeBasisData,
890 const bool meshOnlyDeformed,
891 const bool vselfPerturbationUpdateForStress = false);
892
893
894 /**
895 *@brief Sets inhomegeneous dirichlet boundary conditions upto quadrupole for total potential constraints on
896 * non-periodic boundary (boundary id==0).
897 *
898 * @param[in] dofHandler
899 * @param[out] constraintMatrix dealii::AffineConstraints<double> object
900 *with inhomogeneous Dirichlet boundary condition entries added
901 */
902 void
904 const dealii::DoFHandler<3> & _dofHandler,
905 const dealii::AffineConstraints<double> &onlyHangingNodeConstraints,
906 dealii::AffineConstraints<double> & constraintMatrix);
907
908
909 /**
910 *@brief interpolate rho nodal data to quadrature data using FEEvaluation
911 *
912 *@param[in] basisOperationsPtr basisoperationsPtr object
913 *@param[in] nodalField nodal data to be interpolated
914 *@param[out] quadratureValueData to be computed at quadrature points
915 *@param[out] quadratureGradValueData to be computed at quadrature points
916 *@param[in] isEvaluateGradData denotes a flag to evaluate gradients or not
917 */
918 void
920 const std::shared_ptr<
922 FEBasisOperations<double, double, dftfe::utils::MemorySpace::HOST>>
923 & basisOperationsPtr,
924 const unsigned int dofHandlerId,
925 const unsigned int quadratureId,
926 const distributedCPUVec<double> &nodalField,
928 &quadratureValueData,
930 &quadratureGradValueData,
932 & quadratureHessianValueData,
933 const bool isEvaluateGradData = false,
934 const bool isEvaluateHessianData = false);
935
936
937
938 /**
939 *@brief interpolate rho nodal data to quadrature data using FEEvaluation
940 *
941 *@param[in] basisOperationsPtr basisoperationsPtr object
942 *@param[in] nodalField nodal data to be interpolated
943 *@param[out] quadratureValueData to be computed at quadrature points
944 *@param[out] quadratureGradValueData to be computed at quadrature points
945 *@param[in] isEvaluateGradData denotes a flag to evaluate gradients or not
946 */
947 void
949 const std::shared_ptr<
951 FEBasisOperations<double, double, dftfe::utils::MemorySpace::HOST>>
952 & basisOperationsPtr,
953 const unsigned int dofHandlerId,
954 const unsigned int quadratureId,
955 const distributedCPUVec<double> &nodalField,
957 &quadratureValueData,
959 & quadratureGradValueData,
960 const bool isEvaluateGradData);
961
962
963 /**
964 *@brief add atomic densities at quadrature points
965 *
966 */
967 void
970 &quadratureValueData,
972 & quadratureGradValueData,
973 const bool isConsiderGradData = false);
974
975
976 /**
977 *@brief Finds the global dof ids of the nodes containing atoms.
978 *
979 * @param[in] dofHandler
980 * @param[out] atomNodeIdToChargeValueMap local map of global dof id to atom
981 *charge id
982 */
983 void
984 locateAtomCoreNodes(const dealii::DoFHandler<3> &_dofHandler,
985 std::map<dealii::types::global_dof_index, double>
986 &atomNodeIdToChargeValueMap);
987
988 /**
989 *@brief Sets homogeneous dirichlet boundary conditions on a node farthest from
990 * all atoms (pinned node). This is only done in case of periodic boundary
991 *conditions to get an unique solution to the total electrostatic potential
992 *problem.
993 *
994 * @param[in] dofHandler
995 * @param[in] constraintMatrixBase base dealii::AffineConstraints<double>
996 *object
997 * @param[out] constraintMatrix dealii::AffineConstraints<double> object
998 *with homogeneous Dirichlet boundary condition entries added
999 */
1000 void
1002 const dealii::DoFHandler<3> & _dofHandler,
1003 const dealii::AffineConstraints<double> &constraintMatrixBase,
1004 dealii::AffineConstraints<double> & constraintMatrix);
1005
1006 void
1008
1010
1011 void
1013 void
1015 void
1017 std::vector<std::vector<distributedCPUVec<double>>> eigenVectors);
1018 void
1020
1021
1022 /**
1023 *@brief computes density nodal data from wavefunctions
1024 */
1025 void
1027
1028
1029 void
1033 distributedCPUVec<double> &fvSpin1);
1034
1035 void
1037 void
1039 void
1041 void
1042 loadPSIFiles(unsigned int Z,
1043 unsigned int n,
1044 unsigned int l,
1045 unsigned int &flag);
1046 void
1048 const dealii::DoFHandler<3> & _dofHandler,
1049 const unsigned int lpspQuadratureId,
1050 const dealii::MatrixFree<3, double> & _matrix_free_data,
1051 const unsigned int _phiExtDofHandlerIndex,
1052 const dealii::AffineConstraints<double> &phiExtConstraintMatrix,
1053 const std::map<dealii::types::global_dof_index, dealii::Point<3>>
1054 & supportPoints,
1055 const vselfBinsManager<FEOrder, FEOrderElectro> &vselfBinManager,
1057 std::map<dealii::CellId, std::vector<double>> & _pseudoValues,
1058 std::map<unsigned int, std::map<dealii::CellId, std::vector<double>>>
1059 &_pseudoValuesAtoms);
1060
1061
1062
1063 /**
1064 *@brief Sets homegeneous dirichlet boundary conditions for total potential constraints on
1065 * non-periodic boundary (boundary id==0).
1066 *
1067 * @param[in] dofHandler
1068 * @param[out] constraintMatrix dealii::AffineConstraints<double> object
1069 *with homogeneous Dirichlet boundary condition entries added
1070 */
1071 void
1073 const dealii::DoFHandler<3> & _dofHandler,
1074 const dealii::AffineConstraints<double> &onlyHangingNodeConstraints,
1075 dealii::AffineConstraints<double> & constraintMatrix);
1076
1077
1078
1079 /**
1080 *@brief Computes total charge by integrating the electron-density
1081 */
1082 double
1083 totalCharge(const dealii::DoFHandler<3> & dofHandlerOfField,
1084 const distributedCPUVec<double> &rhoNodalField);
1085
1086
1087 double
1089 const dealii::DoFHandler<3> & dofHandlerOfField,
1090 const std::map<dealii::CellId, std::vector<double>> *rhoQuadValues);
1091
1092 double
1094 const dealii::DoFHandler<3> &dofHandlerOfField,
1096 &rhoQuadValues);
1097
1098
1099 double
1100 totalCharge(const dealii::MatrixFree<3, double> &matrixFreeDataObject,
1101 const distributedCPUVec<double> & rhoNodalField);
1102
1103
1104
1105 double
1106 rhofieldl2Norm(const dealii::MatrixFree<3, double> &matrixFreeDataObject,
1107 const distributedCPUVec<double> & rhoNodalField,
1108 const unsigned int dofHandlerId,
1109 const unsigned int quadratureId);
1110
1111 double
1113 const dealii::MatrixFree<3, double> &matrixFreeDataObject,
1114 const distributedCPUVec<double> & rhoNodalField1,
1115 const distributedCPUVec<double> & rhoNodalField2,
1116 const unsigned int dofHandlerId,
1117 const unsigned int quadratureId);
1118
1119
1120 double
1121 fieldGradl2Norm(const dealii::MatrixFree<3, double> &matrixFreeDataObject,
1122 const distributedCPUVec<double> & field);
1123
1124
1125 /**
1126 *@brief l2 projection
1127 */
1128 void
1130 const std::shared_ptr<
1131 dftfe::basis::
1132 FEBasisOperations<double, double, dftfe::utils::MemorySpace::HOST>>
1133 & basisOperationsPtr,
1134 const dealii::AffineConstraints<double> &constraintMatrix,
1135 const unsigned int dofHandlerId,
1136 const unsigned int quadratureId,
1138 & quadratureValueData,
1139 distributedCPUVec<double> &nodalField);
1140
1141 /**
1142 *@brief Computes net magnetization from the difference of local spin densities
1143 */
1144 void
1147 &magQuadValues);
1148
1149 /**
1150 *@brief normalize the input electron density
1151 */
1152 void
1154
1155 /**
1156 *@brief normalize input mag electron density to total magnetization
1157 *for use in constraint magnetization case (only for initial guess)
1158 */
1159 void
1161
1162
1163 /**
1164 *@brief normalize the output total electron density in each scf
1165 */
1166 void
1168
1169 /**
1170 *@brief normalize the electron density
1171 */
1172 void
1174
1175 /**
1176 *@brief Computes output electron-density from wavefunctions
1177 */
1178 void
1179 compute_rhoOut(const bool isGroundState = false);
1180
1181 /**
1182 *@brief Mixing schemes for mixing electron-density
1183 */
1184
1185 void
1187#ifdef DFTFE_WITH_DEVICE
1188 kerkerSolverProblemDevice<C_rhoNodalPolyOrder<FEOrder, FEOrderElectro>()>
1189 & kerkerPreconditionedResidualSolverProblemDevice,
1190 linearSolverCGDevice &CGSolverDevice,
1191#endif
1193 & kerkerPreconditionedResidualSolverProblem,
1194 dealiiLinearSolver &CGSolver,
1195 const distributedCPUVec<double> &residualRho,
1196 distributedCPUVec<double> & preCondTotalDensityResidualVector);
1197
1198 double
1199 lowrankApproxScfDielectricMatrixInv(const unsigned int scfIter);
1200
1201 double
1203 const unsigned int scfIter);
1204 /**
1205 *@brief Computes Fermi-energy obtained by imposing separate constraints on the number of spin-up and spin-down electrons
1206 */
1207 void
1209 const std::vector<std::vector<double>> &eigenValuesInput);
1210
1211
1212 /**
1213 *@brief Find spin-up and spin-down channel HOMO eigenvalues
1214 */
1215 void
1217 const std::vector<std::vector<double>> &eigenValuesInput);
1218
1219
1220 /**
1221 *@brief compute density of states and local density of states
1222 */
1223 void
1224 compute_tdos(const std::vector<std::vector<double>> &eigenValuesInput,
1225 const std::string & fileName);
1226
1227 void
1228 compute_ldos(const std::vector<std::vector<double>> &eigenValuesInput,
1229 const std::string & fileName);
1230
1231 /**
1232 *@brief compute localization length
1233 */
1234 void
1235 compute_localizationLength(const std::string &locLengthFileName);
1236
1237 /**
1238 *@brief write electron density solution fields
1239 */
1240 void
1242
1243 /**
1244 *@brief write the KS eigen values for given BZ sampling/path
1245 */
1246 void
1248
1249 /**
1250 *@brief Computes the volume of the domain
1251 */
1252 double
1253 computeVolume(const dealii::DoFHandler<3> &_dofHandler);
1254
1255 /**
1256 *@brief Deforms the domain by the given deformation gradient and reinitializes the
1257 * dftClass datastructures.
1258 */
1259 void
1260 deformDomain(const dealii::Tensor<2, 3, double> &deformationGradient,
1261 const bool vselfPerturbationUpdateForStress = false,
1262 const bool useSingleAtomSolutionsOverride = false,
1263 const bool print = true);
1264
1265 /**
1266 *@brief Computes inner Product and Y = alpha*X + Y for complex vectors used during
1267 * periodic boundary conditions
1268 */
1269
1270#ifdef USE_COMPLEX
1271 std::complex<double>
1273
1274 void
1275 alphaTimesXPlusY(std::complex<double> alpha,
1278
1279#endif
1280 /**
1281 *@brief Sets dirichlet boundary conditions for total potential constraints on
1282 * non-periodic boundary (boundary id==0). Currently setting homogeneous bc
1283 *
1284 */
1285 void
1287
1288
1289 void
1291 const std::vector<
1293 &densityQuadValues,
1294 const std::vector<
1296 &gradDensityQuadValues,
1297 const std::map<dealii::CellId, std::vector<double>> &rhoCore,
1298 const std::map<dealii::CellId, std::vector<double>> &gradRhoCore,
1300 & eigenVectorsFlattenedMemSpace,
1301 const std::vector<std::vector<double>> &eigenValues,
1302 const double fermiEnergy_,
1303 const double fermiEnergyUp_,
1304 const double fermiEnergyDown_,
1305 std::shared_ptr<AuxDensityMatrix<memorySpace>> auxDensityMatrixXCPtr);
1306
1307 std::shared_ptr<excManager<memorySpace>> d_excManagerPtr;
1309
1310 /**
1311 * stores required data for Kohn-Sham problem
1312 */
1313 unsigned int numLevels;
1315 std::set<unsigned int> atomTypes;
1316
1317 /// FIXME: eventually it should be a map of atomic number to struct-
1318 /// {valence number, mesh input etc}
1319 std::map<unsigned int, unsigned int> d_atomTypeAtributes;
1320
1321 /// FIXME: remove atom type atributes from atomLocations
1322 std::vector<std::vector<double>> atomLocations, atomLocationsFractional,
1324 std::vector<std::vector<double>> d_atomLocationsInterestPseudopotential;
1325 std::map<unsigned int, unsigned int>
1327 std::vector<std::vector<double>> d_atomLocationsAutoMesh;
1328 std::vector<std::vector<double>> d_imagePositionsAutoMesh;
1329
1330 /// Gaussian displacements of atoms read from file
1331 std::vector<dealii::Tensor<1, 3, double>> d_atomsDisplacementsGaussianRead;
1332
1333 ///
1335
1336 ///
1338
1340
1341 /// Gaussian generator parameter for force computation and Gaussian
1342 /// deformation of atoms and FEM mesh Gaussian generator: Gamma(r)=
1343 /// exp(-(r/d_gaussianConstant)^2) Stored for all domain atoms
1344 std::vector<double> d_gaussianConstantsForce;
1345
1346 /// Gaussian constants for automesh mesh movement stored for all domain
1347 /// atoms
1348 std::vector<double> d_gaussianConstantsAutoMesh;
1349
1350 /// composite generator flat top widths for all domain atoms
1351 std::vector<double> d_generatorFlatTopWidths;
1352
1353 /// flat top widths for all domain atoms in case of automesh mesh movement
1354 /// composite gaussian
1355 std::vector<double> d_flatTopWidthsAutoMeshMove;
1356
1357 /// smeared charge widths for all domain atoms
1358 std::vector<double> d_smearedChargeWidths;
1359
1360 /// smeared charge normalization scaling for all domain atoms
1361 std::vector<double> d_smearedChargeScaling;
1362
1363 /// nearest atom ids for all domain atoms
1364 std::vector<unsigned int> d_nearestAtomIds;
1365
1366 /// nearest atom distances for all domain atoms
1367 std::vector<double> d_nearestAtomDistances;
1368
1369 ///
1371
1372 /// vector of lendth number of periodic image charges with corresponding
1373 /// master chargeIds
1374 std::vector<int> d_imageIds;
1375 // std::vector<int> d_imageIdsAutoMesh;
1376
1377
1378 /// vector of length number of periodic image charges with corresponding
1379 /// charge values
1380 std::vector<double> d_imageCharges;
1381
1382 /// vector of length number of periodic image charges with corresponding
1383 /// positions in cartesian coordinates
1384 std::vector<std::vector<double>> d_imagePositions;
1385
1386 /// globalChargeId to ImageChargeId Map
1387 std::vector<std::vector<int>> d_globalChargeIdToImageIdMap;
1388
1389 /// vector of lendth number of periodic image charges with corresponding
1390 /// master chargeIds , generated with a truncated pspCutoff
1391 std::vector<int> d_imageIdsTrunc;
1392
1393 /// vector of length number of periodic image charges with corresponding
1394 /// charge values , generated with a truncated pspCutoff
1395 std::vector<double> d_imageChargesTrunc;
1396
1397 /// vector of length number of periodic image charges with corresponding
1398 /// positions in cartesian coordinates, generated with a truncated pspCutOff
1399 std::vector<std::vector<double>> d_imagePositionsTrunc;
1400
1401 /// globalChargeId to ImageChargeId Map generated with a truncated pspCutOff
1402 std::vector<std::vector<int>> d_globalChargeIdToImageIdMapTrunc;
1403
1404 /// distance from the domain till which periodic images will be considered
1405 double d_pspCutOff = 15.0;
1406
1407 /// distance from the domain till which periodic images will be considered
1408 const double d_pspCutOffTrunc = 15.0;
1409
1410 /// cut-off distance from atom till which non-local projectors are
1411 /// non-trivial
1412 double d_nlPSPCutOff = 8.0;
1413
1414 /// non-intersecting smeared charges of all atoms at quad points
1415 std::map<dealii::CellId, std::vector<double>> d_bQuadValuesAllAtoms;
1416
1417 /// non-intersecting smeared charge gradients of all atoms at quad points
1418 std::map<dealii::CellId, std::vector<double>> d_gradbQuadValuesAllAtoms;
1419
1420 /// non-intersecting smeared charges atom ids of all atoms at quad points
1421 std::map<dealii::CellId, std::vector<int>> d_bQuadAtomIdsAllAtoms;
1422
1423 /// non-intersecting smeared charges atom ids of all atoms (with image atom
1424 /// ids separately accounted) at quad points
1425 std::map<dealii::CellId, std::vector<int>> d_bQuadAtomIdsAllAtomsImages;
1426
1427 /// map of cell and non-trivial global atom ids (no images) for smeared
1428 /// charges for each bin
1429 std::map<dealii::CellId, std::vector<unsigned int>>
1431
1432 /// map of cell and non-trivial global atom ids (no images) for smeared
1433 /// charge for each bin
1434 std::vector<std::map<dealii::CellId, std::vector<unsigned int>>>
1436
1437 /// map of cell and non-trivial global atom and image ids for smeared
1438 /// charges for each bin
1439 std::map<dealii::CellId, std::vector<unsigned int>>
1441
1442 /// map of cell and non-trivial global atom and image ids for smeared charge
1443 /// for each bin
1444 std::vector<std::map<dealii::CellId, std::vector<unsigned int>>>
1446
1447 /// minimum smeared charge width
1448 const double d_smearedChargeWidthMin = 0.4;
1449
1450 std::vector<orbital> waveFunctionsVector;
1451 std::map<unsigned int,
1452 std::map<unsigned int,
1453 std::map<unsigned int, alglib::spline1dinterpolant>>>
1455 std::map<unsigned int,
1456 std::map<unsigned int, std::map<unsigned int, double>>>
1458
1459 /**
1460 * meshGenerator based object
1461 */
1463
1465 unsigned int d_autoMesh;
1466
1467
1468 /// affine transformation object
1470
1471 /// meshMovementGaussianClass object
1473
1474 std::vector<dealii::Tensor<1, 3, double>>
1476 std::vector<dealii::Point<3>> d_controlPointLocationsCurrentMove;
1477
1478 /// volume of the domain
1480
1481 /// init wfc trunctation radius
1483
1484 /**
1485 * dealii based FE data structres
1486 */
1487 dealii::FESystem<3> FE, FEEigen;
1502 unsigned int d_gllQuadratureId;
1511 unsigned int d_nOMPThreads;
1512 dealii::MatrixFree<3, double> matrix_free_data, d_matrixFreeDataPRefined;
1513 std::shared_ptr<
1515 double,
1518 std::shared_ptr<
1519 dftfe::basis::
1520 FEBasisOperations<double, double, dftfe::utils::MemorySpace::HOST>>
1522#if defined(DFTFE_WITH_DEVICE)
1523 std::shared_ptr<
1525 double,
1527 d_basisOperationsPtrDevice;
1528 std::shared_ptr<
1529 dftfe::basis::
1530 FEBasisOperations<double, double, dftfe::utils::MemorySpace::DEVICE>>
1531 d_basisOperationsPtrElectroDevice;
1532#endif
1533
1534 std::shared_ptr<
1537
1538 std::shared_ptr<dftfe::oncvClass<dataTypes::number, memorySpace>>
1540
1541 std::shared_ptr<
1544
1545 std::shared_ptr<
1546#if defined(DFTFE_WITH_DEVICE)
1548#else
1550#endif
1552
1553 std::map<dealii::types::global_dof_index, dealii::Point<3>> d_supportPoints,
1555 std::vector<const dealii::AffineConstraints<double> *> d_constraintsVector;
1556 std::vector<const dealii::AffineConstraints<double> *>
1558
1559 /**
1560 * parallel objects
1561 */
1562 const MPI_Comm mpi_communicator;
1563#if defined(DFTFE_WITH_DEVICE)
1564 utils::DeviceCCLWrapper *d_devicecclMpiCommDomainPtr;
1565#endif
1566 const MPI_Comm d_mpiCommParent;
1567 const MPI_Comm interpoolcomm;
1568 const MPI_Comm interBandGroupComm;
1569 const unsigned int n_mpi_processes;
1570 const unsigned int this_mpi_process;
1574 std::vector<dealii::types::global_dof_index> local_dof_indicesReal,
1576 std::vector<dealii::types::global_dof_index> localProc_dof_indicesReal,
1578 std::vector<bool> selectedDofsHanging;
1579
1582
1584
1586
1588#ifdef DFTFE_WITH_DEVICE
1589 poissonSolverProblemDevice<FEOrder, FEOrderElectro>
1590 d_phiTotalSolverProblemDevice;
1591
1592 poissonSolverProblemDevice<FEOrder, FEOrderElectro>
1593 d_phiPrimeSolverProblemDevice;
1594#endif
1595
1597
1599
1600 const std::string d_dftfeScratchFolderName;
1601
1602 /**
1603 * chebyshev subspace iteration solver objects
1604 *
1605 */
1607#ifdef DFTFE_WITH_DEVICE
1608 chebyshevOrthogonalizedSubspaceIterationSolverDevice
1609 d_subspaceIterationSolverDevice;
1610#endif
1611
1612 /**
1613 * constraint Matrices
1614 */
1615
1616 /**
1617 *object which is used to store dealii constraint matrix information
1618 *using STL vectors. The relevant dealii constraint matrix
1619 *has hanging node constraints and periodic constraints(for periodic
1620 *problems) used in eigen solve
1621 */
1624
1625
1626 /**
1627 *object which is used to store dealii constraint matrix information
1628 *using STL vectors. The relevant dealii constraint matrix
1629 *has hanging node constraints used in Poisson problem solution
1630 *
1631 */
1634
1635
1636#ifdef DFTFE_WITH_DEVICE
1638 d_constraintsNoneDataInfoDevice;
1639#endif
1640
1641
1642 dealii::AffineConstraints<double> constraintsNone, constraintsNoneEigen,
1644
1645 dealii::AffineConstraints<double> d_constraintsForTotalPotentialElectro;
1646
1647 dealii::AffineConstraints<double> d_constraintsForPhiPrimeElectro;
1648
1649 dealii::AffineConstraints<double> d_constraintsForHelmholtzRhoNodal;
1650
1651 dealii::AffineConstraints<double> d_constraintsPRefined;
1652
1653 dealii::AffineConstraints<double> d_constraintsPRefinedOnlyHanging;
1654
1655 dealii::AffineConstraints<double> d_constraintsRhoNodal;
1656
1657 dealii::AffineConstraints<double> d_constraintsRhoNodalOnlyHanging;
1658
1661
1662 /**
1663 * data storage for Kohn-Sham eigenvalues and partial occupancies
1664 */
1665 std::vector<std::vector<double>> eigenValues;
1666 std::vector<std::vector<double>> d_partialOccupancies;
1667
1668 /**
1669 * data storage for the occupancy of Kohn-Sham wavefunctions
1670 */
1671 std::vector<std::vector<double>> d_fracOccupancy;
1672
1673 std::vector<std::vector<double>> d_densityMatDerFermiEnergy;
1674
1675 /**
1676 * The indexing of d_eigenVectorsFlattenedHost and
1677 * d_eigenVectorsFlattenedDevice [kPoint * numSpinComponents *
1678 * numLocallyOwnedNodes * numWaveFunctions + iSpin * numLocallyOwnedNodes *
1679 * numWaveFunctions + iNode * numWaveFunctions + iWaveFunction]
1680 */
1684
1688
1689 /// device eigenvectors
1690#ifdef DFTFE_WITH_DEVICE
1693 d_eigenVectorsFlattenedDevice;
1696 d_eigenVectorsDensityMatrixPrimeFlattenedDevice;
1697#endif
1698
1699 /// parallel message stream
1700 dealii::ConditionalOStream pcout;
1701
1702 /// compute-time logger
1703 dealii::TimerOutput computing_timer;
1704 dealii::TimerOutput computingTimerStandard;
1705
1706 /// A plain global timer to track only the total elapsed time after every
1707 /// ground-state solve
1708 dealii::Timer d_globalTimer;
1709
1710 // dft related objects
1711 std::vector<
1715 std::vector<distributedCPUVec<double>> d_densityInNodalValues,
1717
1718 // std::map<dealii::CellId, std::vector<double>> d_phiInValues,
1719 // d_phiOutValues;
1725
1729
1730
1732
1733
1737
1738 std::shared_ptr<AuxDensityMatrix<memorySpace>> d_auxDensityMatrixXCInPtr;
1739 std::shared_ptr<AuxDensityMatrix<memorySpace>> d_auxDensityMatrixXCOutPtr;
1740
1741 // For multipole boundary conditions
1743 std::vector<double> d_dipole;
1744 std::vector<double> d_quadrupole;
1745 std::vector<double> d_smearedChargeMoments;
1747
1748
1749 /// for low rank jacobian inverse approximation
1750 std::deque<distributedCPUVec<double>> d_vcontainerVals;
1751 std::deque<distributedCPUVec<double>> d_fvcontainerVals;
1752 std::deque<distributedCPUVec<double>> d_vSpin0containerVals;
1753 std::deque<distributedCPUVec<double>> d_fvSpin0containerVals;
1754 std::deque<distributedCPUVec<double>> d_vSpin1containerVals;
1755 std::deque<distributedCPUVec<double>> d_fvSpin1containerVals;
1757 unsigned int d_rankCurrentLRD;
1761
1762 /// for xl-bomd
1763 std::map<dealii::CellId, std::vector<double>> d_rhoAtomsValues,
1765 std::map<unsigned int, std::map<dealii::CellId, std::vector<double>>>
1768
1769 std::vector<
1773
1774 // storage for total electrostatic potential solution vector corresponding
1775 // to input scf electron density
1777
1778 // storage for total electrostatic potential solution vector corresponding
1779 // to output scf electron density
1781
1782 // storage for electrostatic potential Gateaux derivate corresponding
1783 // to electron number preserving electron-density peturbation (required for
1784 // LRDM)
1786
1787 // storage for sum of nuclear electrostatic potential
1789
1790 // storage of densities for xl-bomd
1791 std::deque<distributedCPUVec<double>> d_groundStateDensityHistory;
1792
1793 std::map<dealii::CellId, std::vector<double>> d_pseudoVLoc;
1794
1795 /// Internal data:: map for cell id to Vpseudo local of individual atoms.
1796 /// Only for atoms whose psp tail intersects the local domain.
1797 std::map<unsigned int, std::map<dealii::CellId, std::vector<double>>>
1799
1800
1801 std::vector<std::vector<double>> d_localVselfs;
1802
1803 // nonlocal pseudopotential related objects used only for pseudopotential
1804 // calculation
1805 std::map<dealii::CellId, std::vector<double>> d_rhoCore;
1806
1807 std::map<dealii::CellId, std::vector<double>> d_gradRhoCore;
1808
1809 std::map<unsigned int, std::map<dealii::CellId, std::vector<double>>>
1811
1812 std::map<dealii::CellId, std::vector<double>> d_hessianRhoCore;
1813
1814 std::map<unsigned int, std::map<dealii::CellId, std::vector<double>>>
1816
1817
1818
1819 /// map of atom node number and atomic weight
1820 std::map<dealii::types::global_dof_index, double> d_atomNodeIdToChargeMap;
1821
1822 /// vselfBinsManager object
1824
1825 /// Gateaux derivative of vself field with respect to affine strain tensor
1826 /// components using central finite difference. This is used for cell stress
1827 /// computation
1828 std::vector<distributedCPUVec<double>> d_vselfFieldGateauxDerStrainFDBins;
1829
1830 /// Compute Gateaux derivative of vself field in bins with respect to affine
1831 /// strain tensor components
1832 void
1834
1835 /// dftParameters object
1837
1838 /// kPoint cartesian coordinates
1839 std::vector<double> d_kPointCoordinates;
1840
1841 /// k point crystal coordinates
1842 std::vector<double> kPointReducedCoordinates;
1843
1844 /// k point weights
1845 std::vector<double> d_kPointWeights;
1846
1847 /// closest tria vertex
1848 std::vector<dealii::Point<3>> d_closestTriaVertexToAtomsLocation;
1849 std::vector<dealii::Tensor<1, 3, double>> d_dispClosestTriaVerticesToAtoms;
1850
1851 /// global k index of lower bound of the local k point set
1852 unsigned int lowerBoundKindex = 0;
1853 /**
1854 * Recomputes the k point cartesian coordinates from the crystal k point
1855 * coordinates and the current lattice vectors, which can change in each
1856 * ground state solve dutring cell optimization.
1857 */
1858 void
1860
1861 /// fermi energy
1863
1865
1867
1868 /// entropic energy
1870
1871 // chebyshev filter variables and functions
1872 // int numPass ; // number of filter passes
1873
1874 std::vector<double> a0;
1875 std::vector<double> bLow;
1876
1877 /// stores flag for first ever call to chebyshev filtering for a given FEM
1878 /// mesh vector for each k point and spin
1879 std::vector<bool> d_isFirstFilteringCall;
1880
1882
1884
1886
1887
1888 /**
1889 * @ nscf variables
1890 */
1892 void
1894 KohnShamHamiltonianOperator<memorySpace> & kohnShamDFTEigenOperator,
1895 chebyshevOrthogonalizedSubspaceIterationSolver &subspaceIterationSolver);
1896 void
1898 KohnShamHamiltonianOperator<memorySpace> & kohnShamDFTEigenOperator,
1899 poissonSolverProblem<FEOrder, FEOrderElectro> &phiTotalSolverProblem,
1900 dealiiLinearSolver & CGSolver);
1901
1902 /**
1903 * @brief compute the maximum of the residual norm of the highest occupied state among all k points
1904 */
1905 double
1907 const std::vector<std::vector<double>>
1908 &residualNormWaveFunctionsAllkPoints,
1909 const std::vector<std::vector<double>> &eigenValuesAllkPoints,
1910 const double _fermiEnergy);
1911
1912
1913 /**
1914 * @brief compute the maximum of the residual norm of the highest state of interest among all k points
1915 */
1916 double
1918 const std::vector<std::vector<double>>
1919 &residualNormWaveFunctionsAllkPoints,
1920 const std::vector<std::vector<double>> &eigenValuesAllkPoints,
1921 const unsigned int highestState);
1922
1923
1924
1925#ifdef DFTFE_WITH_DEVICE
1926 void
1928 const unsigned int s,
1929 const unsigned int kPointIndex,
1931 & kohnShamDFTEigenOperator,
1932 elpaScalaManager &elpaScala,
1933 chebyshevOrthogonalizedSubspaceIterationSolverDevice
1934 &subspaceIterationSolverDevice);
1935
1936#endif
1937
1938 void
1940 const unsigned int s,
1941 const unsigned int kPointIndex,
1943 & kohnShamDFTEigenOperator,
1944 elpaScalaManager &elpaScala);
1945
1946 void
1948 const unsigned int spinType,
1949 const unsigned int kPointIndex,
1951 & kohnShamDFTEigenOperator,
1952 chebyshevOrthogonalizedSubspaceIterationSolver &subspaceIterationSolver,
1953 std::vector<double> & residualNormWaveFunctions,
1954 unsigned int ipass);
1955
1957 std::shared_ptr<hubbard<dataTypes::number, memorySpace>> d_hubbardClassPtr;
1959 };
1960
1961} // namespace dftfe
1962
1963#endif
Definition AuxDensityMatrix.h:33
Definition KohnShamHamiltonianOperator.h:36
This class performs the anderson mixing in a variable agnostic way This class takes can take differen...
Definition mixingClass.h:48
Definition atomCenteredPostProcessing.h:30
Definition FEBasisOperations.h:84
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:1752
double d_atomicRhoScalingFac
Definition dft.h:1009
const std::string d_dftfeScratchFolderName
Definition dft.h:1600
double rhofieldInnerProduct(const dealii::MatrixFree< 3, double > &matrixFreeDataObject, const distributedCPUVec< double > &rhoNodalField1, const distributedCPUVec< double > &rhoNodalField2, const unsigned int dofHandlerId, const unsigned int quadratureId)
double d_freeEnergy
Definition dft.h:1866
unsigned int d_phiExtDofHandlerIndexElectro
Definition dft.h:1490
std::vector< unsigned int > d_nearestAtomIds
nearest atom ids for all domain atoms
Definition dft.h:1364
const std::vector< std::vector< double > > & getLocalVselfs() const
const MPI_Comm & getMPIInterPool() const override
std::map< dealii::CellId, std::vector< unsigned int > > d_bCellNonTrivialAtomImageIds
Definition dft.h:1440
double computeMaximumHighestOccupiedStateResidualNorm(const std::vector< std::vector< double > > &residualNormWaveFunctionsAllkPoints, const std::vector< std::vector< double > > &eigenValuesAllkPoints, const unsigned int highestState)
compute the maximum of the residual norm of the highest state of interest among all k points
unsigned int d_phiTotAXQuadratureIdElectro
Definition dft.h:1505
std::vector< double > d_upperBoundUnwantedSpectrumValues
Definition dft.h:1881
const MPI_Comm d_mpiCommParent
Definition dft.h:1566
unsigned int d_densityDofHandlerIndex
Definition dft.h:1492
distributedCPUVec< double > d_phiTotRhoOut
Definition dft.h:1780
std::vector< std::vector< double > > atomLocationsFractional
Definition dft.h:1322
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:1869
std::vector< double > d_gaussianConstantsAutoMesh
Definition dft.h:1348
const distributedCPUVec< double > & getRhoNodalOut() const
void initBoundaryConditions(const bool recomputeBasisData=true, const bool meshOnlyDeformed=false, const bool vselfPerturbationUpdateForStress=false)
std::vector< std::vector< double > > d_fracOccupancy
Definition dft.h:1671
void initAtomicRho()
std::map< dealii::CellId, std::vector< double > > d_hessianRhoCore
Definition dft.h:1812
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 writeMesh()
Writes inital density and mesh to file.
void kohnShamEigenSpaceCompute(const unsigned int s, const unsigned int kPointIndex, KohnShamHamiltonianOperator< 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.
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:1575
const std::vector< double > & getKPointWeights() const
const MPI_Comm mpi_communicator
Definition dft.h:1562
const dftfe::utils::MemoryStorage< dataTypes::number, dftfe::utils::MemorySpace::HOST > & getEigenVectorsHost() const
Get reference the host eigen vectors.
double d_monopole
Definition dft.h:1742
const std::vector< double > & getNearestAtomDistance() const
Gets the nearest atom distance for each atom.
dealii::IndexSet locally_owned_dofs
Definition dft.h:1571
dealii::DoFHandler< 3 > d_dofHandlerRhoNodal
Definition dft.h:1489
void generateMPGrid()
const std::map< dealii::CellId, std::vector< double > > & getPseudoVLoc() const
return the pseudo potential field
double numElectronsUp
Definition dft.h:1314
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:1323
unsigned int d_phiPrimeDofHandlerIndexElectro
Definition dft.h:1504
dealii::AffineConstraints< double > constraintsNone
Definition dft.h:1642
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:1488
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:1571
std::map< unsigned int, std::map< dealii::CellId, std::vector< double > > > d_gradRhoAtomsValuesSeparate
Definition dft.h:1766
std::vector< std::vector< int > > d_globalChargeIdToImageIdMapTrunc
globalChargeId to ImageChargeId Map generated with a truncated pspCutOff
Definition dft.h:1402
std::map< dealii::CellId, std::vector< unsigned int > > d_bCellNonTrivialAtomIds
Definition dft.h:1430
std::vector< dealii::Point< 3 > > d_closestTriaVertexToAtomsLocation
closest tria vertex
Definition dft.h:1848
std::deque< distributedCPUVec< double > > d_fvcontainerVals
Definition dft.h:1751
double fermiEnergyUp
Definition dft.h:1862
std::vector< std::vector< double > > d_densityMatDerFermiEnergy
Definition dft.h:1673
void l2ProjectionQuadDensityMinusAtomicDensity(const std::shared_ptr< dftfe::basis::FEBasisOperations< double, double, dftfe::utils::MemorySpace::HOST > > &basisOperationsPtr, const dealii::AffineConstraints< double > &constraintMatrix, const unsigned int dofHandlerId, const unsigned int quadratureId, const dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureValueData, distributedCPUVec< double > &nodalField)
l2 projection
poissonSolverProblem< FEOrder, FEOrderElectro > d_phiTotalSolverProblem
Definition dft.h:1585
std::map< unsigned int, std::map< dealii::CellId, std::vector< double > > > d_gradRhoCoreAtoms
Definition dft.h:1810
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 ...
unsigned int d_eigenDofHandlerIndex
Definition dft.h:1490
std::map< dealii::CellId, std::vector< double > > d_bQuadValuesAllAtoms
non-intersecting smeared charges of all atoms at quad points
Definition dft.h:1415
unsigned int d_densityQuadratureIdElectro
Definition dft.h:1509
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > d_gradDensityResidualQuadValues
Definition dft.h:1772
const MPI_Comm interBandGroupComm
Definition dft.h:1568
std::vector< dealii::types::global_dof_index > local_dof_indicesReal
Definition dft.h:1574
std::vector< std::vector< double > > atomLocations
FIXME: remove atom type atributes from atomLocations.
Definition dft.h:1322
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:1839
std::map< unsigned int, std::map< dealii::CellId, std::vector< double > > > d_rhoAtomsValuesSeparate
Definition dft.h:1766
double fermiEnergyDown
Definition dft.h:1862
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:1623
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 loadPSIFiles(unsigned int Z, unsigned int n, unsigned int l, unsigned int &flag)
void generateImageCharges(const double pspCutOff, std::vector< int > &imageIds, std::vector< double > &imageCharges, std::vector< std::vector< double > > &imagePositions)
creates datastructures related to periodic image charges
void outputDensity()
write electron density solution fields
unsigned int d_densityDofHandlerIndexElectro
Definition dft.h:1493
std::shared_ptr< dftfe::basis::FEBasisOperations< double, double, dftfe::utils::MemorySpace::HOST > > getBasisOperationsElectroHost()
unsigned int d_feOrderPlusOneQuadratureId
Definition dft.h:1500
dealii::AffineConstraints< double > d_constraintsRhoNodal
Definition dft.h:1655
dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > d_gradPhiResQuadValues
Definition dft.h:1723
double d_residualNormPredicted
Definition dft.h:1759
double lowrankApproxScfDielectricMatrixInvSpinPolarized(const unsigned int scfIter)
void createMasterChargeIdToImageIdMaps(const double pspCutOff, const std::vector< int > &imageIds, const std::vector< std::vector< double > > &imagePositions, std::vector< std::vector< int > > &globalChargeIdToImageIdMap)
void initnscf(KohnShamHamiltonianOperator< memorySpace > &kohnShamDFTEigenOperator, poissonSolverProblem< FEOrder, FEOrderElectro > &phiTotalSolverProblem, dealiiLinearSolver &CGSolver)
void kohnShamEigenSpaceFirstOrderDensityMatResponse(const unsigned int s, const unsigned int kPointIndex, KohnShamHamiltonianOperator< dftfe::utils::MemorySpace::HOST > &kohnShamDFTEigenOperator, elpaScalaManager &elpaScala)
void computeMultipoleMoments(const std::shared_ptr< dftfe::basis::FEBasisOperations< double, double, dftfe::utils::MemorySpace::HOST > > &basisOperationsPtr, const unsigned int densityQuadratureId, const dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &rhoQuadValues, const std::map< dealii::CellId, std::vector< double > > *bQuadValues)
unsigned int getElectroQuadratureRhsId() const
const std::vector< int > & getImageAtomIDs() const
Gets the current image atom ids from dftClass.
std::shared_ptr< excManager< memorySpace > > d_excManagerPtr
Definition dft.h:1307
std::vector< double > bLow
Definition dft.h:1875
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:1581
std::vector< std::vector< double > > d_imagePositionsTrunc
Definition dft.h:1399
double d_wfcInitTruncation
init wfc trunctation radius
Definition dft.h:1482
std::vector< double > d_smearedChargeWidths
smeared charge widths for all domain atoms
Definition dft.h:1358
unsigned int lowerBoundKindex
global k index of lower bound of the local k point set
Definition dft.h:1852
double d_groundStateEnergy
Definition dft.h:1862
unsigned int getDensityDofHandlerIndex()
get the index of the DoF Handler corresponding to
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:1487
distributedCPUVec< double > d_rhoOutNodalValuesSplit
Definition dft.h:1726
void initLocalPseudoPotential(const dealii::DoFHandler< 3 > &_dofHandler, const unsigned int lpspQuadratureId, const dealii::MatrixFree< 3, double > &_matrix_free_data, const unsigned int _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< unsigned int, std::map< dealii::CellId, std::vector< double > > > &_pseudoValuesAtoms)
const std::vector< dealii::types::global_dof_index > & getLocalProcDofIndicesReal() const
Get local dofs local proc indices real.
double computeVolume(const dealii::DoFHandler< 3 > &_dofHandler)
Computes the volume of the domain.
unsigned int d_smearedChargeQuadratureIdElectro
Definition dft.h:1497
std::map< dealii::CellId, std::vector< double > > d_hessianRhoAtomsValues
Definition dft.h:1764
void trivialSolveForStress()
void setNumElectrons(unsigned int inputNumElectrons)
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:1721
std::vector< distributedCPUVec< double > > d_densityInNodalValues
Definition dft.h:1715
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:1555
const std::vector< double > & getForceonAtoms() const
Gets the current atomic forces from dftClass.
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:1727
std::map< unsigned int, unsigned int > d_atomTypeAtributes
Definition dft.h:1319
const std::map< dealii::CellId, std::vector< unsigned int > > & getbCellNonTrivialAtomIds() const
std::map< unsigned int, unsigned int > d_atomIdPseudopotentialInterestToGlobalId
Definition dft.h:1326
unsigned int d_nOMPThreads
Definition dft.h:1511
std::vector< bool > d_isFirstFilteringCall
Definition dft.h:1879
std::vector< bool > selectedDofsHanging
Definition dft.h:1578
void run()
FIXME: legacy call, move to main.cc.
std::vector< const dealii::AffineConstraints< double > * > d_constraintsVectorElectro
Definition dft.h:1557
const std::vector< std::vector< double > > & getAtomLocationsCart() const
Gets the current atom Locations in cartesian form (origin at center of domain) from dftClass.
double d_nlPSPCutOff
Definition dft.h:1412
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:1554
std::vector< distributedCPUVec< double > > d_densityOutNodalValues
Definition dft.h:1716
void writeMesh(std::string meshFileName)
dealii::DoFHandler< 3 > dofHandler
Definition dft.h:1488
virtual void resetRhoNodalSplitIn(distributedCPUVec< double > &OutDensity)
vselfBinsManager< FEOrder, FEOrderElectro > d_vselfBinsManager
vselfBinsManager object
Definition dft.h:1823
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:1736
void finalizeKohnShamDFTOperator()
bool d_isAtomsGaussianDisplacementsReadFromFile
Definition dft.h:1339
std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< dftfe::utils::MemorySpace::HOST > > d_BLASWrapperPtr
Definition dft.h:1551
double d_relativeErrorJacInvApproxPrevScfLRD
Definition dft.h:1758
std::vector< double > d_dipole
Definition dft.h:1743
std::shared_ptr< hubbard< dataTypes::number, memorySpace > > d_hubbardClassPtr
Definition dft.h:1957
const std::vector< std::vector< double > > & getEigenValues() const
Get reference to the eigen values.
unsigned int d_baseDofHandlerIndexElectro
Definition dft.h:1495
std::vector< double > d_gaussianConstantsForce
Definition dft.h:1344
std::shared_ptr< hubbard< dataTypes::number, memorySpace > > getHubbardClassPtr()
Returns the shared ptr to hubbard class.
triangulationManager * getTriangulationManager()
std::vector< double > d_smearedChargeMoments
Definition dft.h:1745
std::map< dealii::CellId, std::vector< double > > d_rhoAtomsValues
for xl-bomd
Definition dft.h:1763
const unsigned int n_mpi_processes
Definition dft.h:1569
std::map< unsigned int, std::map< dealii::CellId, std::vector< double > > > d_hessianRhoCoreAtoms
Definition dft.h:1815
bool d_smearedChargeMomentsComputed
Definition dft.h:1746
double rhofieldl2Norm(const dealii::MatrixFree< 3, double > &matrixFreeDataObject, const distributedCPUVec< double > &rhoNodalField, const unsigned int dofHandlerId, const unsigned int quadratureId)
std::vector< double > d_imageCharges
Definition dft.h:1380
dealii::MatrixFree< 3, double > d_matrixFreeDataPRefined
Definition dft.h:1512
void nscf(KohnShamHamiltonianOperator< memorySpace > &kohnShamDFTEigenOperator, chebyshevOrthogonalizedSubspaceIterationSolver &subspaceIterationSolver)
void updatePRefinedConstraints()
double numElectrons
Definition dft.h:1314
std::vector< orbital > waveFunctionsVector
Definition dft.h:1450
std::vector< std::map< dealii::CellId, std::vector< unsigned int > > > d_bCellNonTrivialAtomImageIdsBins
Definition dft.h:1445
double totalCharge(const dealii::MatrixFree< 3, double > &matrixFreeDataObject, const distributedCPUVec< double > &rhoNodalField)
std::deque< distributedCPUVec< double > > d_groundStateDensityHistory
Definition dft.h:1791
double lowrankApproxScfDielectricMatrixInv(const unsigned int scfIter)
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:1567
void computeVselfFieldGateauxDerFD()
distributedCPUVec< double > d_rhoInNodalValuesRead
Definition dft.h:1726
dealii::TimerOutput computing_timer
compute-time logger
Definition dft.h:1703
std::vector< double > d_imageChargesTrunc
Definition dft.h:1395
unsigned int d_forceDofHandlerIndex
Definition dft.h:1491
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
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:1723
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:1577
std::vector< std::vector< double > > d_atomLocationsAutoMesh
Definition dft.h:1327
double d_autoMeshMaxJacobianRatio
Definition dft.h:1464
const MPI_Comm & getMPIInterBand() const override
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:1539
std::vector< double > kPointReducedCoordinates
k point crystal coordinates
Definition dft.h:1842
std::shared_ptr< AuxDensityMatrix< memorySpace > > d_auxDensityMatrixXCInPtr
Definition dft.h:1738
std::vector< std::vector< double > > d_imagePositions
Definition dft.h:1384
triangulationManager d_mesh
Definition dft.h:1462
std::map< dealii::types::global_dof_index, dealii::Point< 3 > > d_supportPointsEigen
Definition dft.h:1554
dealii::AffineConstraints< double > d_constraintsPRefined
Definition dft.h:1651
double d_freeEnergyInitial
Definition dft.h:1864
dealii::AffineConstraints< double > d_constraintsForPhiPrimeElectro
Definition dft.h:1647
void normalizeRhoInQuadValues()
normalize the input electron density
void normalizeAtomicRhoQuadValues()
normalize the electron density
unsigned int d_rankCurrentLRD
Definition dft.h:1757
unsigned int getElectroQuadratureAxId() const
chebyshevOrthogonalizedSubspaceIterationSolver d_subspaceIterationSolver
Definition dft.h:1606
std::shared_ptr< dftfe::atomCenteredOrbitalsPostProcessing< dataTypes::number, memorySpace > > d_atomCenteredOrbitalsPostProcessingPtr
Definition dft.h:1543
std::vector< double > d_kPointWeights
k point weights
Definition dft.h:1845
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::map< dealii::types::global_dof_index, dealii::Point< 3 > > d_supportPoints
Definition dft.h:1553
elpaScalaManager * getElpaScalaManager() const
double getFermiEnergy() const
Get the value of fermi energy.
double fieldGradl2Norm(const dealii::MatrixFree< 3, double > &matrixFreeDataObject, const distributedCPUVec< double > &field)
distributedCPUVec< double > d_preCondTotalDensityResidualVector
Definition dft.h:1727
distributedCPUVec< double > d_magInNodalValuesRead
Definition dft.h:1731
bool d_useHubbard
Definition dft.h:1958
std::deque< distributedCPUVec< double > > d_vcontainerVals
for low rank jacobian inverse approximation
Definition dft.h:1750
void readkPointData()
distributedCPUVec< double > d_residualPredicted
Definition dft.h:1756
std::vector< double > a0
Definition dft.h:1874
dealii::Timer d_globalTimer
Definition dft.h:1708
void noRemeshRhoDataInit()
std::vector< double > d_flatTopWidthsAutoMeshMove
Definition dft.h:1355
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:1521
std::map< dealii::types::global_dof_index, double > d_atomNodeIdToChargeMap
map of atom node number and atomic weight
Definition dft.h:1820
std::vector< dealii::Tensor< 1, 3, double > > d_atomsDisplacementsGaussianRead
Gaussian displacements of atoms read from file.
Definition dft.h:1331
unsigned int d_nonPeriodicDensityDofHandlerIndexElectro
Definition dft.h:1494
double d_domainVolume
volume of the domain
Definition dft.h:1479
bool d_isRestartGroundStateCalcFromChk
Definition dft.h:1885
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:1713
dealii::IndexSet d_locallyRelevantDofsRhoNodal
Definition dft.h:1573
dealii::ConditionalOStream pcout
device eigenvectors
Definition dft.h:1700
void calculateNearestAtomDistances()
a
void initUnmovedTriangulation(dealii::parallel::distributed::Triangulation< 3 > &triangulation)
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > d_gradDensityOutQuadValues
Definition dft.h:1771
unsigned int d_nonAtomicWaveFunctions
Number of random wavefunctions.
Definition dft.h:300
std::map< dealii::CellId, std::vector< double > > d_gradRhoCore
Definition dft.h:1807
distributedCPUVec< double > d_phiExt
Definition dft.h:1788
unsigned int d_highestStateForResidualComputation
Definition dft.h:294
unsigned int getSmearedChargeQuadratureIdElectro()
dealii::AffineConstraints< double > d_constraintsPRefinedOnlyHanging
Definition dft.h:1653
const std::vector< std::vector< double > > & getCell() const
Gets the current cell lattice vectors.
void interpolateDensityNodalDataToQuadratureDataGeneral(const std::shared_ptr< dftfe::basis::FEBasisOperations< double, double, dftfe::utils::MemorySpace::HOST > > &basisOperationsPtr, const unsigned int dofHandlerId, const unsigned int 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 > &quadratureHessianValueData, const bool isEvaluateGradData=false, const bool isEvaluateHessianData=false)
interpolate rho nodal data to quadrature data using FEEvaluation
unsigned int d_phiTotDofHandlerIndexElectro
Definition dft.h:1503
std::vector< int > d_imageIdsTrunc
Definition dft.h:1391
void totalMagnetization(const dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &magQuadValues)
Computes net magnetization from the difference of local spin densities.
dealii::IndexSet d_locallyRelevantDofsPRefined
Definition dft.h:1573
const double d_smearedChargeWidthMin
minimum smeared charge width
Definition dft.h:1448
double getEntropicEnergy() const
std::vector< double > d_nearestAtomDistances
nearest atom distances for all domain atoms
Definition dft.h:1367
unsigned int getNumEigenValues() const
std::vector< std::vector< double > > d_localVselfs
Definition dft.h:1801
dealii::AffineConstraints< double > d_constraintsRhoNodalOnlyHanging
Definition dft.h:1657
std::vector< distributedCPUVec< double > > d_densityResidualNodalValues
Definition dft.h:1716
KohnShamHamiltonianOperator< memorySpace > * d_kohnShamDFTOperatorPtr
Definition dft.h:1598
unsigned int d_densityQuadratureId
Definition dft.h:1508
poissonSolverProblem< FEOrder, FEOrderElectro > d_phiPrimeSolverProblem
Definition dft.h:1587
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > & getDensityInValues()
void calculateSmearedChargeWidths()
a
bool d_kohnShamDFTOperatorsInitialized
Definition dft.h:1596
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:1687
std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< dftfe::utils::MemorySpace::HOST > > d_BLASWrapperPtrHost
Definition dft.h:1536
void recomputeKPointCoordinates()
std::vector< std::vector< double > > d_meshSizes
Definition dft.h:1323
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:1764
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:1714
void interpolateDensityNodalDataToQuadratureDataLpsp(const std::shared_ptr< dftfe::basis::FEBasisOperations< double, double, dftfe::utils::MemorySpace::HOST > > &basisOperationsPtr, const unsigned int dofHandlerId, const unsigned int 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
std::deque< distributedCPUVec< double > > d_fvSpin1containerVals
Definition dft.h:1755
std::vector< int > d_imageIds
Definition dft.h:1374
double fermiEnergy
fermi energy
Definition dft.h:1862
dftParameters & getParametersObject() const
Get reference to dftParameters object.
std::vector< double > d_netFloatingDispSinceLastCheckForSmearedChargeOverlaps
Definition dft.h:1337
double computeTraceXtKX(unsigned int numberWaveFunctionsEstimate)
std::vector< double > d_netFloatingDispSinceLastBinsUpdate
Definition dft.h:1334
dealii::AffineConstraints< double > d_constraintsForHelmholtzRhoNodal
Definition dft.h:1649
unsigned int numLevels
Definition dft.h:1313
void initializeKohnShamDFTOperator(const bool initializeCublas=true)
dftUtils::constraintMatrixInfo< dftfe::utils::MemorySpace::HOST > d_constraintsRhoNodalInfo
Definition dft.h:1660
dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > d_phiInQuadValues
Definition dft.h:1721
dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > d_densityTotalInValuesLpspQuad
Definition dft.h:1735
dealii::MatrixFree< 3, double > matrix_free_data
Definition dft.h:1512
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.
unsigned int d_lpspQuadratureId
Definition dft.h:1499
const double d_pspCutOffTrunc
distance from the domain till which periodic images will be considered
Definition dft.h:1408
double getInternalEnergy() const
double numElectronsDown
Definition dft.h:1314
chebyshevOrthogonalizedSubspaceIterationSolver * getSubspaceIterationSolverHost()
Get the Ptr to Chebyshev solver in host.
std::vector< std::vector< double > > d_partialOccupancies
Definition dft.h:1666
std::map< unsigned int, std::map< dealii::CellId, std::vector< double > > > d_hessianRhoAtomsValuesSeparate
Definition dft.h:1767
dealii::AffineConstraints< double > d_noConstraints
Definition dft.h:1643
meshMovementGaussianClass d_gaussianMovePar
meshMovementGaussianClass object
Definition dft.h:1472
unsigned int d_nlpspQuadratureId
Definition dft.h:1498
std::map< dealii::CellId, std::vector< double > > d_pseudoVLoc
Definition dft.h:1793
dftfe::utils::MemoryStorage< dataTypes::number, dftfe::utils::MemorySpace::HOST > d_eigenVectorsFlattenedHost
Definition dft.h:1683
unsigned int getDensityQuadratureId()
dataTypes::number computeTraceXtHX(unsigned int numberWaveFunctionsEstimate)
std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< dftfe::utils::MemorySpace::HOST > > getBLASWrapperHost()
dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > d_gradPhiInQuadValues
Definition dft.h:1723
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:1645
dispersionCorrection d_dispersionCorr
Definition dft.h:1308
void reInitializeKohnShamDFTOperator()
std::vector< std::vector< double > > d_atomLocationsInterestPseudopotential
Definition dft.h:1324
std::vector< std::vector< double > > d_imagePositionsAutoMesh
Definition dft.h:1328
dealii::TimerOutput computingTimerStandard
Definition dft.h:1704
meshMovementAffineTransform d_affineTransformMesh
affine transformation object
Definition dft.h:1469
std::map< unsigned int, std::map< dealii::CellId, std::vector< double > > > d_pseudoVLocAtoms
Definition dft.h:1798
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > d_gradDensityInQuadValues
Definition dft.h:1771
elpaScalaManager * d_elpaScala
Definition dft.h:1583
std::vector< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > d_densityInQuadValues
Definition dft.h:1713
unsigned int d_numEigenValues
Number of Kohn-Sham eigen values to be computed.
Definition dft.h:293
std::map< dealii::CellId, std::vector< double > > d_rhoCore
Definition dft.h:1805
distributedCPUVec< double > d_phiPrime
Definition dft.h:1785
unsigned int d_forceDofHandlerIndexElectro
Definition dft.h:1496
void resetRhoNodalIn(distributedCPUVec< double > &OutDensity)
bool scfConverged
Definition dft.h:1891
distributedCPUVec< double > d_rhoOutNodalValuesDistributed
Definition dft.h:1728
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.
std::map< unsigned int, std::map< unsigned int, std::map< unsigned int, double > > > outerValues
Definition dft.h:1457
const std::vector< std::vector< double > > & getImageAtomLocationsCart() const
Gets the current image atom Locations in cartesian form (origin at center of domain) from dftClass.
void l2ProjectionQuadToNodal(const std::shared_ptr< dftfe::basis::FEBasisOperations< double, double, dftfe::utils::MemorySpace::HOST > > &basisOperationsPtr, const dealii::AffineConstraints< double > &constraintMatrix, const unsigned int dofHandlerId, const unsigned int quadratureId, const dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &quadratureValueData, distributedCPUVec< double > &nodalField)
l2 projection
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.
const std::set< unsigned int > & getAtomTypes() const
Gets the current atom types from dftClass.
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:1735
void determineOrbitalFilling()
distributedCPUVec< double > d_phiTotRhoIn
Definition dft.h:1776
unsigned int getElectroDofHandlerIndex() const
std::vector< dealii::Point< 3 > > d_controlPointLocationsCurrentMove
Definition dft.h:1476
unsigned int d_lpspQuadratureIdElectro
Definition dft.h:1501
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:1642
std::vector< double > d_generatorFlatTopWidths
composite generator flat top widths for all domain atoms
Definition dft.h:1351
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:1665
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:1475
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:1323
void compute_ldos(const std::vector< std::vector< double > > &eigenValuesInput, const std::string &fileName)
double d_minDist
Definition dft.h:1370
std::vector< std::vector< int > > d_globalChargeIdToImageIdMap
globalChargeId to ImageChargeId Map
Definition dft.h:1387
std::vector< dealii::types::global_dof_index > localProc_dof_indicesReal
Definition dft.h:1576
distributedCPUVec< double > d_tempEigenVec
Definition dft.h:1883
forceClass< FEOrder, FEOrderElectro, memorySpace > * forcePtr
Definition dft.h:1580
void writeBands()
write the KS eigen values for given BZ sampling/path
bool d_tolReached
Definition dft.h:1760
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:1405
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:1828
std::deque< distributedCPUVec< double > > d_fvSpin0containerVals
Definition dft.h:1753
unsigned int d_autoMesh
Definition dft.h:1465
virtual void writeGSElectronDensity(const std::string Path) const
writes quadrature grid information and associated spin-up and spin-down electron-density for post-pro...
std::map< dealii::CellId, std::vector< int > > d_bQuadAtomIdsAllAtomsImages
Definition dft.h:1425
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:1572
dealii::IndexSet locally_relevant_dofs
Definition dft.h:1572
double computeMaximumHighestOccupiedStateResidualNorm(const std::vector< std::vector< double > > &residualNormWaveFunctionsAllkPoints, const std::vector< std::vector< double > > &eigenValuesAllkPoints, const double _fermiEnergy)
compute the maximum of the residual norm of the highest occupied state among all k points
unsigned int d_helmholtzDofHandlerIndexElectro
Definition dft.h:1506
unsigned int d_binsStartDofHandlerIndexElectro
Definition dft.h:1507
void initPseudoPotentialAll(const bool updateNonlocalSparsity=true)
void computeRhoNodalFromPSI()
computes density nodal data from wavefunctions
const unsigned int this_mpi_process
Definition dft.h:1570
std::map< dealii::CellId, std::vector< int > > d_bQuadAtomIdsAllAtoms
non-intersecting smeared charges atom ids of all atoms at quad points
Definition dft.h:1421
std::map< unsigned int, std::map< unsigned int, std::map< unsigned int, alglib::spline1dinterpolant > > > radValues
Definition dft.h:1454
std::set< unsigned int > atomTypes
Definition dft.h:1315
dftParameters * d_dftParamsPtr
dftParameters object
Definition dft.h:1836
std::deque< distributedCPUVec< double > > d_vSpin1containerVals
Definition dft.h:1754
double getTotalChargeforRhoSplit()
void kohnShamEigenSpaceComputeNSCF(const unsigned int spinType, const unsigned int kPointIndex, KohnShamHamiltonianOperator< dftfe::utils::MemorySpace::HOST > &kohnShamDFTEigenOperator, chebyshevOrthogonalizedSubspaceIterationSolver &subspaceIterationSolver, std::vector< double > &residualNormWaveFunctions, unsigned int ipass)
void interpolateElectroNodalDataToQuadratureDataGeneral(const std::shared_ptr< dftfe::basis::FEBasisOperations< double, double, dftfe::utils::MemorySpace::HOST > > &basisOperationsPtr, const unsigned int dofHandlerId, const unsigned int 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
MixingScheme d_mixingScheme
Definition dft.h:1724
dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > d_gradDensityTotalOutValuesLpspQuad
Definition dft.h:1736
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::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)
std::map< dealii::CellId, std::vector< double > > d_gradbQuadValuesAllAtoms
non-intersecting smeared charge gradients of all atoms at quad points
Definition dft.h:1418
std::vector< dealii::Tensor< 1, 3, double > > d_dispClosestTriaVerticesToAtoms
Definition dft.h:1849
std::shared_ptr< AuxDensityMatrix< memorySpace > > d_auxDensityMatrixXCOutPtr
Definition dft.h:1739
dealii::FESystem< 3 > FE
Definition dft.h:1487
std::vector< double > d_smearedChargeScaling
smeared charge normalization scaling for all domain atoms
Definition dft.h:1361
expConfiningPotential d_expConfiningPot
Definition dft.h:1956
std::vector< std::map< dealii::CellId, std::vector< unsigned int > > > d_bCellNonTrivialAtomIdsBins
Definition dft.h:1435
unsigned int d_gllQuadratureId
Definition dft.h:1502
void normalizeRhoMagInInitialGuessQuadValues()
normalize input mag electron density to total magnetization for use in constraint magnetization case ...
void set()
atomic system pre-processing steps.
dftUtils::constraintMatrixInfo< dftfe::utils::MemorySpace::HOST > constraintsNoneDataInfo
Definition dft.h:1633
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:1517
bool isHubbardCorrectionsUsed()
Function to check if hubbard corrections is being used.
KohnShamHamiltonianOperator< memorySpace > * getOperatorClass()
get the Ptr to the operator class ( Kohn Sham Operator)
dealii::DoFHandler< 3 > dofHandlerEigen
Definition dft.h:1488
unsigned int d_sparsityPatternQuadratureId
Definition dft.h:1510
std::vector< double > d_quadrupole
Definition dft.h:1744
Namespace which declares the input parameters and the functions to parse them from the input paramete...
Definition dftParameters.h:35
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:44
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
constexpr unsigned int C_rhoNodalPolyOrder()
rho nodal polynomial order
Definition constants.h:133