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 19:13:46 -1077.368916 0.129115
BFGS: 1 19:13:47 -1077.370393 0.075188
BFGS: 2 19:13:47 -1077.372341 0.145326
BFGS: 3 19:13:49 -1077.374554 0.111789
BFGS: 4 19:13:51 -1077.376092 0.074285
BFGS: 5 19:13:56 -1077.377454 0.063783
BFGS: 6 19:13:56 -1077.378941 0.080841
BFGS: 7 19:13:57 -1077.380755 0.096820
BFGS: 8 19:13:59 -1077.382637 0.078417
BFGS: 9 19:14:01 -1077.384445 0.086867
BFGS: 10 19:14:01 -1077.386283 0.083300
BFGS: 11 19:14:02 -1077.388394 0.084040
BFGS: 12 19:14:04 -1077.390739 0.069042
BFGS: 13 19:14:05 -1077.393129 0.076008
BFGS: 14 19:14:05 -1077.395562 0.084305
BFGS: 15 19:14:06 -1077.398146 0.079979
BFGS: 16 19:14:08 -1077.400823 0.079930
BFGS: 17 19:14:09 -1077.403369 0.067396
BFGS: 18 19:14:10 -1077.405676 0.070438
BFGS: 19 19:14:10 -1077.407930 0.087896
BFGS: 20 19:14:11 -1077.410402 0.083991
BFGS: 21 19:14:12 -1077.413125 0.059686
BFGS: 22 19:14:13 -1077.415974 0.071960
BFGS: 23 19:14:13 -1077.418818 0.067832
BFGS: 24 19:14:14 -1077.421566 0.069884
BFGS: 25 19:14:18 -1077.424153 0.067326
BFGS: 26 19:14:19 -1077.426519 0.060888
BFGS: 27 19:14:23 -1077.428603 0.069325
BFGS: 28 19:14:26 -1077.430414 0.060321
BFGS: 29 19:14:27 -1077.431997 0.051487
BFGS: 30 19:14:27 -1077.433387 0.056316
BFGS: 31 19:14:28 -1077.434618 0.057618
BFGS: 32 19:14:28 -1077.435741 0.046088
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 19:14:29 -1091.661289 1.120236
BFGS: 1 19:14:29 -1091.679631 0.313939
BFGS: 2 19:14:30 -1091.683945 0.232091
BFGS: 3 19:14:34 -1091.695508 0.302352
BFGS: 4 19:14:35 -1091.701044 0.210410
BFGS: 5 19:14:37 -1091.707222 0.171330
BFGS: 6 19:14:41 -1091.712982 0.183099
BFGS: 7 19:14:41 -1091.720514 0.262517
BFGS: 8 19:14:42 -1091.727864 0.202909
BFGS: 9 19:14:42 -1091.735397 0.175152
BFGS: 10 19:14:45 -1091.743447 0.214430
BFGS: 11 19:14:47 -1091.752660 0.253292
BFGS: 12 19:14:47 -1091.762639 0.232807
BFGS: 13 19:14:48 -1091.773123 0.197415
BFGS: 14 19:14:49 -1091.784463 0.164051
BFGS: 15 19:14:49 -1091.796076 0.252811
BFGS: 16 19:14:50 -1091.806469 0.270230
BFGS: 17 19:14:51 -1091.815240 0.186191
BFGS: 18 19:14:52 -1091.822968 0.130912
BFGS: 19 19:14:53 -1091.830279 0.120292
BFGS: 20 19:14:54 -1091.837493 0.140896
BFGS: 21 19:14:56 -1091.844732 0.154740
BFGS: 22 19:14:57 -1091.851966 0.162453
BFGS: 23 19:14:57 -1091.858797 0.167902
BFGS: 24 19:14:58 -1091.864158 0.175475
BFGS: 25 19:14:58 -1091.868755 0.402637
BFGS: 26 19:14:59 -1091.873942 0.223521
BFGS: 27 19:15:00 -1091.880204 0.092076
BFGS: 28 19:15:02 -1091.884368 0.091643
BFGS: 29 19:15:03 -1091.889173 0.129506
BFGS: 30 19:15:05 -1091.893703 0.143526
BFGS: 31 19:15:05 -1091.899484 0.245092
BFGS: 32 19:15:09 -1091.904455 0.331921
BFGS: 33 19:15:10 -1091.909063 0.287575
BFGS: 34 19:15:11 -1091.914330 0.211918
BFGS: 35 19:15:12 -1091.920860 0.210662
BFGS: 36 19:15:14 -1091.927206 0.208256
BFGS: 37 19:15:15 -1091.934411 0.294691
BFGS: 38 19:15:18 -1091.939971 0.146837
BFGS: 39 19:15:19 -1091.940348 0.871097
BFGS: 40 19:15:20 -1091.950334 0.174845
BFGS: 41 19:15:21 -1091.955604 0.130794
BFGS: 42 19:15:22 -1091.969520 0.313305
BFGS: 43 19:15:22 -1091.976531 0.282312
BFGS: 44 19:15:24 -1091.993087 0.292550
BFGS: 45 19:15:25 -1092.004469 0.339959
BFGS: 46 19:15:26 -1091.994119 1.265717
BFGS: 47 19:15:29 -1092.023066 0.168518
BFGS: 48 19:15:30 -1092.035129 0.179363
BFGS: 49 19:15:32 -1092.074964 0.478843
BFGS: 50 19:15:34 -1092.091928 0.284901
BFGS: 51 19:15:37 -1092.114741 0.265471
BFGS: 52 19:15:37 -1092.134893 0.585438
BFGS: 53 19:15:38 -1092.150307 0.377559
BFGS: 54 19:15:40 -1092.144698 1.052550
BFGS: 55 19:15:41 -1092.173687 0.413166
BFGS: 56 19:15:43 -1092.184640 0.277428
BFGS: 57 19:15:43 -1092.200645 0.318348
BFGS: 58 19:15:46 -1092.220679 0.317911
BFGS: 59 19:15:50 -1092.229624 0.313956
BFGS: 60 19:15:51 -1092.245762 0.394736
BFGS: 61 19:15:51 -1092.255669 0.395916
BFGS: 62 19:15:52 -1092.264392 0.297284
BFGS: 63 19:15:55 -1092.271083 0.173798
BFGS: 64 19:15:55 -1092.277097 0.105276
BFGS: 65 19:15:56 -1092.282124 0.141937
BFGS: 66 19:15:57 -1092.287529 0.171940
BFGS: 67 19:15:58 -1092.292704 0.155978
BFGS: 68 19:16:01 -1092.297320 0.141063
BFGS: 69 19:16:02 -1092.301502 0.137568
BFGS: 70 19:16:04 -1092.305628 0.184573
BFGS: 71 19:16:05 -1092.309997 0.152052
BFGS: 72 19:16:06 -1092.314353 0.142921
BFGS: 73 19:16:07 -1092.318376 0.172888
BFGS: 74 19:16:08 -1092.322489 0.221816
BFGS: 75 19:16:08 -1092.326247 0.174973
BFGS: 76 19:16:12 -1092.329349 0.114755
BFGS: 77 19:16:12 -1092.332056 0.108454
BFGS: 78 19:16:13 -1092.334410 0.102177
BFGS: 79 19:16:14 -1092.336251 0.112487
BFGS: 80 19:16:15 -1092.337709 0.070413
BFGS: 81 19:16:19 -1092.338942 0.076689
BFGS: 82 19:16:20 -1092.340222 0.092270
BFGS: 83 19:16:21 -1092.341685 0.089014
BFGS: 84 19:16:23 -1092.343166 0.051606
BFGS: 85 19:16:25 -1092.344539 0.055440
BFGS: 86 19:16:26 -1092.345853 0.088608
BFGS: 87 19:16:27 -1092.347149 0.122894
BFGS: 88 19:16:28 -1092.348402 0.087162
BFGS: 89 19:16:28 -1092.349466 0.050990
BFGS: 90 19:16:30 -1092.350280 0.043432
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.148 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 19:16:31 -1077.148356 1.023600
BFGS: 1 19:16:31 -1077.190012 0.896494
BFGS: 2 19:16:32 -1077.240780 0.662940
BFGS: 3 19:16:35 -1077.288165 0.491634
BFGS: 4 19:16:37 -1077.306163 0.353680
BFGS: 5 19:16:38 -1077.322813 0.304886
BFGS: 6 19:16:38 -1077.336505 0.319768
BFGS: 7 19:16:39 -1077.348737 0.250130
BFGS: 8 19:16:39 -1077.355972 0.130303
BFGS: 9 19:16:40 -1077.360752 0.125482
BFGS: 10 19:16:40 -1077.365183 0.174448
BFGS: 11 19:16:42 -1077.369859 0.160966
BFGS: 12 19:16:42 -1077.374591 0.143534
BFGS: 13 19:16:43 -1077.379246 0.129296
BFGS: 14 19:16:43 -1077.383794 0.146667
BFGS: 15 19:16:43 -1077.387692 0.126670
BFGS: 16 19:16:44 -1077.390777 0.093601
BFGS: 17 19:16:45 -1077.393517 0.090462
BFGS: 18 19:16:47 -1077.396303 0.115509
BFGS: 19 19:16:49 -1077.399076 0.120500
BFGS: 20 19:16:52 -1077.401782 0.106518
BFGS: 21 19:16:53 -1077.404422 0.104870
BFGS: 22 19:16:53 -1077.406987 0.088850
BFGS: 23 19:16:57 -1077.409405 0.098243
BFGS: 24 19:16:59 -1077.411591 0.074799
BFGS: 25 19:17:02 -1077.413555 0.082517
BFGS: 26 19:17:04 -1077.415332 0.081815
BFGS: 27 19:17:05 -1077.416847 0.080531
BFGS: 28 19:17:06 -1077.418105 0.049391
Energy of re-relaxed empty MOF: -1077.418 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.542 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.8295034486979329
E_mof_deform = E_mof_adsorbed_state - E_mof_empty
print(f"E_mof_deform: {E_mof_deform}")E_mof_deform: 0.28738453275173015
E_ads = E_int + E_mof_deform
print(f"E_ads: {E_ads}")E_ads: -0.5421189159462028
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
- 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