← 开源
txie-93

cgcnn

Crystal graph convolutional neural networks for predicting material properties.

Model DevelopmentArchitectureDomain-specific trainingPython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
896
Star
356
Fork
+2
本周
2
贡献者
创建于 2018-03-14 · 更新于 2026-10-13 · 今日第 12828 名
主要开发者
txie-93TanyaAdams1

txie-93/cgcnn 排名第 12,828,有 896 个星标。

同类别比较

txie-93/cgcnn 排名第 12,828,此处有 8 个同类条目;Visual-Attention-Network/SegNeXt 排名第 12,830。

同类别比较
名称排名指标
bytedance/fedlearner12,796
语言:
Python
星标数:
899
分叉数:
174
简介:
A multi-party collaborative machine learning framework
megvii-research/mdistiller12,798
语言:
Python
星标数:
899
分叉数:
130
简介:
The official implementation of [CVPR2022] Decoupled Knowledge Distillation https://arxiv.org/abs/2203.08679 and [ICCV2023] DOT: A Distillation-Oriented Trainer https://openaccess.thecvf.com/content/ICCV2023/papers/Zhao_DOT_A_Distillation-Oriented_Trainer_ICCV_2023_paper.pdf
davheld/GOTURN12,803
语言:
C++
星标数:
898
分叉数:
312
简介:
Source code for paper: Learning to Track at 100 FPS with Deep Regression Networks, Held, et al. ECCV 2016
HuguesTHOMAS/KPConv-PyTorch12,809
语言:
Python
星标数:
897
分叉数:
176
简介:
Kernel Point Convolution implemented in PyTorch
Visual-Attention-Network/SegNeXt12,830
语言:
Python
星标数:
895
分叉数:
91
简介:
Official Pytorch implementations for "SegNeXt: Rethinking Convolutional Attention Design for Semantic Segmentation" (NeurIPS 2022)
facebookresearch/ShapeR12,840
语言:
Python
星标数:
894
分叉数:
66
简介:
Code for the ShapeR research paper
nickgillian/grt12,843
语言:
C++
星标数:
894
分叉数:
285
简介:
gesture recognition toolkit
probtorch/probtorch12,852
语言:
Python
星标数:
893
分叉数:
67
简介:
Probabilistic Torch is library for deep generative models that extends PyTorch
关键参数与规格
关键参数与规格
参数值
语言Python
类别Model Development
子类别Architecture,Domain-specific training
星标数896
分叉数356
贡献者2
创建日期2018-03-14
更新日期2026-10-13
1 天星标数0
7 天星标数2
排名12,828
上次排名12,727
排名变化-101
7 天星标排名8,392
上次 7 天星标排名8,468
7 天星标排名变化76
总星标排名12,141
上次总星标排名12,119
总星标排名变化-22
国家UK
README 摘录

Crystal Graph Convolutional Neural Networks This software package implements the Crystal Graph Convolutional Neural Networks (CGCNN) that takes an arbitary crystal structure to predict material properties. The package provides two major functions: Train a CGCNN model with a customized dataset. Predict material properties of new crystals with a pre-trained CGCNN model. The following paper describes the details of the CGCNN framework: Crystal Graph Convolutional Neural Networks for an Accurate and Interpretable Prediction of Material Properties Table of Contents How

to cite Prerequisites Usage Define a customized dataset Train a CGCNN model Predict material properties with a pre-trained CGCNN model Data Authors License How to cite Please cite the following work if you want to use CGCNN. Prerequisites This package requires: PyTorch scikit-learn pymatgen If you are new to Python, the easiest way of installing the prerequisites is via conda. After installing conda, run the following command to create a new environment named and install all prerequisites: *Note

: this code is tested for PyTorch v1. 0+ and is not compatible with versions below v0. This creates a conda environment for running CGCNN. Before using CGCNN, activate the environment by: Then, in directory , you can test if all the prerequisites are installed properly by running: This should display the help messages for and . If you find no error messages, it means that the prerequisites are installed properly. After you finished using CGCNN, exit the environment by: Usage Define a

customized dataset To input crystal structures to CGCNN, you will need to define a customized dataset. Note that this is required for both training and predicting. Before defining a customized dataset, you will need: CIF files recording the structure of the crystals that you are interested in The target properties for each crystal (not needed for predicting, but you need to put some random numbers in ) You can create a customized dataset by creating a directory with the following files

: 1. The first column recodes a unique for each crystal, and the second column recodes the value of target property. If you want to predict material properties with , you can put any number in the second column. : a JSON file that stores the initialization vector for each element. An example of is , which should be good for most applications. : a CIF file that recodes the crystal structure, where is the unique for the crystal. The structure of the should be

: There are two examples of customized datasets in the repository: for regression and for classification. **For advanced PyTorch users** The above method of creating a customized dataset uses the class in . If you want a more flexible way to input crystal structures, PyTorch has a great Tutorial for writing your own dataset class. Train a CGCNN model Before training a new CGCNN model, you will need to: Define a customized dataset at to store the structure-property relations of interest

. Then, in directory , you can train a CGCNN model for your customized dataset by: You can set the number of

常见问题

记录了多少星标和分叉?

txie-93/cgcnn 有 896 个星标和 356 个分叉。

仓库排名是多少?

txie-93/cgcnn 排名第 12,828。

记录的语言和类别是什么?

txie-93/cgcnn 有 896 个星标,语言为 Python,类别为 Model Development。

哪个仓库排名最接近?

txie-93/cgcnn 与 Visual-Attention-Network/SegNeXt 比较,后者排名第 12,830,有 895 个星标。

README

Crystal Graph Convolutional Neural Networks

This software package implements the Crystal Graph Convolutional Neural Networks (CGCNN) that takes an arbitary crystal structure to predict material properties.

The package provides two major functions:

  • Train a CGCNN model with a customized dataset.
  • Predict material properties of new crystals with a pre-trained CGCNN model.

The following paper describes the details of the CGCNN framework:

Crystal Graph Convolutional Neural Networks for an Accurate and Interpretable Prediction of Material Properties

Table of Contents

How to cite

Please cite the following work if you want to use CGCNN.

@article{PhysRevLett.120.145301,
  title = {Crystal Graph Convolutional Neural Networks for an Accurate and Interpretable Prediction of Material Properties},
  author = {Xie, Tian and Grossman, Jeffrey C.},
  journal = {Phys. Rev. Lett.},
  volume = {120},
  issue = {14},
  pages = {145301},
  numpages = {6},
  year = {2018},
  month = {Apr},
  publisher = {American Physical Society},
  doi = {10.1103/PhysRevLett.120.145301},
  url = {https://link.aps.org/doi/10.1103/PhysRevLett.120.145301}
}

Prerequisites

This package requires:

If you are new to Python, the easiest way of installing the prerequisites is via conda. After installing conda, run the following command to create a new environment named cgcnn and install all prerequisites:

conda upgrade conda
conda create -n cgcnn python=3 scikit-learn pytorch torchvision pymatgen -c pytorch -c conda-forge

*Note: this code is tested for PyTorch v1.0.0+ and is not compatible with versions below v0.4.0 due to some breaking changes.

This creates a conda environment for running CGCNN. Before using CGCNN, activate the environment by:

source activate cgcnn

Then, in directory cgcnn, you can test if all the prerequisites are installed properly by running:

python main.py -h
python predict.py -h

This should display the help messages for main.py and predict.py. If you find no error messages, it means that the prerequisites are installed properly.

After you finished using CGCNN, exit the environment by:

source deactivate

Usage

Define a customized dataset

To input crystal structures to CGCNN, you will need to define a customized dataset. Note that this is required for both training and predicting.

Before defining a customized dataset, you will need:

  • CIF files recording the structure of the crystals that you are interested in
  • The target properties for each crystal (not needed for predicting, but you need to put some random numbers in id_prop.csv)

You can create a customized dataset by creating a directory root_dir with the following files:

  1. id_prop.csv: a CSV file with two columns. The first column recodes a unique ID for each crystal, and the second column recodes the value of target property. If you want to predict material properties with predict.py, you can put any number in the second column. (The second column is still needed.)

  2. atom_init.json: a JSON file that stores the initialization vector for each element. An example of atom_init.json is data/sample-regression/atom_init.json, which should be good for most applications.

  3. ID.cif: a CIF file that recodes the crystal structure, where ID is the unique ID for the crystal.

The structure of the root_dir should be:

root_dir
├── id_prop.csv
├── atom_init.json
├── id0.cif
├── id1.cif
├── ...

There are two examples of customized datasets in the repository: data/sample-regression for regression and data/sample-classification for classification.

For advanced PyTorch users

The above method of creating a customized dataset uses the CIFData class in cgcnn.data. If you want a more flexible way to input crystal structures, PyTorch has a great Tutorial for writing your own dataset class.

Train a CGCNN model

Before training a new CGCNN model, you will need to:

Then, in directory cgcnn, you can train a CGCNN model for your customized dataset by:

python main.py root_dir

You can set the number of training, validation, and test data with labels --train-size, --val-size, and --test-size. Alternatively, you may use the flags --train-ratio, --val-ratio, --test-ratio instead. Note that the ratio flags cannot be used with the size flags simultaneously. For instance, data/sample-regression has 10 data points in total. You can train a model by:

python main.py --train-size 6 --val-size 2 --test-size 2 data/sample-regression

or alternatively

python main.py --train-ratio 0.6 --val-ratio 0.2 --test-ratio 0.2 data/sample-regression

You can also train a classification model with label --task classification. For instance, you can use data/sample-classification by:

python main.py --task classification --train-size 5 --val-size 2 --test-size 3 data/sample-classification

After training, you will get three files in cgcnn directory.

  • model_best.pth.tar: stores the CGCNN model with the best validation accuracy.
  • checkpoint.pth.tar: stores the CGCNN model at the last epoch.
  • test_results.csv: stores the ID, target value, and predicted value for each crystal in test set.

Predict material properties with a pre-trained CGCNN model

Before predicting the material properties, you will need to:

Then, in directory cgcnn, you can predict the properties of the crystals in root_dir:

python predict.py pre-trained.pth.tar root_dir

For instace, you can predict the formation energies of the crystals in data/sample-regression:

python predict.py pre-trained/formation-energy-per-atom.pth.tar data/sample-regression

And you can also predict if the crystals in data/sample-classification are metal (1) or semiconductors (0):

python predict.py pre-trained/semi-metal-classification.pth.tar data/sample-classification

Note that for classification, the predicted values in test_results.csv is a probability between 0 and 1 that the crystal can be classified as 1 (metal in the above example).

After predicting, you will get one file in cgcnn directory:

  • test_results.csv: stores the ID, target value, and predicted value for each crystal in test set. Here the target value is just any number that you set while defining the dataset in id_prop.csv, which is not important.

Data

To reproduce our paper, you can download the corresponding datasets following the instruction.

Authors

This software was primarily written by Tian Xie who was advised by Prof. Jeffrey Grossman.

License

CGCNN is released under the MIT License.

排名相邻
同类项目