Xiaoxun-Gong / DeepH-E3

MIT License
60 stars 16 forks source link

The error of eval part #4

Closed newplay closed 1 year ago

newplay commented 1 year ago

I encountered the following error while performing the evaluation process:

##############################################################

  File "/home/zjlin/DeepH-E3/deephe3/process_data_tools/process_data.py", line 29, in <module>
    assert len(stru_path_list) > 0, 'cannot find any structure'
AssertionError: cannot find any structure
Traceback (most recent call last):
  File "/home/zjlin/DeepH-E3/deephe3-eval.py", line 29, in <module>
    kernel.eval(args.config, debug=args.debug)
  File "/home/zjlin/DeepH-E3/deephe3/kernel.py", line 338, in eval
    dataset = self.get_graph(eval_config, inference=eval_config.inference)
  File "/home/zjlin/DeepH-E3/deephe3/kernel.py", line 455, in get_graph
    assert return_code == 0, f'Error occured in executing command: "{cmd}"'
AssertionError: Error occured in executing command: "python /home/zjlin/DeepH-E3/deephe3/process_data_tools/process_data.py --input_dir /home/zjlin/tbg_Deep_ex/work_dir/olp/TBG_7.34_defect_relByVasp --output_dir /home/zjlin/tbg_Deep_ex/work_dir/olp/TBG_7.34_defect_relByVasp --simpout --olp"

############################################################################

and there's my input file eval.ini: ############################################################################

; DO NOT MODIFY THIS CONFIG FILE HERE!
; This is the default config file. If you want to create your own config, please first create a copy at somewhere else.
;
[basic]
;
; ; device            string   Device on which model will be trained (cpu or cuda)
; ; dtype             string   Data type of floating point numbers used during training (float or double)
; ; trained_model_dir string   Directory containing all the trained models that will be used to get predicted hamiltonians_pred.h5
; ; output_dir        string   All the output will be stored to: <output_dir>/<stru_id>/hamiltonians_pred.h5
; ;                            A little trick: you can set output_dir to be the same with processed_data_dir so that
; ;                            hamiltonians_pred.h5 will be exactly stored into the folder with processed structure information.
; ; target            string   Only support "hamiltonian" now
; ; inference         bool     If set to True, then overlaps.h5 will be used to generate graph data, instead of using hamiltonians.h5.
; ;                            If set to False, test result will be generated under save_dir and can be analyzed using testResultAnalyzer.
; ; test_only         bool     If set to True, then hamiltonians_pred.h5 will not be written. Can only be used when inference=False.
;
device = cpu
dtype = float
trained_model_dir = /home/zjlin/tbg_Deep_ex/work_dir/Deep-E3_test/work_dir/train_model/2023-05-15_16-02-11
output_dir = /home/zjlin/tbg_Deep_ex/work_dir/Deep-E3_test/work_dir/inference
target = hamiltonian
inference = True
test_only = False
;
[data]
;
; ; You still have to process the data into a graph first before you can evaluate your models on them.
;
; ; There are three methods to load DeepH-E3 data.
; ; 1. Fill in graph_dir and leave all other parameters blank.
; ;    An existing graph will be loaded.
; ; 2. Fill in processed_data_dir, save_graph_dir, dataset_name.
; ;    A new graph will be created from preprocessed data under processed_data_dir and saved under save_graph_dir.
; ;    This graph will be readily loaded.
; ; 3. Fill in DFT_data_dir, processed_data_dir, save_graph_dir, dataset_name.
; ;    First DFT data will be preprocessed and saved under processed_data_dir.
; ;    Then a new graph will be created using those preprocessed data, and saved under save_graph_dir.
; ;    Finally this new graph will be loaded.
;
; ; graph_dir               string   Directory of preprocessed graph data xxxx.pkl
; ; processed_data_dir      string   Directory containing preprocessed structure data. Should contain elements.dat, info.json,
; ;                                  lat.dat, orbital_types.dat, rlat.dat, site_positions.dat and hamiltonians.h5
; ; DFT_data_dir            string   Directory containing DFT calculated structure folders. Each structure folder should contain
; ;                                  openmx.scfout with openmx.out concatenated to its end.
; ; save_graph_dir          string   Directory for saving graph data (method 2, 3).
; ; target_data             string   Only support 'hamiltonian' now
; ; dataset_name            string   Custom name for your dataset
; ; get_overlap             boolean  Whether to get overlap matrix (for band structure calculation) from
; ;                                  openmx data when processing
;
graph_dir =
DFT_data_dir = /home/zjlin/tbg_Deep_ex/work_dir/olp/TBG_7.34_defect_relByVasp
processed_data_dir =  /home/zjlin/tbg_Deep_ex/work_dir/olp/TBG_7.34_defect_relByVasp
save_graph_dir = /home/zjlin/tbg_Deep_ex/work_dir/Deep-E3_test/work_dir/dataset/graph_dir/TBG_7.34_defect_relByVasp
target_data = hamiltonian
dataset_name = TBG_7.34_defect_relByVasp
get_overlap = True

########################################################################################### The error tells me that there's no structure in the processed_data_dir but the "openmx-overlap result" is exsist in the dir ,as below: image

Could you give me some suggestions, please?

Xiaoxun-Gong commented 1 year ago

Hi, did you combine all the overlaps_xx.h5 into one overlaps.h5 file? DeepH-pack has the functionality to combine all the overlaps_xx.h5 to a single overlaps.h5 file using the command deeph-inference. In the config inference.ini, you should set task=[1] and interface=openmx. OLP_dir should be the output folder of Overlap-only-OpenMX containing openmx.out and output/overlaps_xx.h5. After running the command, you will find all the necessary files under work_dir. Additionally, in your eval.ini for DeepH-E3, you should remove the option DFT_data_dir by leaving it blank, and point processed_data_dir to work_dir in inference.ini.

newplay commented 1 year ago

Thank you for your response. I will give it a try.

newplay commented 1 year ago

@Xiaoxun-Gong I got the right result ! Thank you so much !