Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
7eaa2e7
MAINT: add back delete Pourbaix sampling files
xiaochendu Jul 10, 2024
a052ec1
MAINT: Update dev dependencies
xiaochendu Jul 10, 2024
7a4ead9
MAINT: update `sample_pourbaix_surface.py` to follow new `MCMC` initi…
xiaochendu Jul 10, 2024
c389c4b
Merge branch 'master' into pourbaix
xiaochendu Sep 10, 2024
cc912fb
ENH: preliminary support to add and remove atom groups
xiaochendu Sep 12, 2024
c5e2cce
ENH: implement multi-atom adsorbates
xiaochendu Sep 13, 2024
16f6da5
MAINT: `generate_pourbaix_atoms` take in Path to phase_diagram and po…
xiaochendu Sep 13, 2024
2c46b06
TST: update tests for multi-atom adsorbates
xiaochendu Sep 13, 2024
5cca256
MAINT: `SurfaceSystem` fix `fromdict`
xiaochendu Sep 15, 2024
74b4c84
MAINT: refactor out default-settings for sampling scripts
xiaochendu Sep 15, 2024
2889249
ENH: update `sample_pourbaix_surface.py` to follow new `sample_surfac…
xiaochendu Sep 15, 2024
f8c6761
MAINT: add back surface atoms to pourbaix sampling
xiaochendu Sep 17, 2024
243d16b
ENH: add `symmetrize_slab` helper
xiaochendu Sep 21, 2024
4a7152f
MAINT: save created PourbaixAtoms in config
xiaochendu Sep 25, 2024
b4dc12d
ENH: first attempt for symmetric slab sampling
xiaochendu Sep 25, 2024
2371302
MAINT: save relaxed structures
xiaochendu Sep 26, 2024
322ada6
MAINT: set fake surface tags for high-throughput DFT (htvs)
xiaochendu Sep 26, 2024
42310a8
MAINT: pH and phi in `setup_folders`
xiaochendu Sep 26, 2024
9367273
ENH: add surface OH group adjustments
xiaochendu Sep 30, 2024
9d23f08
MAINT: clustering convert SurfaceSystem to Atoms objects
xiaochendu Oct 1, 2024
59be406
ENH: add adsorbate corrections in `NFFPourbaix`
xiaochendu Oct 2, 2024
8e274e7
BLD: add mpcontribs-client to `pyproject.toml`
xiaochendu Oct 2, 2024
829e5a7
MAINT & BUG: Refactor get_start_ads function in mcmc/slab.py
xiaochendu Oct 3, 2024
13480ae
MAINT: update default matplotlib settings
xiaochendu Oct 9, 2024
7f28d7b
MAINT: add `--input_slab_name` option to prevent from keying slab sto…
xiaochendu Oct 9, 2024
51d7683
MAINT: Add Pt to SYMBOLS and DFT_U_VALUES in create_surface_formation…
xiaochendu Oct 18, 2024
7ad2ec5
MAINT: Add `SupercellSurfaceGenerator` from Hoje in mcmc/utils/slab.py
xiaochendu Oct 20, 2024
f6e5d2f
MAINT: Adjust SurfaceOHCompatibility to account for extra H from water
xiaochendu Oct 24, 2024
e1ad315
MAINT: add option for aqcompat
xiaochendu Oct 24, 2024
3580e4e
MAINT: Allow user to specify `sample_surface_atoms` in `sample_pourba…
xiaochendu Oct 27, 2024
735936f
MAINT: Refactor generate_pourbaix_atoms() to handle single and multi …
xiaochendu Oct 30, 2024
995ba1a
MAINT: Add support for inputting job ID as the slab name
xiaochendu Oct 30, 2024
f1d6d42
MAINT: Enhance Matplotlib settings with additional color configuratio…
xiaochendu Nov 3, 2024
1473420
MAINT: Add GMM clustering support and extend clustering metric options
xiaochendu Nov 6, 2024
3d68f6a
MAINT: Update histogram plotting and filtering to handle missing atom…
xiaochendu Nov 9, 2024
4cf98f0
MAINT: Add correction for H2O in formula calculations and update atom…
xiaochendu Nov 10, 2024
c6fa725
MAINT: Refactor code for improved readability by formatting argument …
xiaochendu Nov 10, 2024
7129fdf
MAINT: Update SurfaceOHCompatibility to include hydrogen bond correct…
xiaochendu Nov 14, 2024
7294fdf
MAINT: Add hydrogen bond energy correction and update argument parsin…
xiaochendu Nov 15, 2024
fc3b965
MAINT: Update filter_stoichiometries to extract relaxed_atoms from Su…
xiaochendu Nov 21, 2024
d00118c
MAINT: Enhance perturb_structures script with energy estimation and m…
xiaochendu Nov 21, 2024
00fe5e6
MAINT: Modify filter_stoichiometries to retain original structures wh…
xiaochendu Nov 22, 2024
e6f6f9c
MAINT: Enhance plotting functions with optional titles and colormap s…
xiaochendu Jan 15, 2025
18e9cfa
MAINT: Update perform_clustering to include colormap and title option…
xiaochendu Jan 15, 2025
2f551c0
MAINT: Refactor plotting functions for improved layout, customization…
xiaochendu Feb 3, 2025
677dbf2
MAINT: Update `create_surface_formation_entries` to handle relaxed at…
xiaochendu Mar 21, 2025
442e3a8
MAINT: Bump version to 0.3.0 and update pymatgen dependency to use fork
xiaochendu Mar 21, 2025
3c0c547
MAINT: Update NeuralForceField dependency to use vssr_pourbaix branch
xiaochendu Mar 21, 2025
2f5bf83
MAINT: add data for pourbaix sampling example
xiaochendu Apr 13, 2025
b3b5c8e
MAINT: update tutorials and tests
xiaochendu Apr 13, 2025
ad2ab54
MAINT: add uncertainty module
xiaochendu Apr 13, 2025
32ab93f
MAINT: add customized LAMMPS calculator adapted from ASE
xiaochendu Apr 13, 2025
35150f7
MAINT: prepare for 0.3.0 release
xiaochendu Apr 13, 2025
be327de
BUG: correct misformatting of import
xiaochendu Apr 13, 2025
b0564c3
Update tests.yml
xiaochendu Apr 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
conda env update --file environment.yml --name base
- name: Install pip dependencies
run: |
pip install "torch<2.6.0,>=2.1.0"
pip install -e '.[dev]'
- name: Append LAMMPS paths
run: |
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ['--maxkb=5000']
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.2
hooks:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Learning Matter @ MIT
Copyright (c) 2023-2025 Learning Matter @ MIT

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
53 changes: 45 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@
[![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)
[![arXiv](https://img.shields.io/badge/arXiv-2305.07251-blue?logo=arXiv&logoColor=white&logoSize=auto)](https://arxiv.org/abs/2305.07251)
[![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)
[![arXiv](https://img.shields.io/badge/arXiv-2503.17870-blue?logo=arXiv&logoColor=white&logoSize=auto)](https://arxiv.org/abs/2503.17870)
[![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)

## Contents
- [Overview](#overview)
- [System requirements](#system-requirements)
- [Setup](#setup)
- [Demo](#demo)
- [Scripts](#scripts)
- [Citation](#citation)
- [Citations](#citations)
- [Development & Bugs](#development--bugs)


# Overview
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).
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).

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

Expand Down Expand Up @@ -63,9 +65,9 @@ tutorials/
├── Si_111_5x5.ipynb
├── SrTiO3_001.ipynb
├── latent_space_clustering.ipynb
└── tutorials/prepare_surface.ipynb
└── prepare_surface.ipynb
```
More data/examples can be found in our [Zenodo dataset](https://doi.org/10.5281/zenodo.7758174).
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).

## Toy example of Cu(100)
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`.
Expand All @@ -91,10 +93,12 @@ Scripts can be found in the `scripts/` folder, including:
```
scripts/
├── sample_surface.py
└── clustering.py
├── sample_pourbaix_surface.py
├── clustering.py
└── create_surface_formation_entries.py
```

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

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

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

### Pre-trained CHGNet model on LaMnO3(001) under pH-$U_\mathrm{SHE}$ conditions
```bash
python scripts/sample_pourbaix_surface.py --run_name LaMnO3_001_chgnet \
--starting_structure_path "tutorials/data/LaMnO3_001/LaMnO3_001_2x2x3_top_pristine.pkl" --model_type CHGNetNFF \
--phase_diagram_path "tutorials/data/LaMnO3_001/pourbaix/LaMnO_pd_dict.json" \
--pourbaix_diagram_path "tutorials/data/LaMnO3_001/pourbaix/LaMnO_no_ternary_pbx_dict.json" \
--settings_path "scripts/configs/sample_pourbaix_config.json"
```

### Latent space clustering
```bash
python scripts/clustering.py --file_paths "tutorials/data/SrTiO3_001/SrTiO3_001_2x2_mcmc_structures_100.pkl" \
Expand All @@ -125,8 +138,18 @@ python scripts/clustering.py --file_paths "tutorials/data/SrTiO3_001/SrTiO3_001_
--clustering_cutoff 0.2 --nff_device "cuda"
```

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

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

2. VSSR-MC with aqueous electrochemical conditions:
```bib
@misc{duAcceleratingEnhancingThermodynamic2025,
title = {Accelerating and Enhancing Thermodynamic Simulations of Electrochemical Interfaces},
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},
year = {2025},
month = mar,
number = {arXiv:2503.17870},
publisher = {arXiv},
doi = {10.48550/arXiv.2503.17870},
keywords = {Computer Science - Computational Engineering Finance and Science,Computer Science - Machine Learning,Condensed Matter - Materials Science,Condensed Matter - Statistical Mechanics},
}
```

# Development & Bugs
VSSR-MC is under active development, if you encounter any bugs in installation and usage,
please open an [issue](https://github.com/learningmatter-mit/surface-sampling/issues). We appreciate your contributions!
1 change: 1 addition & 0 deletions mcmc/calculators/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .calculators import LAMMPSRunSurfCalc, LAMMPSSurfCalc, LAMMMPSCalc, EnsembleNFFSurface, NFFPourbaix, get_std_devs_single, get_std_devs,get_embeddings_single,get_embeddings,get_results_single
Loading