ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
nonlocal.h
Go to the documentation of this file.
1#ifndef NONLOCALNEW_H
2#define NONLOCALNEW_H
9
10#include <array>
11#include <unordered_map>
12#include <vector>
13
14namespace hamilt
15{
16
17#ifndef __NONLOCALNEWTEMPLATE
18#define __NONLOCALNEWTEMPLATE
19
25template <class T>
26class Nonlocal : public T
27{
28};
29
30#endif
31
39template <typename TK, typename TR>
40class Nonlocal<OperatorLCAO<TK, TR>> : public OperatorLCAO<TK, TR>
41{
42 public:
44 const std::vector<ModuleBase::Vector3<double>>& kvec_d_in,
46 const UnitCell* ucell_in,
47 const std::vector<double>& orb_cutoff,
48 const Grid_Driver* GridD_in,
49 const TwoCenterIntegrator* intor);
51
56 virtual void contributeHR() override;
57
58 void cal_force_stress(const bool cal_force,
59 const bool cal_stress,
60 const HContainer<TR>* dmR,
61 ModuleBase::matrix& force,
62 ModuleBase::matrix& stress);
63
129 void cal_dH(std::array<std::vector<hamilt::HContainer<double>*>, 3>& dhR);
130
131 virtual void set_HR_fixed(void*) override;
132
133 private:
134 const UnitCell* ucell = nullptr;
135
136 std::vector<double> orb_cutoff_;
137
139
140 // the following variable is introduced temporarily during LCAO refactoring
141 const TwoCenterIntegrator* intor_ = nullptr;
142
143 bool allocated = false;
144
145 bool HR_fixed_done = false;
146
152 void initialize_HR(const Grid_Driver* GridD_in);
153
159 void calculate_HR();
160
164 void cal_HR_IJR(const int& iat1,
165 const int& iat2,
166 const int& T0,
167 const Parallel_Orbitals* paraV,
168 const std::unordered_map<int, std::vector<double>>& nlm1_all,
169 const std::unordered_map<int, std::vector<double>>& nlm2_all,
170 TR* data_pointer);
171
172 const Grid_Driver* gridD = nullptr;
173
177 void cal_force_IJR(const int& iat1,
178 const int& iat2,
179 const int& T0,
180 const Parallel_Orbitals* paraV,
181 const std::unordered_map<int, std::vector<double>>& nlm1_all,
182 const std::unordered_map<int, std::vector<double>>& nlm2_all,
183 const hamilt::BaseMatrix<TR>* dmR_pointer,
184 double* force1,
185 double* force2);
189 void cal_stress_IJR(const int& iat1,
190 const int& iat2,
191 const int& T0,
192 const Parallel_Orbitals* paraV,
193 const std::unordered_map<int, std::vector<double>>& nlm1_all,
194 const std::unordered_map<int, std::vector<double>>& nlm2_all,
195 const hamilt::BaseMatrix<TR>* dmR_pointer,
196 const ModuleBase::Vector3<double>& dis1,
197 const ModuleBase::Vector3<double>& dis2,
198 double* stress);
199
200 std::vector<AdjacentAtomInfo> adjs_all;
201};
202
203} // namespace hamilt
204#endif
Grid_Driver class for neighbor search interface.
Definition sltk_grid_driver.h:63
3 elements vector
Definition vector3.h:21
Definition matrix.h:15
Definition parallel_orbitals.h:16
A class to compute two-center integrals.
Definition two_center_integrator.h:35
Provide the basic information about unitcell.
Definition unitcell.h:16
Definition base_matrix.h:20
Definition hcontainer.h:147
Definition hs_matrix_k.h:12
void cal_dH(std::array< std::vector< hamilt::HContainer< double > * >, 3 > &dhR)
Calculate the derivative of the non-local pseudopotential Hamiltonian with respect to atomic displace...
Definition nonlocal_dh.cpp:12
std::vector< AdjacentAtomInfo > adjs_all
Definition nonlocal.h:200
Nonlocal(HS_Matrix_K< TK > *hsk_in, const std::vector< ModuleBase::Vector3< double > > &kvec_d_in, hamilt::HContainer< TR > *hR_in, const UnitCell *ucell_in, const std::vector< double > &orb_cutoff, const Grid_Driver *GridD_in, const TwoCenterIntegrator *intor)
Definition nonlocal.cpp:16
hamilt::HContainer< TR > * HR_fixed
Definition nonlocal.h:138
bool allocated
Definition nonlocal.h:143
const TwoCenterIntegrator * intor_
Definition nonlocal.h:141
std::vector< double > orb_cutoff_
Definition nonlocal.h:136
const UnitCell * ucell
Definition nonlocal.h:134
void initialize_HR(const Grid_Driver *GridD_in)
initialize HR, search the nearest neighbor atoms HContainer is used to store the non-local pseudopote...
Definition nonlocal.cpp:51
bool HR_fixed_done
Definition nonlocal.h:145
void calculate_HR()
calculate the non-local pseudopotential matrix with specific <I,J,R> atom-pairs nearest neighbor atom...
Definition nonlocal.cpp:121
virtual void contributeHR() override
contributeHR() is used to calculate the HR matrix <phi_{\mu, 0}|beta_p1>D_{p1, p2}...
Definition nonlocal.cpp:298
const Grid_Driver * gridD
Definition nonlocal.h:172
virtual void set_HR_fixed(void *) override
set_HR_fixed() is used for pass HR_fixed matrix to the next node in sub-chain table not used in base ...
Definition nonlocal.cpp:290
void cal_HR_IJR(const int &iat1, const int &iat2, const int &T0, const Parallel_Orbitals *paraV, const std::unordered_map< int, std::vector< double > > &nlm1_all, const std::unordered_map< int, std::vector< double > > &nlm2_all, TR *data_pointer)
calculate the HR local matrix of <I,J,R> atom pair
Definition nonlocal.cpp:230
void cal_force_stress(const bool cal_force, const bool cal_stress, const HContainer< TR > *dmR, ModuleBase::matrix &force, ModuleBase::matrix &stress)
Definition nonlocal_fs.cpp:10
Definition nonlocal.h:27
void cal_force_IJR(const int &iat1, const int &iat2, const int &T0, const Parallel_Orbitals *paraV, const std::unordered_map< int, std::vector< double > > &nlm1_all, const std::unordered_map< int, std::vector< double > > &nlm2_all, const hamilt::BaseMatrix< std::complex< double > > *dmR_pointer, double *force1, double *force2)
Definition nonlocal_fs.cpp:221
void cal_stress_IJR(const int &iat1, const int &iat2, const int &T0, const Parallel_Orbitals *paraV, const std::unordered_map< int, std::vector< double > > &nlm1_all, const std::unordered_map< int, std::vector< double > > &nlm2_all, const hamilt::BaseMatrix< std::complex< double > > *dmR_pointer, const ModuleBase::Vector3< double > &dis1, const ModuleBase::Vector3< double > &dis2, double *stress)
Definition nonlocal_fs.cpp:286
OperatorLCAO(HS_Matrix_K< TK > *hsk_in, const std::vector< ModuleBase::Vector3< double > > &kvec_d_in, HContainer< TR > *hR_in)
H(R) matrix, R is the Bravis lattice vector.
Definition operator_lcao.h:16
#define T
Definition exp.cpp:237
Definition wf_op.cpp:6
Grid_Driver class for neighbor search interface.