ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
gint_drho.h
Go to the documentation of this file.
1#ifndef ABACUS_SOURCE_HAMILT_MODULE_GINT_GINT_DRHO_H
2#define ABACUS_SOURCE_HAMILT_MODULE_GINT_GINT_DRHO_H
3
4#include "gint.h"
5#include "gint_info.h"
7#include <vector>
8
9namespace ModuleGint
10{
11
12// Gint_drho integrates, on the real-space grid, the gradient density
13// [grad rho]^d(r) = sum_{Kk,Ll} D_{Kk,Ll} (grad^d phi_Kk)(r) phi_Ll(r), d = x,y,z
14// i.e. the derivative is taken on the FIRST (row) orbital of the density matrix.
15// Pass a symmetrized matrix (D + D^T) to obtain
16// [grad rho^S]^d(r) = sum_{Kk,Ll} D_{Kk,Ll} [grad phi_Kk phi_Ll + phi_Kk grad phi_Ll].
17//
18// The grid loop / dm-to-gint preparation mirror Gint_rho; the orbital gradient
19// (set_phi_dphi) is obtained exactly as in Gint_dvlocal. Everything is fp64 because
20// set_phi_dphi only provides double-precision gradients.
21//
22// The three output buffers are ACCUMULATED into (phi_dot_phi uses +=), so the caller
23// must zero-initialize drho_{x,y,z}[is] (each of length nrxx) before calling cal_gint().
24class Gint_drho : public Gint
25{
26 public:
28 const std::vector<HContainer<double> *> &dm_vec,
29 const int nspin,
30 double **drho_x,
31 double **drho_y,
32 double **drho_z)
33 : dm_vec_(dm_vec), nspin_(nspin), drho_x_(drho_x), drho_y_(drho_y), drho_z_(drho_z)
34 {
35 }
36
37 void cal_gint();
38
39 private:
40 std::vector<HContainer<double>> init_dm_gint_() const;
41
42 void cal_drho_(const std::vector<HContainer<double>> &dm_gint_vec) const;
43
44 // input
45 const std::vector<HContainer<double> *> dm_vec_;
46 const int nspin_;
47
48 // output: [grad rho]_{x,y,z}[is](ir), accumulated
49 double **drho_x_ = nullptr;
50 double **drho_y_ = nullptr;
51 double **drho_z_ = nullptr;
52};
53
54} // namespace ModuleGint
55
56#endif // ABACUS_SOURCE_HAMILT_MODULE_GINT_GINT_DRHO_H
const std::vector< HContainer< double > * > dm_vec_
Definition gint_drho.h:45
Gint_drho(const std::vector< HContainer< double > * > &dm_vec, const int nspin, double **drho_x, double **drho_y, double **drho_z)
Definition gint_drho.h:27
void cal_gint()
Definition gint_drho.cpp:9
const int nspin_
Definition gint_drho.h:46
void cal_drho_(const std::vector< HContainer< double > > &dm_gint_vec) const
Definition gint_drho.cpp:29
double ** drho_z_
Definition gint_drho.h:51
std::vector< HContainer< double > > init_dm_gint_() const
Definition gint_drho.cpp:19
double ** drho_y_
Definition gint_drho.h:50
double ** drho_x_
Definition gint_drho.h:49
Definition batch_biggrid.cpp:4
hamilt::HContainer< T > HContainer
Definition gint_type.h:15