@@ -15,43 +15,6 @@ const double* ElecState::getRho(int spin) const
15
15
return &(this ->charge ->rho [spin][0 ]);
16
16
}
17
17
18
- void ElecState::fixed_weights (const std::vector<double >& ocp_kb, const int & nbands, const double & nelec)
19
- {
20
- assert (nbands > 0 );
21
- assert (nelec > 0.0 );
22
-
23
- const double ne_thr = 1.0e-5 ;
24
-
25
- const int num = this ->klist ->get_nks () * nbands;
26
- if (num != ocp_kb.size ())
27
- {
28
- ModuleBase::WARNING_QUIT (" ElecState::fixed_weights" ,
29
- " size of occupation array is wrong , please check ocp_set" );
30
- }
31
-
32
- double num_elec = 0.0 ;
33
- for (int i = 0 ; i < ocp_kb.size (); ++i)
34
- {
35
- num_elec += ocp_kb[i];
36
- }
37
-
38
- if (std::abs (num_elec - nelec) > ne_thr)
39
- {
40
- ModuleBase::WARNING_QUIT (" ElecState::fixed_weights" ,
41
- " total number of occupations is wrong , please check ocp_set" );
42
- }
43
-
44
- for (int ik = 0 ; ik < this ->wg .nr ; ++ik)
45
- {
46
- for (int ib = 0 ; ib < this ->wg .nc ; ++ib)
47
- {
48
- this ->wg (ik, ib) = ocp_kb[ik * this ->wg .nc + ib];
49
- }
50
- }
51
- this ->skip_weights = true ;
52
-
53
- return ;
54
- }
55
18
56
19
57
20
void ElecState::init_nelec_spin ()
@@ -64,143 +27,6 @@ void ElecState::init_nelec_spin()
64
27
}
65
28
}
66
29
67
-
68
- void ElecState::calculate_weights ()
69
- {
70
- ModuleBase::TITLE (" ElecState" , " calculate_weights" );
71
- if (this ->skip_weights )
72
- {
73
- return ;
74
- }
75
-
76
- const int nbands = this ->ekb .nc ;
77
- const int nks = this ->ekb .nr ;
78
-
79
- if (!Occupy::use_gaussian_broadening && !Occupy::fixed_occupations)
80
- {
81
- if (PARAM.globalv .two_fermi )
82
- {
83
- Occupy::iweights (nks,
84
- this ->klist ->wk ,
85
- nbands,
86
- this ->nelec_spin [0 ],
87
- this ->ekb ,
88
- this ->eferm .ef_up ,
89
- this ->wg ,
90
- 0 ,
91
- this ->klist ->isk );
92
- Occupy::iweights (nks,
93
- this ->klist ->wk ,
94
- nbands,
95
- this ->nelec_spin [1 ],
96
- this ->ekb ,
97
- this ->eferm .ef_dw ,
98
- this ->wg ,
99
- 1 ,
100
- this ->klist ->isk );
101
- // ef = ( ef_up + ef_dw ) / 2.0_dp need??? mohan add 2012-04-16
102
- }
103
- else
104
- {
105
- // -1 means don't need to consider spin.
106
- Occupy::iweights (nks,
107
- this ->klist ->wk ,
108
- nbands,
109
- PARAM.inp .nelec ,
110
- this ->ekb ,
111
- this ->eferm .ef ,
112
- this ->wg ,
113
- -1 ,
114
- this ->klist ->isk );
115
- }
116
- }
117
- else if (Occupy::use_gaussian_broadening)
118
- {
119
- if (PARAM.globalv .two_fermi )
120
- {
121
- double demet_up = 0.0 ;
122
- double demet_dw = 0.0 ;
123
- Occupy::gweights (nks,
124
- this ->klist ->wk ,
125
- nbands,
126
- this ->nelec_spin [0 ],
127
- Occupy::gaussian_parameter,
128
- Occupy::gaussian_type,
129
- this ->ekb ,
130
- this ->eferm .ef_up ,
131
- demet_up,
132
- this ->wg ,
133
- 0 ,
134
- this ->klist ->isk );
135
- Occupy::gweights (nks,
136
- this ->klist ->wk ,
137
- nbands,
138
- this ->nelec_spin [1 ],
139
- Occupy::gaussian_parameter,
140
- Occupy::gaussian_type,
141
- this ->ekb ,
142
- this ->eferm .ef_dw ,
143
- demet_dw,
144
- this ->wg ,
145
- 1 ,
146
- this ->klist ->isk );
147
- this ->f_en .demet = demet_up + demet_dw;
148
- }
149
- else
150
- {
151
- // -1 means is no related to spin.
152
- Occupy::gweights (nks,
153
- this ->klist ->wk ,
154
- nbands,
155
- PARAM.inp .nelec ,
156
- Occupy::gaussian_parameter,
157
- Occupy::gaussian_type,
158
- this ->ekb ,
159
- this ->eferm .ef ,
160
- this ->f_en .demet ,
161
- this ->wg ,
162
- -1 ,
163
- this ->klist ->isk );
164
- }
165
- #ifdef __MPI
166
- const int npool = GlobalV::KPAR * PARAM.inp .bndpar ;
167
- Parallel_Reduce::reduce_double_allpool (npool, GlobalV::NPROC_IN_POOL, this ->f_en .demet );
168
- #endif
169
- }
170
- else if (Occupy::fixed_occupations)
171
- {
172
- ModuleBase::WARNING_QUIT (" calculate_weights" , " other occupations, not implemented" );
173
- }
174
-
175
- return ;
176
- }
177
-
178
-
179
- void ElecState::calEBand ()
180
- {
181
- ModuleBase::TITLE (" ElecState" , " calEBand" );
182
- // calculate ebands using wg and ekb
183
- double eband = 0.0 ;
184
- #ifdef _OPENMP
185
- #pragma omp parallel for collapse(2) reduction(+ : eband)
186
- #endif
187
- for (int ik = 0 ; ik < this ->ekb .nr ; ++ik)
188
- {
189
- for (int ibnd = 0 ; ibnd < this ->ekb .nc ; ibnd++)
190
- {
191
- eband += this ->ekb (ik, ibnd) * this ->wg (ik, ibnd);
192
- }
193
- }
194
- this ->f_en .eband = eband;
195
-
196
- #ifdef __MPI
197
- const int npool = GlobalV::KPAR * PARAM.inp .bndpar ;
198
- Parallel_Reduce::reduce_double_allpool (npool, GlobalV::NPROC_IN_POOL, this ->f_en .eband );
199
- #endif
200
- return ;
201
- }
202
-
203
-
204
30
void ElecState::init_scf (const int istep,
205
31
const UnitCell& ucell,
206
32
const Parallel_Grid& pgrid,
0 commit comments