Skip to content
JieCoaPublic

About

[npj Computational Materials] The implementation for the paper "Physics-informed graph neural network representation learning for crystal property prediction"

Topics

Resources

Stars

7 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

27 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

[ English ] [ δΈ­ζ–‡ ]

  • News - Oct 30th

    1. We have refactored the inference interface to support multiple CIF files or a JSON file containing multiple crystal structures.
    2. Inference commands have been simplified while retaining support for legacy inference commands.
  • News - July 9th

    We have added the complete code and usage instructions for the Atomic Descriptor module. This module is a data preparation process independent of model training. Researchers can customize the node representations used to initialize GNNs based on the diverse atomic physical properties provided by mendeleev, similar to the atom_features(116d)_update01.json I provided.

    Note: Different physical property data are obtained through different methods. For details, please refer to the mendeleev documentation. The sample code I provided only involves the retrieval of some properties.

Physics-informed graph neural network representation learning for crystal property prediction

License: MIT DOI HuggingFace

πŸ“ƒ Paper

AtomNet Architecture

Pipeline

Environment Configuration

Use the environment.yml file in the repository to automatically install the environment:

# Create a Conda environment
conda env create -f environment.yml

# Activate the environment
conda activate 'atomnet'

Manual installation of all environment packages

This is a record of the author's previous manual configuration on the server. Since it was done some time ago, some library installations might be missing. If you encounter missing libraries, please install them manually.

conda create -n atomnet python=3.11

conda install pytorch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 pytorch-cuda=12.1 -c nvidia -c pytorch
# If the CUDA package corruption/metadata error described in the Chinese README occurs,
# use its alternative command to pin cuda-version to 12.1:
# conda install pytorch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 pytorch-cuda=12.1 cuda-version=12.1 -c pytorch -c nvidia -c conda-forge

# Install torch_geometric dependencies
pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-2.1.2+cu121.html
pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-2.1.2+cu121.html
pip install torch-cluster -f https://pytorch-geometric.com/whl/torch-2.1.2+cu121.html
pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-2.1.2+cu121.html

# Install torch_geometric
pip install torch-geometric

# Install jarvis package
pip install jarvis-tools

# Install remaining packages according to the code requirements
pip install roma
pip install pandas
pip install pytorch_lightning
pip install yacs
pip install wandb
pip install mendeleev==0.14.0
pip install captum


# Put this last: Incompatible with numpy 2.X+, switch back to 1.23.X+ but below 1.26.0
pip install numpy==1.26.0

⭐Datasets

Most of original datasets are automatically downloaded and processed by the code (πŸ“‚loader β†’ loader.py), except for the bulk and shear modulus that are publicly available at Figshare. The bulk modulus and shear modulus datasets need to be manually downloaded and stored in the dataset/megnet/ path. (Remember to change the file path to your own data storage path).

We also provide pre-processed datasets so you can directly train or infer your model. (In fact, the data preprocessing process only takes a few minutes.)

❗ Place the preprocessed datasets in the dataset/jarvis/preprocessed/ directory.

⭐Pre-trained models

For the five tasks in the Jarvis dataset, we provide corresponding pre-trained models for inference.

❗ Unzip the compressed file and place the πŸ“‚results folder in the project root directory.

  • In other words, place the pre-trained models in the results/ directory.

Parameter Description

We designed a large number of command arguments in main.py, and we provide relevant descriptions for each parameter. We explain some important parameters in detail to help users better reproduce our experiments. For parameters not mentioned, we recommend keeping the default values. The inference parameters below include the additions from Oct 30th.

  • atom_init: Filename of the atom descriptors used to initialize node representations (suffix .json is auto-completed; all atom descriptor files are stored in πŸ“‚dataset β†’ πŸ“‚json).

  • name: Name of the current wandb experiment, which will be synchronized to the corresponding wandb_project to generate training records.

  • electronegativity_type: Use different RBF kernel functions for Sanderson electronegativity edge features.

    electronegativity_type = newRBF, newRBF02, newRBF03, newRBF04, newRBF05
  • envelope_type: We provide Cubic Smooth and Simply weight functions proposed in the main paper and supplementary files, i.e., cubic and simply.

  • disableUpdateEdge: Limit or stop the update of edge features during the message passing process.

  • limitedUpdateEdge: Run edge feature updates (residual connection) in the first limitedUpdateEdge + 1 AtomNet Layers. Used in conjunction with disableUpdateEdge. Value range [0, 3], corresponding to AtomNet Layer count (default: 4).

    • In the Jarvis DFT 3D 2021 BandGap(MBJ) task, we found that when setting limitedUpdateEdge==3 (if AtomNet_layer is 4 layers), the model's MAE metric is better. Alternatively, simply remove --disableUpdateEdge and --limitedUpdateEdge from the training script.
  • usePolynomial: Default value 3. In our experiments, besides using RBF (Radial Basis Function) for feature derivation on interatomic distances, we also applied classic polynomial feature derivation methods from Feature Engineering to extend "distance" features. Although not mentioned in the paper, experimental results proved the effectiveness of this method. (We recommend users to keep using the --usePolynomial 3 parameter in all tasks to reproduce the paper results).

  • useElectronegativity: Use Sanderson electronegativity as a new edge feature.

  • normalizedElectronegativity: Used with useElectronegativity to normalize the electronegativity edge features.

    • When using this parameter, the electronegativity_type parameter value is automatically ignored (i.e., no dimension expansion on electronegativity edge features).
  • inference: Run predictions with a pre-trained model. For the nine supported dataset/target pairs, main.py selects the built-in inference preset and checkpoint path. Legacy full commands are still accepted; see the inference examples below for the configuration behavior.

  • inference_data_path: Inference input: a JSON file, a single CIF file, or a directory containing CIF files. When a directory contains both CIF and JSON files, the CIF files take precedence. Without CIF files, a directory must contain exactly one JSON file.

  • inference_results_path: Output JSON file path, defaulting to dataset/inference/inference_results.json. This parameter specifies the output file, not the input directory.

  • cif_primitive: Convert CIF structures to primitive cells before graph construction when using the pymatgen parser. The JARVIS fallback does not apply this conversion.

  • ig: Conduct interpretability experiments based on a pre-trained model and output visualization results.

    • Similar to the inference process, add the --ig parameter to the script used to get the pre-trained model, or use our provided example code and pre-trained models to achieve interpretability analysis results for atom descriptor features.
  • max_neighbours: Experiments verified that while limiting the number of neighbors for the central atom can reduce model parameters and training time to some extent, the prediction results relying solely on the cutoff radius are superior in terms of final MAE metrics compared to models using both cutoff radius and maximum neighbor limits.

Must Modify ❗

We highly recommend using wandb to monitor model training. It's an excellent visualization website.

parser.add_argument("--wandb_project", type=str, default="your_project_name", help="Wandb project name")
parser.add_argument("--wandb_entity", type=str, default="wandb_username", help="Name of the wandb entity")

Since the author used wandb for full process recording during model training, every user needs to change wandb_project and wandb_entity in main.py to their own project name and wandb username created on the wandb website before running the code, and configure the wandb API key in the running environment.

Key Settings (2 Ways)

  1. Write in code. e.g. train.py

    import wandb 
    
    wandb.login(key=YOUR_API_KEY)
  2. πŸ‘ Set in Command Line (Suitable for temporary use, used by the author).

    export WANDB_API_KEY=YOUR_API_KEY

Upload Training Records to wandb (Only for offline mode, execute after training ends)

Due to server access restrictions, we use offline mode during model training. Records need to be uploaded manually after training is complete.

# wandb offline mode (use this if unable to connect to wandb server)
run = wandb.init(entity=cfg.wandb_entity, project=cfg.wandb_project, name=cfg.name, config=cfg, mode="offline")

# wandb online mode (remove 'mode="offline"')
run = wandb.init(entity=cfg.wandb_entity, project=cfg.wandb_project, name=cfg.name, config=cfg)

Upload commands:

  1. Open terminal and activate the virtual environment (wandb package must be installed).
  2. Enter the wandb log storage path (πŸ“‚wandb folder in the project).
  3. Execute wandb sync "experiment_record_folder_name" to upload records. (Ensure you can access the wandb website before uploading, otherwise it will time out).
  4. If uploaded successfully, a xxx.synced file will be generated in the directory of "experiment_record_folder_name".

πŸ†• Atomic Descriptor

We have experimented with 5 sets of Atomic Descriptor composed of different combinations of atomic physical properties, and through repeated testing, we have proven the optimal performance of Feature of 'Version 4' (AtomNet's atomic descriptor module): atom_features(116d)_update01. However, we believe that there are still undiscovered combinations of physical properties that could exhibit superior performance compared to the atom_features(116d)_update01.json we have provided.

It should be noted that in def get_data_by_features(), we provide three different list parameters: atom_properties=[], atom_methods=[], public_features=[]. Different lists correspond to different ways of obtaining parameter data. Please refer to https://mendeleev.readthedocs.io/en/stable/data.html and fill in the corresponding lists with the respective target physical properties.

πŸš€ Training

To reproduce the experiments in the paper, we provide optimal model training configuration code for each task (Paper results are the average of 8 results, obtained by training with 10 different seed parameters and removing one maximum and one minimum value).

Jarvis DFT 3D 2021

We provide two methods for executing scripts for model training and inference:

  1. Execute the script in the command-line terminal (example script shown below);

  2. Execute /scripts/linux_train_atomnet.py on Linux.

Linux

For ( and ) symbols, \ is needed for escaping; this is the only difference from Windows commands.

1. formation energy
python main.py --seed 206 --name dft_3D_formation_energy --dataset jarvis --figshare_target formation_energy_peratom --threads 10 --workers 5 --epochs 300 --atom_init atom_features\(116d\)_update01 --useElectronegativity --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type simply --electronegativity_type newRBF
2. bandgap(OPT)
python main.py --seed 448 --name dft_3D_opt_bandgap --dataset jarvis --figshare_target optb88vdw_bandgap --threads 10 --workers 5 --epochs 300 --atom_init atom_features\(116d\)_update01 --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type cubic
3. bandgap(MBJ)
python main.py --seed 296 --name dft_3D_mbj_bandgap --dataset jarvis --figshare_target mbj_bandgap --epochs 300 --atom_init atom_features\(116d\)_update01 --envelope_type simply
4. ehull
python main.py --seed 510 --name dft_3D_ehull --dataset jarvis --figshare_target ehull --threads 10 --workers 5 --epochs 300 --atom_init atom_features\(116d\)_update01 --useElectronegativity --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type cubic --electronegativity_type newRBF04
5. total energy
python main.py --seed 306 --name dft_3D_total_energy --dataset jarvis --figshare_target optb88vdw_total_energy --threads 10 --workers 5 --epochs 300 --atom_init atom_features\(116d\)_update01 --useElectronegativity --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type cubic --electronegativity_type newRBF

Windows

1. formation energy
python main.py --seed 206 --name dft_3D_formation_energy --dataset jarvis --figshare_target formation_energy_peratom --threads 10 --workers 5 --epochs 300 --atom_init atom_features(116d)_update01 --useElectronegativity --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type simply --electronegativity_type newRBF
2. bandgap(OPT)
python main.py --seed 448 --name dft_3D_opt_bandgap --dataset jarvis --figshare_target optb88vdw_bandgap --threads 10 --workers 5 --epochs 300 --atom_init atom_features(116d)_update01 --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type cubic
3. bandgap(MBJ)
python main.py --seed 296 --name dft_3D_mbj_bandgap --dataset jarvis --figshare_target mbj_bandgap --epochs 300 --atom_init atom_features(116d)_update01 --envelope_type simply
4. ehull
python main.py --seed 510 --name dft_3D_ehull --dataset jarvis --figshare_target ehull --threads 10 --workers 5 --epochs 300 --atom_init atom_features(116d)_update01 --useElectronegativity --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type cubic --electronegativity_type newRBF04
5. total energy
python main.py --seed 306 --name dft_3D_total_energy --dataset jarvis --figshare_target optb88vdw_total_energy --threads 10 --workers 5 --epochs 300 --atom_init atom_features(116d)_update01 --useElectronegativity --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type cubic --electronegativity_type newRBF

Materials Project

Here we uniformly provide the basic script suitable for Linux. If you want to change to Windows, simply remove the \ in the --atom_init part.

1. e_form
python main.py --seed 235 --name megnet_formation_energy --dataset megnet --figshare_target e_form --threads 10 --workers 5 --epochs 300 --atom_init atom_features\(116d\)_update01 --useElectronegativity --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type simply
2. bandgap
python main.py --seed 331 --name megnet_bandgap --dataset megnet --threads 10 --workers 5 --epochs 300 --atom_init atom_features\(116d\)_update01 --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type cubic
3. bulk modulus
python main.py --seed 536 --name megnet_bulk_modulus --dataset megnet --figshare_target 'bulk modulus' --epochs 300 --atom_init atom_features\(116d\)_update01 --useElectronegativity --normalizedElectronegativity --batch 64 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type simply
4. shear modulus
python main.py --seed 440 --name megnet_shear_modulus --dataset megnet --figshare_target 'shear modulus' --epochs 300 --atom_init atom_features\(116d\)_update01 --useElectronegativity --batch 64 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type cubic --electronegativity_type newRBF02

Inference

Data

Ideally, inference structures should be distinct from the training data. Inputs can be JSON structures matching inference_data.json, CIF files downloaded from databases such as Materials Project, or a directory of CIF files.

All inputs are normalized to the jarvis.core.atoms.Atoms dictionary format before being passed to Figshare_Dataset. For JSON, props can be empty; it is not used to construct model features.

inference_data.json

The recommended top-level format is an ID-to-structure dictionary. Its keys become the id values in the prediction results. The legacy list format, [{"atoms": {...}}, ...], is also supported.

{
  "mp-19306": {"atoms": {
        "lattice_mat": [
            [
                1.6374061181864787,
                4.6320620294223085,
                2.836071848582606
            ],
            [
                -0.0003656271176311,
                -0.0002587898763079,
                5.6727763751083975
            ],
            [
                4.9133178857659425,
                8.84592966e-08,
                -2.836705415419651
            ]
        ],
        "coords": [
            [
                3.2751799999999998,
                2.3159,
                2.8360700000000003
            ],
            [
                0.81852,
                2.3159,
                4.254425
            ],
            [
                2.45666,
                0.0,
                -1.418355
            ],
            [
                3.275365,
                2.31603,
                -0.000320000000000098
            ],
            [
                0.8187019541225831,
                0.5789094103158883,
                1.4180396205680705
            ],
            [
                5.731658045877419,
                4.052890589684114,
                4.254100379431928
            ],
            [
                2.564110246226763,
                3.4359435249916004,
                1.4178436178370966
            ],
            [
                2.456217182400851,
                3.3596525149154344,
                4.254296382471964
            ],
            [
                1.6914174084098796,
                1.1960121133920303,
                2.929622058350195
            ],
            [
                4.094142817599149,
                1.2721474850845667,
                1.417843617528035
            ],
            [
                1.691196226115134,
                1.1958564755409065,
                5.579347730486713
            ],
            [
                4.858942591590121,
                3.435787886607971,
                2.7425179416498056
            ],
            [
                3.986249753773237,
                1.195856475008399,
                4.254296382162902
            ],
            [
                4.859163773884865,
                3.4359435244590935,
                0.09279226951328705
            ]
        ],
        "elements": [
            "Fe",
            "Fe",
            "Fe",
            "Fe",
            "Fe",
            "Fe",
            "O",
            "O",
            "O",
            "O",
            "O",
            "O",
            "O",
            "O"
        ],
        "cartesian": true,
        "props": [
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            ""
        ]
    }}
}

Inference directly from CIF

--inference_data_path accepts the following inputs:

Input Description Result id
*.json An ID-to-structure dictionary such as {"mp-19306": {"atoms": {...}}, ...}, or a legacy structure list Dictionary key; for a list, the entry's id / reference / jid / mp_id, falling back to file_stem#index (zero-based)
*.cif A single CIF file Filename without the extension
Directory All CIF files directly inside the directory, sorted by filename; if there are no CIF files, exactly one JSON file is accepted CIF filename without the extension, or the JSON IDs
# Single CIF; retain the original model configuration when supplying a full command
python main.py --seed 206 --name dft_3D_formation_energy --dataset jarvis --figshare_target formation_energy_peratom --threads 10 --workers 5 --epochs 300 --atom_init "atom_features(116d)_update01" --useElectronegativity --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type simply --electronegativity_type newRBF --inference --inference_data_path dataset/inference/cifs/mp-19306_Fe3O4.cif

# Batch inference from a directory using the task preset
python main.py --dataset jarvis --figshare_target formation_energy_peratom --inference --inference_data_path dataset/inference/cifs

# Convert the CIF to a primitive cell before inference
python main.py --dataset jarvis --figshare_target formation_energy_peratom --inference --inference_data_path dataset/inference/cifs/mp-19306_Fe3O4.cif --cif_primitive
  • CIF parsing first uses pymatgen (Structure.from_file, including symmetry expansion). If pymatgen is unavailable or parsing fails, it falls back to jarvis.core.atoms.Atoms.from_cif.
  • The pymatgen conversion uses fractional coordinates and a lattice matrix of row vectors (cartesian: false), matching the JARVIS coordinate convention. It also supplies abc, angles, and props.
  • For sites with multiple species, the pymatgen conversion selects the species with the highest occupancy and logs a warning. This is a simplified representation of disorder.
  • A conventional Fe3O4 cell can contain 56 atoms. --cif_primitive can reduce it to a 14-atom primitive cell, closer to the representation used in JARVIS and with lower graph-construction cost. This option takes effect on the pymatgen path; the JARVIS fallback does not perform primitive-cell conversion.
  • Structures producing no edges are skipped, with the skipped count logged. Their predictions are omitted while IDs remain aligned for the surviving structures.

Output format

Results default to dataset/inference/inference_results.json; use --inference_results_path to choose another output JSON file. Predictions are a flat list with sample IDs, rather than arrays grouped by batch:

[
  {"id": "mp-19306", "prediction": -0.123456},
  {"id": "mp-19306_frac", "prediction": -0.234567}
]

Predictions are rounded to six decimal places. Each result identifies its input through the JSON dictionary key or CIF filename, so a separate positional mapping is unnecessary. The sample values above illustrate the format.

python main.py --dataset jarvis --figshare_target formation_energy_peratom --inference --inference_data_path dataset/inference/cifs --inference_results_path dataset/inference/formation_predictions.json

Example script

The commands below cover the nine dataset/target pairs supported by the built-in presets. Place the corresponding best.ckpt files under results/ in the code execution directory (AtomNet/). A preset selects seed, batch size, experiment name, descriptor, envelope type, and electronegativity settings, and uses its fixed checkpoint path. It overrides those fields even when supplied in a legacy command. Other settings, including edge-update flags, are not restored by the preset; keep them consistent with the checkpoint when reproducing a full training configuration. For a custom checkpoint on one of these tasks, adjust the preset/checkpoint selection in main.py.

  • Legacy commands remain accepted. Unless --inference_data_path is provided, they now read the default JSON input, rather than the test split.

Jarvis DFT 3D 2021

1. formation energy
# Legacy inference command
# python main.py --seed 206 --name dft_3D_formation_energy --dataset jarvis --figshare_target formation_energy_peratom --threads 10 --workers 5 --epochs 300 --atom_init atom_features\(116d\)_update01 --useElectronegativity --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type simply --electronegativity_type newRBF --inference
python main.py --dataset jarvis --figshare_target formation_energy_peratom --inference --inference_data_path dataset/inference/cifs
2. bandgap(OPT)
# Legacy inference command
# python main.py --seed 448 --name dft_3D_opt_bandgap --dataset jarvis --figshare_target optb88vdw_bandgap --threads 10 --workers 5 --epochs 300 --atom_init atom_features\(116d\)_update01 --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type cubic --inference
python main.py --dataset jarvis --figshare_target optb88vdw_bandgap --inference --inference_data_path dataset/inference/cifs
3. bandgap(MBJ)
# Legacy inference command
# python main.py --seed 296 --name dft_3D_mbj_bandgap --dataset jarvis --figshare_target mbj_bandgap --epochs 300 --atom_init atom_features\(116d\)_update01 --envelope_type simply --inference
python main.py --dataset jarvis --figshare_target mbj_bandgap --inference --inference_data_path dataset/inference/cifs
4. ehull
# Legacy inference command
# python main.py --seed 510 --name dft_3D_ehull --dataset jarvis --figshare_target ehull --threads 10 --workers 5 --epochs 300 --atom_init atom_features\(116d\)_update01 --useElectronegativity --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type cubic --electronegativity_type newRBF04 --inference
python main.py --dataset jarvis --figshare_target ehull --inference --inference_data_path dataset/inference/cifs
5. total energy
# Legacy inference command
# python main.py --seed 306 --name dft_3D_total_energy --dataset jarvis --figshare_target optb88vdw_total_energy --threads 10 --workers 5 --epochs 300 --atom_init atom_features\(116d\)_update01 --useElectronegativity --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type cubic --electronegativity_type newRBF --inference
python main.py --dataset jarvis --figshare_target optb88vdw_total_energy --inference --inference_data_path dataset/inference/cifs

Materials Project

1. e_form
# Legacy inference command
# python main.py --seed 235 --name megnet_formation_energy --dataset megnet --figshare_target e_form --threads 10 --workers 5 --epochs 300 --atom_init atom_features\(116d\)_update01 --useElectronegativity --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type simply --max_neighbours -1 --inference
python main.py --dataset megnet --figshare_target e_form --inference --inference_data_path dataset/inference/cifs
2. bandgap
# Legacy inference command
# python main.py --seed 331 --name megnet_bandgap --dataset megnet --figshare_target 'gap pbe' --threads 10 --workers 5 --epochs 300 --atom_init atom_features\(116d\)_update01 --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type cubic --max_neighbours -1 --inference
python main.py --dataset megnet --figshare_target 'gap pbe' --inference --inference_data_path dataset/inference/cifs
3. bulk modulus
# Legacy inference command
# python main.py --seed 536 --name megnet_bulk_modulus --dataset megnet --figshare_target 'bulk modulus' --epochs 300 --atom_init atom_features\(116d\)_update01 --useElectronegativity --normalizedElectronegativity --batch 64 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type simply --inference
python main.py --dataset megnet --figshare_target 'bulk modulus' --inference --inference_data_path dataset/inference/cifs
4. shear modulus
# Legacy inference command
# python main.py --seed 440 --name megnet_shear_modulus --dataset megnet --figshare_target 'shear modulus' --epochs 300 --atom_init atom_features\(116d\)_update01 --useElectronegativity --batch 64 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type cubic --electronegativity_type newRBF02 --inference
python main.py --dataset megnet --figshare_target 'shear modulus' --inference --inference_data_path dataset/inference/cifs

πŸ“Š Interpretability Results Visualization

Interpretability experiments are based on pre-trained models. Here we uniformly provide the basic script suitable for Linux. If you want to change to Windows, simply remove the \ in the --atom_init part.

Taking total energy as an example

Step 1: Train the model (skip if using a pre-trained model)

python main.py --seed 306 --name dft_3D_total_energy --dataset jarvis --figshare_target optb88vdw_total_energy --threads 10 --workers 5 --epochs 300 --atom_init atom_features\(116d\)_update01 --useElectronegativity --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type cubic --electronegativity_type newRBF

Step 2: Conduct interpretability analysis experiment

Simply add an --ig parameter to the training script base.

python main.py --seed 306 --name dft_3D_total_energy --dataset jarvis --figshare_target optb88vdw_total_energy --threads 10 --workers 5 --epochs 300 --atom_init atom_features\(116d\)_update01 --useElectronegativity --batch 128 --disableUpdateEdge --limitedUpdateEdge 2 --envelope_type cubic --electronegativity_type newRBF --ig

Step 3: Result Visualization

(1) Importance of different physical properties in atom descriptors

ig_framework.py will visualize the importance of different atomic properties by plotting bar charts. You can find the saved images in the path πŸ“‚/dataset/ig/img/

Pipeline

(2) Stability analysis of IG values

The table data will be output to the console.

n1 n2 spearman kendall MRC
20 32 1.0 1.0 0.000186
20 64 1.0 1.0 0.000196
20 128 1.0 1.0 0.000196
32 64 1.0 1.0 0.000026
32 128 1.0 1.0 0.000026
64 128 1.0 1.0 0.000002

Model Efficiency

image-20260104085058662

Citation

Please cite our paper if you find the code helpful or if you want to use the benchmark results. Thank you!

@article{cao2026physics,
  title={Physics-informed graph neural network representation learning for crystal property prediction},
  author={Cao, Jie and Huang, Kai and Mao, Jian and Zhong, Mengya and Chen, Chen and Li, Kexun and Liu, Taikang},
  journal={npj Computational Materials},
  year={2026},
  publisher={Nature Publishing Group UK London}
}

Contact Us

If you have any questions or suggestions, please contact us at 202412854021@jmu.edu.cn (First Author) or kaihuang@jmu.edu.cn (Corresponding Author).

About

[npj Computational Materials] The implementation for the paper "Physics-informed graph neural network representation learning for crystal property prediction"

Topics

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages