前言
收录些与机器学习相关的数据库、结构搭建、结构搜索、描述符、计算框架、图神经网络、可视化等。
数据库
1
|
pip install jarvis-tools
|

结构搜索
描述符
神经网络
1
2
3
|
pip install -U "jax[cuda11]"
# or
pip install --upgrade "jax[cuda11_pip]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
|
1
|
pip install jax==0.4.13 jaxlib==0.4.13
|

安装GPU驱动
1
2
3
4
|
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\lib
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\libnvvp
|
1
2
3
|
cd C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\extras\demo_suite
deviceQuery.exe
bandwidthTest.exe
|
查看是否有Result = PASS
输出。
GPU监控
1
2
|
pip install gpustat
gpustat
|
安装TensorFlow、PyTorch、Keras
1
|
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
|
1
2
3
4
|
pip install tensorflow[and-cuda] # Linux
pip install tensorflow # Windows
# or
pip install tensorflow-gpu==2.10.1 # Windows Python <= 3.10, Anaconda3-2023.03-1*
|
测试TensorFlow、PyTorch、Keras
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# -*-coding:utf-8 -*-
import os
os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'
import tensorflow as tf
import torch
import jax
from jax.lib import xla_bridge
import keras
import warnings
warnings.filterwarnings("ignore")
os.chdir(os.path.split(os.path.realpath(__file__))[0])
print('copyright by misaraty (misaraty@163.com)\n' + 'last update: 2024-04-23\n')
print("------------")
# TensorFlow GPU test
print("TensorFlow:")
print("TensorFlow version:", tf.__version__)
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
print("------------")
# PyTorch GPU test
print("PyTorch:")
print("PyTorch version:", torch.__version__)
print("Is CUDA available: ", torch.cuda.is_available())
print("Num GPUs Available:", torch.cuda.device_count())
print("GPU Name:", torch.cuda.get_device_name(0) if torch.cuda.is_available() else "No GPU")
print("------------")
# # JAX GPU test
# print("JAX:")
# print("JAX version:", jax.__version__)
# print("JAX backend:", xla_bridge.get_backend().platform)
# print("------------")
# Keras GPU test (uses TensorFlow backend)
print("Keras:")
print("Keras version:", keras.__version__)
print("Keras GPU available:", "Yes" if tf.config.list_physical_devices('GPU') else "No")
print("------------")
|
问题
1
2
3
4
5
6
7
8
9
10
|
[root@master ~]# python
Python 3.11.7 (main, Dec 15 2023, 18:12:31) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
...
File "/opt/ohpc/pub/apps/anaconda3/lib/python3.11/site-packages/google/protobuf/descriptor.py", line 47, in <module>
from google.protobuf.pyext import _message
ImportError: /opt/ohpc/pub/compiler/gcc/8.3.0/lib64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /opt/ohpc/pub/apps/anaconda3/lib/python3.11/site-packages/google/protobuf/pyext/_message.cpython-311-x86_64-linux-gnu.so)
|
解决
1
2
3
4
5
|
cd /opt/ohpc/pub/apps/anaconda3/lib
strings libstdc++.so | grep GLIBCXX
# .bashrc
export LD_LIBRARY_PATH=/opt/ohpc/pub/apps/anaconda3/lib:$LD_LIBRARY_PATH
|
图神经网络
- MEGNet
Chen C, Ye W, Zuo Y, et al. Graph networks as a universal machine learning framework for molecules and crystals[J]. Chemistry of Materials, 2019, 31(9): 3564-3572. 被引843
1
|
pip install megnet --no-deps
|
-
CGCNN | Tutorial Park C W, Wolverton C. Developing an improved crystal graph convolutional neural network framework for accelerated materials discovery[J]. Physical Review Materials, 2020, 4(6): 063801. 被引228
AugLiChem: CGCNN k-fold cross validation
MatDGL
CGCNN2
-
ALIGNN Choudhary K, DeCost B. Atomistic line graph neural network for improved materials property predictions[J]. npj Computational Materials, 2021, 7(1): 185. 被引165
-
M3GNet Chen C, Ong S P. A universal graph deep learning interatomic potential for the periodic table[J]. Nature Computational Science, 2022, 2(11): 718-728. 被引136
MatGL
1
|
pip install matgl --no-deps
|
-
DeeperGATGNN Louis S Y, Zhao Y, Nasiri A, et al. Graph convolutional neural networks with global attention for improved materials property prediction[J]. Physical Chemistry Chemical Physics, 2020, 22(32): 18141-18148. 被引130
-
OGCNN Karamad M, Magar R, Shi Y, et al. Orbital graph convolutional neural network for material property prediction[J]. Physical Review Materials, 2020, 4(9): 093801. 被引94
-
CHGNet Deng B, Zhong P, Jun K J, et al. CHGNet as a pretrained universal neural network potential for charge-informed atomistic modelling[J]. Nature Machine Intelligence, 2023, 5(9): 1031-1041. 被引29
-
KGCNN Reiser P, Eberhard A, Friederich P. Graph neural networks in TensorFlow-Keras with RaggedTensor representation (kgcnn)[J]. Software Impacts, 2021, 9: 100095. 被引14
-
SkipAtom Antunes L M, Grau-Crespo R, Butler K T. Distributed representations of atoms and materials for machine learning[J]. npj Computational Materials, 2022, 8(1): 44. 被引11
-
CEGANN Banik S, Dhabal D, Chan H, et al. CEGANN: Crystal Edge Graph Attention Neural Network for multiscale classification of materials environment[J]. npj Computational Materials, 2023, 9(1): 23. 被引10
-
ChargE3Net Koker T, Quigley K, Taw E, et al. Higher-order equivariant neural networks for charge density prediction in materials[J]. npj Computational Materials, 2024, 10(1): 161. 被引1
-
Matformer
1
2
3
|
git clone https://github.com/YKQ98/Matformer.git
cd Matformer
python setup.py install
|
1
|
pip install torch-geometric
|
1
2
3
4
5
|
# Linux:
pip install dgl==1.1.2 -f https://data.dgl.ai/wheels/cu117/repo.html
# Windows:
pip install dgl==1.1.2 -f https://data.dgl.ai/wheels/cu117/repo.html
|
1
|
pip install -e . --no-deps
|
问题
1
2
3
4
5
6
|
...\pyg_test\cogn_congn\train_scripts\train_scripts\jarvis_coGN\run.py", line 12, in <module>
from jarvis.core.atoms import Atoms
File "C:\Users\lenovo\anaconda3\lib\site-packages\jarvis\__init__.py", line 20
except OSError, e:
^^^^^^^^^^
SyntaxError: multiple exception types must be parenthesized
|
解决
方法一:
1
|
pip install jarvis-tools
|
方法二:
修改C:\Users\lenovo\anaconda3\lib\site-packages\jarvis\__init__.py
,
改为,
1
2
3
4
5
6
7
8
9
|
# install
pip install matminer
pip install numpy==1.23.5
pip install pandas==2.1.4
pip install modnet --no-deps
# test
from modnet.preprocessing import MODData
from modnet.models import MODNetModel
|
1
2
3
4
5
|
pip install protobuf==3.20.3
pip install chemprop # v1.6.1
import chemprop
# https://chemprop.readthedocs.io/en/v1.7.1/tutorial.html
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
pip install lightning==2.0.2 --no-deps
pip install fastapi
pip install optax
pip install numpy==1.23.5
pip install jax==0.4.13 jaxlib==0.4.13
pip install dm-haiku==0.0.9
pip install dgl==1.1.2 -f https://data.dgl.ai/wheels/repo.html
pip install pydantic==1.10.13
pip install optax==0.1.4 chex==0.1.7
pip install scipy==1.10.1
pip install websockets
pip install deepdiff
pip install deepchem #v2.8.0
import deepchem as dc
|

PyG与DGL对比
扩散模型
安装
环境:PyTorch version: 2.0.1+cu117
。
1
2
3
4
5
6
|
pip install hydra-core
pip install pytorch-lightning==2.0.1
pip install torch-geometric
pip install p-tqdm
pip install torch-scatter -f https://data.pyg.org/whl/torch-2.0.1+cu117.html
pip install wandb
|
问题
1
2
|
FutureWarning: with_local_env_strategy is deprecated, and will be removed on 2025-03-20
Use from_local_env_strategy in pymatgen.analysis.graphs instead.
|
解决
修改C:\software\cdvae-main\cdvae\common\data_utils.py
,
1
2
3
|
if graph_method == 'crystalnn':
crystal_graph = StructureGraph.from_local_env_strategy(
# crystal_graph = StructureGraph.with_local_env_strategy(
|
或修改C:\software\cdvae-main\cdvae\run.py
,
1
2
|
import warnings
warnings.filterwarnings("ignore", category=FutureWarning)
|
问题
1
2
3
|
File "c:\software\cdvae-main\cdvae\pl_modules\gnn.py", line 7, in <module>
from torch_geometric.nn.acts import swish
ModuleNotFoundError: No module named 'torch_geometric.nn.acts'
|
解决
修改C:\software\cdvae-main\cdvae\pl_modules\gnn.py
,
1
2
3
4
5
|
# from torch_geometric.nn.acts import swish
try:
from torch_geometric.nn.acts import swish
except ImportError:
from torch_geometric.nn.resolver import swish
|
LLM
时间序列

原子间势
-
MACE Batatia I, Kovacs D P, Simm G, et al. MACE: Higher order equivariant message passing neural networks for fast and accurate force fields[J]. Advances in neural information processing systems, 2022, 35: 11423-11436. 被引821
-
NequIP Batzner S, Musaelian A, Sun L, et al. E (3)-equivariant graph neural networks for data-efficient and accurate interatomic potentials[J]. Nature communications, 2022, 13(1): 2453. 被引637
BOTnet Batatia I, Batzner S, Kovács D P, et al. The design space of E (3)-equivariant atom-centred interatomic potentials[J]. Nature Machine Intelligence, 2025: 1-12. 被引117
Allegro Musaelian A, Batzner S, Johansson A, et al. Learning local equivariant representations for large-scale atomistic dynamics[J]. Nature Communications, 2023, 14(1): 579. 被引296
-
ChemicalMotifIdentifier Sheriff, K., Cao, Y. & Freitas, R. Chemical-motif characterization of short-range order with E(3)-equivariant graph neural networks. npj Comput Mater 10, 215 (2024).
-
SchNetPack Schütt K T, Kessel P, Gastegger M, et al. SchNetPack: A deep learning toolbox for atomistic systems[J]. Journal of chemical theory and computation, 2018, 15(1): 448-455. 被引354
-
equiformer
equiformer_v2
equiformer-pytorch
-
GPUMD
-
e3nn Geiger M, Smidt T. e3nn: Euclidean neural networks[J]. arXiv preprint arXiv:2207.09453, 2022. 被引202
可视化