Skip to content

Commit 625129e

Browse files
authored
Merge pull request #6 from learningmatter-mit/pourbaix
Pourbaix
2 parents 2b5f8a1 + b0564c3 commit 625129e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+11951
-6436
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
conda env update --file environment.yml --name base
2727
- name: Install pip dependencies
2828
run: |
29+
pip install "torch<2.6.0,>=2.1.0"
2930
pip install -e '.[dev]'
3031
- name: Append LAMMPS paths
3132
run: |

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ repos:
88
- id: end-of-file-fixer
99
- id: check-yaml
1010
- id: check-added-large-files
11+
args: ['--maxkb=5000']
1112
- repo: https://github.com/astral-sh/ruff-pre-commit
1213
rev: v0.3.2
1314
hooks:

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Learning Matter @ MIT
3+
Copyright (c) 2023-2025 Learning Matter @ MIT
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,21 @@
22
[![Tests](https://github.com/learningmatter-mit/surface-sampling/actions/workflows/tests.yml/badge.svg)](https://github.com/learningmatter-mit/surface-sampling/actions/workflows/tests.yml)
33
[![arXiv](https://img.shields.io/badge/arXiv-2305.07251-blue?logo=arXiv&logoColor=white&logoSize=auto)](https://arxiv.org/abs/2305.07251)
44
[![Zenodo](https://img.shields.io/badge/data-10.5281/zenodo.7758174-14b8a6?logo=zenodo&logoColor=white&logoSize=auto)](https://zenodo.org/doi/10.5281/zenodo.7758174)
5+
[![arXiv](https://img.shields.io/badge/arXiv-2503.17870-blue?logo=arXiv&logoColor=white&logoSize=auto)](https://arxiv.org/abs/2503.17870)
6+
[![Zenodo](https://img.shields.io/badge/data-10.5281/zenodo.15066441-14b8a6?logo=zenodo&logoColor=white&logoSize=auto)](https://zenodo.org/doi/10.5281/zenodo.15066441)
57

68
## Contents
79
- [Overview](#overview)
810
- [System requirements](#system-requirements)
911
- [Setup](#setup)
1012
- [Demo](#demo)
1113
- [Scripts](#scripts)
12-
- [Citation](#citation)
14+
- [Citations](#citations)
1315
- [Development & Bugs](#development--bugs)
1416

1517

1618
# Overview
17-
This is the VSSR-MC algorithm for sampling surface reconstructions. VSSR-MC samples across both compositional and configurational spaces. It can interface with both a neural network potential (through [ASE](https://wiki.fysik.dtu.dk/ase/)) or a classical potential (through ASE or [LAMMPS](https://www.lammps.org/)). It is a key component of the Automatic Surface Reconstruction (AutoSurfRecon) pipeline described in the following work: [Machine-learning-accelerated simulations to enable automatic surface reconstruction](https://doi.org/10.1038/s43588-023-00571-7).
19+
This is the VSSR-MC algorithm for sampling surface reconstructions. VSSR-MC samples across both compositional and configurational spaces. It can interface with both a neural network potential (through [ASE](https://wiki.fysik.dtu.dk/ase/)) or a classical potential (through ASE or [LAMMPS](https://www.lammps.org/)). It is a key component of the Automatic Surface Reconstruction (AutoSurfRecon) pipeline described in the following work: [Machine-learning-accelerated simulations to enable automatic surface reconstruction](https://doi.org/10.1038/s43588-023-00571-7). VSSR-MC can be used to sample either surfaces under gas/vacuum conditions as demonstrated in the [original work](https://doi.org/10.1038/s43588-023-00571-7) or under aqueous electrochemical conditions as described in this work: [Accelerating and enhancing thermodynamic simulations of electrochemical interfaces](https://doi.org/10.48550/arXiv.2503.17870).
1820

1921
![Cover image](site/static/vssr_cover_image.png)
2022

@@ -63,9 +65,9 @@ tutorials/
6365
├── Si_111_5x5.ipynb
6466
├── SrTiO3_001.ipynb
6567
├── latent_space_clustering.ipynb
66-
└── tutorials/prepare_surface.ipynb
68+
└── prepare_surface.ipynb
6769
```
68-
More data/examples can be found in our [Zenodo dataset](https://doi.org/10.5281/zenodo.7758174).
70+
More data/examples can be found in our Zenodo datasets: [1](https://doi.org/10.5281/zenodo.7758174) and [2](https://doi.org/10.5281/zenodo.15066440).
6971

7072
## Toy example of Cu(100)
7173
A toy example to illustrate the use of VSSR-MC. It should only take about a few seconds to run. Refer to `tutorials/example.ipynb`.
@@ -91,10 +93,12 @@ Scripts can be found in the `scripts/` folder, including:
9193
```
9294
scripts/
9395
├── sample_surface.py
94-
└── clustering.py
96+
├── sample_pourbaix_surface.py
97+
├── clustering.py
98+
└── create_surface_formation_entries.py
9599
```
96100

97-
The arguments for the scripts can be found by running `python scripts/sample_surface.py -h` or `python scripts/clustering.py -h`.
101+
The arguments for the scripts can be found by running `python /path/to/script.py -h`.
98102

99103
## Example usage:
100104
### Original VSSR-MC with PaiNN model trained on SrTiO3(001) surfaces
@@ -107,13 +111,22 @@ python scripts/sample_surface.py --run_name "SrTiO3_001_painn" \
107111
--settings_path "scripts/configs/sample_config_painn.json"
108112
```
109113

110-
### Pre-trained "foundational" CHGNet model on SrTiO3(001) surfaces
114+
### Pre-trained CHGNet model on SrTiO3(001) surfaces
111115
```bash
112116
python scripts/sample_surface.py --run_name "SrTiO3_001_chgnet" \
113117
--starting_structure_path "tutorials/data/SrTiO3_001/SrTiO3_001_2x2_pristine_slab.pkl" \
114118
--model_type "CHGNetNFF" --settings_path "scripts/configs/sample_config_chgnet.json"
115119
```
116120

121+
### Pre-trained CHGNet model on LaMnO3(001) under pH-$U_\mathrm{SHE}$ conditions
122+
```bash
123+
python scripts/sample_pourbaix_surface.py --run_name LaMnO3_001_chgnet \
124+
--starting_structure_path "tutorials/data/LaMnO3_001/LaMnO3_001_2x2x3_top_pristine.pkl" --model_type CHGNetNFF \
125+
--phase_diagram_path "tutorials/data/LaMnO3_001/pourbaix/LaMnO_pd_dict.json" \
126+
--pourbaix_diagram_path "tutorials/data/LaMnO3_001/pourbaix/LaMnO_no_ternary_pbx_dict.json" \
127+
--settings_path "scripts/configs/sample_pourbaix_config.json"
128+
```
129+
117130
### Latent space clustering
118131
```bash
119132
python scripts/clustering.py --file_paths "tutorials/data/SrTiO3_001/SrTiO3_001_2x2_mcmc_structures_100.pkl" \
@@ -125,8 +138,18 @@ python scripts/clustering.py --file_paths "tutorials/data/SrTiO3_001/SrTiO3_001_
125138
--clustering_cutoff 0.2 --nff_device "cuda"
126139
```
127140

141+
### Create surface surface formation entries for Pourbaix analysis
142+
```bash
143+
python scripts/create_surface_formation_entries.py --surface_name "LaMnO3_001_2x2" \
144+
--file_paths "tutorials/data/LaMnO3_001/20241120-003720_AtomsBatch_surface_48.pkl" --model_type "CHGNetNFF" \
145+
--model_paths "tutorials/data/LaMnO3_001/nff/finetuned/best_model" \
146+
--phase_diagram_path "tutorials/data/LaMnO3_001/pourbaix/LaMnO_pd_dict.json" \
147+
--pourbaix_diagram_path "tutorials/data/LaMnO3_001/pourbaix/LaMnO_no_ternary_pbx_dict.json" --correct_hydroxide_energy \
148+
--input_job_id --elements "La" "Mn" "O" --device "cuda" --save_folder "tutorials/data/LaMnO3_001/pourbaix/"
149+
```
128150

129-
# Citation
151+
# Citations
152+
1. Original VSSR-MC work:
130153
```bib
131154
@article{duMachinelearningacceleratedSimulationsEnable2023,
132155
title = {Machine-Learning-Accelerated Simulations to Enable Automatic Surface Reconstruction},
@@ -143,6 +166,20 @@ python scripts/clustering.py --file_paths "tutorials/data/SrTiO3_001/SrTiO3_001_
143166
}
144167
```
145168

169+
2. VSSR-MC with aqueous electrochemical conditions:
170+
```bib
171+
@misc{duAcceleratingEnhancingThermodynamic2025,
172+
title = {Accelerating and Enhancing Thermodynamic Simulations of Electrochemical Interfaces},
173+
author = {Du, Xiaochen and Liu, Mengren and Peng, Jiayu and Chun, Hoje and Hoffman, Alexander and Yildiz, Bilge and Li, Lin and Bazant, Martin Z. and {G{\'o}mez-Bombarelli}, Rafael},
174+
year = {2025},
175+
month = mar,
176+
number = {arXiv:2503.17870},
177+
publisher = {arXiv},
178+
doi = {10.48550/arXiv.2503.17870},
179+
keywords = {Computer Science - Computational Engineering Finance and Science,Computer Science - Machine Learning,Condensed Matter - Materials Science,Condensed Matter - Statistical Mechanics},
180+
}
181+
```
182+
146183
# Development & Bugs
147184
VSSR-MC is under active development, if you encounter any bugs in installation and usage,
148185
please open an [issue](https://github.com/learningmatter-mit/surface-sampling/issues). We appreciate your contributions!

mcmc/calculators/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .calculators import LAMMPSRunSurfCalc, LAMMPSSurfCalc, LAMMMPSCalc, EnsembleNFFSurface, NFFPourbaix, get_std_devs_single, get_std_devs,get_embeddings_single,get_embeddings,get_results_single

0 commit comments

Comments
 (0)