A script to calculate Inverse Participation Ratio (IPR) of Kohn-Sham state
$ cd pyIPR
$ ls .
README.md data pyIPR setup.py
$ pip3 install -e .
>>> from pyIPR.IPRGenerator import IPRCalculator
>>> from pymatgen.electronic_structure.core import Spin
>>> procar_path = '<your_path>/pyIPR/data/PROCAR'
>>> eigenval_path = "<your_path>/pyIPR/data/EIGENVAL"
>>> output_path = "<your_path>/pyIPR/data/IPRs.csv"
>>> IPR_calculator = IPRCalculator(
procar_path=procar_path,
eigenval_path=eigenval_path,
output_csv_path=output_path
)
>>> print(IPR_calculator)
+----------------+----------+--------+-------+
| spins_lst | nkpoints | nbands | nions |
+----------------+----------+--------+-------+
| [<Spin.up: 1>] | 25 | 480 | 108 |
+----------------+----------+--------+-------+
# 计算真空能级的 IPR
>>> IPR_calculator.concat_energys_IPRs(Spin(1), efermi=None) # 运行完毕后,产生 "<your_path>/pyIPR/data/IPRs.csv" 文件
>>> from pyIPR.IPRGenerator import IPRCalculator
>>> from pymatgen.electronic_structure.core import Spin
>>> from pymatgen.io.vasp.outputs import Vasprun
>>> procar_path = '<your_path>/pyIPR/data/PROCAR'
>>> eigenval_path = "<your_path>/pyIPR/data/EIGENVAL"
>>> vasprun_path = "<your_path>/pyIPR/data/vasprun.xml"
>>> output_path = "<your_path>/pyIPR/data/IPRs.csv"
>>> IPR_calculator = IPRCalculator(
procar_path=procar_path,
eigenval_path=eigenval_path,
output_csv_path=output_path
)
>>> print(IPR_calculator)
+----------------+----------+--------+-------+
| spins_lst | nkpoints | nbands | nions |
+----------------+----------+--------+-------+
| [<Spin.up: 1>] | 25 | 480 | 108 |
+----------------+----------+--------+-------+
# 计算 feimi 能级
>>> vasprun = Vasprun(vasprun_path)
>>> dos_data = vasprun.complete_dos
>>> fermi = dos_data.efermi
# 计算减去 fermi 能级的 IPR
>>> IPR_calculator.concat_energys_IPRs(Spin(1), efermi=efermi) # 运行完毕后,产生 "<your_path>/pyIPR/data/IPRs.csv" 文件