chem-sorption-widom
Goal
To determine the initial affinity of a porous material (e.g., MOFs, COFs) for a specific gas molecule at infinite dilution. This is done by computing the Henry coefficient ($K_H$) and the isosteric heat of adsorption ($\Delta H_{ads}$) using Widom insertion, calculating interaction energies with a generic Machine Learning Interatomic Potential (MLIP) such as MACE, FairChem, or MatGL.
Prerequisites
- Input: A relaxed framework structure in CIF (or XYZ) format. The structure should ideally be processed by chem-sorption-relax to ensure proper supercell dimensions.
- Conda environment: Depends on the MLIP used (e.g.,
fairchem-agent, mace-agent, matgl-agent).
Instructions
- Perform Widom Insertion: Use the
run_widom.py script, specifying the structure, gas, temperature, and your MLIP of choice.
# Env: fairchem-agent (if using fairchem), mace-agent (if using mace), etc.
python .agents/skills/chem-sorption-widom/scripts/run_widom.py \
--structure path/to/relaxed_supercell.cif \
--name MY_FRAMEWORK \
--calculator fairchem \
--model-name uma-s-1p2 \
--task-name omol \
--gas CO2 \
--temperature 298 \
--output-dir ./results
Parameters
--structure: Path to the relaxed host framework (must be large enough, see Constraints).
--name: Identifier for the output files.
--calculator: The backend MLIP (fairchem, mace, matgl).
--model-name: Name or path to the MLIP weights (e.g., uma-s-1p1.pt, MACE-MH-1).
--task-name: Optional, but highly recommended for multi-task models (e.g., omol for FairChem UMA and MACE-MH).
--gas: The adsorbate gas (e.g., CO2, N2, CH4).
--temperature: Temperature in Kelvin.
--num-insertions: Number of Monte Carlo insertion attempts (default: 50,000).
--output-dir: Directory to save the widom_results.json.
Examples
Example 1: Using FairChem UMA-S-1p2 for CO2 adsorption at 298K
# Env: fairchem-agent
python .agents/skills/chem-sorption-widom/scripts/run_widom.py \
--structure ./results/COF-1_supercell.cif \
--name COF-1 \
--calculator fairchem \
--model-name uma-s-1p2 \
--task-name omol \
--gas CO2 \
--temperature 298 \
--output-dir ./results
Constraints
- Cell Size: The periodic boundary conditions of the framework must be large enough ($> 12$ Å minimum interplanar distance) to prevent artificial self-interactions of the inserted gas molecules across boundaries. It is highly recommended to use chem-sorption-relax first.
- Statistical Noise: Increasing
--num-insertions (e.g., to 100,000) improves the convergence of $K_H$ and $\Delta H_{ads}$, at the cost of increased computation time.
- Model Compatibility: Ensure the selected MLIP and its corresponding
task-name are suitable for non-covalent interactions (e.g., omol for UMA, or dispersion-corrected MACE/MatGL models).
Author: Artur Lyssenko
Contact: GitHub @arturlyssenko12
1---2name: chem-sorption-widom3description: Calculates Henry coefficient and heat of adsorption for a gas in a porous framework using Widom insertion with any supported MLIP.4---56# chem-sorption-widom78## Goal910To determine the initial affinity of a porous material (e.g., MOFs, COFs) for a specific gas molecule at infinite dilution. This is done by computing the Henry coefficient ($K_H$) and the isosteric heat of adsorption ($\Delta H_{ads}$) using Widom insertion, calculating interaction energies with a generic Machine Learning Interatomic Potential (MLIP) such as MACE, FairChem, or MatGL.1112## Prerequisites1314- **Input**: A relaxed framework structure in CIF (or XYZ) format. The structure should ideally be processed by [chem-sorption-relax](../chem-sorption-relax/SKILL.md) to ensure proper supercell dimensions.15- **Conda environment**: Depends on the MLIP used (e.g., `fairchem-agent`, `mace-agent`, `matgl-agent`).1617## Instructions18191. **Perform Widom Insertion**: Use the `run_widom.py` script, specifying the structure, gas, temperature, and your MLIP of choice.2021```bash22# Env: fairchem-agent (if using fairchem), mace-agent (if using mace), etc.23python .agents/skills/chem-sorption-widom/scripts/run_widom.py \24 --structure path/to/relaxed_supercell.cif \25 --name MY_FRAMEWORK \26 --calculator fairchem \27 --model-name uma-s-1p2 \28 --task-name omol \29 --gas CO2 \30 --temperature 298 \31 --output-dir ./results32```3334### Parameters3536- `--structure`: Path to the relaxed host framework (must be large enough, see [Constraints](#constraints)).37- `--name`: Identifier for the output files.38- `--calculator`: The backend MLIP (`fairchem`, `mace`, `matgl`).39- `--model-name`: Name or path to the MLIP weights (e.g., `uma-s-1p1.pt`, `MACE-MH-1`).40- `--task-name`: Optional, but highly recommended for multi-task models (e.g., `omol` for FairChem UMA and MACE-MH).41- `--gas`: The adsorbate gas (e.g., `CO2`, `N2`, `CH4`).42- `--temperature`: Temperature in Kelvin.43- `--num-insertions`: Number of Monte Carlo insertion attempts (default: 50,000).44- `--output-dir`: Directory to save the `widom_results.json`.4546## Examples4748**Example 1: Using FairChem UMA-S-1p2 for CO2 adsorption at 298K**49```bash50# Env: fairchem-agent51python .agents/skills/chem-sorption-widom/scripts/run_widom.py \52 --structure ./results/COF-1_supercell.cif \53 --name COF-1 \54 --calculator fairchem \55 --model-name uma-s-1p2 \56 --task-name omol \57 --gas CO2 \58 --temperature 298 \59 --output-dir ./results60```6162636465## Constraints6667- **Cell Size**: The periodic boundary conditions of the framework must be large enough ($> 12$ Å minimum interplanar distance) to prevent artificial self-interactions of the inserted gas molecules across boundaries. It is highly recommended to use [chem-sorption-relax](../chem-sorption-relax/SKILL.md) first.68- **Statistical Noise**: Increasing `--num-insertions` (e.g., to 100,000) improves the convergence of $K_H$ and $\Delta H_{ads}$, at the cost of increased computation time.69- **Model Compatibility**: Ensure the selected MLIP and its corresponding `task-name` are suitable for non-covalent interactions (e.g., `omol` for UMA, or dispersion-corrected MACE/MatGL models).7071---7273**Author:** Artur Lyssenko74**Contact:** [GitHub @arturlyssenko12](https://github.com/arturlyssenko12)