QuantumLab-ZY / HamGNN

An E(3) equivariant Graph Neural Network for predicting electronic Hamiltonian matrix
GNU General Public License v3.0
55 stars 15 forks source link

Python environment for HamGNN #14

Open flamingoXu opened 5 months ago

flamingoXu commented 5 months ago

Dear Zhong Yang When I tried to run HamGNN in the GPU platform, I encountered some problem due to the version of the python library. However, the library that I have installed is completely in accordance with the readme requirements. my GPU tpye is V100,pytorch(cuda11.3) 691f2166ce538dcf691b793f9d900a7

367492cb3d3055f9385649d6f24ff80

QuantumLab-ZY commented 5 months ago

I want to check your config.yaml file.

flamingoXu commented 5 months ago

Dear Zhong Yang: thanks for your help! here is my config.yaml,and i also want to know whether this program can predict wavefunction? If could ,how to output Hamiltonian and Wavefunction together dataset_params: batch_size: 1 split_file: null test_ratio: 0.1 train_ratio: 0.8 val_ratio: 0.1 graph_data_path: ./Examples/Moire_twisted_bilayer_MoS2/ # Directory where graph_data.npz is located

losses_metrics: losses:

Generally, the optim_params module only needs to set the initial learning rate (lr)

optim_params: lr: 0.001 lr_decay: 0.5 lr_patience: 5 gradient_clip_val: 0.0 max_epochs: 3000 min_epochs: 100 stop_patience: 30

output_nets: output_module: HamGNN_out HamGNN_out: ham_only: true # true: Only the Hamiltonian H is computed; 'false': Fit both H and S ham_type: openmx # openmx: fit openmx Hamiltonian; abacus: fit abacus Hamiltonian nao_max: 19 # The maximum number of atomic orbitals in the data set, which can be 14, 19 or 27 add_H0: true # Generally true, the complete Hamiltonian is predicted as the sum of H_scf plus H_nonscf (H0) symmetrize: true # if set to true, the Hermitian symmetry constraint is imposed on the Hamiltonian calculate_band_energy: false # Whether to calculate the energy bands to train the model num_k: 5 # When calculating the energy bands, the number of K points to use band_num_control: null # dict: controls how many orbitals are considered for each atom in energy bands; int: [vbm-num, vbm+num]; null: all bands k_path: null # auto: Automatically determine the k-point path; null: random k-point path; list: list of k-point paths provided by the user soc_switch: false # if true, fit the SOC Hamiltonian nonlinearity_type: norm # norm or gate

profiler_params: progress_bar_refresh_rat: 1 train_dir: ./Examples/MoS2_tw_5.09 #The folder for saving training information and prediction results. This directory can be read by tensorboard to monitor the training process.

representation_nets:

Network parameters usually do not need to be changed.

HamGNN_pre: cutoff: 20.0 resnet: True cutoff_func: cos edge_sh_normalization: component edge_sh_normalize: true ######## Irreps set 1 (crystal): ################ feature_irreps_hidden: 32x0o+32x0e+32x1o+32x1e+32x2e+32x2o+32x3o+32x3e+32x4o+32x4e irreps_edge_output: 32x0o+32x0e+32x1o+32x1e+32x2e+32x2o+32x3o+32x3e+32x4o+32x4e irreps_edge_sh: 0e + 1o + 2e + 3o + 4e irreps_node_features: 32x0o+32x0e+32x1o+32x1e+32x2e+32x2o+32x3o+32x3e+32x4o+32x4e irreps_node_output: 32x0o+32x0e+32x1o+32x1e+32x2e+32x2o+32x3o+32x3e+32x4o+32x4e irreps_triplet_output: 32x0o+32x0e+32x1o+32x1e+32x2e+32x2o+32x3o+32x3e+32x4o+32x4e invariant_layers: 2 invariant_neurons: 64 num_interaction_layers: 5 num_radial: 8 num_spherical: 8 num_types: 60 export_triplet: false rbf_func: bessel set_features: true add_edge_tp: false irreps_node_prev: 16x0o+16x0e+8x1o+8x1e+8x2e+8x2o+8x3o+8x3e+8x4o+8x4e num_node_attr_feas: 64

setup: GNN_Net: HamGNN_pre accelerator: null ignore_warnings: true checkpoint_path: ./network_weights_bilayer_MoS2.ckpt # Path to the model weights file load_from_checkpoint: false resume: false num_gpus: [1] # null: use cpu; [i]: use the ith GPU device precision: 32 property: hamiltonian stage: test # fit: training; test: inference

QuantumLab-ZY commented 5 months ago

The problem seems to be caused by the pymatgen library, which throws this exception when executing 'from Pymatgen.core. structure import Structure'. The version of pymatgen I used is Pymatgen-2022.3.7, yours seems to be the latest version of 2024, you can try my version of pymatgen to see if the bug still exists.

Dear Zhong Yang When I tried to run HamGNN in the GPU platform, I encountered some problem due to the version of the python library. However, the library that I have installed is completely in accordance with the readme requirements. my GPU tpye is V100,pytorch(cuda11.3) 691f2166ce538dcf691b793f9d900a7

367492cb3d3055f9385649d6f24ff80

QuantumLab-ZY commented 5 months ago

I have uploaded my HamGNN conda environment on this website, and users can directly extract this conda environment to their own conda/envs path.

flamingoXu commented 5 months ago

Dear Zhong Yang: I had tried to change my pymatgen version into 22.3.7, but it doesn't work. Then, I changed my networkx with an old version 2.8.8, which finally fixed the bug. It will be nice if you can label your python libs version in the readme file. which will help the user a lot. Best wishes.

QuantumLab-ZY commented 5 months ago

This is a good suggestion, I will provide more detailed information about the Python environment when I have convenient time.

Dear Zhong Yang: I had tried to change my pymatgen version into 22.3.7, but it doesn't work. Then, I changed my networkx with an old version 2.8.8, which finally fixed the bug. It will be nice if you can label your python libs version in the readme file. which will help the user a lot. Best wishes.

JaGeo commented 4 months ago

This is a good suggestion, I will provide more detailed information about the Python environment when I have convenient time.

Dear Zhong Yang: I had tried to change my pymatgen version into 22.3.7, but it doesn't work. Then, I changed my networkx with an old version 2.8.8, which finally fixed the bug. It will be nice if you can label your python libs version in the readme file. which will help the user a lot. Best wishes.

This would be really great for reuse! If you are interested in reuse, maybe an easier installation process via pip install and pypi or conda would also help! Thanks in advance!

QuantumLab-ZY commented 4 months ago

Dear JaGeo,

I appreciate your suggestion regarding an easier installation process. Unfortunately, this code cannot be installed simply via pip install due to its dependency on numerous external third-party libraries, which in turn rely on some additional Python packages with which I am not familiar. Resolving all these dependencies is quite challenging.

As a temporary solution, I have uploaded the Conda environment I am using to this repository. You can extract this Conda environment to your own conda/envs directory and then use the command pip list --format=freeze > requirements.txt within this Conda environment to generate a list of all the third-party Python dependency versions. This should help you get started more easily. If you have any suggestions for a better and simpler way to handle the environment dependencies for HamGNN, I would greatly appreciate it.

Thank you for your understanding and support!

Best regards, Yang Zhong

This is a good suggestion, I will provide more detailed information about the Python environment when I have convenient time.

Dear Zhong Yang: I had tried to change my pymatgen version into 22.3.7, but it doesn't work. Then, I changed my networkx with an old version 2.8.8, which finally fixed the bug. It will be nice if you can label your python libs version in the readme file. which will help the user a lot. Best wishes.

This would be really great for reuse! If you are interested in reuse, maybe an easier installation process via pip install and pypi or conda would also help! Thanks in advance!

JaGeo commented 4 months ago

@QuantumLab-ZY Thank you very much! This should already help quite a lot!