Pre-trained ODAC models are versatile across various MOF-related tasks. To begin, we’ll start with a fundamental application: calculating the adsorption energy for a single CO2 molecule. This serves as an excellent and simple demonstration of what you can achieve with these datasets and models.
For predicting the adsorption energy of a single CO2 molecule within a MOF structure, the adsorption energy () is defined as:
Each term on the right-hand side represents the energy of the relaxed state of the indicated chemical system. For a comprehensive understanding of our methodology for computing these adsorption energies, please refer to our paper.
Loading Pre-trained Models¶
Need to install fairchem-core or get UMA access or getting permissions/401 errors?
Install the necessary packages using pip, uv etc
! pip install fairchem-core fairchem-data-oc fairchem-applications-cattsunamiGet access to any necessary huggingface gated models
Get and login to your Huggingface account
Request access to https://
huggingface .co /facebook /UMA Create a Huggingface token at https://
huggingface .co /settings /tokens/ with the permission “Permissions: Read access to contents of all public gated repos you can access” Add the token as an environment variable using
huggingface-cli loginor by setting the HF_TOKEN environment variable.
# Login using the huggingface-cli utility
! huggingface-cli login
# alternatively,
import os
os.environ['HF_TOKEN'] = 'MY_TOKEN'A pre-trained model can be loaded using FAIRChemCalculator. In this example, we’ll employ UMA to determine the CO2 adsorption energies.
from fairchem.core import FAIRChemCalculator, pretrained_mlip
predictor = pretrained_mlip.get_predict_unit("uma-s-1p2")
calc = FAIRChemCalculator(predictor, task_name="odac")WARNING:root:device was not explicitly set, using device='cuda'.
Adsorption in rigid MOFs: CO2 Adsorption Energy in Mg-MOF-74¶
Let’s apply our knowledge to Mg-MOF-74, a widely studied MOF known for its excellent CO2 adsorption properties. Its structure comprises magnesium atomic complexes connected by a carboxylated and oxidized benzene ring, serving as an organic linker. Previous studies consistently report the CO2 adsorption energy for Mg-MOF-74 to be around -0.40 eV [1] [2] [3].
Our goal is to verify if we can achieve a similar value by performing a simple single-point calculation using UMA. In the ODAC23 dataset, all MOF structures are identified by their CSD (Cambridge Structural Database) code. For Mg-MOF-74, this code is OPAGIX. We’ve extracted a specific OPAGIX+CO2 configuration from the dataset, which exhibits the lowest adsorption energy among its counterparts.
import matplotlib.pyplot as plt
from ase.io import read
from ase.visualize.plot import plot_atoms
mof_co2 = read("structures/OPAGIX_w_CO2.cif")
mof = read("structures/OPAGIX.cif")
co2 = read("structures/co2.xyz")
fig, ax = plt.subplots(figsize=(5, 4.5), dpi=250)
plot_atoms(mof_co2, ax)
ax.set_axis_off()
The final step in calculating the adsorption energy involves connecting the FAIRChemCalculator to each relaxed structure: OPAGIX+CO2, OPAGIX, and CO2. The structures used here are already relaxed from ODAC23. For simplicity, we assume here that further relaxations can be neglected. We will show how to go beyond this assumption in the next section.
mof_co2.calc = calc
mof.calc = calc
co2.calc = calc
E_ads = (
mof_co2.get_potential_energy()
- mof.get_potential_energy()
- co2.get_potential_energy()
)
print(f"Adsorption energy of CO2 in Mg-MOF-74: {E_ads:.3f} eV")WARNING:root:Model is being compiled this might take a while for the first time
W0820 00:02:59.776000 10290 site-packages/torch/_logging/_internal.py:1345] [0/0] Profiler record function <class 'torch.autograd.profiler.record_function'> will be ignored
WARNING:root:The UMA fast path (merge_mole + compile) is only available for fixed composition, task, charge, and spin. This is optimized for MD applications. Falling back to a less optimized version for subsequent evaluations. Reason: 'Compositions differ from merged model'.
Use inference_settings='batch' for heterogeneous batched evaluations.
Adsorption energy of CO2 in Mg-MOF-74: -0.473 eV
Adsorption in flexible MOFs¶
The adsorption energy calculation method outlined above is typically performed with rigid MOFs for simplicity. Both experimental and modeling literature have shown, however, that MOF flexibility can be important in accurately capturing the underlying chemistry of adsorption [1] [2] [3]. In particular, uptake can be improved by treating MOFs as flexible. Two types of MOF flexibility can be considered: intrinsic flexibility and deformation induced by guest molecules. In the Open DAC Project, we consider the latter MOF deformation by allowing the atomic positions of the MOF to relax during geometry optimization [4]. The addition of additional degrees of freedoms can complicate the computation of the adsorption energy and necessitates an extra step in the calculation procedure.
The figure below shows water adsorption in the MOF with CSD code WOBHEB with added defects (WOBHEB_0.11_0) from a DFT simulation. A typical adsorption energy calculation would only seek to capture the effects shaded in purple, which include both chemisorption and non-bonded interactions between the host and guest molecule. When allowing the MOF to relax, however, the adsorption energy also includes the energetic effect of the MOF deformation highlighted in green.

To account for this deformation, it is vital to use the most energetically favorable MOF geometry for the empty MOF term in Eqn. 1. Including MOF atomic coordinates as degrees of freedom can result in three possible outcomes:
The MOF does not deform, so the energies of the relaxed empty MOF and the MOF in the adsorbed state are the same
The MOF deforms to a less energetically favorable geometry than its ground state
The MOF locates a new energetically favorable geoemtry relative to the empty MOF relaxation
The first outcome requires no additional computation because the MOF rigidity assumption is valid. The second outcome represents physical and reversible deformation where the MOF returns to its empty ground state upon removal of the guest molecule. The third outcome is often the result of the guest molecule breaking local symmetry. We also found cases in ODAC in which both outcomes 2 and 3 occur within the same MOF.
To ensure the most energetically favorable empty MOF geometry is found, an addition empty MOF relaxation should be performed after MOF + adsorbate relaxation. The guest molecule should be removed, and the MOF should be relaxed starting from its geometry in the adsorbed state. If all deformation is reversible, the MOF will return to its original empty geometry. Otherwise, the lowest energy (most favorable) MOF geometry should be taken as the reference energy, , in Eqn. 1.
H2O Adsorption Energy in Flexible WOBHEB with UMA¶
The first part of this tutorial demonstrates how to perform a single point adsorption energy calculation using UMA. To treat MOFs as flexible, we perform all calculations on geometries determined by geometry optimization. The following example corresponds to the figure shown above (H2O adsorption in WOBHEB_0.11_0).
In this tutorial, corresponds to the energy of determined from geometry optimization of .
First, we obtain the energy of the empty MOF from relaxation of only the MOF:
import ase.io
from ase.optimize import BFGS
mof = ase.io.read("structures/WOBHEB_0.11.cif")
mof.calc = calc
relax = BFGS(mof)
relax.run(fmax=0.05)
E_mof_empty = mof.get_potential_energy()
print(f"Energy of empty MOF: {E_mof_empty:.3f} eV") Step Time Energy fmax
BFGS: 0 00:03:45 -1077.368916 0.129115
BFGS: 1 00:03:46 -1077.370391 0.075187
BFGS: 2 00:03:47 -1077.372342 0.145328
BFGS: 3 00:03:49 -1077.374553 0.111788
BFGS: 4 00:03:51 -1077.376093 0.074246
BFGS: 5 00:03:51 -1077.377454 0.063782
BFGS: 6 00:03:52 -1077.378942 0.080769
BFGS: 7 00:03:54 -1077.380756 0.096930
BFGS: 8 00:03:55 -1077.382639 0.078391
BFGS: 9 00:03:55 -1077.384447 0.086892
BFGS: 10 00:03:56 -1077.386286 0.083330
BFGS: 11 00:03:56 -1077.388393 0.084060
BFGS: 12 00:03:57 -1077.390739 0.069010
BFGS: 13 00:03:58 -1077.393129 0.076032
BFGS: 14 00:03:59 -1077.395558 0.084338
BFGS: 15 00:04:02 -1077.398142 0.079947
BFGS: 16 00:04:04 -1077.400824 0.080010
BFGS: 17 00:04:06 -1077.403369 0.067389
BFGS: 18 00:04:07 -1077.405676 0.070446
BFGS: 19 00:04:08 -1077.407932 0.087905
BFGS: 20 00:04:10 -1077.410399 0.083971
BFGS: 21 00:04:14 -1077.413127 0.059663
BFGS: 22 00:04:16 -1077.415977 0.071893
BFGS: 23 00:04:17 -1077.418823 0.067859
BFGS: 24 00:04:17 -1077.421563 0.070024
BFGS: 25 00:04:18 -1077.424153 0.067313
BFGS: 26 00:04:18 -1077.426519 0.060840
BFGS: 27 00:04:19 -1077.428605 0.069341
BFGS: 28 00:04:20 -1077.430415 0.060325
BFGS: 29 00:04:20 -1077.431998 0.051493
BFGS: 30 00:04:21 -1077.433390 0.056322
BFGS: 31 00:04:21 -1077.434619 0.057610
BFGS: 32 00:04:21 -1077.435741 0.046064
Energy of empty MOF: -1077.436 eV
Next, we add the H2O guest molecule and relax the MOF + adsorbate to obtain .
mof_h2o = ase.io.read("structures/WOBHEB_H2O.cif")
mof_h2o.calc = calc
relax = BFGS(mof_h2o)
relax.run(fmax=0.05)
E_combo = mof_h2o.get_potential_energy()
print(f"Energy of MOF + H2O: {E_combo:.3f} eV") Step Time Energy fmax
BFGS: 0 00:04:22 -1091.661287 1.120236
BFGS: 1 00:04:22 -1091.679631 0.313939
BFGS: 2 00:04:23 -1091.683945 0.232091
BFGS: 3 00:04:23 -1091.695507 0.302352
BFGS: 4 00:04:23 -1091.701043 0.210409
BFGS: 5 00:04:23 -1091.707223 0.171332
BFGS: 6 00:04:25 -1091.712984 0.183112
BFGS: 7 00:04:25 -1091.720515 0.262519
BFGS: 8 00:04:25 -1091.727863 0.202883
BFGS: 9 00:04:26 -1091.735395 0.175177
BFGS: 10 00:04:27 -1091.743446 0.214433
BFGS: 11 00:04:27 -1091.752662 0.253377
BFGS: 12 00:04:27 -1091.762640 0.232720
BFGS: 13 00:04:28 -1091.773123 0.197350
BFGS: 14 00:04:28 -1091.784460 0.164042
BFGS: 15 00:04:28 -1091.796075 0.252704
BFGS: 16 00:04:29 -1091.806471 0.270286
BFGS: 17 00:04:29 -1091.815243 0.186040
BFGS: 18 00:04:29 -1091.822971 0.130875
BFGS: 19 00:04:30 -1091.830282 0.119917
BFGS: 20 00:04:30 -1091.837502 0.139434
BFGS: 21 00:04:31 -1091.844739 0.154425
BFGS: 22 00:04:31 -1091.851981 0.162015
BFGS: 23 00:04:32 -1091.858858 0.162966
BFGS: 24 00:04:33 -1091.864376 0.153369
BFGS: 25 00:04:33 -1091.868605 0.438495
BFGS: 26 00:04:33 -1091.873920 0.215349
BFGS: 27 00:04:34 -1091.879874 0.106734
BFGS: 28 00:04:34 -1091.884368 0.089531
BFGS: 29 00:04:35 -1091.888732 0.153087
BFGS: 30 00:04:35 -1091.893242 0.141894
BFGS: 31 00:04:37 -1091.899397 0.193578
BFGS: 32 00:04:37 -1091.905126 0.218516
BFGS: 33 00:04:38 -1091.907894 0.482193
BFGS: 34 00:04:38 -1091.913676 0.152396
BFGS: 35 00:04:38 -1091.919298 0.111572
BFGS: 36 00:04:39 -1091.927040 0.130021
BFGS: 37 00:04:40 -1091.933394 0.359937
BFGS: 38 00:04:41 -1091.938579 0.228338
BFGS: 39 00:04:41 -1091.945699 0.346874
BFGS: 40 00:04:42 -1091.952103 0.196927
BFGS: 41 00:04:42 -1091.957162 0.518020
BFGS: 42 00:04:43 -1091.965439 0.268629
BFGS: 43 00:04:44 -1091.978068 0.252883
BFGS: 44 00:04:44 -1091.988008 0.227154
BFGS: 45 00:04:45 -1092.002246 0.423861
BFGS: 46 00:04:45 -1092.006645 0.838167
BFGS: 47 00:04:45 -1092.021696 0.662632
BFGS: 48 00:04:45 -1092.039744 0.350554
BFGS: 49 00:04:46 -1092.057138 0.248289
BFGS: 50 00:04:46 -1092.092312 0.486711
BFGS: 51 00:04:46 -1092.109359 0.283720
BFGS: 52 00:04:47 -1092.129635 0.333481
BFGS: 53 00:04:47 -1092.149414 0.870044
BFGS: 54 00:04:47 -1092.162541 0.391591
BFGS: 55 00:04:47 -1092.176792 0.274305
BFGS: 56 00:04:48 -1092.194778 0.212725
BFGS: 57 00:04:48 -1092.209865 0.267658
BFGS: 58 00:04:49 -1092.222048 0.366605
BFGS: 59 00:04:49 -1092.233828 0.458573
BFGS: 60 00:04:50 -1092.246121 0.425474
BFGS: 61 00:04:51 -1092.256131 0.301706
BFGS: 62 00:04:51 -1092.265067 0.131821
BFGS: 63 00:04:52 -1092.271473 0.116882
BFGS: 64 00:04:53 -1092.277562 0.117352
BFGS: 65 00:04:55 -1092.283314 0.117426
BFGS: 66 00:04:55 -1092.288657 0.137114
BFGS: 67 00:04:56 -1092.293465 0.158545
BFGS: 68 00:04:56 -1092.298016 0.123431
BFGS: 69 00:04:58 -1092.302298 0.138715
BFGS: 70 00:04:58 -1092.306297 0.150358
BFGS: 71 00:04:58 -1092.310193 0.178738
BFGS: 72 00:04:59 -1092.314416 0.195365
BFGS: 73 00:04:59 -1092.318869 0.163001
BFGS: 74 00:04:59 -1092.322875 0.090580
BFGS: 75 00:05:00 -1092.326255 0.075819
BFGS: 76 00:05:00 -1092.329425 0.110616
BFGS: 77 00:05:00 -1092.332404 0.099666
BFGS: 78 00:05:00 -1092.334776 0.050924
BFGS: 79 00:05:01 -1092.336473 0.052347
BFGS: 80 00:05:01 -1092.337817 0.085807
BFGS: 81 00:05:02 -1092.339132 0.068699
BFGS: 82 00:05:02 -1092.340498 0.070546
BFGS: 83 00:05:02 -1092.341872 0.078621
BFGS: 84 00:05:03 -1092.343222 0.106496
BFGS: 85 00:05:03 -1092.344587 0.095798
BFGS: 86 00:05:04 -1092.345961 0.070413
BFGS: 87 00:05:04 -1092.347266 0.041141
Energy of MOF + H2O: -1092.347 eV
We can now isolate the MOF atoms from the relaxed MOF + H2O geometry and see that the MOF has adopted a geometry that is less energetically favorable than the empty MOF by ~0.2 eV. The energy of the MOF in the adsorbed state corresponds to .
mof_adsorbed_state = mof_h2o[:-3]
mof_adsorbed_state.calc = calc
E_mof_adsorbed_state = mof_adsorbed_state.get_potential_energy()
print(f"Energy of MOF in the adsorbed state: {E_mof_adsorbed_state:.3f} eV")Energy of MOF in the adsorbed state: -1077.147 eV
H2O adsorption in this MOF appears to correspond to Case #2 as outlined above. We can now perform re-relaxation of the empty MOF starting from the geometry.
relax = BFGS(mof_adsorbed_state)
relax.run(fmax=0.05)
E_mof_rerelax = mof_adsorbed_state.get_potential_energy()
print(f"Energy of re-relaxed empty MOF: {E_mof_rerelax:.3f} eV") Step Time Energy fmax
BFGS: 0 00:05:04 -1077.146978 1.021033
BFGS: 1 00:05:06 -1077.188800 0.894810
BFGS: 2 00:05:07 -1077.240546 0.660935
BFGS: 3 00:05:08 -1077.288099 0.501487
BFGS: 4 00:05:08 -1077.306405 0.361481
BFGS: 5 00:05:08 -1077.323414 0.303570
BFGS: 6 00:05:08 -1077.337430 0.323740
BFGS: 7 00:05:09 -1077.350027 0.256704
BFGS: 8 00:05:10 -1077.357532 0.145863
BFGS: 9 00:05:10 -1077.362473 0.128691
BFGS: 10 00:05:10 -1077.367017 0.175297
BFGS: 11 00:05:11 -1077.371845 0.162323
BFGS: 12 00:05:11 -1077.376713 0.147254
BFGS: 13 00:05:12 -1077.381561 0.132026
BFGS: 14 00:05:12 -1077.386235 0.142650
BFGS: 15 00:05:12 -1077.390172 0.121294
BFGS: 16 00:05:14 -1077.393266 0.091308
BFGS: 17 00:05:14 -1077.395997 0.094728
BFGS: 18 00:05:15 -1077.398674 0.110119
BFGS: 19 00:05:15 -1077.401306 0.105755
BFGS: 20 00:05:16 -1077.403946 0.106415
BFGS: 21 00:05:17 -1077.406604 0.106877
BFGS: 22 00:05:17 -1077.409187 0.082751
BFGS: 23 00:05:17 -1077.411511 0.090659
BFGS: 24 00:05:19 -1077.413550 0.074326
BFGS: 25 00:05:19 -1077.415426 0.080510
BFGS: 26 00:05:20 -1077.417158 0.080477
BFGS: 27 00:05:20 -1077.418612 0.076045
BFGS: 28 00:05:21 -1077.419811 0.050857
BFGS: 29 00:05:22 -1077.420944 0.065518
BFGS: 30 00:05:22 -1077.422156 0.074632
BFGS: 31 00:05:22 -1077.423334 0.071978
BFGS: 32 00:05:23 -1077.424370 0.046092
Energy of re-relaxed empty MOF: -1077.424 eV
The MOF returns to its original empty reference energy upon re-relaxation, confirming that this deformation is physically relevant and is induced by the adsorbate molecule. In Case #3, this re-relaxed energy will be more negative (more favorable) than the original empty MOF relaxation. Thus, we take the reference empty MOF energy ( in Eqn. 1) to be the minimum of the original empty MOF energy and the re-relaxed MOf energy:
E_mof = min(E_mof_empty, E_mof_rerelax)
# get adsorbate reference energy
h2o = mof_h2o[-3:]
h2o.calc = calc
E_h2o = h2o.get_potential_energy()
# compute adsorption energy
E_ads = E_combo - E_mof - E_h2o
print(f"Adsorption energy of H2O in WOBHEB_0.11_0: {E_ads:.3f} eV")Adsorption energy of H2O in WOBHEB_0.11_0: -0.538 eV
This adsorption energy closely matches that from DFT (–0.699 eV) [1]. The strong adsorption energy is a consequence of both H2O chemisorption and MOF deformation. We can decompose the adsorption energy into contributions from these two factors. Assuming rigid H2O molecules, we define and , respectively, as
describes host host–guest interactions for the MOF in the adsorbed state only. quantifies the magnitude of deformation between the MOF in the adsorbed state and the most energetically favorable empty MOF geometry determined from the workflow presented here. It can be shown that
For H2O adsorption in WOBHEB_0.11, we have
E_int = E_combo - E_mof_adsorbed_state - E_h2o
print(f"E_int: {E_int}")E_int: -0.8269143107117696
E_mof_deform = E_mof_adsorbed_state - E_mof_empty
print(f"E_mof_deform: {E_mof_deform}")E_mof_deform: 0.28876350059613287
E_ads = E_int + E_mof_deform
print(f"E_ads: {E_ads}")E_ads: -0.5381508101156367
is equivalent to when the MOF is assumed to be rigid. In this case, failure to consider adsorbate-induced deformation would result in an overestimation of the adsorption energy magnitude.
Acknowledgements & Authors¶
Logan Brabson and Sihoon Choi (Georgia Tech) and the OpenDAC project.
- Sriram, A., Choi, S., Yu, X., Brabson, L. M., Das, A., Ulissi, Z., Uyttendaele, M., Medford, A. J., & Sholl, D. S. (2024). The Open DAC 2023 Dataset and Challenges for Sorbent Discovery in Direct Air Capture. ACS Central Science, 10(5), 923–941. 10.1021/acscentsci.3c01629
- Queen, W. L., Hudson, M. R., Bloch, E. D., Mason, J. A., Gonzalez, M. I., Lee, J. S., Gygi, D., Howe, J. D., Lee, K., Darwish, T. A., James, M., Peterson, V. K., Teat, S. J., Smit, B., Neaton, J. B., Long, J. R., & Brown, C. M. (2014). Comprehensive study of carbon dioxide adsorption in the metal–organic frameworks M 2 (dobdc) (M = Mg, Mn, Fe, Co, Ni, Cu, Zn). Chem. Sci., 5(12), 4569–4581. 10.1039/c4sc02064b
- Yu, D., Yazaydin, A. O., Lane, J. R., Dietzel, P. D. C., & Snurr, R. Q. (2013). A combined experimental and quantum chemical study of CO2 adsorption in the metal–organic framework CPO-27 with different metals. Chemical Science, 4(9), 3544. 10.1039/c3sc51319j
- Alonso, G., Bahamon, D., Keshavarz, F., Giménez, X., Gamallo, P., & Sayós, R. (2018). Density Functional Theory-Based Adsorption Isotherms for Pure and Flue Gas Mixtures on Mg-MOF-74. Application in CO2 Capture Swing Adsorption Processes. The Journal of Physical Chemistry C, 122(7), 3945–3957. 10.1021/acs.jpcc.8b00938
- Witman, M., Ling, S., Jawahery, S., Boyd, P. G., Haranczyk, M., Slater, B., & Smit, B. (2017). The Influence of Intrinsic Framework Flexibility on Adsorption in Nanoporous Materials. Journal of the American Chemical Society, 139(15), 5547–5557. 10.1021/jacs.7b01688