DFT-FE 1.3.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
AtomicCenteredNonLocalOperator.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// @author Kartick Ramakrishnan, Vishal Subramanian, Sambit Das
18//
19
20#ifndef DFTFE_ATOMICCENTEREDNONLOCALOPERATOR_H
21#define DFTFE_ATOMICCENTEREDNONLOCALOPERATOR_H
22#include <MultiVector.h>
23#include <headers.h>
26#include <BLASWrapper.h>
27#include <memory>
28#include <MemorySpaceType.h>
29#include "FEBasisOperations.h"
30#include <headers.h>
31#include <dftUtils.h>
32#include <pseudoUtils.h>
33#include <vectorUtilities.h>
34#include <MPIPatternP2P.h>
35#include <MultiVector.h>
36#include <DeviceTypeConfig.h>
37#include <cmath>
39
40namespace dftfe
41{
42 /**
43 * @brief Enum class that lists
44 * used in the non-local Operator
45 *
46 */
53
61
62
63
64 template <typename ValueType, dftfe::utils::MemorySpace memorySpace>
66 {
67 public:
70 BLASWrapperPtr,
71 std::shared_ptr<
73 basisOperatorPtr,
74 std::shared_ptr<AtomCenteredSphericalFunctionContainer>
75 atomCenteredSphericalFunctionContainer,
76 const MPI_Comm &mpi_comm_parent,
77 const bool memOptMode = false,
78 const bool floatingNuclearCharges = true, //@Kartick to be removed
79 const bool useGlobalCMatrix = false,
80 const bool computeIonForces = false,
81 const bool computeCellStress = false);
82
83 /**
84 * @brief Resizes various internal data members and selects the kpoint of interest.
85 * @param[in] kPointIndex specifies the k-point of interest
86 */
87 void
89 dftfe::uInt kPointIndex,
90 const nonLocalContractionVectorType NonLocalContractionVectorType =
92 /**
93 * @brief initialises the multivector object, waveFunctionBlockSize and resizes various internal data members.
94 * !!!! It is very imporant to ensure that the vector of
95 * nonLocalContractionVectorType CconjTransX for which the coupling matrix/V
96 * matrix is to be applied on is initialised last. If not, applyV function
97 * wil Assert out. !!!!
98 * @param[in] waveFunctionBlockSize sets the wavefunction block size for the
99 * action of the nonlocal operator.
100 * * @param[in] NonLocalContractionVectorType specifies the type of
101 * allreduce operation
102 * @param[out] sphericalFunctionKetTimesVectorParFlattened, the multivector
103 * that is initialised based on blocksize and partitioner.
104 *
105 */
106 void
108 dftfe::uInt waveFunctionBlockSize,
110 &sphericalFunctionKetTimesVectorParFlattened,
111 const nonLocalContractionVectorType NonLocalContractionVectorType =
113 /**
114 * @brief calls internal function: initialisePartitioner, initialiseKpoint and computeCMatrixEntries
115 * @param[in] updateSparsity flag on whether the sparstiy patten was
116 * updated, hence the partitioner is updated.
117 * @param[in] kPointWeights std::vector<double> of size number of kPoints
118 * @param[out] kPointCoordinates std::vector<double> of kPoint coordinates
119 * @param[in] basisOperationsPtr HOST FEBasisOperations shared_ptr required
120 * to indetify the element ids and quad points
121 * @param[in] quadratureIndex quadrature index for sampling the spherical
122 * function. Quadrature Index is used to reinit basisOperationsPtr
123 */
124 void
126 const bool updateSparsity,
127 const std::vector<double> &kPointWeights,
128 const std::vector<double> &kPointCoordinates,
129 std::shared_ptr<
131 double,
133 basisOperationsPtr,
134 std::shared_ptr<
136 BLASWrapperHostPtr,
137 const dftfe::uInt quadratureIndex);
138 /**
139 * @brief calls internal function: initialisePartitioner, initialiseKpoint and computeCMatrixEntries
140 * @param[in] updateSparsity flag on whether the sparstiy patten was
141 * updated, hence the partitioner is updated.
142 * @param[in] kPointWeights std::vector<double> of size number of kPoints
143 * @param[out] kPointCoordinates std::vector<double> of kPoint coordinates
144 * @param[in] basisOperationsPtr HOST FEBasisOperations shared_ptr required
145 * to indetify the element ids and quad points
146 * @param[in] BLASWrapperHostPtr CPU blasWrapperPtr, used for xcopy calls
147 * @param[in] quadratureIndex quadrature index for sampling the spherical
148 * function. Quadrature Index is used to reinit basisOperationsPtr
149 * @param[in] nonLocalOperatorSrc The source nonLocalOpertor from where the
150 * CMatrix and partitioner is copied. Generally, it is of higher precision.
151 */
152 template <typename ValueTypeSrc>
153 void
155 const bool updateSparsity,
156 const std::vector<double> &kPointWeights,
157 const std::vector<double> &kPointCoordinates,
158 std::shared_ptr<
160 double,
162 basisOperationsPtr,
163 std::shared_ptr<
165 BLASWrapperHostPtr,
166 const dftfe::uInt quadratureIndex,
167 const std::shared_ptr<
169 nonLocalOperatorSrc);
170#if defined(DFTFE_WITH_DEVICE)
171 // for device specific initialise
172 /**
173 * @brief
174 * @param[in] totalAtomsInCurrentProcessor number of atoms in current
175 * processor based on compact support
176 * @param[out] totalNonLocalElements number of nonLocal elements in current
177 * processor
178 * @param[out] numberCellsForEachAtom number of cells associated which each
179 * atom in the current processor. vecot of size totalAtomsInCurrentProcessor
180 * @param[out] numberCellsAccumNonLocalAtoms number of cells accumulated
181 * till iatom in current processor. vector of size
182 * totalAtomsInCurrentProcessor
183 */
184 void
185 initialiseCellWaveFunctionPointers(
187 &cellWaveFunctionMatrix,
188 const dftfe::uInt cellsBlockSize,
189 const std::vector<nonLocalContractionVectorType>
190 NonLocalContractionVectorType = {
192
193 void
194 freeDeviceVectors(const std::vector<nonLocalContractionVectorType>
195 NonLocalContractionVectorType = {
197#endif
198
199 // Getter functions
200 // Returns the vector that takes in nonlocalElementIndex and returns the
201 // cellID
202
203 bool
205
206 const std::vector<dftfe::uInt> &
208 // Returns the number of atoms in current processor
211
214
217
220
223
224 bool
226
229 const dftfe::uInt alpha) const;
230
233
234 std::vector<dftfe::uInt> &
236
237 std::vector<dftfe::uInt> &
239
240 std::vector<dftfe::uInt> &
242
243 const std::vector<ValueType> &
245
246 const std::vector<ValueType> &
248
249 const std::map<dftfe::uInt, std::vector<dftfe::uInt>> &
251
252 const std::vector<dftfe::uInt> &
254
255 const std::vector<dftfe::uInt> &
257
258 const dftfe::uInt
260
261
262 const std::vector<dftfe::uInt> &
264
265 /**
266 * @brief Required in configurational forces. Cummulative sphercial Fn Id. The size is numCells in processor
267 */
268 const std::map<dftfe::uInt, std::vector<dftfe::uInt>> &
270
271 /**
272 * @brief Returns the Flattened vector of sphericalFunctionIDs in order of atomIDs of atoms in processor.
273 */
274 const std::vector<dftfe::uInt> &
276
277 const std::vector<dftfe::uInt> &
279
280 const std::vector<dftfe::uInt> &
282
283 /**
284 * @brief Computes C^{T}D^{-1}C at the global level for atomId. This is required in PAW
285 */
286 void
288 const dftfe::uInt atomId,
289 std::shared_ptr<
291 BLASWrapperPtr,
293 &Dinverse,
295 PconjtransposePmatrix);
296 // Calls for both device and host
297 /**
298 * @brief compute the action of coupling matrix on sphericalFunctionKetTimesVectorParFlattened.
299 * !!!! This function only acts on distributed vector of type CconjTransX
300 * and not for other types. !!!
301 * @param[in] couplingtype structure of coupling matrix
302 * @param[in] couplingMatrix entires of the coupling matrix V in
303 * CVCconjtrans. Ensure that the coupling matrix is padded. Refer to
304 * ONCVclass for template
305 * @param[out] sphericalFunctionKetTimesVectorParFlattened multivector to
306 * store results of CconjtransX which is initiliased using
307 * initialiseFlattenedVector call. The results are stored in
308 * sphericalFunctionKetTimesVectorParFlattened or internal data member based
309 * on flagCopyResultsToMatrix.
310 * @param[in] flagCopyResultsToMatrix flag to confirm whether to scal the
311 * multivector sphericalFunctionKetTimesVectorParFlattened or store results
312 * in internal data member.
313 */
314 void
316 const CouplingStructure couplingtype,
319 &sphericalFunctionKetTimesVectorParFlattened,
320 const bool flagCopyResultsToMatrix = true);
321
322 /**
323 * @brief After AllReduce function is called this will copy to the nonLocalOperatorClassDatastructure.
324 */
325 void
328 &sphericalFunctionKetTimesVectorParFlattened,
330 /**
331 * @brief copies the results from internal member to sphericalFunctionKetTimesVectorParFlattened, on which ghost values are called.
332 * crucial operation for completion of the full CconjtranX on all cells
333 * @param[in] sphericalFunctionKetTimesVectorParFlattened multivector to
334 * store results of CconjtransX which is initiliased using
335 * initialiseFlattenedVector call
336 * @param[in] skip1 flag for compute-communication overlap in ChFSI on GPUs
337 * @param[in] skip2 flag for compute-communication overlap in ChFSI on GPUs
338 */
339 void
342 &sphericalFunctionKetTimesVectorParFlattened,
343 const bool skipComm = false,
344 const nonLocalContractionVectorType NonLocalContractionVectorType =
346
347 /**
348 * @brief computes the results of CconjtransX on the cells of interst specied by cellRange
349 * @param[in] X input cell level vector
350 * @param[in] cellRange start and end element id in list of nonlocal
351 * elements
352 */
353 void
354 applyCconjtransOnX(const ValueType *X,
355 const std::pair<dftfe::uInt, dftfe::uInt> cellRange);
356
357 /**
358 * @brief computes the results of CRconjtransX on the cells of interst specied by cellRange
359 * @param[in] X input cell level vector
360 * @param[in] cellRange start and end element id in list of nonlocal
361 * elements
362 */
363 void
364 applyCRconjtransOnX(const ValueType *X,
365 const std::pair<dftfe::uInt, dftfe::uInt> cellRange);
366
367 /**
368 * @brief computes the results of CconjtransX on the cells of interst specied by cellRange
369 * @param[in] X input cell level vector
370 * @param[in] cellRange start and end element id in list of nonlocal
371 * elements
372 */
373 void
374 applyDconjtransOnX(const ValueType *X,
375 const std::pair<dftfe::uInt, dftfe::uInt> cellRange);
376
377 /**
378 * @brief computes the results of CconjtransX on the cells of interst specied by cellRange
379 * @param[in] X input cell level vector
380 * @param[in] cellRange start and end element id in list of nonlocal
381 * elements
382 */
383 void
385 const ValueType *X,
386 const std::pair<dftfe::uInt, dftfe::uInt> cellRange);
387
388 /**
389 * @brief computes the results of CconjtransX on nodal X vector
390 * @param[in] X input X nodal vector
391 * elements
392 */
393 void
396
397
398 // Returns the pointer of CTX stored in HOST memory for the atom Index in
399 // the list of atoms with support in the processor.
400 /**
401 * @brief Returns the pointer of CTX stored in HOST memory
402 * @param[in] iAtom atomIndex in the list of atoms with support in the
403 * current processor. NOTE!! One must be careful here
404 */
405 const ValueType *
407
408 /**
409 * @brief completes the VCconjX on nodal vector src. The src vector must have all ghost nodes and constraint nodes updated.
410 * @param[in] src input nodal vector on which operator acts on.
411 * @param[in] kPointIndex kPoint of interest for current operation
412 * @param[in] couplingtype structure of coupling matrix
413 * @param[in] couplingMatrix entries of the coupling matrix V in
414 * CVCconjtrans. Ensure the coupling matrix is padded
415 * @param[out] sphericalFunctionKetTimesVectorParFlattened multivector to
416 * store results of CconjtransX which is initiliased using
417 * initialiseFlattenedVector call
418 */
419 void
422 const dftfe::uInt kPointIndex,
423 const CouplingStructure couplingtype,
426 &sphericalFunctionKetTimesVectorParFlattened,
427 const bool flagScaleInternalMatrix = false);
428
429
430 /**
431 * @brief completes the action of CVCconjtranspose on nodal vector src. The src vector must have all ghost nodes and contraint nodes updated.
432 * @param[in] src input nodal vector on which operator acts on.
433 * @param[in] kPointIndex kPoint of interst for current operation
434 * @param[in] couplingtype structure of coupling matrix
435 * @param[in] couplingMatrix entires of the coupling matrix V in
436 * CVCconjtrans
437 * @param[in] sphericalFunctionKetTimesVectorParFlattened multivector to
438 * store results of CconjtransX which is initiliased using
439 * initialiseFlattenedVector call
440 * @param[out] dst output nodal vector where the results of the operator is
441 * copied into.
442 */
443 void
446 const dftfe::uInt kPointIndex,
447 const CouplingStructure couplingtype,
450 &sphericalFunctionKetTimesVectorParFlattened,
452
453 /**
454 * @brief adds the result of CVCtX onto Xout for both CPU and GPU calls
455 * @param[out] Xout memoryStorage object of size
456 * cells*numberOfNodex*BlockSize. Typical case holds the results of H_{loc}X
457 * @param[in] cellRange start and end element id in list of nonlocal
458 * elements
459 */
460 void
461 applyCOnVCconjtransX(ValueType *Xout,
462 const std::pair<dftfe::uInt, dftfe::uInt> cellRange);
463
464
465 /**
466 * @brief adds the result of CVCtX onto Xout for both CPU and GPU calls
467 * @param[out] Xout memoryStorage object of size
468 * cells*numberOfNodex*BlockSize. Typical case holds the results of H_{loc}X
469 * @param[in] cellRange start and end element id in list of nonlocal
470 * elements
471 */
472 void
475
476 std::vector<ValueType>
478 dftfe::uInt atomId,
479 dftfe::Int iElem) const;
480
481 bool
483 const std::pair<dftfe::uInt, dftfe::uInt> cellRange) const;
484 /**
485 * @brief Called only for GPU runs where the coupling matrix has to be padded
486 * @param[in] entries COupling matrix entries without padding in the atomId
487 * order
488 * @param[out] entriesPadded Padding of coupling matrix entries
489 * @param[in] couplingtype Determines the dimension of entriesPadded and the
490 * padding mechanism elements
491 */
492 void
493 paddingCouplingMatrix(const std::vector<ValueType> &entries,
494 std::vector<ValueType> &entriesPadded,
495 const CouplingStructure couplingtype);
496
497 /**
498 * @brief Returns C matrix entries for chargeId and it compact support element Id.
499 */
500 const std::vector<ValueType> &
502 const dftfe::uInt iElemComp) const;
503 /**
504 * @brief Returns C conj matrix entries for chargeId and it compact support element Id.
505 */
506 const std::vector<ValueType> &
508 const dftfe::uInt iElemComp) const;
509 /**
510 * @brief Returns global C matrix of all atoms.
511 */
512 const std::vector<
513 std::vector<dftfe::utils::MemoryStorage<ValueType, memorySpace>>> &
515
516 /**
517 * @brief Returns number of spherical function for a given nonlocal atom id.
518 */
521
522 /**
523 * @brief Computes the inner products summing over the sphericalFn and WaveFns for each atom
524 * @param[in] vectorDimension dimension of
525 * sphericalFunctionKetTimesVectorParFlattened vector type
526 * @param[in] VCconjTransXsphericalFunctionKetTimesVectorParFlattened
527 * VCconjTransX vector type.
528 * @param[in] sphericalFunctionKetTimesVectorParFlattened distributed vector
529 * of dimension vectorDimension.
530 * @param[in] reinitFlag flag to reinit the vector. @Nikhil make sure you
531 * set this correctly in the block loop
532 * @param[out] outputVector output vector whose dimensions depend on
533 * vectorDimension
534 */
535 void
537 const dftfe::Int vectorDimension,
539 &VCconjTransXsphericalFunctionKetTimesVectorParFlattened,
541 &sphericalFunctionKetTimesVectorParFlattened,
542 const std::map<dftfe::uInt, dftfe::uInt> nonlocalAtomIdToGlobalIdMap,
543 std::vector<ValueType> &outputVector);
544
545
546 protected:
547 /**
548 * @brief completes the VCconjX on nodal vector src. The src vector must have all ghost nodes and constraint nodes updated.
549 * @param[in] src input nodal vector on which operator acts on.
550 * @param[in] kPointIndex kPoint of interest for current operation
551 * @param[in] couplingtype structure of coupling matrix
552 * @param[in] couplingMatrix entries of the coupling matrix V in
553 * CVCconjtrans. Ensure the coupling matrix is padded
554 * @param[out] sphericalFunctionKetTimesVectorParFlattened multivector to
555 * store results of CconjtransX which is initiliased using
556 * initialiseFlattenedVector call
557 */
558 void
561 const dftfe::uInt kPointIndex,
562 const CouplingStructure couplingtype,
565 &sphericalFunctionKetTimesVectorParFlattened,
566 const bool flagScaleInternalMatrix = false);
567
568 /**
569 * @brief completes the VCconjX on nodal vector src using global C matrix.
570 * The global C matrix mush have been computed before.
571 * The src vector must have all ghost nodes and constraint nodes updated.
572 * @param[in] src input nodal vector on which operator acts on.
573 * @param[in] kPointIndex kPoint of interest for current operation
574 * @param[in] couplingtype structure of coupling matrix
575 * @param[in] couplingMatrix entries of the coupling matrix V in
576 * CVCconjtrans. Ensure the coupling matrix is padded
577 * @param[out] sphericalFunctionKetTimesVectorParFlattened multivector to
578 * store results of CconjtransX which is initiliased using
579 * initialiseFlattenedVector call
580 */
581 void
584 const dftfe::uInt kPointIndex,
585 const CouplingStructure couplingtype,
588 &sphericalFunctionKetTimesVectorParFlattened,
589 const bool flagScaleInternalMatrix = false);
590
591
593 std::vector<double> d_kPointWeights;
594 std::vector<double> d_kPointCoordinates;
595 std::shared_ptr<dftfe::linearAlgebra::BLASWrapper<memorySpace>>
597 std::shared_ptr<AtomCenteredSphericalFunctionContainer>
599 std::shared_ptr<
602 std::vector<dftfe::uInt> d_numberCellsForEachAtom;
603
604 std::shared_ptr<
607
608
609 // Required by force.cc
611 // Required for stress compute
612 std::vector<ValueType>
614
615 /// map from cell number to set of non local atom ids (local numbering)
616 std::map<dftfe::uInt, std::vector<dftfe::uInt>>
618
619 /// vector of size num physical cells
620 std::vector<dftfe::uInt> d_nonTrivialSphericalFnPerCell;
621
622 /// vector of size num physical cell with starting index for each cell for
623 /// the above array
625
627
628 /// map from local nonlocal atomid to vector over cells
629 std::map<dftfe::uInt, std::vector<dftfe::uInt>>
631
633
635
636 // The above set of variables are needed in force class
637
638#ifdef USE_COMPLEX
639 std::vector<distributedCPUVec<std::complex<double>>>
641
642#else
643 std::vector<distributedCPUVec<double>> d_SphericalFunctionKetTimesVectorPar;
644#endif
645
646 std::map<std::pair<dftfe::uInt, dftfe::uInt>, dftfe::uInt>
648
649 std::vector<dftfe::uInt> d_OwnedAtomIdsInCurrentProcessor;
652 std::map<std::pair<dftfe::uInt, dftfe::uInt>, dftfe::uInt>
654 std::vector<std::vector<
655 std::vector<dftfe::utils::MemoryStorage<ValueType, memorySpace>>>>
657 dealii::ConditionalOStream pcout;
658 const MPI_Comm d_mpi_communicator;
663
664 dftfe::uInt d_totalAtomsInCurrentProc; // number of atoms of interst with
665 // compact in current processor
667 d_totalNonlocalElems; // number of nonlocal FE celss having nonlocal
668 // contribution in current processor
669 dftfe::uInt d_totalNonLocalEntries; // Total number of nonlocal components
671 d_maxSingleAtomContribution; // maximum number of nonlocal indexes across
672 // all atoms of interset
673 std::vector<dftfe::uInt> d_numberCellsAccumNonLocalAtoms;
676 dftfe::uInt d_numberNodesPerElement; // Access from BasisOperator WHile
677 // filling CMatrixEntries
682 bool d_isMallocCalled = false;
684 // Host CMatrix Entries are stored here
685 std::vector<std::vector<std::vector<ValueType>>> d_CMatrixEntriesConjugate,
687 std::vector<std::vector<std::vector<ValueType>>> d_CRMatrixEntriesConjugate;
688 std::vector<std::vector<std::vector<ValueType>>> d_DMatrixEntriesConjugate;
689 std::vector<std::vector<std::vector<ValueType>>>
691
692
693
694 private:
695 /**
696 * @brief stores the d_kpointWeights, d_kpointCoordinates. Other data members regarding are computed from container data object
697 * @param[in] kPointWeights std::vector<double> of size number of kPoints
698 * @param[out] kPointCoordinates std::vector<double> of kPoint coordinates
699 */
700 void
701 initKpoints(const std::vector<double> &kPointWeights,
702 const std::vector<double> &kPointCoordinates);
703 /**
704 * @brief creates the partitioner for the distributed vector based on sparsity patten from sphericalFn container.
705 * @param[in] basisOperationsPtr HOST FEBasisOperations shared_ptr required
706 * to indetify the element ids and quad points.
707 */
708 void
710 /**
711 * @brief computes the entries in C matrix for CPUs and GPUs. On GPUs the entries are copied to a flattened vector on device memory.
712 * Further on GPUs, various maps are created crucial for accessing and
713 * padding entries in Cmatrix flattened device.
714 * @param[in] basisOperationsPtr HOST FEBasisOperations shared_ptr required
715 * to indetify the element ids and quad points
716 * @param[in] quadratureIndex quadrature index for sampling the spherical
717 * function. Quadrature Index is used to reinit basisOperationsPtr
718 */
719 void
721 std::shared_ptr<dftfe::basis::FEBasisOperations<
723 double,
724 dftfe::utils::MemorySpace::HOST>> basisOperationsPtr,
725 std::shared_ptr<
727 BLASWrapperHostPtr,
728 const dftfe::uInt quadratureIndex);
729
730 template <typename ValueTypeSrc>
731 void
733 const std::shared_ptr<
735 nonLocalOperatorSrc,
736 std::shared_ptr<
738 double,
740 basisOperationsPtr,
741 const dftfe::uInt quadratureIndex);
742
743 template <typename ValueTypeSrc>
744 void
746 const std::shared_ptr<
748 nonLocalOperatorSrc,
749 std::shared_ptr<
751 double,
753 basisOperationsPtr,
754 const dftfe::uInt quadratureIndex);
755
756
757 std::map<
761
762 std::map<
766
767 std::map<
771
772 std::map<
776
777 std::vector<dftfe::uInt>
781 std::vector<dftfe::uInt> d_nonlocalElemIdToCellIdVector;
786 std::vector<dftfe::uInt> d_atomStartIndexGlobal;
788
789 std::vector<
790 std::vector<dftfe::utils::MemoryStorage<ValueType, memorySpace>>>
792
793 std::set<dftfe::uInt> d_setOfAtomicNumber;
794 std::vector<dftfe::uInt> d_mapAtomIdToSpeciesIndex,
796 std::vector<dftfe::utils::MemoryStorage<ValueType, memorySpace>>
798 std::vector<dftfe::uInt> d_mapIAtomicNumToDotProd;
799 std::vector<dftfe::uInt> d_mapiAtomToDotProd;
800
802
803 std::vector<dftfe::uInt> d_mapiAtomTosphFuncWaveStart;
804 std::map<dftfe::uInt, std::vector<dftfe::uInt>> d_listOfiAtomInSpecies;
805
806 /**
807 * @brief computes Global Cmatrix on HOST.
808 * @param[in] basisOperationsPtr HOST FEBasisOperations shared_ptr required
809 * to indetify the element ids and quad points
810 * @param[in] BLASWrapperHostPtr HOST BLASWrapper
811 */
812 void
814 std::shared_ptr<dftfe::basis::FEBasisOperations<
816 double,
817 dftfe::utils::MemorySpace::HOST>> basisOperationsPtr,
818 std::shared_ptr<
820 BLASWrapperHostPtr);
821
822#if defined(DFTFE_WITH_DEVICE)
823 /**
824 * @brief Copies the data from distributed Vector to Padded Memory storage object.
825 * @param[in] sphericalFunctionKetTimesVectorParFlattened Distributed Vector
826 * @param[out] paddedVector Padded Vector of size
827 * noAtomsInProc*maxSingleAtomContribution*Nwfc
828 */
829 void
830 copyDistributedVectorToPaddedMemoryStorageVectorDevice(
832 &sphericalFunctionKetTimesVectorParFlattened,
834
835 /**
836 * @brief Copies Padded Memory storage object to Distributed vector.
837 * @param[in] paddedVector Padded Vector of size
838 * noAtomsInProc*maxSingleAtomContribution*Nwfc
839 * @param[out] sphericalFunctionKetTimesVectorParFlattened Distributed
840 * Vector
841 *
842 */
843 void
844 copyPaddedMemoryStorageVectorToDistributeVectorDevice(
847 &sphericalFunctionKetTimesVectorParFlattened);
848
849
850
851 ValueType *d_wfcStartPointer;
852
853 std::vector<ValueType **> deviceWfcPointersInCellRange,
854 devicePointerCDaggerInCellRange, devicePointerCDaggerOutTempInCellRange;
855 std::vector<std::vector<ValueType **>> devicePointerDDaggerInCellRange,
856 devicePointerDDaggerOutTempInCellRange,
857 devicePointerDdyadicRDaggerInCellRange,
858 devicePointerDdyadicRDaggerOutTempInCellRange,
859 devicePointerCRDaggerInCellRange, devicePointerCRDaggerOutTempInCellRange;
860 std::vector<ValueType **> hostWfcPointersInCellRange,
861 hostPointerCDaggerInCellRange, hostPointerCDaggerOutTempInCellRange;
862 std::vector<std::vector<ValueType **>> hostPointerDDaggerInCellRange,
863 hostPointerDDaggerOutTempInCellRange,
864 hostPointerDdyadicRDaggerInCellRange,
865 hostPointerDdyadicRDaggerOutTempInCellRange,
866 hostPointerCRDaggerInCellRange, hostPointerCRDaggerOutTempInCellRange;
867 std::vector<ValueType *> d_wfcStartPointerInCellRange;
868 dftfe::uInt d_cellsBlockSize, d_numCellBatches;
869 std::vector<dftfe::uInt> d_nonLocalElementsInCellRange;
870
871 std::vector<dftfe::uInt> d_nonlocalElemIdToLocalElemIdMap;
872 std::vector<std::vector<std::pair<dftfe::uInt, dftfe::uInt>>>
873 d_elementIdToNonLocalElementIdMap;
874 // The below memory storage objects receives the copy of the distributed
875 // ketTimesWfc data in a padded form. THe padding is done by
876 // copyDistributedVectorToPaddedMemoryStorageVector
878 d_sphericalFnTimesVectorDevice;
880 d_sphericalFnTimesWavefunctionMatrix;
882 d_sphericalFnTimesXTimesWavefunctionMatrix;
884 d_sphericalFnTimesGradientWavefunctionMatrix;
886 d_sphericalFnTimesGradientWavefunctionDyadicXMatrix;
887 // Data structures moved from KSOperatorDevice
888
889 // CconjTranspose and CTranspose entries flattened with iElem as outermost
890 // index
891 std::vector<ValueType>
892 d_IntegralFEMShapeFunctionValueTimesAtomicSphericalFunctionConjugate;
894 d_IntegralFEMShapeFunctionValueTimesAtomicSphericalFunctionConjugateDevice;
895 std::vector<ValueType>
896 d_IntegralFEMShapeFunctionValueTimesAtomicSphericalFunctionTranspose;
898 d_IntegralFEMShapeFunctionValueTimesAtomicSphericalFunctionTransposeDevice;
899
900 // CRconjTranspose entries flattened with iElem as outermost
901 // index
902 std::vector<ValueType>
903 d_IntegralFEMShapeFunctionValueTimesXTimesAtomicSphericalFunctionConjugate;
905 d_IntegralFEMShapeFunctionValueTimesXTimesAtomicSphericalFunctionConjugateDevice;
906 // DconjTranspose entries flattened with iElem as outermost
907 // index
908 std::vector<ValueType>
909 d_IntegralGradientFEMShapeFunctionValueTimesAtomicSphericalFunctionConjugate;
911 d_IntegralGradientFEMShapeFunctionValueTimesAtomicSphericalFunctionConjugateDevice;
912 // DDyadicRconjTranspose entries flattened with iElem as outermost
913 // index
914 std::vector<ValueType>
915 d_IntegralGradientFEMShapeFunctionValueDyadicAtomicSphericalFunctionTimesRConjugate;
917 d_IntegralGradientFEMShapeFunctionValueDyadicAtomicSphericalFunctionTimesRConjugateDevice;
918 // Output of CVCconjTransX flattened with iElem as outermost index: size is
919 // totalNonLocalElements times p^3 times N
921 d_cellHamMatrixTimesWaveMatrixNonLocalDevice;
923 d_sphericalFnTimesVectorAllCellsDevice;
925 d_sphericalFnTimesXTimesVectorAllCellsDevice;
927 d_sphericalFnTimesGradientVectorAllCellsDevice;
929 d_sphericalFnTimesRDyadicGradientVectorAllCellsDevice;
930
931 // Map from cell level atom wise contribution to sphericalFn vector
932 std::vector<dftfe::uInt> d_mapSphericalFnTimesVectorAllCellsReduction;
934 d_mapSphericalFnTimesVectorAllCellsReductionDevice;
935
936
938 d_couplingMatrixTimesVectorDevice;
939
940 // Map from padded nonlocal projector index of iAtom to parallel dealii
941 // vector index.
942 std::vector<dftfe::Int> d_sphericalFnIdsPaddedParallelNumberingMap;
944 d_sphericalFnIdsPaddedParallelNumberingMapDevice;
945
946 // Map from projector index of iAtom in processor to parallel dealii vector
947 // index.
948 std::vector<dftfe::uInt> d_sphericalFnIdsParallelNumberingMap;
950 d_sphericalFnIdsParallelNumberingMapDevice;
951
952
953 // Map from padded nonlocal vector to totalNonLocalElements*maxSphericalFn
954 // cellWise vector.
955 std::vector<dftfe::Int>
956 d_indexMapFromPaddedNonLocalVecToParallelNonLocalVec;
958 d_indexMapFromPaddedNonLocalVecToParallelNonLocalVecDevice;
959
960#endif
961 };
962
963
964
965} // namespace dftfe
966#endif // DFTFE_ATOMICCENTEREDNONLOCALOPERATOR_H
void applyAllReduceOnCconjtransX(dftfe::linearAlgebra::MultiVector< ValueType, memorySpace > &sphericalFunctionKetTimesVectorParFlattened, const bool skipComm=false, const nonLocalContractionVectorType NonLocalContractionVectorType=nonLocalContractionVectorType::CconjTransX)
copies the results from internal member to sphericalFunctionKetTimesVectorParFlattened,...
bool atomPresentInCellRange(const std::pair< dftfe::uInt, dftfe::uInt > cellRange) const
void initKpoints(const std::vector< double > &kPointWeights, const std::vector< double > &kPointCoordinates)
stores the d_kpointWeights, d_kpointCoordinates. Other data members regarding are computed from conta...
std::vector< ValueType > d_atomCenteredKpointIndexedSphericalFnQuadValues
Definition AtomicCenteredNonLocalOperator.h:610
void applyDDyadicRconjtransOnX(const ValueType *X, const std::pair< dftfe::uInt, dftfe::uInt > cellRange)
computes the results of CconjtransX on the cells of interst specied by cellRange
void applyVCconjtransOnX(const dftfe::linearAlgebra::MultiVector< ValueType, memorySpace > &src, const dftfe::uInt kPointIndex, const CouplingStructure couplingtype, const dftfe::utils::MemoryStorage< ValueType, memorySpace > &couplingMatrix, dftfe::linearAlgebra::MultiVector< ValueType, memorySpace > &sphericalFunctionKetTimesVectorParFlattened, const bool flagScaleInternalMatrix=false)
completes the VCconjX on nodal vector src. The src vector must have all ghost nodes and constraint no...
void applyDconjtransOnX(const ValueType *X, const std::pair< dftfe::uInt, dftfe::uInt > cellRange)
computes the results of CconjtransX on the cells of interst specied by cellRange
std::vector< dftfe::uInt > d_mapiAtomToDotProd
Definition AtomicCenteredNonLocalOperator.h:799
bool d_reinitialiseKPoint
Definition AtomicCenteredNonLocalOperator.h:683
dftfe::uInt d_totalNumSphericalFunctionsGlobal
Definition AtomicCenteredNonLocalOperator.h:787
dealii::IndexSet d_locallyOwnedAtomCenteredFnIdsCurrentProcess
Definition AtomicCenteredNonLocalOperator.h:650
std::map< dftfe::uInt, std::vector< dftfe::uInt > > d_atomIdToNonTrivialSphericalFnCellStartIndex
map from local nonlocal atomid to vector over cells
Definition AtomicCenteredNonLocalOperator.h:630
dftfe::uInt getTotalAtomInCurrentProcessor() const
std::vector< dftfe::utils::MemoryStorage< ValueType, memorySpace > > d_dotProductAtomicWaveInputWaveTemp
Definition AtomicCenteredNonLocalOperator.h:797
const std::vector< dftfe::uInt > & getSphericalFnTimesVectorFlattenedVectorLocalIds() const
Returns the Flattened vector of sphericalFunctionIDs in order of atomIDs of atoms in processor.
void initialiseFlattenedDataStructure(dftfe::uInt waveFunctionBlockSize, dftfe::linearAlgebra::MultiVector< ValueType, memorySpace > &sphericalFunctionKetTimesVectorParFlattened, const nonLocalContractionVectorType NonLocalContractionVectorType=nonLocalContractionVectorType::CconjTransX)
initialises the multivector object, waveFunctionBlockSize and resizes various internal data members....
bool d_useGlobalCMatrix
Definition AtomicCenteredNonLocalOperator.h:785
const std::vector< ValueType > & getCmatrixEntriesConjugate(const dftfe::uInt chargeId, const dftfe::uInt iElemComp) const
Returns C matrix entries for chargeId and it compact support element Id.
std::vector< double > d_kPointWeights
Definition AtomicCenteredNonLocalOperator.h:593
const dftfe::uInt d_n_mpi_processes
Definition AtomicCenteredNonLocalOperator.h:660
std::vector< ValueType > getCmatrixEntries(dftfe::Int kPointIndex, dftfe::uInt atomId, dftfe::Int iElem) const
bool d_AllReduceCompleted
Definition AtomicCenteredNonLocalOperator.h:592
const std::map< dftfe::uInt, std::vector< dftfe::uInt > > & getAtomIdToNonTrivialSphericalFnCellStartIndex() const
Required in configurational forces. Cummulative sphercial Fn Id. The size is numCells in processor.
std::map< dftfe::uInt, std::vector< dftfe::uInt > > d_cellIdToAtomIdsLocalCompactSupportMap
map from cell number to set of non local atom ids (local numbering)
Definition AtomicCenteredNonLocalOperator.h:617
std::vector< dftfe::uInt > d_flattenedNonLocalCellDofIndexToProcessDofIndexVector
Definition AtomicCenteredNonLocalOperator.h:778
void copyPartitionerKPointsAndComputeCMatrixEntries(const bool updateSparsity, const std::vector< double > &kPointWeights, const std::vector< double > &kPointCoordinates, std::shared_ptr< dftfe::basis::FEBasisOperations< dataTypes::number, double, dftfe::utils::MemorySpace::HOST > > basisOperationsPtr, std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< dftfe::utils::MemorySpace::HOST > > BLASWrapperHostPtr, const dftfe::uInt quadratureIndex, const std::shared_ptr< AtomicCenteredNonLocalOperator< ValueTypeSrc, memorySpace > > nonLocalOperatorSrc)
calls internal function: initialisePartitioner, initialiseKpoint and computeCMatrixEntries
const std::vector< ValueType > & getAtomCenteredKpointTimesSphericalFnTimesDistFromAtomQuadValues() const
std::map< std::pair< dftfe::uInt, dftfe::uInt >, dftfe::uInt > d_AtomCenteredFnIdsNumberingMapCurrentProcess
Definition AtomicCenteredNonLocalOperator.h:653
std::vector< std::vector< std::vector< ValueType > > > d_CRMatrixEntriesConjugate
Definition AtomicCenteredNonLocalOperator.h:687
dftfe::uInt d_numberWaveFunctions
Definition AtomicCenteredNonLocalOperator.h:679
std::vector< dftfe::uInt > d_nonlocalElemIdToCellIdVector
Definition AtomicCenteredNonLocalOperator.h:781
const MPI_Comm d_mpi_communicator
Definition AtomicCenteredNonLocalOperator.h:658
std::vector< dftfe::uInt > d_mapiAtomTosphFuncWaveStart
Definition AtomicCenteredNonLocalOperator.h:803
dftfe::uInt d_locallyOwnedCells
Definition AtomicCenteredNonLocalOperator.h:678
const std::vector< dftfe::uInt > & getAtomIdsInCurrentProcessor() const
std::map< dftfe::uInt, std::vector< dftfe::uInt > > d_listOfiAtomInSpecies
Definition AtomicCenteredNonLocalOperator.h:804
std::set< dftfe::uInt > d_setOfAtomicNumber
Definition AtomicCenteredNonLocalOperator.h:793
dftfe::utils::MemoryStorage< dftfe::uInt, memorySpace > d_iElemNonLocalToElemIndexMap
Definition AtomicCenteredNonLocalOperator.h:675
bool d_computeIonForces
Definition AtomicCenteredNonLocalOperator.h:783
dftfe::uInt d_kPointIndex
Definition AtomicCenteredNonLocalOperator.h:680
void paddingCouplingMatrix(const std::vector< ValueType > &entries, std::vector< ValueType > &entriesPadded, const CouplingStructure couplingtype)
Called only for GPU runs where the coupling matrix has to be padded.
dftfe::uInt d_maxSingleAtomContribution
Definition AtomicCenteredNonLocalOperator.h:671
dealii::IndexSet d_ghostSphericalFunctionIdsCurrentProcess
Definition AtomicCenteredNonLocalOperator.h:662
std::vector< std::vector< std::vector< ValueType > > > d_CMatrixEntriesConjugate
Definition AtomicCenteredNonLocalOperator.h:685
std::vector< dftfe::uInt > d_nonTrivialSphericalFnsCellStartIndex
Definition AtomicCenteredNonLocalOperator.h:624
void computeInnerProductOverSphericalFnsWaveFns(const dftfe::Int vectorDimension, const dftfe::linearAlgebra::MultiVector< ValueType, memorySpace > &VCconjTransXsphericalFunctionKetTimesVectorParFlattened, const dftfe::linearAlgebra::MultiVector< ValueType, memorySpace > &sphericalFunctionKetTimesVectorParFlattened, const std::map< dftfe::uInt, dftfe::uInt > nonlocalAtomIdToGlobalIdMap, std::vector< ValueType > &outputVector)
Computes the inner products summing over the sphericalFn and WaveFns for each atom.
std::shared_ptr< dftfe::basis::FEBasisOperations< dataTypes::number, double, memorySpace > > d_basisOperatorPtr
Definition AtomicCenteredNonLocalOperator.h:606
std::vector< std::vector< std::vector< ValueType > > > d_CMatrixEntriesTranspose
Definition AtomicCenteredNonLocalOperator.h:686
const std::vector< dftfe::uInt > & getNonTrivialAllCellsSphericalFnAlphaToElemIdMap() const
dftfe::uInt d_totalAtomsInCurrentProc
Definition AtomicCenteredNonLocalOperator.h:664
std::map< dftfe::uInt, dftfe::utils::MemoryStorage< ValueType, dftfe::utils::MemorySpace::HOST > > d_sphericalFnTimesGradientWavefunMatrix
Definition AtomicCenteredNonLocalOperator.h:770
std::vector< distributedCPUVec< double > > d_SphericalFunctionKetTimesVectorPar
Definition AtomicCenteredNonLocalOperator.h:643
void intitialisePartitionerKPointsAndComputeCMatrixEntries(const bool updateSparsity, const std::vector< double > &kPointWeights, const std::vector< double > &kPointCoordinates, std::shared_ptr< dftfe::basis::FEBasisOperations< dataTypes::number, double, dftfe::utils::MemorySpace::HOST > > basisOperationsPtr, std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< dftfe::utils::MemorySpace::HOST > > BLASWrapperHostPtr, const dftfe::uInt quadratureIndex)
calls internal function: initialisePartitioner, initialiseKpoint and computeCMatrixEntries
dftfe::uInt d_sumNonTrivialSphericalFnOverAllCells
Definition AtomicCenteredNonLocalOperator.h:632
std::map< dftfe::uInt, dftfe::utils::MemoryStorage< ValueType, dftfe::utils::MemorySpace::HOST > > d_sphericalFnTimesWavefunMatrix
Definition AtomicCenteredNonLocalOperator.h:760
dftfe::uInt d_totalLocallyOwnedNodes
Definition AtomicCenteredNonLocalOperator.h:801
std::map< dftfe::uInt, dftfe::utils::MemoryStorage< ValueType, dftfe::utils::MemorySpace::HOST > > d_sphericalFnTimesXTimesWavefunMatrix
Definition AtomicCenteredNonLocalOperator.h:765
std::vector< std::vector< dftfe::utils::MemoryStorage< ValueType, memorySpace > > > d_CMatrixGlobal
Definition AtomicCenteredNonLocalOperator.h:791
const std::vector< dftfe::uInt > & getOwnedAtomIdsInCurrentProcessor() const
const std::vector< ValueType > & getAtomCenteredKpointIndexedSphericalFnQuadValues() const
void initialiseOperatorActionOnX(dftfe::uInt kPointIndex, const nonLocalContractionVectorType NonLocalContractionVectorType=nonLocalContractionVectorType::CconjTransX)
Resizes various internal data members and selects the kpoint of interest.
std::vector< dftfe::uInt > d_nonTrivialSphericalFnPerCell
vector of size num physical cells
Definition AtomicCenteredNonLocalOperator.h:620
void applyCRconjtransOnX(const ValueType *X, const std::pair< dftfe::uInt, dftfe::uInt > cellRange)
computes the results of CRconjtransX on the cells of interst specied by cellRange
std::vector< dftfe::uInt > d_numberCellsAccumNonLocalAtoms
Definition AtomicCenteredNonLocalOperator.h:673
void applyCOnVCconjtransX(dftfe::linearAlgebra::MultiVector< ValueType, memorySpace > &Xout)
adds the result of CVCtX onto Xout for both CPU and GPU calls
std::vector< dftfe::uInt > & getAtomWiseNumberCellsInCompactSupport() const
std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< memorySpace > > d_BLASWrapperPtr
Definition AtomicCenteredNonLocalOperator.h:596
void copyCMatrixEntries(const std::shared_ptr< AtomicCenteredNonLocalOperator< ValueTypeSrc, memorySpace > > nonLocalOperatorSrc, std::shared_ptr< dftfe::basis::FEBasisOperations< dataTypes::number, double, dftfe::utils::MemorySpace::HOST > > basisOperationsPtr, const dftfe::uInt quadratureIndex)
std::vector< dftfe::uInt > d_mapiAtomToSpeciesIndex
Definition AtomicCenteredNonLocalOperator.h:795
void copyBackFromDistributedVectorToLocalDataStructure(dftfe::linearAlgebra::MultiVector< ValueType, memorySpace > &sphericalFunctionKetTimesVectorParFlattened, const dftfe::utils::MemoryStorage< double, memorySpace > &scalingVector)
After AllReduce function is called this will copy to the nonLocalOperatorClassDatastructure.
void computeCMatrixEntries(std::shared_ptr< dftfe::basis::FEBasisOperations< dataTypes::number, double, dftfe::utils::MemorySpace::HOST > > basisOperationsPtr, std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< dftfe::utils::MemorySpace::HOST > > BLASWrapperHostPtr, const dftfe::uInt quadratureIndex)
computes the entries in C matrix for CPUs and GPUs. On GPUs the entries are copied to a flattened vec...
dftfe::uInt getGlobalDofAtomIdSphericalFnPair(const dftfe::uInt atomId, const dftfe::uInt alpha) const
void applyVCconjtransOnXCellLevel(const dftfe::linearAlgebra::MultiVector< ValueType, memorySpace > &src, const dftfe::uInt kPointIndex, const CouplingStructure couplingtype, const dftfe::utils::MemoryStorage< ValueType, memorySpace > &couplingMatrix, dftfe::linearAlgebra::MultiVector< ValueType, memorySpace > &sphericalFunctionKetTimesVectorParFlattened, const bool flagScaleInternalMatrix=false)
completes the VCconjX on nodal vector src. The src vector must have all ghost nodes and constraint no...
std::vector< dftfe::uInt > d_numberCellsForEachAtom
Definition AtomicCenteredNonLocalOperator.h:602
std::shared_ptr< AtomCenteredSphericalFunctionContainer > d_atomCenteredSphericalFunctionContainer
Definition AtomicCenteredNonLocalOperator.h:598
void applyVOnCconjtransX(const CouplingStructure couplingtype, const dftfe::utils::MemoryStorage< ValueType, memorySpace > &couplingMatrix, dftfe::linearAlgebra::MultiVector< ValueType, memorySpace > &sphericalFunctionKetTimesVectorParFlattened, const bool flagCopyResultsToMatrix=true)
compute the action of coupling matrix on sphericalFunctionKetTimesVectorParFlattened....
void initialisePartitioner()
creates the partitioner for the distributed vector based on sparsity patten from sphericalFn containe...
dftfe::uInt getTotalNumberOfSphericalFunctionsForAtomId(dftfe::uInt atomId)
Returns number of spherical function for a given nonlocal atom id.
std::vector< dftfe::uInt > d_atomStartIndexGlobal
Definition AtomicCenteredNonLocalOperator.h:786
std::map< dftfe::uInt, dftfe::utils::MemoryStorage< ValueType, dftfe::utils::MemorySpace::HOST > > d_sphericalFnTimesGradientWavefunDyadicXMatrix
Definition AtomicCenteredNonLocalOperator.h:775
bool atomSupportInElement(dftfe::uInt iElem) const
std::vector< dftfe::uInt > d_sphericalFnTimesVectorFlattenedVectorLocalIds
Definition AtomicCenteredNonLocalOperator.h:634
std::vector< dftfe::uInt > d_mapAtomIdToSpeciesIndex
Definition AtomicCenteredNonLocalOperator.h:794
const std::vector< dftfe::uInt > & getNonTrivialSphericalFnsCellStartIndex() const
const dftfe::utils::MemoryStorage< dftfe::uInt, memorySpace > & getFlattenedNonLocalCellDofIndexToProcessDofIndexMap() const
std::vector< std::vector< std::vector< dftfe::utils::MemoryStorage< ValueType, memorySpace > > > > d_CMatrixEntries
Definition AtomicCenteredNonLocalOperator.h:656
const std::vector< dftfe::uInt > & getNonlocalElementToCellIdVector() const
dftfe::utils::MemoryStorage< dftfe::uInt, memorySpace > d_flattenedNonLocalCellDofIndexToProcessDofIndexMap
Definition AtomicCenteredNonLocalOperator.h:780
void applyCconjtransOnX(const dftfe::linearAlgebra::MultiVector< ValueType, memorySpace > &X)
computes the results of CconjtransX on nodal X vector
dftfe::uInt d_numberNodesPerElement
Definition AtomicCenteredNonLocalOperator.h:676
bool d_isMallocCalled
Definition AtomicCenteredNonLocalOperator.h:682
std::shared_ptr< const utils::mpi::MPIPatternP2P< dftfe::utils::MemorySpace::HOST > > d_mpiPatternP2P
Definition AtomicCenteredNonLocalOperator.h:601
bool d_floatingNuclearCharges
Definition AtomicCenteredNonLocalOperator.h:782
void applyCconjtransOnX(const ValueType *X, const std::pair< dftfe::uInt, dftfe::uInt > cellRange)
computes the results of CconjtransX on the cells of interst specied by cellRange
std::vector< dftfe::uInt > & getAtomWiseNumberCellsAccumulated() const
dftfe::uInt d_totalNonLocalEntries
Definition AtomicCenteredNonLocalOperator.h:669
dealii::ConditionalOStream pcout
Definition AtomicCenteredNonLocalOperator.h:657
void applyCOnVCconjtransX(ValueType *Xout, const std::pair< dftfe::uInt, dftfe::uInt > cellRange)
adds the result of CVCtX onto Xout for both CPU and GPU calls
std::vector< dftfe::uInt > d_mapIAtomicNumToDotProd
Definition AtomicCenteredNonLocalOperator.h:798
void applyCVCconjtransOnX(const dftfe::linearAlgebra::MultiVector< ValueType, memorySpace > &src, const dftfe::uInt kPointIndex, const CouplingStructure couplingtype, const dftfe::utils::MemoryStorage< ValueType, memorySpace > &couplingMatrix, dftfe::linearAlgebra::MultiVector< ValueType, memorySpace > &sphericalFunctionKetTimesVectorParFlattened, dftfe::linearAlgebra::MultiVector< ValueType, memorySpace > &dst)
completes the action of CVCconjtranspose on nodal vector src. The src vector must have all ghost node...
const std::map< dftfe::uInt, std::vector< dftfe::uInt > > & getCellIdToAtomIdsLocalCompactSupportMap() const
void applyVCconjtransOnXUsingGlobalC(const dftfe::linearAlgebra::MultiVector< ValueType, memorySpace > &src, const dftfe::uInt kPointIndex, const CouplingStructure couplingtype, const dftfe::utils::MemoryStorage< ValueType, memorySpace > &couplingMatrix, dftfe::linearAlgebra::MultiVector< ValueType, memorySpace > &sphericalFunctionKetTimesVectorParFlattened, const bool flagScaleInternalMatrix=false)
completes the VCconjX on nodal vector src using global C matrix. The global C matrix mush have been c...
const ValueType * getCconjtansXLocalDataStructure(const dftfe::uInt iAtom) const
Returns the pointer of CTX stored in HOST memory.
std::vector< std::vector< std::vector< ValueType > > > d_DMatrixEntriesConjugate
Definition AtomicCenteredNonLocalOperator.h:688
const dftfe::uInt getTotalNonTrivialSphericalFnsOverAllCells() const
const std::vector< dftfe::uInt > & getNonTrivialSphericalFnsPerCell() const
std::map< std::pair< dftfe::uInt, dftfe::uInt >, dftfe::uInt > d_sphericalFunctionIdsNumberingMapCurrentProcess
Definition AtomicCenteredNonLocalOperator.h:647
std::vector< dftfe::uInt > d_OwnedAtomIdsInCurrentProcessor
Definition AtomicCenteredNonLocalOperator.h:649
std::vector< dftfe::uInt > d_nonTrivialAllCellsSphericalFnAlphaToElemIdMap
Definition AtomicCenteredNonLocalOperator.h:626
std::vector< double > d_kPointCoordinates
Definition AtomicCenteredNonLocalOperator.h:594
AtomicCenteredNonLocalOperator(std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< memorySpace > > BLASWrapperPtr, std::shared_ptr< dftfe::basis::FEBasisOperations< dataTypes::number, double, memorySpace > > basisOperatorPtr, std::shared_ptr< AtomCenteredSphericalFunctionContainer > atomCenteredSphericalFunctionContainer, const MPI_Comm &mpi_comm_parent, const bool memOptMode=false, const bool floatingNuclearCharges=true, const bool useGlobalCMatrix=false, const bool computeIonForces=false, const bool computeCellStress=false)
dftfe::uInt getMaxSingleAtomEntries() const
bool d_memoryOptMode
Definition AtomicCenteredNonLocalOperator.h:681
const std::vector< std::vector< dftfe::utils::MemoryStorage< ValueType, memorySpace > > > & getGlobalCMatrix() const
Returns global C matrix of all atoms.
void copyGlobalCMatrix(const std::shared_ptr< AtomicCenteredNonLocalOperator< ValueTypeSrc, memorySpace > > nonLocalOperatorSrc, std::shared_ptr< dftfe::basis::FEBasisOperations< dataTypes::number, double, dftfe::utils::MemorySpace::HOST > > basisOperationsPtr, const dftfe::uInt quadratureIndex)
dftfe::uInt getLocalIdOfDistributedVec(const dftfe::uInt globalId) const
const std::vector< ValueType > & getCmatrixEntriesTranspose(const dftfe::uInt chargeId, const dftfe::uInt iElemComp) const
Returns C conj matrix entries for chargeId and it compact support element Id.
const dftfe::uInt d_this_mpi_process
Definition AtomicCenteredNonLocalOperator.h:659
dftfe::uInt getTotalNonLocalEntriesCurrentProcessor() const
void computeGlobalCMatrixVector(std::shared_ptr< dftfe::basis::FEBasisOperations< dataTypes::number, double, dftfe::utils::MemorySpace::HOST > > basisOperationsPtr, std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< dftfe::utils::MemorySpace::HOST > > BLASWrapperHostPtr)
computes Global Cmatrix on HOST.
dealii::IndexSet d_locallyOwnedSphericalFunctionIdsCurrentProcess
Definition AtomicCenteredNonLocalOperator.h:661
std::vector< std::vector< std::vector< ValueType > > > d_DDyadicRMatrixEntriesConjugate
Definition AtomicCenteredNonLocalOperator.h:690
bool d_computeCellStress
Definition AtomicCenteredNonLocalOperator.h:784
void computeCconjtransCMatrix(const dftfe::uInt atomId, std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< dftfe::utils::MemorySpace::HOST > > BLASWrapperPtr, const dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &Dinverse, dftfe::utils::MemoryStorage< ValueType, dftfe::utils::MemorySpace::HOST > PconjtransposePmatrix)
Computes C^{T}D^{-1}C at the global level for atomId. This is required in PAW.
dftfe::uInt getTotalNonLocalElementsInCurrentProcessor() const
std::vector< dftfe::uInt > & getNonLocalElemIdToLocalElemIdMap() const
std::vector< ValueType > d_atomCenteredKpointTimesSphericalFnTimesDistFromAtomQuadValues
Definition AtomicCenteredNonLocalOperator.h:613
dealii::IndexSet d_ghostAtomCenteredFnIdsCurrentProcess
Definition AtomicCenteredNonLocalOperator.h:651
dftfe::uInt d_totalNonlocalElems
Definition AtomicCenteredNonLocalOperator.h:667
Definition FEBasisOperations.h:85
Definition BLASWrapper.h:35
An class template to encapsulate a MultiVector. A MultiVector is a collection of vectors belonging t...
Definition MultiVector.h:127
Definition MemoryStorage.h:33
A class template to store the communication pattern (i.e., which entries/nodes to receive from which ...
Definition MPIPatternP2P.h:57
double number
Definition dftfeDataTypes.h:41
@ HOST
Definition MemorySpaceType.h:34
Definition pseudoPotentialToDftfeConverter.cc:34
nonLocalContractionVectorType
Definition AtomicCenteredNonLocalOperator.h:55
@ CconjTransX
Definition AtomicCenteredNonLocalOperator.h:56
@ DDyadicRconjTransX
Definition AtomicCenteredNonLocalOperator.h:59
@ CRconjTransX
Definition AtomicCenteredNonLocalOperator.h:57
@ DconjTransX
Definition AtomicCenteredNonLocalOperator.h:58
CouplingStructure
Enum class that lists used in the non-local Operator.
Definition AtomicCenteredNonLocalOperator.h:48
@ dense
Definition AtomicCenteredNonLocalOperator.h:50
@ blockDiagonal
Definition AtomicCenteredNonLocalOperator.h:51
@ diagonal
Definition AtomicCenteredNonLocalOperator.h:49
std::uint32_t uInt
Definition TypeConfig.h:10
std::int32_t Int
Definition TypeConfig.h:11