Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have a problem when i inference hamiton #65

Open
zhanghongfei12 opened this issue Apr 1, 2024 · 9 comments
Open

I have a problem when i inference hamiton #65

zhanghongfei12 opened this issue Apr 1, 2024 · 9 comments

Comments

@zhanghongfei12
Copy link

Hello, I got this error when forecasting, but I'm running the previously calculated material and it's fine, the settings are all the same, what could be the cause of this?

=> Atomic types: [32], spinful: True, the number of atomic types: 1.
Save processed graph to /mnt/raid1/work/zhang/Ge/4.27/work_dir/inference/7.34/graph.pkl, cost 38.801493644714355 seconds
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [02:56<00:00, 176.66s/it]
Traceback (most recent call last):
File "/mnt/raid1/work/zhang/miniconda3/envs/deeph/bin/deeph-inference", line 8, in
sys.exit(main())
File "/mnt/raid1/work/zhang/miniconda3/envs/deeph/lib/python3.9/site-packages/deeph/scripts/inference.py", line 124, in main
predict(input_dir=work_dir, output_dir=work_dir, disable_cuda=disable_cuda, device=device,
File "/mnt/raid1/work/zhang/miniconda3/envs/deeph/lib/python3.9/site-packages/deeph/inference/pred_ham.py", line 167, in predict
assert np.all(np.isnan(hamiltonian) == False)
AssertionErro

Here are the settings
OLP_dir = /mnt/raid1/work/zhang/Ge/4.27/work_dir/olp/5_4/7.34
work_dir = /mnt/raid1/work/zhang/Ge/4.27/work_dir/inference/7.34
structure_file_name = POSCAR
task = [1, 2, 3, 4, 5]
sparse_calc_config = /mnt/raid1/work/zhang/Ge/4.27/work_dir/inference/5_4/band.json
trained_model_dir = /mnt/raid1/work/zhang/Ge/4.27/work_dir/Ge_4.27
restore_blocks_py = True
eigen_solver = sparse_jl

[interpreter]
julia_interpreter = /mnt/raid1/work/zhang/julia-1.8.3/bin/julia

[graph]
radius = -1.0
create_from_DFT = True

@zhanghongfei12
Copy link
Author

 Based on the information reported in the error, my guess is that there is a “hamiltonian” value of NaN, but which data is this ”hamiltonian“

if restore_blocks_py:
for hamiltonian in hoppings_pred.values():
assert np.all(np.isnan(hamiltonian) == False)
write_ham_h5(hoppings_pred, path=os.path.join(output_dir, 'rh_pred.h5'))

@mzjb
Copy link
Owner

mzjb commented Apr 2, 2024

Please check whether the orbital parameter of your model(s) covers all orbital pairs of the material you are studying.

@zhanghongfei12
Copy link
Author

Hello, I re-trained after changing the orbitial, but I have a new problem, when I have “eigen_solver = sparse_jl” it works fine. But when I set “eigen_solver = dense_py” I get the error

####### Begin 5.sparse_calc
/mnt/raid1/work/zhang/Ge/4.27/work_dir/inference/5_4/band.json
Traceback (most recent call last):
File "/mnt/raid1/work/zhang/miniconda3/envs/deeph/lib/python3.9/site-packages/deeph/inference/dense_calc.py", line 76, in
if len(site_position.shape) == 2:
NameError: name 'site_position' is not defined
Traceback (most recent call last):
File "/mnt/raid1/work/zhang/miniconda3/envs/deeph/bin/deeph-inference", line 8, in
sys.exit(main())
File "/mnt/raid1/work/zhang/miniconda3/envs/deeph/lib/python3.9/site-packages/deeph/scripts/inference.py", line 150, in main
assert capture_output.returncode == 0
AssertionErro

@mzjb
Copy link
Owner

mzjb commented Apr 4, 2024

Please use the latest version of the code from the repository.

@zhanghongfei12
Copy link
Author

I updated deeph=0.2.2 and then re-predicted and the following error was reported

####### Begin 5.sparse_calc
/mnt/raid1/work/zhang/Ge/4.27/work_dir/inference/5_4/band.json
read h5
Time for reading h5: 5.994760990142822 s
construct Hamiltonian and overlap matrix in the real space
Traceback (most recent call last):
File "/mnt/raid1/work/zhang/miniconda3/envs/deeph/lib/python3.9/site-packages/deeph/inference/dense_calc.py", line 144, in
assert (site_norbits[atom_i], site_norbits[atom_j]) == hamiltonian_pred.shape
AssertionError
Traceback (most recent call last):
File "/mnt/raid1/work/zhang/miniconda3/envs/deeph/bin/deeph-inference", line 8, in
sys.exit(main())
File "/mnt/raid1/work/zhang/miniconda3/envs/deeph/lib/python3.9/site-packages/deeph/scripts/inference.py", line 150, in main
assert capture_output.returncode == 0
AssertionError

@zhanghongfei12
Copy link
Author

Finding Fermi energy levels using sparse algorithms is a matter of setting “num_band” in “band.json” to 1 and starting to gradually make the number larger until the number is the number of valence electrons needed? But isn't the band centered around your own initial Fermi energy level?

@mzjb
Copy link
Owner

mzjb commented Apr 5, 2024

I updated deeph=0.2.2 and then re-predicted and the following error was reported

####### Begin 5.sparse_calc /mnt/raid1/work/zhang/Ge/4.27/work_dir/inference/5_4/band.json read h5 Time for reading h5: 5.994760990142822 s construct Hamiltonian and overlap matrix in the real space Traceback (most recent call last): File "/mnt/raid1/work/zhang/miniconda3/envs/deeph/lib/python3.9/site-packages/deeph/inference/dense_calc.py", line 144, in assert (site_norbits[atom_i], site_norbits[atom_j]) == hamiltonian_pred.shape AssertionError Traceback (most recent call last): File "/mnt/raid1/work/zhang/miniconda3/envs/deeph/bin/deeph-inference", line 8, in sys.exit(main()) File "/mnt/raid1/work/zhang/miniconda3/envs/deeph/lib/python3.9/site-packages/deeph/scripts/inference.py", line 150, in main assert capture_output.returncode == 0 AssertionError

I mean please use the code from the latest commit, not the code from the latest tag/release.

@mzjb mzjb closed this as completed Apr 5, 2024
@mzjb mzjb reopened this Apr 5, 2024
@mzjb
Copy link
Owner

mzjb commented Apr 9, 2024

Finding Fermi energy levels using sparse algorithms is a matter of setting “num_band” in “band.json” to 1 and starting to gradually make the number larger until the number is the number of valence electrons needed? But isn't the band centered around your own initial Fermi energy level?

You do not need to increase num_band, just adjust fermi_level to calculate the eigenvalues of all valence bands.

@zhanghongfei12
Copy link
Author

In the sparse algorithm, which calculates data around the Fermi energy, how do I know what the valence bands of those things are, and then what is the lowest energy that you were talking about before, and how do I determine that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants