ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
dspin_lcao.h
Go to the documentation of this file.
1#ifndef DELTA_SPIN_LCAO_H
2#define DELTA_SPIN_LCAO_H
3
10#include <unordered_map>
11
12namespace hamilt
13{
14
15#ifndef __DELTASPINTEMPLATE
16#define __DELTASPINTEMPLATE
17
18template <class T>
19class DeltaSpin : public T
20{
21};
22
23#endif
24
25template <typename TK, typename TR>
26class DeltaSpin<OperatorLCAO<TK, TR>> : public OperatorLCAO<TK, TR>
27{
28 public:
30 const std::vector<ModuleBase::Vector3<double>>& kvec_d_in,
32 const UnitCell& ucell_in,
33 const Grid_Driver* gridD_in,
34 const TwoCenterIntegrator* intor,
35 const std::vector<double>& orb_cutoff);
37
42 virtual void contributeHR() override;
43
49 std::vector<double> cal_moment(const HContainer<double>* dmR, const std::vector<ModuleBase::Vector3<int>>& constrain);
50
55 {
56 for(int is=0;is<this->spin_num;is++)
57 {
58 this->update_lambda_[is] = true;
59 }
60 }
61
63 void cal_force_stress(const bool cal_force,
64 const bool cal_stress,
65 const HContainer<double>* dmR,
66 ModuleBase::matrix& force,
67 ModuleBase::matrix& stress);
68
69 private:
70 const UnitCell* ucell = nullptr;
71
72 const Grid_Driver* gridD = nullptr;
73
74 const Parallel_Orbitals* paraV = nullptr;
75
77
78 const TwoCenterIntegrator* intor_ = nullptr;
79
80 std::vector<double> orb_cutoff_;
81
83 int nspin = 0;
84
88 void cal_HR_IJR(const int& iat1,
89 const int& iat2,
90 const std::unordered_map<int, std::vector<double>>& nlm1_all,
91 const std::unordered_map<int, std::vector<double>>& nlm2_all,
92 TR* data_pointer);
93
98 void cal_pre_HR();
99
103 void cal_constraint_atom_list(const std::vector<ModuleBase::Vector3<int>>& constraints);
104
108 void cal_moment_IJR(const double* dmR,
109 const TR* hr,
110 const int row_size,
111 const int col_size,
112 double* moment);
113
117 void cal_force_IJR(const int& iat1,
118 const int& iat2,
119 const Parallel_Orbitals* paraV,
120 const std::unordered_map<int, std::vector<double>>& nlm1_all,
121 const std::unordered_map<int, std::vector<double>>& nlm2_all,
122 const hamilt::BaseMatrix<double>* dmR_pointer,
123 const ModuleBase::Vector3<double>& lambda,
124 const int nspin,
125 double* force1,
126 double* force2);
130 void cal_stress_IJR(const int& iat1,
131 const int& iat2,
132 const Parallel_Orbitals* paraV,
133 const std::unordered_map<int, std::vector<double>>& nlm1_all,
134 const std::unordered_map<int, std::vector<double>>& nlm2_all,
135 const hamilt::BaseMatrix<double>* dmR_pointer,
136 const ModuleBase::Vector3<double>& lambda,
137 const int nspin,
138 const ModuleBase::Vector3<double>& dis1,
139 const ModuleBase::Vector3<double>& dis2,
140 double* stress);
141
145 void pre_coeff_array(const std::vector<TR>& coeff, const int row_size, const int col_size);
146
147 std::vector<bool> constraint_atom_list;
148 std::vector<hamilt::HContainer<TR>*> pre_hr;
149
150 std::vector<double> tmp_dmr_memory;
151 std::vector<TR> tmp_coeff_array;
152 std::vector<double> lambda_save;
153
154 bool initialized = false;
155 int spin_num = 1;
156 std::vector<bool> update_lambda_;
157};
158
159}
160
161#endif
Definition sltk_grid_driver.h:43
3 elements vector
Definition vector3.h:22
Definition matrix.h:19
Definition parallel_orbitals.h:9
A class to compute two-center integrals.
Definition two_center_integrator.h:35
Definition unitcell.h:16
Definition base_matrix.h:20
virtual void contributeHR() override
contributeHR() is used to calculate the HR matrix <phi_{\mu, 0}|beta_p1>D_{p1, p2}<beta_p2|phi_{\nu,...
void update_lambda()
set the update_lambda_ to true, which means the lambda will be updated in the next contributeHR()
Definition dspin_lcao.h:54
std::vector< double > lambda_save
Definition dspin_lcao.h:152
std::vector< double > tmp_dmr_memory
Definition dspin_lcao.h:150
void cal_constraint_atom_list(const std::vector< ModuleBase::Vector3< int > > &constraints)
calculate the constaint atom list
std::vector< TR > tmp_coeff_array
Definition dspin_lcao.h:151
std::vector< double > cal_moment(const HContainer< double > *dmR, const std::vector< ModuleBase::Vector3< int > > &constrain)
calculate the magnetization moment for each atom
std::vector< bool > constraint_atom_list
Definition dspin_lcao.h:147
void cal_HR_IJR(const int &iat1, const int &iat2, 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
std::vector< bool > update_lambda_
Definition dspin_lcao.h:156
void cal_moment_IJR(const double *dmR, const TR *hr, const int row_size, const int col_size, double *moment)
calculate the atomic magnetization moment for each <IJR>
std::vector< double > orb_cutoff_
Definition dspin_lcao.h:80
void pre_coeff_array(const std::vector< TR > &coeff, const int row_size, const int col_size)
calculate the array of coefficient of lambda * d\rho^p/drho^{\sigma\sigma'}
std::vector< hamilt::HContainer< TR > * > pre_hr
Definition dspin_lcao.h:148
void cal_pre_HR()
calculate the prepare HR for each atom pre_hr^I = \sum_{lm}<phi_mu|alpha^I_{lm}><alpha^I_{lm}|phi_{nu...
Definition dspin_lcao.h:20
Definition hcontainer.h:144
Definition hs_matrix_k.hpp:11
Definition operator_lcao.h:12
#define T
Definition exp.cpp:237
Definition hamilt.h:12