Python scripts dealing with the output files obtained from PWmat.
Instructions for all scripts are available by adding the -h
option, e.g.,
$ python check_PWmat_convergence.py -h
usage: check_PWmat_convergence.py [-h] [-i <etot.input file>] [-r <RELAXSTEPS file>] [-p <plot graph>] [-v]
Author: Dr. Huan Wang, Email: huan.wang@whut.edu.cn, Version: v1.0, Date: August 7, 2024
optional arguments:
-h, --help show this help message and exit
-i <etot.input file> you can specify the file name (default: ~/etot.input)
-r <RELAXSTEPS file> you can specify the file name (default: ~/RELAXSTEPS)
-p <plot graph> plot graph (default: "yes")
-v, --verbose verbose mode, show details of the RELAXSTEPS file (default: False)
- Python >= 3.8.3
- Numpy >= 1.23.0
- Scipy >= 1.5.0
- Matplotlib >= 3.2.2
I strongly recommend using Anaconda3
to manage these packages.
The check_PWmat_convergence.py
script is designed to check cell and ionic optimization convergence using the PEB or HSE06 functionals in PWmat. This script plots the trends of Total Energy and Average Force as a function of the number of optimization steps, facilitating observation during the calculation process.
Usage:
$ python check_PWmat_convergence.py
If one wishes to view values of total energy, average force, SCF cycles, etc., the inclusion of the -v option is advised.
$ python check_PWmat_convergence.py -v
The convert_MDSTEPS.py
script is designed to convert the MDSTEPS file generated by PWmat during the AIMD or rt-TDDFT simulations into a .csv
format table. Additionally, it facilitates the creation of a MDsteps.csv
file will be convenient for subsequent plotting purposes.
Usage:
$ python convert_MDSTEPS.py
The check_rtTDDFT_Time.py
script is employed to extract the TDDFT_TIME=
parameters from the input file (etot.input
) of PWmat in rt-TDDFT calculations and visualize it as a waveform profile of laser intensity over time.
Usage:
$ python check_rtTDDFT_Time.py
The split_MOVEMENT.py
script split the MOVEMENT file generated by PWmat in rt-TDDFT calculations. This script has been devised as a subsequent analysis that requires the computation of the density of states (DOS) at specific time points. It swiftly divides the MOVEMENT file into several atom_XXXfs.config files based on user-specified time intervals.
Usage:
$ python split_MOVEMENT.py -s 10 30.5 100.7 240
then, the atom_10.0fs.config, atom_30.5fs.config,atom_100.7fs.config,and atom_240.0fs.config files are obtained.
Still in testing The set_rtTDDFT_time.py
script is designed to configure the TDDFT_TIME=
parameters
The num_excited_electrons.py
script is employed to calculate and plot the number of excited electrons over time in the conduction band during the rt-TDDFT calculations. It processes the plot.TDDFT.DOS file generated by PWmat's built-in plot_TDDFT.x
script. Moreover, it extracts the total number of electrons from the REPORT file to derive the percentage of excited electrons.
Usage:
$ python num_excited_electrons.py
The parse_force.py
script is employed to parse the MOVEMENT file and plot the Force
obtained from the rt-TDDFT calculations. The script will read the MOVEMENT file by default. Users can also specify the file name by typing -f MOVEMNT_1st_try
if the file name has changed. By using the -i
option, users can select the elements by the index (indices), e.g., -i 3 7 11
or select All elements by typing -i 0
. In addition, the parsed force values will automatically save as a .csv
file, with the output file name as the combination of element symbols and their index (e.g. if the user types -i 3 7 11
and if the corresponding elements are H
, C
, and N
, then the output file name is H_1_C_3_N_11.csv). Moreover, the -p
option provides two types of plotting results. By default, each panel illustrates each element with the force components. If users type -p xyz
, the figure will present three panels for the x, y, z
components of the specific elements.
Usage:
$ python parse_force.py -f MOVEMENT -i 1 2 5
PWmat_tools系列脚本用于处理PWmat计算的结果文件。这些脚本以Python3
语言编写,调用了Numpy
,Scipy
,Matplotlib
等库,因此建议使用Anaconda3
套件来管理和运行这些脚本。
所有的脚本均有说明文档,可以通过 -h
查看具体的说明。例如:
$ python check_PWmat_convergence.py -h
usage: check_PWmat_convergence.py [-h] [-i <etot.input file>] [-r <RELAXSTEPS file>] [-p <plot graph>] [-v]
Author: Dr. Huan Wang, Email: huan.wang@whut.edu.cn, Version: v1.0, Date: August 7, 2024
optional arguments:
-h, --help show this help message and exit
-i <etot.input file> you can specify the file name (default: ~/etot.input)
-r <RELAXSTEPS file> you can specify the file name (default: ~/RELAXSTEPS)
-p <plot graph> plot graph (default: yes)
-v, --verbose verbose mode, show details of the RELAXSTEPS file (default: False)
- Python >= 3.8.3
- Numpy >= 1.23.0
- Scipy >= 1.5.0
- Matplotlib >= 3.2.2
check_PWmat_convergence.py
脚本用于检查PWmat结构优化(适用PBE,HSE06等泛函的晶胞优化+结构优化,结构优化)的收敛情况。此脚本将能量,平均受力随优化步数的变化趋势绘制成图,方便计算过程中观察。
使用方法:
$ python check_PWmat_convergence.py
如果想查看能量,平均受力,SCF循环次数等随优化步数的变化数据,则可以添加-v
选项
$ python check_PWmat_convergence.py -v
convert_MDSTEPS.py
脚本用于将PWmat在AIMD和rt-TDDFT计算产生的MDSTEPS文件转换成.csv格式的表格。同时,绘制含有总能量-时间(Total Energy vs. MD Time), 势能-时间(Potential Energy vs. MD Time), 动能-时间(Kinetic Energy vs. MD Time),动能变化量-时间( MDsteps.csv
文件也可以方便后续绘图。
使用方法:
$ python convert_MDSTEPS.py
check_rtTDDFT_Time.py
脚本用于读取PWmat在rt-TDDFT计算的输入文件(etot.input)中的TDDFT_TIME=参数,并绘制成激光强度-时间的波形图.
使用方法:
$ python check_rtTDDFT_Time.py
split_MOVEMENT.py
脚本用于读取PWmat在rt-TDDFT计算中产生的的MOVEMENT文件。由于后续处理时需要计算某些时刻的态密度(DOS),因此开发了此拆分脚本。split_MOVEMENT.py
脚本可以按照使用者输入的时刻迅速将MOVEMENT
文件拆分成若干个atom_XXXfs.config
文件。
使用方法:
$ python check_rtTDDFT_Time.py -s 10 30.5 100.7 240
即可得到 atom_10.0fs.config, atom_30.5fs.config,atom_100.7fs.config,atom_240.0fs.config 等文件。
仍在测试中 set_rtTDDFT_time.py
脚本用于根据实验条件设置TDDFT_TIME
的
num_excited_electrons.py
脚本用于计算PWmat在rt-TDDFT计算中被激发到导带中的电子数。此脚本读取的是PWmat
自带的plot_TDDFT.x
脚本处理得到的plot.TDDFT.DOS
文件,得到被激发的电子数随时间变化的数据。另外,此脚本读取REPORT
文件中的总电子数,从而进一步得到被激发的电子数的百分比。
使用方法:
$ python num_excited_electrons.py
parse_force.py
脚本用于解析PWmat在rt-TDDFT计算中产生的 MOVEMENT 文件中的 Force。此脚本读取每个时刻的Force
分量。默认不需要输入MOVEMENT
文件名,但是如果用户修改了文件名,可以用-f
来指定文件名,例如 -i MOVEMENT_first_try
。用户可以通过 -i
选项来输入元素的索引号选取元素。脚本将处理后的Force
分量保存为.csv
格式的文件,文件名为元素符号和对应的原子索引号(例如,输入的是 -i 1 3 11
,假如对应的元素是 H C N,则保存的文件名为 H_1_C_3_N_11.csv)。另外,脚本提供-p
选项用户绘图,其中默认的是根据绘制用户输入的序号对应的各个元素的受力分量(选了多少元素就有多少个图层,每个图层绘制一个元素的受力 x, y, z 随时间的变化 )。如果用户希望按x,y,z
来观察,也可以用 -p xyz
功能可以得到受力的 x y z
三个分量的图(上,中,下三个图分别绘制所选元素的 x, y, z 分量)。
使用方法:
$ python parse_force.py -i 1 2 5