Skip to content

Commit d2d579f

Browse files
committed
Merge branch 'develop' of https://github.com/deepmodeling/abacus-develop into develop
2 parents 3b718ef + f2c5f94 commit d2d579f

39 files changed

+1574
-761
lines changed

docs/examples/band-struc.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pw_diag_thr 1.0e-7
2727
#Parameters (File)
2828
init_chg file
2929
out_band 1
30+
out_proj_band 1
3031
3132
#Parameters (Smearing)
3233
smearing_method gaussian
@@ -58,4 +59,35 @@ points.
5859
Run the program, and you will see a file named BANDS_1.dat in the output directory. Plot it
5960
to get energy band structure.
6061

61-
[back to top](#band-structure)
62+
If "out_proj_band" set 1, it will also produce the projected band structure in a file called PBAND_1 in xml format.
63+
64+
The PBAND_1 file starts with number of atomic orbitals in the system, the text contents of element <band structure> is the same as data in the BANDS_1.dat file, such as:
65+
```
66+
<pband>
67+
<nspin>1</nspin>
68+
<norbitals>153</norbitals>
69+
<band_structure nkpoints="96" nbands="50" units="eV">
70+
...
71+
72+
```
73+
74+
The rest of the files arranged in sections, each section with a header such as below:
75+
76+
```
77+
<orbital
78+
index=" 1"
79+
atom_index=" 1"
80+
species="Si"
81+
l=" 0"
82+
m=" 0"
83+
z=" 1"
84+
>
85+
<data>
86+
...
87+
</data>
88+
89+
```
90+
91+
The shape of text contents of element <data> is (Number of k-points, Number of bands)
92+
93+
[back to top](#band-structure)

docs/input-main.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
- [Variables related to output information](#variables-related-to-output-information)
3434

35-
[out_force](#out_force) | [out_mul](#out_mul) | [out_freq_elec](#out_freq_elec) | [out_freq_ion](#out_freq_ion) | [out_chg](#out_chg) | [out_pot](#out_pot) | [out_dm](#out-dm) | [out_wfc_pw](#out_wfc_pw) | [out_wfc_r](#out_wfc_r) | [out_wfc_lcao](#out_wfc_lcao) | [out_dos](#out-dos) | [out_band](#out-band) | [out_stru](#out-stru) | [out_level](#out_level) | [out_alllog](#out-alllog) | [out_mat_hs](#out_mat_hs) | [out_mat_r](#out_mat_r) | [out_mat_hs2](#out_mat_hs2) | [out_element_info](#out-element-info) | [restart_save](#restart_save) | [restart_load](#restart_load)
35+
[out_force](#out_force) | [out_mul](#out_mul) | [out_freq_elec](#out_freq_elec) | [out_freq_ion](#out_freq_ion) | [out_chg](#out_chg) | [out_pot](#out_pot) | [out_dm](#out-dm) | [out_wfc_pw](#out_wfc_pw) | [out_wfc_r](#out_wfc_r) | [out_wfc_lcao](#out_wfc_lcao) | [out_dos](#out-dos) | [out_band](#out-band) | [out_proj_band](#out-proj-band) | [out_stru](#out-stru) | [out_level](#out_level) | [out_alllog](#out-alllog) | [out_mat_hs](#out_mat_hs) | [out_mat_r](#out_mat_r) | [out_mat_hs2](#out_mat_hs2) | [out_element_info](#out-element-info) | [restart_save](#restart_save) | [restart_load](#restart_load)
3636

3737
- [Density of states](#density-of-states)
3838

@@ -735,6 +735,12 @@ This part of variables are used to control the output of properties.
735735
- **Description**: Controls whether to output the band structure. For mroe information, refer to the [worked example](examples/band-struc.md)
736736
- **Default**: 0
737737
738+
#### out_proj_band
739+
740+
- **Type**: Integer
741+
- **Description**: Controls whether to output the projected band structure. For mroe information, refer to the [worked example](examples/band-struc.md)
742+
- **Default**: 0
743+
738744
#### out_stru
739745
740746
- **Type**: Boolean

source/Makefile.Objects

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ gint_k_init.o\
121121
gint_k_vl.o\
122122
gint_k_rho.o\
123123
gint_k_fvl.o\
124+
gint_k_fvl_new.o\
124125
gint_k_env.o \
125126
ORB_control.o\
126127
ORB_read.o\

source/input.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ void Input::Default(void)
268268
out_wfc_r = 0;
269269
out_dos = 0;
270270
out_band = 0;
271+
out_proj_band = 0;
271272
out_mat_hs = 0;
272273
out_mat_hs2 = 0; // LiuXh add 2019-07-15
273274
out_mat_r = 0; // jingan add 2019-8-14
@@ -995,6 +996,10 @@ bool Input::Read(const std::string &fn)
995996
{
996997
read_value(ifs, out_band);
997998
}
999+
else if (strcmp("out_proj_band", word) == 0)
1000+
{
1001+
read_value(ifs, out_proj_band);
1002+
}
9981003

9991004
else if (strcmp("out_mat_hs", word) == 0)
10001005
{
@@ -1941,6 +1946,7 @@ void Input::Bcast()
19411946
Parallel_Common::bcast_int(out_wfc_r);
19421947
Parallel_Common::bcast_int(out_dos);
19431948
Parallel_Common::bcast_int(out_band);
1949+
Parallel_Common::bcast_int(out_proj_band);
19441950
Parallel_Common::bcast_int(out_mat_hs);
19451951
Parallel_Common::bcast_int(out_mat_hs2); // LiuXh add 2019-07-15
19461952
Parallel_Common::bcast_int(out_mat_r); // jingan add 2019-8-14
@@ -2227,6 +2233,7 @@ void Input::Check(void)
22272233
out_stru = 0;
22282234
out_dos = 0;
22292235
out_band = 0;
2236+
out_proj_band = 0;
22302237
cal_force = 0;
22312238
init_wfc = "file";
22322239
init_chg = "atomic"; // useless,
@@ -2248,6 +2255,7 @@ void Input::Check(void)
22482255
out_stru = 0;
22492256
out_dos = 0;
22502257
out_band = 0;
2258+
out_proj_band = 0;
22512259
cal_force = 0;
22522260
init_wfc = "file";
22532261
init_chg = "atomic";

source/input.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ class Input
206206
int out_wfc_r; // 0: no; 1: yes
207207
int out_dos; // dos calculation. mohan add 20090909
208208
int out_band; // band calculation pengfei 2014-10-13
209+
int out_proj_band; // projected band structure calculation jiyy add 2022-05-11
209210
int out_mat_hs; // output H matrix and S matrix in local basis.
210211
int out_mat_hs2; // LiuXh add 2019-07-16, output H(R) matrix and S(R) matrix in local basis.
211212
int out_mat_r; // jingan add 2019-8-14, output r(R) matrix.

source/input_conv.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ void Input_Conv::Convert(void)
434434
GlobalC::wf.out_wfc_r = INPUT.out_wfc_r;
435435
GlobalC::en.out_dos = INPUT.out_dos;
436436
GlobalC::en.out_band = INPUT.out_band;
437+
GlobalC::en.out_proj_band = INPUT.out_proj_band;
437438
#ifdef __LCAO
438439
Local_Orbital_Charge::out_dm = INPUT.out_dm;
439440
Pdiag_Double::out_mat_hs = INPUT.out_mat_hs;

source/module_elecstate/elecstate_lcao.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void ElecStateLCAO::psiToRho(const psi::Psi<std::complex<double>>& psi)
9494
//------------------------------------------------------------
9595

9696
ModuleBase::GlobalFunc::NOTE("Calculate the charge on real space grid!");
97-
this->uhm->GK.cal_rho_k(this->loc->DM_R);
97+
this->uhm->GK.cal_rho_k(this->loc->DM_R, this->charge);
9898

9999
this->charge->renormalize_rho();
100100

@@ -142,7 +142,7 @@ void ElecStateLCAO::psiToRho(const psi::Psi<double>& psi)
142142
// calculate the charge density on real space grid.
143143
//------------------------------------------------------------
144144
ModuleBase::GlobalFunc::NOTE("Calculate the charge on real space grid!");
145-
this->uhm->GG.cal_rho(this->loc->DM);
145+
this->uhm->GG.cal_rho(this->loc->DM, this->charge);
146146

147147
this->charge->renormalize_rho();
148148

source/module_esolver/esolver_ks_lcao.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,19 @@ namespace ModuleESolver
143143
int ion_step = 0;
144144
GlobalC::pot.init_pot(ion_step, GlobalC::pw.strucFac);
145145

146+
//------------------init Basis_lcao----------------------
147+
// Init Basis should be put outside of Ensolver.
148+
// * reading the localized orbitals/projectors
149+
// * construct the interpolation tables.
150+
this->Init_Basis_lcao(this->orb_con, inp, ucell);
151+
//------------------init Basis_lcao----------------------
152+
153+
//------------------init Hamilt_lcao----------------------
154+
// * allocate H and S matrices according to computational resources
155+
// * set the 'trace' between local H/S and global H/S
156+
this->LM.divide_HS_in_frag(GlobalV::GAMMA_ONLY_LOCAL, orb_con.ParaV);
157+
//------------------init Hamilt_lcao----------------------
158+
146159
#ifdef __MPI
147160
// PLEASE simplify the Exx_Global interface
148161
// mohan add 2021-03-25
@@ -175,19 +188,7 @@ namespace ModuleESolver
175188

176189
if (INPUT.dft_plus_dmft) GlobalC::dmft.init(INPUT, ucell);
177190

178-
//------------------init Basis_lcao----------------------
179-
// Init Basis should be put outside of Ensolver.
180-
// * reading the localized orbitals/projectors
181-
// * construct the interpolation tables.
182-
this->Init_Basis_lcao(this->orb_con, inp, ucell);
183-
//------------------init Basis_lcao----------------------
184-
185-
//------------------init Hamilt_lcao----------------------
186-
// * allocate H and S matrices according to computational resources
187-
// * set the 'trace' between local H/S and global H/S
188-
this->LM.divide_HS_in_frag(GlobalV::GAMMA_ONLY_LOCAL, orb_con.ParaV);
189-
//------------------init Hamilt_lcao----------------------
190-
//init Psi
191+
//init Psi
191192
if (GlobalV::GAMMA_ONLY_LOCAL)
192193
this->LOWF.wfc_gamma.resize(GlobalV::NSPIN);
193194
else

source/module_esolver/esolver_ks_lcao_elec.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ namespace ModuleESolver
124124
// calculate the charge density
125125
if (GlobalV::GAMMA_ONLY_LOCAL)
126126
{
127-
this->UHM.GG.cal_rho(this->LOC.DM);
127+
this->UHM.GG.cal_rho(this->LOC.DM, (Charge*)(&GlobalC::CHR));
128128
}
129129
else
130130
{
131-
this->UHM.GK.cal_rho_k(this->LOC.DM_R);
131+
this->UHM.GK.cal_rho_k(this->LOC.DM_R, (Charge*)(&GlobalC::CHR));
132132
}
133133

134134
// renormalize the charge density

source/module_orbital/ORB_gen_tables.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,18 @@ void ORB_gen_tables::snap_psibeta_half(
140140

141141
//find number of projectors on atom R0
142142
const int nproj = infoNL_.nproj[T0];
143-
assert(nproj>0); // mohan add 2021-04-25
143+
if(nproj==0)
144+
{
145+
if(calc_deri)
146+
{
147+
nlm.resize(4);
148+
}
149+
else
150+
{
151+
nlm.resize(1);
152+
}
153+
return;
154+
}
144155

145156
std::vector<bool> calproj;
146157
calproj.resize(nproj);

0 commit comments

Comments
 (0)