FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
abacus-develop/source/source_lcao/edm.cpp at develop · pplab/abacus-develop · GitHub
pplab
/
abacus-develop
Public
forked from
deepmodeling/abacus-develop
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
abacus-develop
/
source
/
source_lcao
/
edm.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
103 lines (93 loc) · 2.92 KB
Breadcrumbs
abacus-develop
/
source
/
source_lcao
/
edm.cpp
Copy path
File metadata and controls
103 lines (93 loc) · 2.92 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#
include
"
FORCE.h
"
#
include
"
source_estate/module_dm/cal_dm_psi.h
"
#
include
"
source_base/memory.h
"
#
include
"
source_io/module_parameter/parameter.h
"
template
<>
elecstate::DensityMatrix<
double
,
double
> Force_LCAO<
double
>::cal_edm(
const
elecstate::ElecState* pelec,
const
psi::Psi<
double
>& psi,
const
elecstate::DensityMatrix<
double
,
double
>& dm,
const
K_Vectors& kv,
const
Parallel_Orbitals& pv,
const
int
& nspin,
const
int
& nbands,
const
UnitCell& ucell,
Record_adj& ra)
const
{
ModuleBase::matrix wg_ekb;
wg_ekb.
create
(nspin, nbands);
for
(
int
is=
0
; is<nspin; is++)
{
for
(
int
ib=
0
; ib<nbands; ib++)
{
wg_ekb
(is,ib) = pelec->
wg
(is,ib) * pelec->
ekb
(is, ib);
}
}
//
construct a DensityMatrix for Gamma-Only
elecstate::DensityMatrix<
double
,
double
>
edm
(&pv, nspin);
#
ifdef
__PEXSI
if
(
PARAM
.
inp
.
ks_solver
==
"
pexsi
"
)
{
auto
pes =
dynamic_cast
<
const
elecstate::ElecStateLCAO<
double
>*>(pelec);
for
(
int
ik =
0
; ik < nspin; ik++)
{
edm.
set_DMK_pointer
(ik, pes->
get_DM
()->
pexsi_EDM
[ik]);
}
}
else
#
endif
{
elecstate::cal_dm_psi
(edm.
get_paraV_pointer
(), wg_ekb, psi, edm);
}
return
edm;
}
template
<>
elecstate::DensityMatrix<std::
complex
<
double
>,
double
> Force_LCAO<std::
complex
<
double
>>::cal_edm(
const
elecstate::ElecState* pelec,
const
psi::Psi<std::
complex
<
double
>>& psi,
const
elecstate::DensityMatrix<std::
complex
<
double
>,
double
>& dm,
const
K_Vectors& kv,
const
Parallel_Orbitals& pv,
const
int
& nspin,
const
int
& nbands,
const
UnitCell& ucell,
Record_adj& ra)
const
{
//
construct a DensityMatrix object
const
int
nspin_dm = nspin ==
2
?
2
:
1
;
elecstate::DensityMatrix<std::
complex
<
double
>,
double
>
edm
(&pv, nspin_dm, kv.
kvec_d
, kv.
get_nks
() / nspin_dm);
//
--------------------------------------------
//
calculate the energy density matrix here.
//
--------------------------------------------
ModuleBase::matrix wg_ekb;
wg_ekb.
create
(kv.
get_nks
(), nbands);
ModuleBase::Memory::record
(
"
Force::wg_ekb
"
,
sizeof
(
double
) * kv.
get_nks
() * nbands);
#
ifdef
_OPENMP
#
pragma
omp parallel for collapse(2) schedule(static, 1024)
#
endif
for
(
int
ik =
0
; ik < kv.
get_nks
(); ik++)
{
for
(
int
ib =
0
; ib < nbands; ib++)
{
wg_ekb
(ik, ib) = pelec->
wg
(ik, ib) * pelec->
ekb
(ik, ib);
}
}
//
use the original formula (Hamiltonian matrix) to calculate energy density matrix
if
(dm.
EDMK
.
size
())
{
#
ifdef
_OPENMP
#
pragma
omp parallel for schedule(static)
#
endif
for
(
int
ik =
0
; ik < kv.
get_nks
(); ++ik)
{
edm.
set_DMK_pointer
(ik, dm.
EDMK
[ik].
c
);
}
}
else
{
//
cal_dm_psi
elecstate::cal_dm_psi
(edm.
get_paraV_pointer
(), wg_ekb, psi, edm);
}
//
cal_dm_2d
edm.
init_DMR
(ra, &ucell);
edm.
cal_DMR
();
return
edm;
}
Back
|
FazBrowse Home
|
New Git URL