mzjb/DeepH-pack

How to calculate the eigenvalues of different k points in parallel in the inference step?

Closed this issue · 2 comments

Hello, I wonder how to calculate the eigenvalues of different k points in parallel in the inference step?

[which_k : Define which point in k-path to calculate, start counting from 1. You can set it ‘0’ for all k points, or ‘-1’ for no point. It is recommended to calculate the eigenvalues of different k points in parallel through it. (Invalid for dense matrix calculation)]

mzjb commented

If which_k is set to n, only the eigenvalues of the n-th kpoint (1-based index) will be calculated.

To calculate the eigenvalues in parallel, firstly, you can set which_k to '-1' in the json config file and perform a normal inference step by deeph-inference to get the necessary files (dense_calc should be set to 'False' in the ini config file). You can check if sparse matrix.jld is in the output directory (${output_dir}) of deeph-inference.

Then, you can prepare many json config files with different values ​​of which_k in different subdirectories of ${output_dir} (${output_dir}/${index_k}); and edit a bash script to run sparse_calc.jl with different which_k in parallel, e.g.,

# calc_band.sh
julia ${path_of_DeepH}/deeph/inference/sparse_calc.jl --input_dir ${output_dir}$ --output_dir ${output_dir}/1 --config ${output_dir}/1/config.json &

julia ${path_of_DeepH}/deeph/inference/sparse_calc.jl --input_dir ${output_dir}$ --output_dir ${output_dir}/2 --config ${output_dir}/2/config.json &

julia ${path_of_DeepH}/deeph/inference/sparse_calc.jl --input_dir ${output_dir}$ --output_dir ${output_dir}/3 --config ${output_dir}/3/config.json &

...

wait

, and run bash calc_band.sh.

Finally, you can get the eigenvalues of the n-th kpoint in the file ${output_dir}/n/openmx.Band.

Thanks you for your answer.