Skip to content

Commit

Permalink
[rsgrad gap] docs done, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
Ionizing committed Dec 1, 2022
1 parent 80befb2 commit 287a6f7
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

Cargo.lock
.DS_Store
*.swp
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rsgrad"
version = "0.4.2"
version = "0.4.3"
authors = ["Ionizing <PeterSmith_9@outlook.com>"]
edition = "2018"

Expand Down
85 changes: 85 additions & 0 deletions docs/src/Gap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Gap

This command (`rsgrad gap`) calculates the band gap and prints positions of VBM and CBM.

There are two ways to run this command:
1. Use `WAVECAR` only. All required information can be extracted from `WAVECAR`.
2. Or use `PROCAR` and `OUTCAR` instead. `PROCAR` is read for the band energies, band occupations and k-point coordinates;
`OUTCAR` is read for the Fermi level only.

Note: Usually it's faster to parse results from `WAVECAR`.

If your system is a non-SCF calculation for band structure, you may need to specify the correct Fermi level by
`rsgrad gap -e <put the correct E-fermi here>`, the correct Fermi level can be obtained from the OUTCAR of SCF calculation.


## Help Message
```shell
$ rsgrad gap --help
rsgrad-gap
Find band gap and print positions of VBM and CBM

USAGE:
rsgrad gap [OPTIONS]

OPTIONS:
-e, --efermi <EFERMI> Specify Fermi level, if left empty, this value would be read from
WAVECAR or OUTCAR
-h, --help Print help information
-o, --outcar <OUTCAR> OUTCAR file name, this file is parsed to get Fermi level only
[default: OUTCAR]
-p, --procar <PROCAR> PROCAR file name, OUTCAR is also needed to get Fermi level [default:
PROCAR]
-w, --wavecar <WAVECAR> WAVECAR file name, no more files needed [default: WAVECAR]
```
## Example
1. For metal system:
```shell
[2022-12-01T11:30:49Z INFO rsgrad::commands::gap] Trying to parse "WAVECAR" ...
----------------------------------------
Current system is Metal
----------------------------------------
[2022-12-01T11:30:49Z INFO rsgrad] Time used: 166.251241ms
```
2. For non-spin-polarized direct gap system:
```shell
[2022-12-01T11:37:15Z INFO rsgrad::commands::gap] Trying to parse "WAVECAR" ...
--------------------------------------------------------------------------------
Current system has Direct Gap of 0.328 eV
CBM @ k-point 1 of ( 0.000, 0.000, 0.000) , band 819 of 0.322 eV
VBM @ k-point 1 of ( 0.000, 0.000, 0.000) , band 818 of -0.006 eV
--------------------------------------------------------------------------------
[2022-12-01T11:37:15Z INFO rsgrad] Time used: 253.556682ms
```
3. For spin-polarized direct gap system:
```shell
$ rsgrad gap
[2022-12-01T11:38:16Z INFO rsgrad::commands::gap] Trying to parse "WAVECAR" ...
--------------------------------------------------------------------------------
==================== Gap Info For SPIN UP ====================
Current system has Direct Gap of 0.976 eV
CBM @ k-point 1 of ( 0.000, 0.000, 0.000) , band 129 of 0.498 eV
VBM @ k-point 1 of ( 0.000, 0.000, 0.000) , band 128 of -0.478 eV
==================== Gap Info For SPIN DOWN ====================
Current system has Direct Gap of 0.980 eV
CBM @ k-point 1 of ( 0.000, 0.000, 0.000) , band 129 of 0.499 eV
VBM @ k-point 1 of ( 0.000, 0.000, 0.000) , band 128 of -0.481 eV
--------------------------------------------------------------------------------
[2022-12-01T11:38:16Z INFO rsgrad] Time used: 31.744371ms
```
4. For non-spin-polarized indirect gap system:
```shell
$ rsgrad gap
[2022-12-01T11:40:52Z INFO rsgrad::commands::gap] Trying to parse "WAVECAR" ...
--------------------------------------------------------------------------------
Current system has Indirect Gap of 1.160 eV
CBM @ k-point 25 of ( 0.000, 0.444, 0.444) , band 5 of 1.097 eV
VBM @ k-point 17 of ( 0.000, 0.000, 0.000) , band 4 of -0.062 eV
--------------------------------------------------------------------------------
[2022-12-01T11:40:52Z INFO rsgrad] Time used: 22.565948ms
```
1 change: 1 addition & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- [POSCAR](./POSCAR.md)
- [POTCAR](./POTCAR.md)
- [Transition Dipole Moment](./TransitionDipoleMoment.md)
- [Gap](./Gap.md)

---

Expand Down
6 changes: 3 additions & 3 deletions src/commands/gap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl OptProcess for Gap {


// find vbm
let vbeigs = multizip((vbidx, eigs.lanes(Axis(2))))
let vbeigs = multizip((vbidx.clone(), eigs.lanes(Axis(2))))
.map(|(i, v)| v[i])
.collect::<Array1<f64>>()
.into_shape((nspin, nkpts)).unwrap();
Expand Down Expand Up @@ -164,7 +164,7 @@ impl OptProcess for Gap {
format!("{:8.3}", cbeigs[(0, cbmik[0])]).bright_blue()
));
output.push_str(&format!(" VBM @ k-point {:5} of ({:6.3},{:6.3},{:6.3}) , band {:5} of {:8} eV\n",
vbmik[0]+1, kvbm[0], kvbm[1], kvbm[2], cbidx[(0,0)]+1,
vbmik[0]+1, kvbm[0], kvbm[1], kvbm[2], vbidx[(0,0)]+1,
format!("{:8.3}", vbeigs[(0, vbmik[0])]).bright_blue()
));
} else {
Expand All @@ -185,7 +185,7 @@ impl OptProcess for Gap {
format!("{:8.3}", cbeigs[(ispin, cbmik[ispin])]).bright_blue()
));
output.push_str(&format!(" VBM @ k-point {:5} of ({:6.3},{:6.3},{:6.3}) , band {:5} of {:8} eV\n",
vbmik[ispin]+1, kvbm[0], kvbm[1], kvbm[2], cbidx[(ispin,0)]+1,
vbmik[ispin]+1, kvbm[0], kvbm[1], kvbm[2], vbidx[(ispin,0)]+1,
format!("{:8.3}", vbeigs[(ispin, vbmik[ispin])]).bright_blue()
));
}
Expand Down

0 comments on commit 287a6f7

Please sign in to comment.