Skip to content

Commit 5ecd3a9

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into develop
2 parents f9b330c + 025e574 commit 5ecd3a9

File tree

258 files changed

+2384
-2454
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

258 files changed

+2384
-2454
lines changed

docs/advanced/elec_properties/band.md

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,40 @@
11
# Extracting Band Structure
22

3-
ABACUS can calculate the energy band structure, and the examples can be found in [examples/band](https://github.com/deepmodeling/abacus-develop/tree/develop/examples/band).
4-
Similar to the [DOS case](https://abacus-rtd.readthedocs.io/en/latest/advanced/elec_properties/dos.html), we first, do a ground-state energy calculation ***with one additional keyword "[out_chg](https://abacus-rtd.readthedocs.io/en/latest/advanced/input_files/input-main.html#out-chg)" in the INPUT file***:
3+
In ABACUS, in order to obtain the eigenvalues of Hamiltonian, or generally called band structure, examples can be found in [examples/band](https://github.com/deepmodeling/abacus-develop/tree/develop/examples/band).
4+
Similar to the [DOS case](https://abacus-rtd.readthedocs.io/en/latest/advanced/elec_properties/dos.html), one first needs to perform a ground-state energy calculation ***with one additional keyword "[out_chg](https://abacus-rtd.readthedocs.io/en/latest/advanced/input_files/input-main.html#out-chg)" in the INPUT file***:
55

66
```
7-
out_chg 1
7+
out_chg 1
88
```
99

10-
This will produce the converged charge density, which is contained in the file SPIN1_CHG.cube.
11-
Then, use the same `STRU` file, pseudopotential file and atomic orbital file (and the local density matrix file onsite.dm if DFT+U is used) to do a non-self-consistent calculation. In this example, the potential is constructed from the ground-state charge density from the proceeding calculation. Now the INPUT file is like:
10+
With this input parameter, the converged charge density will be output in the files such as `chgs1.cube`, `chgs2.cube`, etc.
11+
Then, one can use the same `STRU` file, pseudopotential files and atomic orbital files (and the local density matrix file onsite.dm if DFT+U is used) to do a non-self-consistent (NSCF) calculation. In this example, the potential is constructed from the ground-state charge density from the proceeding calculation. Now the INPUT file is like:
1212

1313
```
1414
INPUT_PARAMETERS
1515
#Parameters (General)
16-
ntype 1
17-
nbands 8
18-
calculation nscf
19-
basis_type lcao
20-
read_file_dir ./
16+
nbands 8
17+
calculation nscf
18+
basis_type lcao
19+
read_file_dir ./
2120
2221
#Parameters (Accuracy)
23-
ecutwfc 60
24-
scf_nmax 50
25-
scf_thr 1.0e-9
26-
pw_diag_thr 1.0e-7
22+
ecutwfc 60
23+
scf_nmax 50
24+
scf_thr 1.0e-9
25+
pw_diag_thr 1.0e-7
2726
2827
#Parameters (File)
29-
init_chg file
30-
out_band 1
28+
init_chg file
29+
out_band 1
3130
out_proj_band 1
3231
3332
#Parameters (Smearing)
3433
smearing_method gaussian
35-
smearing_sigma 0.02
34+
smearing_sigma 0.02
3635
```
3736

38-
Here the the relevant k-point file KPT looks like,
37+
Here is a relevant k-point file KPT (in LINE mode):
3938

4039
```
4140
K_POINTS # keyword for start
@@ -49,16 +48,16 @@ Line # line-mode
4948
0.0 0.0 0.0 1 # G
5049
```
5150

52-
This means we are using:
51+
This means we are using the following k-points:
5352

54-
- 6 number of k points, here means 6 k points:
53+
- 6 k points, here means 6 k points:
5554
(0.5, 0.0, 0.5) (0.0, 0.0, 0.0) (0.5, 0.5, 0.5) (0.5, 0.25, 0.75) (0.375, 0.375, 0.75) (0.0, 0.0,
5655
0.0)
5756
- 20/1 number of k points along the segment line, which is constructed by two adjacent k
5857
points.
5958

60-
Run the program, and you will see a file named BANDS_1.dat in the output directory. Plot it
61-
to get energy band structure.
59+
Next, run ABACUS and you will see a file named `eigs1.txt` in the output directory.
60+
Plot it and you will obtain the energy band structure!
6261

6362
If "out_proj_band" set 1, it will also produce the projected band structure in a file called PBAND_1 in xml format.
6463

@@ -77,8 +76,8 @@ The rest of the files arranged in sections, each section with a header such as b
7776

7877
```
7978
<orbital
80-
index=" 1"
81-
atom_index=" 1"
79+
index=" 1"
80+
atom_index=" 1"
8281
species="Si"
8382
l=" 0"
8483
m=" 0"

docs/advanced/input_files/input-main.md

Lines changed: 68 additions & 31 deletions
Large diffs are not rendered by default.

docs/quick_start/output.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,10 @@ For a complete list of input parameters, please consult this [instruction](../ad
2424

2525
This file contains the information of all generated k-points, as well as the list of k-points actually used for calculations after considering symmetry.
2626

27-
## *istate.info*
27+
## *eig.txt*
2828

29-
This file includes the energy levels computed for all k-points. From left to right, the columns represent: energy level index, eigenenergy, and occupancy number.
30-
31-
Below is an example `istate.info`:
32-
33-
```
34-
BAND Energy(ev) Occupation Kpoint = 1 (0 0 0)
35-
1 -5.33892 0.03125
36-
2 6.68535 0.0312006
37-
3 6.68535 0.0312006
38-
4 6.68535 0.0312006
39-
5 9.41058 0
40-
```
29+
This file includes the energy levels and occupations computed for all k-points.
30+
Note: In 3.10-LTS version, the file is named 'istate.info'
4131

4232
## *STRU.cif*
4333

source/module_cell/klist.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,6 @@ void K_Vectors::renew(const int& kpoint_number)
178178
isk.resize(kpoint_number);
179179
ngk.resize(kpoint_number);
180180

181-
/*ModuleBase::Memory::record("KV::kvec_c",sizeof(double) * kpoint_number*3);
182-
ModuleBase::Memory::record("KV::kvec_d",sizeof(double) * kpoint_number*3);
183-
ModuleBase::Memory::record("KV::wk",sizeof(double) * kpoint_number*3);
184-
ModuleBase::Memory::record("KV::isk",sizeof(int) * kpoint_number*3);
185-
ModuleBase::Memory::record("KV::ngk",sizeof(int) * kpoint_number*3);*/
186-
187181
return;
188182
}
189183

source/module_cell/parallel_kpoints.cpp

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,12 @@ void Parallel_Kpoints::get_whichpool(const int& nkstot)
4848
{
4949
this->whichpool.resize(nkstot, 0);
5050

51-
// std::cout << " calculate : whichpool" << std::endl;
52-
// std::cout << " nkstot is " << nkstot << std::endl;
53-
54-
5551
for (int i = 0; i < this->kpar; i++)
5652
{
5753
for (int ik = 0; ik < this->nks_pool[i]; ik++)
5854
{
5955
const int k_now = ik + startk_pool[i];
6056
this->whichpool[k_now] = i;
61-
// ofs_running << "\n whichpool[" << k_now <<"] = " << whichpool[k_now];
6257
}
6358
}
6459

@@ -72,19 +67,13 @@ void Parallel_Kpoints::get_nks_pool(const int& nkstot)
7267
const int nks_ave = nkstot / this->kpar;
7368
const int remain = nkstot % this->kpar;
7469

75-
// ofs_running << "\n nkstot = " << nkstot;
76-
// ofs_running << "\n this->kpar = " << this->kpar;
77-
// ofs_running << "\n nks_ave = " << nks_ave;
78-
7970
for (int i = 0; i < this->kpar; i++)
80-
8171
{
8272
this->nks_pool[i] = nks_ave;
8373
if (i < remain)
8474
{
8575
nks_pool[i]++;
8676
}
87-
// ofs_running << "\n nks_pool[i] = " << nks_pool[i];
8877
}
8978
return;
9079
}
@@ -93,14 +82,10 @@ void Parallel_Kpoints::get_startk_pool(const int& nkstot)
9382
{
9483
startk_pool.resize(this->kpar, 0);
9584

96-
// const int remain = nkstot%this->kpar;
97-
9885
startk_pool[0] = 0;
9986
for (int i = 1; i < this->kpar; i++)
100-
10187
{
10288
startk_pool[i] = startk_pool[i - 1] + nks_pool[i - 1];
103-
// ofs_running << "\n startk_pool[i] = " << startk_pool[i];
10489
}
10590
return;
10691
}
@@ -120,7 +105,6 @@ void Parallel_Kpoints::set_startpro_pool()
120105
{
121106
startpro_pool[i]++;
122107
}
123-
// ofs_running << "\n startpro_pool[i] = " << startpro_pool[i];
124108
}
125109
return;
126110
}
@@ -138,8 +122,6 @@ void Parallel_Kpoints::gatherkvec(const std::vector<ModuleBase::Vector3<double>>
138122
{
139123
vec_global[i + startk_pool[this->my_pool]] = vec_local[i];
140124
}
141-
// vec_global[i + startk_pool[MY_POOL]] = vec_local[i] / double(NPROC_IN_POOL);
142-
143125
}
144126

145127
MPI_Allreduce(MPI_IN_PLACE, &vec_global[0], 3 * this->nkstot_np, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
@@ -152,7 +134,6 @@ void Parallel_Kpoints::pool_collection(double& value, const double* wk, const in
152134
#ifdef __MPI
153135

154136
const int ik_now = ik - this->startk_pool[this->my_pool];
155-
// ofs_running << "\n\n ik=" << ik << " ik_now=" << ik_now;
156137

157138
const int pool = this->whichpool[ik];
158139

@@ -167,8 +148,6 @@ void Parallel_Kpoints::pool_collection(double& value, const double* wk, const in
167148
}
168149
else
169150
{
170-
171-
// ofs_running << " receive data.";
172151
MPI_Status ierror;
173152
MPI_Recv(&value, 1, MPI_DOUBLE, this->startpro_pool[pool], ik, MPI_COMM_WORLD, &ierror);
174153

@@ -178,18 +157,12 @@ void Parallel_Kpoints::pool_collection(double& value, const double* wk, const in
178157
{
179158
if (this->my_pool == pool)
180159
{
181-
182-
// ofs_running << " send data.";
183-
184160
MPI_Send(&wk[ik_now], 1, MPI_DOUBLE, 0, ik, MPI_COMM_WORLD);
185161
}
186162
}
187163
}
188164
else
189165
{
190-
191-
// ofs_running << "\n do nothing.";
192-
193166
}
194167

195168
MPI_Barrier(MPI_COMM_WORLD);
@@ -238,13 +211,10 @@ void Parallel_Kpoints::pool_collection_aux(T* value, const V& w, const int& dim,
238211
T* p = &w.ptr[begin];
239212
// temprary restrict kpar=1 for NSPIN=2 case for generating_orbitals
240213
int pool = 0;
241-
if (this->nspin != 2) {
242-
pool = this->whichpool[ik];
243-
}
244-
245-
246-
// ofs_running << "\n ik=" << ik;
247-
214+
if (this->nspin != 2)
215+
{
216+
pool = this->whichpool[ik];
217+
}
248218

249219
if (this->rank_in_pool == 0)
250220
{
@@ -261,7 +231,6 @@ void Parallel_Kpoints::pool_collection_aux(T* value, const V& w, const int& dim,
261231
}
262232
else
263233
{
264-
// ofs_running << " receive data.";
265234
MPI_Status ierror;
266235
MPI_Recv(value, dim, MPI_DOUBLE, this->startpro_pool[pool], ik * 2 + 0, MPI_COMM_WORLD, &ierror);
267236
}
@@ -270,14 +239,12 @@ void Parallel_Kpoints::pool_collection_aux(T* value, const V& w, const int& dim,
270239
{
271240
if (this->my_pool == pool)
272241
{
273-
// ofs_running << " send data.";
274242
MPI_Send(p, dim, MPI_DOUBLE, 0, ik * 2 + 0, MPI_COMM_WORLD);
275243
}
276244
}
277245
}
278246
else
279247
{
280-
// ofs_running << "\n do nothing.";
281248
}
282249
MPI_Barrier(MPI_COMM_WORLD);
283250

@@ -292,4 +259,4 @@ void Parallel_Kpoints::pool_collection_aux(T* value, const V& w, const int& dim,
292259
}
293260
// data transfer ends.
294261
#endif
295-
}
262+
}

source/module_elecstate/elecstate_print.cpp

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -148,98 +148,6 @@ void print_scf_iterinfo(const std::string& ks_solver,
148148
}
149149
std::cout << buf;
150150
}
151-
/// @brief print and check for band energy and occupations
152-
/// @param ofs
153-
void print_eigenvalue(const ModuleBase::matrix& ekb,
154-
const ModuleBase::matrix& wg,
155-
const K_Vectors* klist,
156-
std::ofstream& ofs)
157-
{
158-
bool wrong = false;
159-
const int nks = klist->get_nks();
160-
const int nkstot = klist->get_nkstot();
161-
for (int ik = 0; ik < nks; ++ik)
162-
{
163-
for (int ib = 0; ib < ekb.nc; ++ib)
164-
{
165-
if (std::abs(ekb(ik, ib)) > 1.0e10)
166-
{
167-
GlobalV::ofs_warning << " ik=" << ik + 1 << " ib=" << ib + 1 << " " << ekb(ik, ib) << " Ry" << std::endl;
168-
wrong = true;
169-
}
170-
}
171-
}
172-
#ifdef __MPI
173-
MPI_Allreduce(MPI_IN_PLACE, &wrong, 1, MPI_C_BOOL, MPI_LOR, MPI_COMM_WORLD);
174-
#endif
175-
if (wrong)
176-
{
177-
ModuleBase::WARNING_QUIT("print_eigenvalue", "Eigenvalues are too large!");
178-
}
179-
180-
std::string filename = PARAM.globalv.global_out_dir + PARAM.globalv.log_file;
181-
std::vector<int> ngk_tot = klist->ngk;
182-
183-
#ifdef __MPI
184-
MPI_Allreduce(MPI_IN_PLACE, ngk_tot.data(), nks, MPI_INT, MPI_SUM, POOL_WORLD);
185-
#endif
186-
187-
ModuleBase::TITLE("ESolver_KS_PW", "print_eigenvalue");
188-
189-
ofs << "\n STATE ENERGY(eV) AND OCCUPATIONS ";
190-
const int nk_fac = PARAM.inp.nspin == 2 ? 2 : 1;
191-
const int nks_np = nks / nk_fac;
192-
const int nkstot_np = nkstot / nk_fac;
193-
ofs << " NSPIN == " << PARAM.inp.nspin << std::endl;
194-
for (int is = 0; is < nk_fac; ++is)
195-
{
196-
if (is == 0 && nk_fac == 2)
197-
{
198-
ofs << "SPIN UP : " << std::endl;
199-
}
200-
else if (is == 1 && nk_fac == 2)
201-
{
202-
ofs << "SPIN DOWN : " << std::endl;
203-
}
204-
205-
for (int ip = 0; ip < GlobalV::KPAR; ++ip)
206-
{
207-
#ifdef __MPI
208-
MPI_Barrier(MPI_COMM_WORLD);
209-
#endif
210-
bool ip_flag = PARAM.inp.out_alllog || (GlobalV::RANK_IN_POOL == 0 && GlobalV::MY_BNDGROUP == 0);
211-
if (GlobalV::MY_POOL == ip && ip_flag)
212-
{
213-
const int start_ik = nks_np * is;
214-
const int end_ik = nks_np * (is + 1);
215-
for (int ik = start_ik; ik < end_ik; ++ik)
216-
{
217-
std::ofstream ofs_eig(filename.c_str(), std::ios::app);
218-
ofs_eig << std::setprecision(5);
219-
ofs_eig << std::setiosflags(std::ios::showpoint);
220-
ofs_eig << " " << klist->ik2iktot[ik] + 1 - is * nkstot_np << "/" << nkstot_np
221-
<< " kpoint (Cartesian) = " << klist->kvec_c[ik].x << " " << klist->kvec_c[ik].y
222-
<< " " << klist->kvec_c[ik].z << " (" << ngk_tot[ik] << " pws)" << std::endl;
223-
224-
ofs_eig << std::setprecision(6);
225-
ofs_eig << std::setiosflags(std::ios::showpoint);
226-
for (int ib = 0; ib < ekb.nc; ib++)
227-
{
228-
ofs_eig << std::setw(8) << ib + 1 << std::setw(15) << ekb(ik, ib) * ModuleBase::Ry_to_eV
229-
<< std::setw(15) << wg(ik, ib) << std::endl;
230-
}
231-
ofs_eig << std::endl;
232-
ofs_eig.close();
233-
}
234-
}
235-
}
236-
#ifdef __MPI
237-
MPI_Barrier(MPI_COMM_WORLD);
238-
#endif
239-
ofs.seekp(0, std::ios::end);
240-
}
241-
return;
242-
}
243151

244152
/// @brief function for printing eigenvalues : ekb
245153
/// @param ik: index of kpoints

source/module_elecstate/elecstate_print.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ namespace elecstate
1616
void print_format(const std::string& name,
1717
const double& value);
1818

19-
void print_eigenvalue(const ModuleBase::matrix& ekb,
20-
const ModuleBase::matrix& wg,
21-
const K_Vectors* klist,
22-
std::ofstream& ofs);
23-
2419
void print_etot(const Magnetism& magnet,
2520
const ElecState& elec,
2621
const bool converged,

0 commit comments

Comments
 (0)