catbench 0.1.20__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- catbench-0.1.20/LICENSE +21 -0
- catbench-0.1.20/PKG-INFO +306 -0
- catbench-0.1.20/README.md +290 -0
- catbench-0.1.20/catbench/__init__.py +9 -0
- catbench-0.1.20/catbench/core.py +2116 -0
- catbench-0.1.20/catbench.egg-info/PKG-INFO +306 -0
- catbench-0.1.20/catbench.egg-info/SOURCES.txt +10 -0
- catbench-0.1.20/catbench.egg-info/dependency_links.txt +1 -0
- catbench-0.1.20/catbench.egg-info/requires.txt +3 -0
- catbench-0.1.20/catbench.egg-info/top_level.txt +1 -0
- catbench-0.1.20/setup.cfg +4 -0
- catbench-0.1.20/setup.py +26 -0
catbench-0.1.20/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Jinuk Moon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
catbench-0.1.20/PKG-INFO
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: catbench
|
|
3
|
+
Version: 0.1.20
|
|
4
|
+
Summary: CatBench: Benchmark of Graph Neural Networks for Adsorption Energy Predictions in Heterogeneous Catalysis
|
|
5
|
+
Home-page: https://github.com/JinukMoon/catbench
|
|
6
|
+
Author: JinukMoon
|
|
7
|
+
Author-email: jumoon@snu.ac.kr
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: GNN benchmarking for catalysis
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Requires-Python: >=3.8
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
|
|
17
|
+
# CatBench
|
|
18
|
+
CatBench: Benchmark Framework for Graph Neural Networks in Adsorption Energy Predictions
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install catbench
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Overview
|
|
27
|
+

|
|
28
|
+
CatBench is a comprehensive benchmarking framework designed to evaluate Graph Neural Networks (GNNs) for adsorption energy predictions. It provides tools for data processing, model evaluation, and result analysis.
|
|
29
|
+
|
|
30
|
+
## Usage Workflow
|
|
31
|
+
|
|
32
|
+
### 1. Data Processing
|
|
33
|
+
CatBench supports two types of data sources:
|
|
34
|
+
|
|
35
|
+
#### A. Direct from Catalysis-Hub
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
# Import the catbench package
|
|
39
|
+
import catbench
|
|
40
|
+
|
|
41
|
+
# Process data from Catalysis-Hub
|
|
42
|
+
catbench.cathub_preprocess("Catalysis-Hub_Dataset_tag")
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Example:**
|
|
46
|
+
```python
|
|
47
|
+
# Process specific dataset from Catalysis-Hub
|
|
48
|
+
# Using AraComputational2022 as an example
|
|
49
|
+
catbench.cathub_preprocess("AraComputational2022")
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
#### B. User Dataset
|
|
53
|
+
For custom datasets, prepare your data structure as follows:
|
|
54
|
+
|
|
55
|
+
The data structure should include:
|
|
56
|
+
- Gas references (`gas/`) containing VASP output files for gas phase molecules
|
|
57
|
+
- Surface structures (`surface1/`, `surface2/`, etc.) containing:
|
|
58
|
+
- Clean slab calculations (`slab/`)
|
|
59
|
+
- Adsorbate-surface systems (`H/`, `OH/`, etc.)
|
|
60
|
+
|
|
61
|
+
Note: Each directory must contain CONTCAR and OSZICAR files. Other VASP output files can be present as well - the `process_output` function will automatically clean up (delete) all files except CONTCAR and OSZICAR.
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
data/
|
|
65
|
+
├── gas/
|
|
66
|
+
│ ├── H2gas/
|
|
67
|
+
│ │ ├── CONTCAR
|
|
68
|
+
│ │ └── OSZICAR
|
|
69
|
+
│ └── H2Ogas/
|
|
70
|
+
│ ├── CONTCAR
|
|
71
|
+
│ └── OSZICAR
|
|
72
|
+
├── surface1/
|
|
73
|
+
│ ├── slab/
|
|
74
|
+
│ │ ├── CONTCAR
|
|
75
|
+
│ │ └── OSZICAR
|
|
76
|
+
│ ├── H/
|
|
77
|
+
│ │ ├── 1/
|
|
78
|
+
│ │ │ ├── CONTCAR
|
|
79
|
+
│ │ │ └── OSZICAR
|
|
80
|
+
│ │ └── 2/
|
|
81
|
+
│ │ ├── CONTCAR
|
|
82
|
+
│ │ └── OSZICAR
|
|
83
|
+
│ └── OH/
|
|
84
|
+
│ ├── 1/
|
|
85
|
+
│ │ ├── CONTCAR
|
|
86
|
+
│ │ └── OSZICAR
|
|
87
|
+
│ └── 2/
|
|
88
|
+
│ ├── CONTCAR
|
|
89
|
+
│ └── OSZICAR
|
|
90
|
+
└── surface2/
|
|
91
|
+
├── slab/
|
|
92
|
+
│ ├── CONTCAR
|
|
93
|
+
│ └── OSZICAR
|
|
94
|
+
├── H/
|
|
95
|
+
│ ├── 1/
|
|
96
|
+
│ │ ├── CONTCAR
|
|
97
|
+
│ │ └── OSZICAR
|
|
98
|
+
│ └── 2/
|
|
99
|
+
│ ├── CONTCAR
|
|
100
|
+
│ └── OSZICAR
|
|
101
|
+
└── OH/
|
|
102
|
+
├── 1/
|
|
103
|
+
│ ├── CONTCAR
|
|
104
|
+
│ └── OSZICAR
|
|
105
|
+
└── 2/
|
|
106
|
+
├── CONTCAR
|
|
107
|
+
└── OSZICAR
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Then process using:
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
import catbench
|
|
114
|
+
|
|
115
|
+
# Define coefficients for calculating adsorption energies
|
|
116
|
+
# For each adsorbate, specify coefficients based on the reaction equation:
|
|
117
|
+
# Example for H*:
|
|
118
|
+
# E_ads(H*) = E(H*) - E(slab) - 1/2 E(H2_gas)
|
|
119
|
+
# Example for OH*:
|
|
120
|
+
# E_ads(OH*) = E(OH*) - E(slab) + 1/2 E(H2_gas) - E(H2O_gas)
|
|
121
|
+
|
|
122
|
+
coeff_setting = {
|
|
123
|
+
"H": {
|
|
124
|
+
"slab": -1, # Coefficient for clean surface
|
|
125
|
+
"adslab": 1, # Coefficient for adsorbate-surface system
|
|
126
|
+
"H2gas": -1/2, # Coefficient for H2 gas reference
|
|
127
|
+
},
|
|
128
|
+
"OH": {
|
|
129
|
+
"slab": -1, # Coefficient for clean surface
|
|
130
|
+
"adslab": 1, # Coefficient for adsorbate-surface system
|
|
131
|
+
"H2gas": +1/2, # Coefficient for H2 gas reference
|
|
132
|
+
"H2Ogas": -1, # Coefficient for H2O gas reference
|
|
133
|
+
},
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
# This will clean up directories and keep only CONTCAR and OSZICAR files
|
|
137
|
+
catbench.process_output("data", coeff_setting)
|
|
138
|
+
catbench.userdata_preprocess("data")
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### 2. Execute Benchmark
|
|
142
|
+
|
|
143
|
+
#### A. General Benchmark
|
|
144
|
+
This is a general benchmark setup. The `range()` value determines the number of repetitions for reproducibility testing. If reproducibility testing is not needed, it can be set to 1.
|
|
145
|
+
|
|
146
|
+
Note: This benchmark is only compatible with GNN models that output total system energy. For example, OC20 GNN models that are trained to directly predict adsorption energies cannot be used with this framework.
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
import catbench
|
|
150
|
+
from your_calculator import Calculator
|
|
151
|
+
|
|
152
|
+
# Prepare calculator list
|
|
153
|
+
# range(5): Run 5 times for reproducibility testing
|
|
154
|
+
# range(1): Single run when reproducibility testing is not needed
|
|
155
|
+
calculators = [Calculator() for _ in range(5)]
|
|
156
|
+
|
|
157
|
+
config = {}
|
|
158
|
+
catbench.execute_benchmark(calculators, **config)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
After execution, the following files and directories will be created:
|
|
162
|
+
|
|
163
|
+
1. A `result` directory is created to store all calculation outputs.
|
|
164
|
+
2. Inside the `result` directory, subdirectories are created for each GNN.
|
|
165
|
+
3. Each GNN's subdirectory contains:
|
|
166
|
+
- `gases/`: Gas reference molecules for adsorption energy calculations
|
|
167
|
+
- `log/`: Slab and adslab calculation logs
|
|
168
|
+
- `traj/`: Slab and adslab trajectory files
|
|
169
|
+
- `{GNN_name}_gases.json`: Gas molecules energies
|
|
170
|
+
- `{GNN_name}_anomaly_detection.json`: Anomaly detection status for each adsorption data
|
|
171
|
+
- `{GNN_name}_result.json`: Raw data (energies, calculation times, anomaly detection, slab displacements, etc.)
|
|
172
|
+
|
|
173
|
+
#### B. OC20 GNN Benchmark
|
|
174
|
+
Since OC20 project GNN models are trained to predict adsorption energies directly rather than total energies, they are handled with a separate function.
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
import catbench
|
|
178
|
+
from your_calculator import Calculator
|
|
179
|
+
|
|
180
|
+
# Prepare calculator list
|
|
181
|
+
# range(5): Run 5 times for reproducibility testing
|
|
182
|
+
# range(1): Single run when reproducibility testing is not needed
|
|
183
|
+
calculators = [Calculator() for _ in range(5)]
|
|
184
|
+
|
|
185
|
+
config = {}
|
|
186
|
+
catbench.execute_benchmark_OC20(calculators, **config)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
The overall usage is similar to the general benchmark, but each GNN will only have the following subdirectories:
|
|
190
|
+
|
|
191
|
+
- `log/`: Slab and adslab calculation logs
|
|
192
|
+
- `traj/`: Slab and adslab trajectory files
|
|
193
|
+
- `{GNN_name}_anomaly_detection.json`: Anomaly detection status for each adsorption data
|
|
194
|
+
- `{GNN_name}_result.json`: Raw data (energies, calculation times, anomaly detection, slab displacements, etc.)
|
|
195
|
+
|
|
196
|
+
#### C. Single-point Calculation Benchmark
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
import catbench
|
|
200
|
+
from your_calculator import Calculator
|
|
201
|
+
|
|
202
|
+
calculator = Calculator()
|
|
203
|
+
|
|
204
|
+
config = {}
|
|
205
|
+
catbench.execute_benchmark_single(calculator, **config)
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### 3. Analysis
|
|
209
|
+
|
|
210
|
+
```python
|
|
211
|
+
import catbench
|
|
212
|
+
|
|
213
|
+
config = {}
|
|
214
|
+
catbench.analysis_GNNs(**config)
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
The analysis function processes the calculation data stored in the `result` directory and generates:
|
|
218
|
+
|
|
219
|
+
1. A `plot/` directory:
|
|
220
|
+
- Parity plots for each GNN model
|
|
221
|
+
- Combined parity plots for comparison
|
|
222
|
+
- Performance visualization plots
|
|
223
|
+
|
|
224
|
+
2. An Excel file `{dataset_name}_Benchmarking_Analysis.xlsx`:
|
|
225
|
+
- Comprehensive performance metrics for all GNN models
|
|
226
|
+
- Statistical analysis of predictions
|
|
227
|
+
- Model-specific details and parameters
|
|
228
|
+
|
|
229
|
+
#### Single-point Calculation Analysis
|
|
230
|
+
|
|
231
|
+
```python
|
|
232
|
+
import catbench
|
|
233
|
+
|
|
234
|
+
config = {}
|
|
235
|
+
catbench.analysis_GNNs_single(**config)
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Outputs
|
|
239
|
+
|
|
240
|
+
### 1. Adsorption Energy Parity Plot (mono_version & multi_version)
|
|
241
|
+
You can plot adsorption energy parity plots for each adsorbate across all GNNs, either simply or by adsorbate.
|
|
242
|
+
<p float="left">
|
|
243
|
+
<img src="assets/mono_plot.png" width="400" />
|
|
244
|
+
<img src="assets/multi_plot.png" width="400" />
|
|
245
|
+
</p>
|
|
246
|
+
|
|
247
|
+
### 2. Comprehensive Performance Table
|
|
248
|
+
View various metrics for all GNNs.
|
|
249
|
+

|
|
250
|
+
|
|
251
|
+
### 3. Anomaly Analysis
|
|
252
|
+
See how anomalies are detected for all GNNs.
|
|
253
|
+

|
|
254
|
+
|
|
255
|
+
### 4. Analysis by Adsorbate
|
|
256
|
+
Observe how each GNN predicts for each adsorbate.
|
|
257
|
+

|
|
258
|
+
|
|
259
|
+
## Configuration Options
|
|
260
|
+
|
|
261
|
+
### execute_benchmark / execute_benchmark_OC20
|
|
262
|
+
| Option | Description | Default |
|
|
263
|
+
|--------|-------------|---------|
|
|
264
|
+
| GNN_name | Name of your GNN | Required |
|
|
265
|
+
| benchmark | Name of benchmark dataset | Required |
|
|
266
|
+
| F_CRIT_RELAX | Force convergence criterion | 0.05 |
|
|
267
|
+
| N_CRIT_RELAX | Maximum number of steps | 999 |
|
|
268
|
+
| rate | Fix ratio for surface atoms (0: use original constraints, >0: fix atoms from bottom up to specified ratio) | 0.5 |
|
|
269
|
+
| disp_thrs_slab | Displacement threshold for slab | 1.0 |
|
|
270
|
+
| disp_thrs_ads | Displacement threshold for adsorbate | 1.5 |
|
|
271
|
+
| again_seed | Seed variation threshold | 0.2 |
|
|
272
|
+
| damping | Damping factor for optimization | 1.0 |
|
|
273
|
+
| gas_distance | Cell size for gas molecules | 10 |
|
|
274
|
+
| optimizer | Optimization algorithm | "LBFGS" |
|
|
275
|
+
|
|
276
|
+
### execute_benchmark_single
|
|
277
|
+
| Option | Description | Default |
|
|
278
|
+
|--------|-------------|---------|
|
|
279
|
+
| GNN_name | Name of your GNN | Required |
|
|
280
|
+
| benchmark | Name of benchmark dataset | Required |
|
|
281
|
+
| gas_distance | Cell size for gas molecules | 10 |
|
|
282
|
+
|
|
283
|
+
### analysis_GNNs
|
|
284
|
+
| Option | Description | Default |
|
|
285
|
+
|--------|-------------|---------|
|
|
286
|
+
| Benchmarking_name | Name for output files | Current directory name |
|
|
287
|
+
| calculating_path | Path to result directory | "./result" |
|
|
288
|
+
| GNN_list | List of GNNs to analyze | All GNNs in result directory |
|
|
289
|
+
| target_adsorbates | Target adsorbates to analyze | All adsorbates |
|
|
290
|
+
| specific_color | Color for plots | "black" |
|
|
291
|
+
| min | Axis minimum | Auto-calculated |
|
|
292
|
+
| max | Axis maximum | Auto-calculated |
|
|
293
|
+
| figsize | Figure size | (9, 8) |
|
|
294
|
+
| mark_size | Marker size | 100 |
|
|
295
|
+
| linewidths | Line width | 1.5 |
|
|
296
|
+
| dpi | Plot resolution | 300 |
|
|
297
|
+
| legend_off | Toggle legend | False |
|
|
298
|
+
| error_bar_display | Toggle error bars | False |
|
|
299
|
+
| font_setting | Font setting <br> (Eg: `["/Users/user/Library/Fonts/Helvetica.ttf", "sans-serif"]`) | False |
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
## License
|
|
303
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
304
|
+
|
|
305
|
+
## Citation
|
|
306
|
+
This work will be published soon.
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
# CatBench
|
|
2
|
+
CatBench: Benchmark Framework for Graph Neural Networks in Adsorption Energy Predictions
|
|
3
|
+
|
|
4
|
+
## Installation
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
pip install catbench
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+

|
|
12
|
+
CatBench is a comprehensive benchmarking framework designed to evaluate Graph Neural Networks (GNNs) for adsorption energy predictions. It provides tools for data processing, model evaluation, and result analysis.
|
|
13
|
+
|
|
14
|
+
## Usage Workflow
|
|
15
|
+
|
|
16
|
+
### 1. Data Processing
|
|
17
|
+
CatBench supports two types of data sources:
|
|
18
|
+
|
|
19
|
+
#### A. Direct from Catalysis-Hub
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
# Import the catbench package
|
|
23
|
+
import catbench
|
|
24
|
+
|
|
25
|
+
# Process data from Catalysis-Hub
|
|
26
|
+
catbench.cathub_preprocess("Catalysis-Hub_Dataset_tag")
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Example:**
|
|
30
|
+
```python
|
|
31
|
+
# Process specific dataset from Catalysis-Hub
|
|
32
|
+
# Using AraComputational2022 as an example
|
|
33
|
+
catbench.cathub_preprocess("AraComputational2022")
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
#### B. User Dataset
|
|
37
|
+
For custom datasets, prepare your data structure as follows:
|
|
38
|
+
|
|
39
|
+
The data structure should include:
|
|
40
|
+
- Gas references (`gas/`) containing VASP output files for gas phase molecules
|
|
41
|
+
- Surface structures (`surface1/`, `surface2/`, etc.) containing:
|
|
42
|
+
- Clean slab calculations (`slab/`)
|
|
43
|
+
- Adsorbate-surface systems (`H/`, `OH/`, etc.)
|
|
44
|
+
|
|
45
|
+
Note: Each directory must contain CONTCAR and OSZICAR files. Other VASP output files can be present as well - the `process_output` function will automatically clean up (delete) all files except CONTCAR and OSZICAR.
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
data/
|
|
49
|
+
├── gas/
|
|
50
|
+
│ ├── H2gas/
|
|
51
|
+
│ │ ├── CONTCAR
|
|
52
|
+
│ │ └── OSZICAR
|
|
53
|
+
│ └── H2Ogas/
|
|
54
|
+
│ ├── CONTCAR
|
|
55
|
+
│ └── OSZICAR
|
|
56
|
+
├── surface1/
|
|
57
|
+
│ ├── slab/
|
|
58
|
+
│ │ ├── CONTCAR
|
|
59
|
+
│ │ └── OSZICAR
|
|
60
|
+
│ ├── H/
|
|
61
|
+
│ │ ├── 1/
|
|
62
|
+
│ │ │ ├── CONTCAR
|
|
63
|
+
│ │ │ └── OSZICAR
|
|
64
|
+
│ │ └── 2/
|
|
65
|
+
│ │ ├── CONTCAR
|
|
66
|
+
│ │ └── OSZICAR
|
|
67
|
+
│ └── OH/
|
|
68
|
+
│ ├── 1/
|
|
69
|
+
│ │ ├── CONTCAR
|
|
70
|
+
│ │ └── OSZICAR
|
|
71
|
+
│ └── 2/
|
|
72
|
+
│ ├── CONTCAR
|
|
73
|
+
│ └── OSZICAR
|
|
74
|
+
└── surface2/
|
|
75
|
+
├── slab/
|
|
76
|
+
│ ├── CONTCAR
|
|
77
|
+
│ └── OSZICAR
|
|
78
|
+
├── H/
|
|
79
|
+
│ ├── 1/
|
|
80
|
+
│ │ ├── CONTCAR
|
|
81
|
+
│ │ └── OSZICAR
|
|
82
|
+
│ └── 2/
|
|
83
|
+
│ ├── CONTCAR
|
|
84
|
+
│ └── OSZICAR
|
|
85
|
+
└── OH/
|
|
86
|
+
├── 1/
|
|
87
|
+
│ ├── CONTCAR
|
|
88
|
+
│ └── OSZICAR
|
|
89
|
+
└── 2/
|
|
90
|
+
├── CONTCAR
|
|
91
|
+
└── OSZICAR
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Then process using:
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
import catbench
|
|
98
|
+
|
|
99
|
+
# Define coefficients for calculating adsorption energies
|
|
100
|
+
# For each adsorbate, specify coefficients based on the reaction equation:
|
|
101
|
+
# Example for H*:
|
|
102
|
+
# E_ads(H*) = E(H*) - E(slab) - 1/2 E(H2_gas)
|
|
103
|
+
# Example for OH*:
|
|
104
|
+
# E_ads(OH*) = E(OH*) - E(slab) + 1/2 E(H2_gas) - E(H2O_gas)
|
|
105
|
+
|
|
106
|
+
coeff_setting = {
|
|
107
|
+
"H": {
|
|
108
|
+
"slab": -1, # Coefficient for clean surface
|
|
109
|
+
"adslab": 1, # Coefficient for adsorbate-surface system
|
|
110
|
+
"H2gas": -1/2, # Coefficient for H2 gas reference
|
|
111
|
+
},
|
|
112
|
+
"OH": {
|
|
113
|
+
"slab": -1, # Coefficient for clean surface
|
|
114
|
+
"adslab": 1, # Coefficient for adsorbate-surface system
|
|
115
|
+
"H2gas": +1/2, # Coefficient for H2 gas reference
|
|
116
|
+
"H2Ogas": -1, # Coefficient for H2O gas reference
|
|
117
|
+
},
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
# This will clean up directories and keep only CONTCAR and OSZICAR files
|
|
121
|
+
catbench.process_output("data", coeff_setting)
|
|
122
|
+
catbench.userdata_preprocess("data")
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 2. Execute Benchmark
|
|
126
|
+
|
|
127
|
+
#### A. General Benchmark
|
|
128
|
+
This is a general benchmark setup. The `range()` value determines the number of repetitions for reproducibility testing. If reproducibility testing is not needed, it can be set to 1.
|
|
129
|
+
|
|
130
|
+
Note: This benchmark is only compatible with GNN models that output total system energy. For example, OC20 GNN models that are trained to directly predict adsorption energies cannot be used with this framework.
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
import catbench
|
|
134
|
+
from your_calculator import Calculator
|
|
135
|
+
|
|
136
|
+
# Prepare calculator list
|
|
137
|
+
# range(5): Run 5 times for reproducibility testing
|
|
138
|
+
# range(1): Single run when reproducibility testing is not needed
|
|
139
|
+
calculators = [Calculator() for _ in range(5)]
|
|
140
|
+
|
|
141
|
+
config = {}
|
|
142
|
+
catbench.execute_benchmark(calculators, **config)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
After execution, the following files and directories will be created:
|
|
146
|
+
|
|
147
|
+
1. A `result` directory is created to store all calculation outputs.
|
|
148
|
+
2. Inside the `result` directory, subdirectories are created for each GNN.
|
|
149
|
+
3. Each GNN's subdirectory contains:
|
|
150
|
+
- `gases/`: Gas reference molecules for adsorption energy calculations
|
|
151
|
+
- `log/`: Slab and adslab calculation logs
|
|
152
|
+
- `traj/`: Slab and adslab trajectory files
|
|
153
|
+
- `{GNN_name}_gases.json`: Gas molecules energies
|
|
154
|
+
- `{GNN_name}_anomaly_detection.json`: Anomaly detection status for each adsorption data
|
|
155
|
+
- `{GNN_name}_result.json`: Raw data (energies, calculation times, anomaly detection, slab displacements, etc.)
|
|
156
|
+
|
|
157
|
+
#### B. OC20 GNN Benchmark
|
|
158
|
+
Since OC20 project GNN models are trained to predict adsorption energies directly rather than total energies, they are handled with a separate function.
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
import catbench
|
|
162
|
+
from your_calculator import Calculator
|
|
163
|
+
|
|
164
|
+
# Prepare calculator list
|
|
165
|
+
# range(5): Run 5 times for reproducibility testing
|
|
166
|
+
# range(1): Single run when reproducibility testing is not needed
|
|
167
|
+
calculators = [Calculator() for _ in range(5)]
|
|
168
|
+
|
|
169
|
+
config = {}
|
|
170
|
+
catbench.execute_benchmark_OC20(calculators, **config)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
The overall usage is similar to the general benchmark, but each GNN will only have the following subdirectories:
|
|
174
|
+
|
|
175
|
+
- `log/`: Slab and adslab calculation logs
|
|
176
|
+
- `traj/`: Slab and adslab trajectory files
|
|
177
|
+
- `{GNN_name}_anomaly_detection.json`: Anomaly detection status for each adsorption data
|
|
178
|
+
- `{GNN_name}_result.json`: Raw data (energies, calculation times, anomaly detection, slab displacements, etc.)
|
|
179
|
+
|
|
180
|
+
#### C. Single-point Calculation Benchmark
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
import catbench
|
|
184
|
+
from your_calculator import Calculator
|
|
185
|
+
|
|
186
|
+
calculator = Calculator()
|
|
187
|
+
|
|
188
|
+
config = {}
|
|
189
|
+
catbench.execute_benchmark_single(calculator, **config)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### 3. Analysis
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
import catbench
|
|
196
|
+
|
|
197
|
+
config = {}
|
|
198
|
+
catbench.analysis_GNNs(**config)
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
The analysis function processes the calculation data stored in the `result` directory and generates:
|
|
202
|
+
|
|
203
|
+
1. A `plot/` directory:
|
|
204
|
+
- Parity plots for each GNN model
|
|
205
|
+
- Combined parity plots for comparison
|
|
206
|
+
- Performance visualization plots
|
|
207
|
+
|
|
208
|
+
2. An Excel file `{dataset_name}_Benchmarking_Analysis.xlsx`:
|
|
209
|
+
- Comprehensive performance metrics for all GNN models
|
|
210
|
+
- Statistical analysis of predictions
|
|
211
|
+
- Model-specific details and parameters
|
|
212
|
+
|
|
213
|
+
#### Single-point Calculation Analysis
|
|
214
|
+
|
|
215
|
+
```python
|
|
216
|
+
import catbench
|
|
217
|
+
|
|
218
|
+
config = {}
|
|
219
|
+
catbench.analysis_GNNs_single(**config)
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Outputs
|
|
223
|
+
|
|
224
|
+
### 1. Adsorption Energy Parity Plot (mono_version & multi_version)
|
|
225
|
+
You can plot adsorption energy parity plots for each adsorbate across all GNNs, either simply or by adsorbate.
|
|
226
|
+
<p float="left">
|
|
227
|
+
<img src="assets/mono_plot.png" width="400" />
|
|
228
|
+
<img src="assets/multi_plot.png" width="400" />
|
|
229
|
+
</p>
|
|
230
|
+
|
|
231
|
+
### 2. Comprehensive Performance Table
|
|
232
|
+
View various metrics for all GNNs.
|
|
233
|
+

|
|
234
|
+
|
|
235
|
+
### 3. Anomaly Analysis
|
|
236
|
+
See how anomalies are detected for all GNNs.
|
|
237
|
+

|
|
238
|
+
|
|
239
|
+
### 4. Analysis by Adsorbate
|
|
240
|
+
Observe how each GNN predicts for each adsorbate.
|
|
241
|
+

|
|
242
|
+
|
|
243
|
+
## Configuration Options
|
|
244
|
+
|
|
245
|
+
### execute_benchmark / execute_benchmark_OC20
|
|
246
|
+
| Option | Description | Default |
|
|
247
|
+
|--------|-------------|---------|
|
|
248
|
+
| GNN_name | Name of your GNN | Required |
|
|
249
|
+
| benchmark | Name of benchmark dataset | Required |
|
|
250
|
+
| F_CRIT_RELAX | Force convergence criterion | 0.05 |
|
|
251
|
+
| N_CRIT_RELAX | Maximum number of steps | 999 |
|
|
252
|
+
| rate | Fix ratio for surface atoms (0: use original constraints, >0: fix atoms from bottom up to specified ratio) | 0.5 |
|
|
253
|
+
| disp_thrs_slab | Displacement threshold for slab | 1.0 |
|
|
254
|
+
| disp_thrs_ads | Displacement threshold for adsorbate | 1.5 |
|
|
255
|
+
| again_seed | Seed variation threshold | 0.2 |
|
|
256
|
+
| damping | Damping factor for optimization | 1.0 |
|
|
257
|
+
| gas_distance | Cell size for gas molecules | 10 |
|
|
258
|
+
| optimizer | Optimization algorithm | "LBFGS" |
|
|
259
|
+
|
|
260
|
+
### execute_benchmark_single
|
|
261
|
+
| Option | Description | Default |
|
|
262
|
+
|--------|-------------|---------|
|
|
263
|
+
| GNN_name | Name of your GNN | Required |
|
|
264
|
+
| benchmark | Name of benchmark dataset | Required |
|
|
265
|
+
| gas_distance | Cell size for gas molecules | 10 |
|
|
266
|
+
|
|
267
|
+
### analysis_GNNs
|
|
268
|
+
| Option | Description | Default |
|
|
269
|
+
|--------|-------------|---------|
|
|
270
|
+
| Benchmarking_name | Name for output files | Current directory name |
|
|
271
|
+
| calculating_path | Path to result directory | "./result" |
|
|
272
|
+
| GNN_list | List of GNNs to analyze | All GNNs in result directory |
|
|
273
|
+
| target_adsorbates | Target adsorbates to analyze | All adsorbates |
|
|
274
|
+
| specific_color | Color for plots | "black" |
|
|
275
|
+
| min | Axis minimum | Auto-calculated |
|
|
276
|
+
| max | Axis maximum | Auto-calculated |
|
|
277
|
+
| figsize | Figure size | (9, 8) |
|
|
278
|
+
| mark_size | Marker size | 100 |
|
|
279
|
+
| linewidths | Line width | 1.5 |
|
|
280
|
+
| dpi | Plot resolution | 300 |
|
|
281
|
+
| legend_off | Toggle legend | False |
|
|
282
|
+
| error_bar_display | Toggle error bars | False |
|
|
283
|
+
| font_setting | Font setting <br> (Eg: `["/Users/user/Library/Fonts/Helvetica.ttf", "sans-serif"]`) | False |
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
## License
|
|
287
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
288
|
+
|
|
289
|
+
## Citation
|
|
290
|
+
This work will be published soon.
|