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")Warp DeprecationWarning: The symbol `warp.vec` will soon be removed from the public API. Use `warp.types.vector` instead.
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")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 06:57:39 -1077.368916 0.129115
BFGS: 1 06:57:40 -1077.370392 0.075188
BFGS: 2 06:57:41 -1077.372342 0.145326
BFGS: 3 06:57:42 -1077.374554 0.111789
BFGS: 4 06:57:44 -1077.376091 0.074286
BFGS: 5 06:57:45 -1077.377457 0.063781
BFGS: 6 06:57:46 -1077.378943 0.080817
BFGS: 7 06:57:47 -1077.380753 0.096874
BFGS: 8 06:57:49 -1077.382637 0.078411
BFGS: 9 06:57:50 -1077.384448 0.086861
BFGS: 10 06:57:50 -1077.386286 0.083326
BFGS: 11 06:57:53 -1077.388394 0.083968
BFGS: 12 06:57:56 -1077.390742 0.069073
BFGS: 13 06:57:57 -1077.393127 0.076017
BFGS: 14 06:57:58 -1077.395559 0.084334
BFGS: 15 06:57:59 -1077.398143 0.079950
BFGS: 16 06:58:02 -1077.400826 0.079988
BFGS: 17 06:58:05 -1077.403369 0.067388
BFGS: 18 06:58:06 -1077.405674 0.070439
BFGS: 19 06:58:07 -1077.407932 0.087926
BFGS: 20 06:58:08 -1077.410399 0.083985
BFGS: 21 06:58:09 -1077.413124 0.059740
BFGS: 22 06:58:09 -1077.415974 0.072024
BFGS: 23 06:58:12 -1077.418817 0.067762
BFGS: 24 06:58:13 -1077.421562 0.069897
BFGS: 25 06:58:13 -1077.424152 0.067318
BFGS: 26 06:58:14 -1077.426523 0.060818
BFGS: 27 06:58:16 -1077.428603 0.069330
BFGS: 28 06:58:18 -1077.430417 0.060328
BFGS: 29 06:58:20 -1077.431996 0.051475
BFGS: 30 06:58:22 -1077.433388 0.056308
BFGS: 31 06:58:25 -1077.434618 0.057611
BFGS: 32 06:58:25 -1077.435741 0.046106
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 06:58:26 -1091.661288 1.120236
BFGS: 1 06:58:28 -1091.679631 0.313939
BFGS: 2 06:58:29 -1091.683944 0.232091
BFGS: 3 06:58:31 -1091.695506 0.302433
BFGS: 4 06:58:32 -1091.701044 0.210470
BFGS: 5 06:58:33 -1091.707222 0.171338
BFGS: 6 06:58:34 -1091.712981 0.183077
BFGS: 7 06:58:35 -1091.720515 0.262585
BFGS: 8 06:58:36 -1091.727862 0.203020
BFGS: 9 06:58:38 -1091.735396 0.175080
BFGS: 10 06:58:39 -1091.743449 0.214429
BFGS: 11 06:58:40 -1091.752655 0.253306
BFGS: 12 06:58:41 -1091.762640 0.232716
BFGS: 13 06:58:42 -1091.773122 0.197351
BFGS: 14 06:58:43 -1091.784456 0.164014
BFGS: 15 06:58:45 -1091.796074 0.252699
BFGS: 16 06:58:45 -1091.806471 0.270282
BFGS: 17 06:58:46 -1091.815239 0.186038
BFGS: 18 06:58:47 -1091.822968 0.130861
BFGS: 19 06:58:47 -1091.830277 0.119955
BFGS: 20 06:58:49 -1091.837497 0.139375
BFGS: 21 06:58:51 -1091.844738 0.154519
BFGS: 22 06:58:52 -1091.851980 0.162026
BFGS: 23 06:58:52 -1091.858862 0.162918
BFGS: 24 06:58:53 -1091.864410 0.148798
BFGS: 25 06:58:54 -1091.868569 0.444903
BFGS: 26 06:58:55 -1091.873918 0.213461
BFGS: 27 06:58:56 -1091.879791 0.111733
BFGS: 28 06:58:57 -1091.884374 0.088918
BFGS: 29 06:58:58 -1091.888649 0.156420
BFGS: 30 06:59:01 -1091.893166 0.141394
BFGS: 31 06:59:03 -1091.899367 0.186927
BFGS: 32 06:59:05 -1091.905195 0.192753
BFGS: 33 06:59:06 -1091.907726 0.506736
BFGS: 34 06:59:06 -1091.913695 0.142511
BFGS: 35 06:59:07 -1091.918977 0.123537
BFGS: 36 06:59:08 -1091.927471 0.128361
BFGS: 37 06:59:09 -1091.933435 0.351424
BFGS: 38 06:59:11 -1091.938710 0.238493
BFGS: 39 06:59:12 -1091.945889 0.349652
BFGS: 40 06:59:13 -1091.952175 0.202790
BFGS: 41 06:59:14 -1091.957069 0.537613
BFGS: 42 06:59:15 -1091.965228 0.260100
BFGS: 43 06:59:16 -1091.977943 0.221804
BFGS: 44 06:59:17 -1091.987808 0.261329
BFGS: 45 06:59:18 -1092.002629 0.278246
BFGS: 46 06:59:19 -1092.015380 0.209752
BFGS: 47 06:59:20 -1092.010111 1.315145
BFGS: 48 06:59:21 -1092.044970 0.207968
BFGS: 49 06:59:22 -1092.059866 0.236342
BFGS: 50 06:59:23 -1092.095243 0.533745
BFGS: 51 06:59:24 -1092.112353 0.248960
BFGS: 52 06:59:25 -1092.133667 0.353575
BFGS: 53 06:59:26 -1092.155863 0.456054
BFGS: 54 06:59:27 -1092.167969 0.362343
BFGS: 55 06:59:29 -1092.183025 0.359043
BFGS: 56 06:59:31 -1092.198402 0.298786
BFGS: 57 06:59:33 -1092.213785 0.241418
BFGS: 58 06:59:33 -1092.224196 0.308912
BFGS: 59 06:59:34 -1092.238496 0.366594
BFGS: 60 06:59:35 -1092.250596 0.335279
BFGS: 61 06:59:35 -1092.259845 0.228000
BFGS: 62 06:59:36 -1092.267397 0.144493
BFGS: 63 06:59:37 -1092.274087 0.117572
BFGS: 64 06:59:38 -1092.279949 0.108475
BFGS: 65 06:59:38 -1092.285333 0.106156
BFGS: 66 06:59:39 -1092.290431 0.154971
BFGS: 67 06:59:40 -1092.295332 0.144615
BFGS: 68 06:59:43 -1092.299781 0.099191
BFGS: 69 06:59:44 -1092.303788 0.116816
BFGS: 70 06:59:45 -1092.307717 0.126437
BFGS: 71 06:59:46 -1092.311868 0.161737
BFGS: 72 06:59:47 -1092.316230 0.160021
BFGS: 73 06:59:48 -1092.320427 0.149313
BFGS: 74 06:59:50 -1092.324075 0.094865
BFGS: 75 06:59:51 -1092.327339 0.100525
BFGS: 76 06:59:52 -1092.330436 0.113257
BFGS: 77 06:59:54 -1092.333205 0.077734
BFGS: 78 06:59:56 -1092.335301 0.051398
BFGS: 79 06:59:59 -1092.336868 0.066442
BFGS: 80 06:59:59 -1092.338223 0.072968
BFGS: 81 07:00:00 -1092.339563 0.064097
BFGS: 82 07:00:03 -1092.340928 0.062198
BFGS: 83 07:00:03 -1092.342314 0.082883
BFGS: 84 07:00:06 -1092.343689 0.092175
BFGS: 85 07:00:06 -1092.345045 0.092405
BFGS: 86 07:00:08 -1092.346386 0.067563
BFGS: 87 07:00:08 -1092.347678 0.057815
BFGS: 88 07:00:09 -1092.348818 0.052588
BFGS: 89 07:00:11 -1092.349766 0.040936
Energy of MOF + H2O: -1092.350 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.150 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 07:00:12 -1077.149979 1.020758
BFGS: 1 07:00:13 -1077.191349 0.894265
BFGS: 2 07:00:14 -1077.241897 0.662140
BFGS: 3 07:00:14 -1077.289354 0.480717
BFGS: 4 07:00:15 -1077.307123 0.355594
BFGS: 5 07:00:16 -1077.323809 0.302568
BFGS: 6 07:00:17 -1077.337513 0.319681
BFGS: 7 07:00:18 -1077.349730 0.252128
BFGS: 8 07:00:19 -1077.356911 0.131622
BFGS: 9 07:00:20 -1077.361701 0.128422
BFGS: 10 07:00:21 -1077.366151 0.174366
BFGS: 11 07:00:22 -1077.370830 0.161376
BFGS: 12 07:00:24 -1077.375530 0.140726
BFGS: 13 07:00:25 -1077.380179 0.131400
BFGS: 14 07:00:26 -1077.384726 0.148871
BFGS: 15 07:00:26 -1077.388609 0.123356
BFGS: 16 07:00:27 -1077.391667 0.092646
BFGS: 17 07:00:28 -1077.394388 0.089444
BFGS: 18 07:00:30 -1077.397130 0.113657
BFGS: 19 07:00:31 -1077.399853 0.117222
BFGS: 20 07:00:32 -1077.402525 0.104061
BFGS: 21 07:00:33 -1077.405155 0.104677
BFGS: 22 07:00:34 -1077.407705 0.090360
BFGS: 23 07:00:35 -1077.410088 0.097459
BFGS: 24 07:00:36 -1077.412228 0.074967
BFGS: 25 07:00:38 -1077.414167 0.081961
BFGS: 26 07:00:39 -1077.415916 0.082078
BFGS: 27 07:00:40 -1077.417398 0.079457
BFGS: 28 07:00:41 -1077.418632 0.049228
Energy of re-relaxed empty MOF: -1077.419 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.541 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.8270156798213417
E_mof_deform = E_mof_adsorbed_state - E_mof_empty
print(f"E_mof_deform: {E_mof_deform}")E_mof_deform: 0.2857624145265163
E_ads = E_int + E_mof_deform
print(f"E_ads: {E_ads}")E_ads: -0.5412532652948254
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 M2(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
- 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