Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
bc9527e
add notes for the modified output file names, specify the names in th…
mohanchen May 29, 2025
dab6d17
update the CHG file names in input-main.md and change the output file…
mohanchen May 29, 2025
050b85e
add explanations for taus1.cube, etc.
mohanchen May 29, 2025
5140b3c
change the file names for 203_PW_OK example
mohanchen May 29, 2025
69b23cf
update read in charge density codes and tests
mohanchen May 29, 2025
5cb73b5
fix example 050_PW_CHG_mismatch
mohanchen May 29, 2025
47f36c2
update the file names of charge densities
mohanchen May 29, 2025
d22a573
update CHG files in support directories
mohanchen May 29, 2025
a61e8f4
fix file names in rho_io_test.cpp
mohanchen May 29, 2025
7ac520f
update 203_PW_OK
mohanchen May 29, 2025
a30cae7
Merge branch 'develop' of https://github.com/mohanchen/abacus-mc into…
mohanchen May 31, 2025
fb3e91b
update result.ref in 23_NO_KP_OK
mohanchen May 31, 2025
1f86f85
delete redundant print_eigenvalues in elecstate_print.cpp, change the…
mohanchen May 31, 2025
0b7e0f0
Merge branch 'develop' of https://github.com/mohanchen/abacus-mc into…
mohanchen Jun 1, 2025
fba1452
Merge branch 'fix_nscf' into develop
mohanchen Jun 1, 2025
5a7742f
update information about writing eigenvalues, enable SDFT to write ou…
mohanchen Jun 1, 2025
585fc9b
output input and output documents
mohanchen Jun 1, 2025
eae0460
update the reading wave functions according to eig.txt instead of the…
mohanchen Jun 1, 2025
2048ad5
update write_istate_info.cpp
mohanchen Jun 1, 2025
e78b052
fix write_istate_info test
mohanchen Jun 2, 2025
1501ed1
update the test read_wf2rho_pw_test.cpp
mohanchen Jun 2, 2025
96d25d5
change the name of reference data eigs1.txt.ref
mohanchen Jun 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 23 additions & 24 deletions docs/advanced/elec_properties/band.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
# Extracting Band Structure

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).
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***:
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).
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***:

```
out_chg 1
out_chg 1
```

This will produce the converged charge density, which is contained in the file SPIN1_CHG.cube.
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:
With this input parameter, the converged charge density will be output in the files such as `chgs1.cube`, `chgs2.cube`, etc.
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:

```
INPUT_PARAMETERS
#Parameters (General)
ntype 1
nbands 8
calculation nscf
basis_type lcao
read_file_dir ./
nbands 8
calculation nscf
basis_type lcao
read_file_dir ./

#Parameters (Accuracy)
ecutwfc 60
scf_nmax 50
scf_thr 1.0e-9
pw_diag_thr 1.0e-7
ecutwfc 60
scf_nmax 50
scf_thr 1.0e-9
pw_diag_thr 1.0e-7

#Parameters (File)
init_chg file
out_band 1
init_chg file
out_band 1
out_proj_band 1

#Parameters (Smearing)
smearing_method gaussian
smearing_sigma 0.02
smearing_sigma 0.02
```

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

```
K_POINTS # keyword for start
Expand All @@ -49,16 +48,16 @@ Line # line-mode
0.0 0.0 0.0 1 # G
```

This means we are using:
This means we are using the following k-points:

- 6 number of k points, here means 6 k points:
- 6 k points, here means 6 k points:
(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,
0.0)
- 20/1 number of k points along the segment line, which is constructed by two adjacent k
points.

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

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

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

```
<orbital
index=" 1"
atom_index=" 1"
index=" 1"
atom_index=" 1"
species="Si"
l=" 0"
m=" 0"
Expand Down
7 changes: 5 additions & 2 deletions docs/advanced/input_files/input-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ These variables are used to control general system parameters.

- atomic: the density is starting from the summation of the atomic density of single atoms.
- 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.
- 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`.
- 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`.
- auto: Abacus first attempts to read the density from a file; if not found, it defaults to using atomic density.
- **Default**: atomic

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

- **Type**: Boolean \[Integer\](optional)
- **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)
- **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:
- nspin = 1 or 4: `eigs1.txt`;
- nspin = 2: `eigs1.txt` and `eigs2.txt`;
- For more information, refer to the [band.md](../elec_properties/band.md)
- **Default**: False

### out_proj_band
Expand Down
16 changes: 3 additions & 13 deletions docs/quick_start/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,10 @@ For a complete list of input parameters, please consult this [instruction](../ad

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.

## *istate.info*
## *eig.txt*

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.

Below is an example `istate.info`:

```
BAND Energy(ev) Occupation Kpoint = 1 (0 0 0)
1 -5.33892 0.03125
2 6.68535 0.0312006
3 6.68535 0.0312006
4 6.68535 0.0312006
5 9.41058 0
```
This file includes the energy levels and occupations computed for all k-points.
Note: In 3.10-LTS version, the file is named 'istate.info'

## *STRU.cif*

Expand Down
6 changes: 0 additions & 6 deletions source/module_cell/klist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,6 @@ void K_Vectors::renew(const int& kpoint_number)
isk.resize(kpoint_number);
ngk.resize(kpoint_number);

/*ModuleBase::Memory::record("KV::kvec_c",sizeof(double) * kpoint_number*3);
ModuleBase::Memory::record("KV::kvec_d",sizeof(double) * kpoint_number*3);
ModuleBase::Memory::record("KV::wk",sizeof(double) * kpoint_number*3);
ModuleBase::Memory::record("KV::isk",sizeof(int) * kpoint_number*3);
ModuleBase::Memory::record("KV::ngk",sizeof(int) * kpoint_number*3);*/

return;
}

Expand Down
43 changes: 5 additions & 38 deletions source/module_cell/parallel_kpoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,12 @@ void Parallel_Kpoints::get_whichpool(const int& nkstot)
{
this->whichpool.resize(nkstot, 0);

// std::cout << " calculate : whichpool" << std::endl;
// std::cout << " nkstot is " << nkstot << std::endl;


for (int i = 0; i < this->kpar; i++)
{
for (int ik = 0; ik < this->nks_pool[i]; ik++)
{
const int k_now = ik + startk_pool[i];
this->whichpool[k_now] = i;
// ofs_running << "\n whichpool[" << k_now <<"] = " << whichpool[k_now];
}
}

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

// ofs_running << "\n nkstot = " << nkstot;
// ofs_running << "\n this->kpar = " << this->kpar;
// ofs_running << "\n nks_ave = " << nks_ave;

for (int i = 0; i < this->kpar; i++)

{
this->nks_pool[i] = nks_ave;
if (i < remain)
{
nks_pool[i]++;
}
// ofs_running << "\n nks_pool[i] = " << nks_pool[i];
}
return;
}
Expand All @@ -93,14 +82,10 @@ void Parallel_Kpoints::get_startk_pool(const int& nkstot)
{
startk_pool.resize(this->kpar, 0);

// const int remain = nkstot%this->kpar;

startk_pool[0] = 0;
for (int i = 1; i < this->kpar; i++)

{
startk_pool[i] = startk_pool[i - 1] + nks_pool[i - 1];
// ofs_running << "\n startk_pool[i] = " << startk_pool[i];
}
return;
}
Expand All @@ -120,7 +105,6 @@ void Parallel_Kpoints::set_startpro_pool()
{
startpro_pool[i]++;
}
// ofs_running << "\n startpro_pool[i] = " << startpro_pool[i];
}
return;
}
Expand All @@ -138,8 +122,6 @@ void Parallel_Kpoints::gatherkvec(const std::vector<ModuleBase::Vector3<double>>
{
vec_global[i + startk_pool[this->my_pool]] = vec_local[i];
}
// vec_global[i + startk_pool[MY_POOL]] = vec_local[i] / double(NPROC_IN_POOL);

}

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

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

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

Expand All @@ -167,8 +148,6 @@ void Parallel_Kpoints::pool_collection(double& value, const double* wk, const in
}
else
{

// ofs_running << " receive data.";
MPI_Status ierror;
MPI_Recv(&value, 1, MPI_DOUBLE, this->startpro_pool[pool], ik, MPI_COMM_WORLD, &ierror);

Expand All @@ -178,18 +157,12 @@ void Parallel_Kpoints::pool_collection(double& value, const double* wk, const in
{
if (this->my_pool == pool)
{

// ofs_running << " send data.";

MPI_Send(&wk[ik_now], 1, MPI_DOUBLE, 0, ik, MPI_COMM_WORLD);
}
}
}
else
{

// ofs_running << "\n do nothing.";

}

MPI_Barrier(MPI_COMM_WORLD);
Expand Down Expand Up @@ -238,13 +211,10 @@ void Parallel_Kpoints::pool_collection_aux(T* value, const V& w, const int& dim,
T* p = &w.ptr[begin];
// temprary restrict kpar=1 for NSPIN=2 case for generating_orbitals
int pool = 0;
if (this->nspin != 2) {
pool = this->whichpool[ik];
}


// ofs_running << "\n ik=" << ik;

if (this->nspin != 2)
{
pool = this->whichpool[ik];
}

if (this->rank_in_pool == 0)
{
Expand All @@ -261,7 +231,6 @@ void Parallel_Kpoints::pool_collection_aux(T* value, const V& w, const int& dim,
}
else
{
// ofs_running << " receive data.";
MPI_Status ierror;
MPI_Recv(value, dim, MPI_DOUBLE, this->startpro_pool[pool], ik * 2 + 0, MPI_COMM_WORLD, &ierror);
}
Expand All @@ -270,14 +239,12 @@ void Parallel_Kpoints::pool_collection_aux(T* value, const V& w, const int& dim,
{
if (this->my_pool == pool)
{
// ofs_running << " send data.";
MPI_Send(p, dim, MPI_DOUBLE, 0, ik * 2 + 0, MPI_COMM_WORLD);
}
}
}
else
{
// ofs_running << "\n do nothing.";
}
MPI_Barrier(MPI_COMM_WORLD);

Expand All @@ -292,4 +259,4 @@ void Parallel_Kpoints::pool_collection_aux(T* value, const V& w, const int& dim,
}
// data transfer ends.
#endif
}
}
Loading
Loading