From 287a6f73786c40922407391aee1b4b7656643cd1 Mon Sep 17 00:00:00 2001 From: Ionizing Date: Thu, 1 Dec 2022 19:43:39 +0800 Subject: [PATCH] [rsgrad gap] docs done, bump version --- .gitignore | 1 + Cargo.toml | 2 +- docs/src/Gap.md | 85 +++++++++++++++++++++++++++++++++++++++++++++ docs/src/SUMMARY.md | 1 + src/commands/gap.rs | 6 ++-- 5 files changed, 91 insertions(+), 4 deletions(-) create mode 100644 docs/src/Gap.md diff --git a/.gitignore b/.gitignore index 96dd50c..74dfefd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ Cargo.lock .DS_Store +*.swp diff --git a/Cargo.toml b/Cargo.toml index 1efb314..bf8e8b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rsgrad" -version = "0.4.2" +version = "0.4.3" authors = ["Ionizing "] edition = "2018" diff --git a/docs/src/Gap.md b/docs/src/Gap.md new file mode 100644 index 0000000..c27d9fe --- /dev/null +++ b/docs/src/Gap.md @@ -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 `, 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 Specify Fermi level, if left empty, this value would be read from + WAVECAR or OUTCAR + -h, --help Print help information + -o, --outcar OUTCAR file name, this file is parsed to get Fermi level only + [default: OUTCAR] + -p, --procar PROCAR file name, OUTCAR is also needed to get Fermi level [default: + PROCAR] + -w, --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 +``` diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 8cef8e3..9ba51c2 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -17,6 +17,7 @@ - [POSCAR](./POSCAR.md) - [POTCAR](./POTCAR.md) - [Transition Dipole Moment](./TransitionDipoleMoment.md) +- [Gap](./Gap.md) --- diff --git a/src/commands/gap.rs b/src/commands/gap.rs index 79a0e63..3ac5bdb 100644 --- a/src/commands/gap.rs +++ b/src/commands/gap.rs @@ -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::>() .into_shape((nspin, nkpts)).unwrap(); @@ -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 { @@ -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() )); }