Skip to content

Commit 9cfa31f

Browse files
authored
Change 'istate.info' to 'eig.txt', add explanations for the parameter "out_band" (open files eigs1.txt and eigs2.txt). In the 'after_all_runners" subroutine in SDFT, use after_all_runners from ESolver_KS (#6257)
* add notes for the modified output file names, specify the names in the 3.10-LTS version * update the CHG file names in input-main.md and change the output file names of charge density * add explanations for taus1.cube, etc. * change the file names for 203_PW_OK example * update read in charge density codes and tests * fix example 050_PW_CHG_mismatch * update the file names of charge densities * update CHG files in support directories * fix file names in rho_io_test.cpp * update 203_PW_OK * update result.ref in 23_NO_KP_OK * delete redundant print_eigenvalues in elecstate_print.cpp, change the file name istate.info to eig.txt * update information about writing eigenvalues, enable SDFT to write out eigenvalues if applicable * output input and output documents * update the reading wave functions according to eig.txt instead of the old istate.info * update write_istate_info.cpp * fix write_istate_info test * update the test read_wf2rho_pw_test.cpp * change the name of reference data eigs1.txt.ref
1 parent 2d6accb commit 9cfa31f

File tree

28 files changed

+265
-518
lines changed

28 files changed

+265
-518
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: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ These variables are used to control general system parameters.
609609

610610
- atomic: the density is starting from the summation of the atomic density of single atoms.
611611
- file: the density will be read in from a binary file `charge-density.dat` first. If it does not exist, the charge density will be read in from cube files. Besides, when you do `nspin=1` calculation, you only need the density file chgs1.cube. However, if you do `nspin=2` calculation, you also need the density file chgs2.cube. The density file should be output with these names if you set out_chg = 1 in INPUT file.
612-
- wfc: the density will be calculated by wavefunctions and occupations. Wavefunctions are read in from binary files `wf*.dat` (see [out_wfc_pw](#out_wfc_pw)) while occupations are read in from file `istate.info`.
612+
- wfc: the density will be calculated by wavefunctions and occupations. Wavefunctions are read in from binary files `wf*.dat` (see [out_wfc_pw](#out_wfc_pw)) while occupations are read in from file `eig.txt`.
613613
- auto: Abacus first attempts to read the density from a file; if not found, it defaults to using atomic density.
614614
- **Default**: atomic
615615

@@ -1721,7 +1721,10 @@ These variables are used to control the output of properties.
17211721
### out_band
17221722

17231723
- **Type**: Boolean \[Integer\](optional)
1724-
- **Description**: Whether to output the band structure (in eV), optionally output precision can be set by a second parameter, default is 8. For more information, refer to the [band.md](../elec_properties/band.md)
1724+
- **Description**: Whether to output the eigenvalues of Hamiltonian matrix (in eV), optionally output precision can be set by a second parameter, default is 8. The output file names are:
1725+
- nspin = 1 or 4: `eigs1.txt`;
1726+
- nspin = 2: `eigs1.txt` and `eigs2.txt`;
1727+
- For more information, refer to the [band.md](../elec_properties/band.md)
17251728
- **Default**: False
17261729

17271730
### out_proj_band

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+
}

0 commit comments

Comments
 (0)