forked from abacusmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 230
Refactor: Improve stability of KSDFT-generated ML descriptors #7431
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
Open
sunliang98
wants to merge
6
commits into
deepmodeling:develop
Choose a base branch
from
sunliang98:enhance_mlkedf
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bb6a29b
Enhance the stability of of_ml_gene_data
sunliang98 4bee6e2
Test: Add an integrate test 01_PW/103_PW_Gene_Descriptors for of_ml_g…
sunliang98 5b0cc49
Potential fix for pull request finding
sunliang98 0709bf8
Test: Add a unit test for of_ml_gene_data, and update Autotest.sh
sunliang98 c52bd7c
docs: trigger readthedocs rebuild
sunliang98 e37ab4f
Merge branch 'develop' into enhance_mlkedf
sunliang98 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| INPUT_PARAMETERS | ||
| #Parameters (1.General) | ||
| suffix autotest | ||
| calculation scf | ||
| nbands 3 | ||
| symmetry 1 | ||
| pseudo_dir ../../PP_ORB | ||
| pseudo_rcut 16 | ||
|
|
||
| #Parameters (2.Iteration) | ||
| ecutwfc 10 | ||
| scf_nmax 100 | ||
| dft_functional XC_GGA_X_PBE+XC_GGA_C_PBE | ||
|
|
||
|
|
||
| #Parameters (3.Basis) | ||
| basis_type pw | ||
|
|
||
| #Parameters (4.Smearing) | ||
| smearing_method gauss | ||
| smearing_sigma 0.0002 | ||
|
|
||
| #Parameters (5.Mixing) | ||
| mixing_type broyden | ||
| device cpu | ||
|
|
||
| #Parameters (6.Gene Data) | ||
| of_full_pw 1 | ||
| of_full_pw_dim 1 | ||
|
|
||
| of_ml_gene_data 1 | ||
|
|
||
| of_ml_nkernel 2 | ||
| of_ml_kernel 1 1 | ||
| of_ml_kernel_scaling 1.5 1 | ||
| of_ml_chi_p 0.2 | ||
| of_ml_chi_q 0.1 | ||
| of_ml_chi_pnl 0.2 0.2 | ||
| of_ml_chi_qnl 0.1 0.1 | ||
| of_ml_chi_xi 0.8 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| K_POINTS | ||
| 0 | ||
| Gamma | ||
| 20 20 20 0 0 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Tests the correctness of ML functional descriptors generated by PW KSDFT; this case supports single-rank only. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| ATOMIC_SPECIES | ||
| Al 13 al.gga.psp blps | ||
|
|
||
| LATTICE_CONSTANT | ||
| 7.6513590200098225 // add lattice constant | ||
|
|
||
| LATTICE_VECTORS | ||
| 0.000000000000 0.500000000000 0.500000000000 | ||
| 0.500000000000 0.000000000000 0.500000000000 | ||
| 0.500000000000 0.500000000000 0.000000000000 | ||
|
|
||
| ATOMIC_POSITIONS | ||
| Direct | ||
|
|
||
| Al | ||
| 0.0 | ||
| 1 | ||
| 0.000000000000 0.000000000000 0.000000000000 1 1 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| etotref -57.04829815855825 | ||
| etotperatomref -57.0482981586 | ||
| ml_desc_mean_enhancement_npy 1.111419127928 | ||
| ml_desc_mean_gamma_npy 0.995847307666 | ||
| ml_desc_mean_gammanl_1_1_5_npy 0.077138936619 | ||
| ml_desc_mean_gammanl_1_1_npy 0.083331919287 | ||
| ml_desc_mean_nablaRhox_npy 0.003714583460 | ||
| ml_desc_mean_nablaRhoy_npy 0.003714583460 | ||
| ml_desc_mean_nablaRhoz_npy 0.003714583460 | ||
| ml_desc_mean_p_npy 0.095710030124 | ||
| ml_desc_mean_pauli_npy 0.875124481343 | ||
| ml_desc_mean_pnl_1_1_5_npy 0.230824971750 | ||
| ml_desc_mean_pnl_1_1_npy 0.224100011030 | ||
| ml_desc_mean_q_npy 0.310335060112 | ||
| ml_desc_mean_qnl_1_1_5_npy 0.598582089727 | ||
| ml_desc_mean_qnl_1_1_npy 0.660815190079 | ||
| ml_desc_mean_rho_npy 0.026789555290 | ||
| ml_desc_mean_tanh_pnl_1_1_5_npy 0.044695787317 | ||
| ml_desc_mean_tanh_pnl_1_1_npy 0.043383873620 | ||
| ml_desc_mean_tanh_qnl_1_1_5_npy 0.053898994944 | ||
| ml_desc_mean_tanh_qnl_1_1_npy 0.059951993401 | ||
| ml_desc_mean_tanhp_npy 0.018740571716 | ||
| ml_desc_mean_tanhp_nl_1_1_5_npy 0.044938608030 | ||
| ml_desc_mean_tanhp_nl_1_1_npy 0.043643966443 | ||
| ml_desc_mean_tanhq_npy 0.028985866312 | ||
| ml_desc_mean_tanhq_nl_1_1_5_npy 0.054446092813 | ||
| ml_desc_mean_tanhq_nl_1_1_npy 0.060077197039 | ||
| ml_desc_mean_tanhxi_1_1_5_npy 0.065230231297 | ||
| ml_desc_mean_tanhxi_1_1_npy 0.086762840891 | ||
| ml_desc_mean_tanhxi_nl_1_1_5_npy 0.113754807936 | ||
| ml_desc_mean_tanhxi_nl_1_1_npy 0.163063987051 | ||
| ml_desc_mean_veff_npy 0.431187756019 | ||
| ml_desc_mean_xi_1_1_5_npy 0.083625451851 | ||
| ml_desc_mean_xi_1_1_npy 0.090202449809 | ||
| pointgroupref O_h | ||
| spacegroupref O_h | ||
| nksibzref 256 | ||
| totaltimeref 1.46 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #!/usr/bin/env python3 | ||
| import argparse | ||
| import os | ||
| import re | ||
| import sys | ||
|
|
||
| import numpy as np | ||
|
|
||
|
|
||
| def sanitize_name(name): | ||
| return re.sub(r"[^A-Za-z0-9_]", "_", name) | ||
|
|
||
|
|
||
| def main(): | ||
| parser = argparse.ArgumentParser() | ||
| parser.add_argument("descriptor_dir") | ||
| args = parser.parse_args() | ||
|
|
||
| descriptor_dir = args.descriptor_dir | ||
| if not os.path.isdir(descriptor_dir): | ||
| print(f"Descriptor dir not found: {descriptor_dir}", file=sys.stderr) | ||
| return 1 | ||
|
|
||
| files = sorted(f for f in os.listdir(descriptor_dir) if f.endswith(".npy")) | ||
| if not files: | ||
| print(f"No .npy files in: {descriptor_dir}", file=sys.stderr) | ||
| return 1 | ||
|
|
||
| for filename in files: | ||
| path = os.path.join(descriptor_dir, filename) | ||
| data = np.load(path, allow_pickle=False) | ||
| if data.size == 0: | ||
| mean_value = 0.0 | ||
| else: | ||
| mean_value = float(np.mean(np.abs(data))) | ||
| key = f"ml_desc_mean_{sanitize_name(filename)}" | ||
| print(f"{key} {mean_value:.12f}") | ||
|
|
||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| raise SystemExit(main()) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.