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 00:29:34 -1077.368915 0.129115
BFGS: 1 00:29:36 -1077.370392 0.075187
BFGS: 2 00:29:37 -1077.372342 0.145320
BFGS: 3 00:29:41 -1077.374554 0.111799
BFGS: 4 00:29:43 -1077.376093 0.074297
BFGS: 5 00:29:43 -1077.377454 0.063782
BFGS: 6 00:29:44 -1077.378941 0.080752
BFGS: 7 00:29:47 -1077.380760 0.096917
BFGS: 8 00:29:47 -1077.382636 0.078405
BFGS: 9 00:29:48 -1077.384446 0.086878
BFGS: 10 00:29:48 -1077.386285 0.083329
BFGS: 11 00:29:48 -1077.388393 0.084004
BFGS: 12 00:29:49 -1077.390738 0.069094
BFGS: 13 00:29:49 -1077.393127 0.076055
BFGS: 14 00:29:50 -1077.395557 0.084287
BFGS: 15 00:29:50 -1077.398146 0.079953
BFGS: 16 00:29:50 -1077.400825 0.079994
BFGS: 17 00:29:51 -1077.403371 0.067384
BFGS: 18 00:29:51 -1077.405674 0.070421
BFGS: 19 00:29:52 -1077.407933 0.087902
BFGS: 20 00:29:55 -1077.410401 0.084010
BFGS: 21 00:29:56 -1077.413125 0.059896
BFGS: 22 00:29:56 -1077.415974 0.071914
BFGS: 23 00:29:57 -1077.418820 0.067830
BFGS: 24 00:29:57 -1077.421563 0.069978
BFGS: 25 00:29:57 -1077.424149 0.067319
BFGS: 26 00:29:58 -1077.426522 0.060845
BFGS: 27 00:29:59 -1077.428603 0.069302
BFGS: 28 00:29:59 -1077.430414 0.060295
BFGS: 29 00:30:00 -1077.431996 0.051480
BFGS: 30 00:30:01 -1077.433387 0.056303
BFGS: 31 00:30:01 -1077.434615 0.057580
BFGS: 32 00:30:02 -1077.435742 0.046093
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:30:02 -1091.661287 1.120236
BFGS: 1 00:30:03 -1091.679632 0.313939
BFGS: 2 00:30:03 -1091.683945 0.232090
BFGS: 3 00:30:03 -1091.695511 0.302373
BFGS: 4 00:30:04 -1091.701045 0.210394
BFGS: 5 00:30:06 -1091.707225 0.171330
BFGS: 6 00:30:06 -1091.712983 0.183108
BFGS: 7 00:30:10 -1091.720513 0.262608
BFGS: 8 00:30:10 -1091.727863 0.203015
BFGS: 9 00:30:10 -1091.735396 0.175033
BFGS: 10 00:30:10 -1091.743445 0.214430
BFGS: 11 00:30:11 -1091.752655 0.253404
BFGS: 12 00:30:11 -1091.762643 0.232655
BFGS: 13 00:30:11 -1091.773118 0.197334
BFGS: 14 00:30:14 -1091.784461 0.164051
BFGS: 15 00:30:14 -1091.796077 0.252764
BFGS: 16 00:30:14 -1091.806473 0.270292
BFGS: 17 00:30:15 -1091.815239 0.186180
BFGS: 18 00:30:16 -1091.822965 0.130936
BFGS: 19 00:30:16 -1091.830278 0.120930
BFGS: 20 00:30:16 -1091.837492 0.141986
BFGS: 21 00:30:17 -1091.844732 0.154879
BFGS: 22 00:30:17 -1091.851959 0.162450
BFGS: 23 00:30:17 -1091.858810 0.165608
BFGS: 24 00:30:18 -1091.864217 0.167887
BFGS: 25 00:30:18 -1091.868699 0.416325
BFGS: 26 00:30:18 -1091.873930 0.220194
BFGS: 27 00:30:19 -1091.880088 0.092586
BFGS: 28 00:30:19 -1091.884371 0.090819
BFGS: 29 00:30:20 -1091.889009 0.136088
BFGS: 30 00:30:20 -1091.893531 0.142614
BFGS: 31 00:30:20 -1091.899523 0.221205
BFGS: 32 00:30:21 -1091.904682 0.305768
BFGS: 33 00:30:21 -1091.908656 0.369191
BFGS: 34 00:30:21 -1091.913877 0.189126
BFGS: 35 00:30:22 -1091.920604 0.134899
BFGS: 36 00:30:22 -1091.926895 0.148123
BFGS: 37 00:30:23 -1091.934237 0.344300
BFGS: 38 00:30:23 -1091.939362 0.156970
BFGS: 39 00:30:23 -1091.944746 0.477269
BFGS: 40 00:30:24 -1091.952376 0.199428
BFGS: 41 00:30:24 -1091.959389 0.229065
BFGS: 42 00:30:24 -1091.969843 0.226820
BFGS: 43 00:30:25 -1091.978631 0.336228
BFGS: 44 00:30:28 -1091.989803 0.278211
BFGS: 45 00:30:28 -1091.969788 1.573978
BFGS: 46 00:30:28 -1092.005685 0.161459
BFGS: 47 00:30:29 -1092.014717 0.149327
BFGS: 48 00:30:29 -1092.048098 0.566750
BFGS: 49 00:30:29 -1092.066330 0.347358
BFGS: 50 00:30:30 -1092.091163 0.303867
BFGS: 51 00:30:30 -1092.093979 0.785659
BFGS: 52 00:30:30 -1092.125244 0.726660
BFGS: 53 00:30:31 -1092.140743 0.508057
BFGS: 54 00:30:31 -1092.167975 0.300228
BFGS: 55 00:30:31 -1092.178039 0.251833
BFGS: 56 00:30:32 -1092.198272 0.258285
BFGS: 57 00:30:32 -1092.212106 0.380988
BFGS: 58 00:30:32 -1092.224342 0.460994
BFGS: 59 00:30:33 -1092.236205 0.529767
BFGS: 60 00:30:33 -1092.249335 0.398759
BFGS: 61 00:30:34 -1092.258720 0.264565
BFGS: 62 00:30:34 -1092.266348 0.144742
BFGS: 63 00:30:34 -1092.272883 0.120092
BFGS: 64 00:30:35 -1092.278829 0.122444
BFGS: 65 00:30:35 -1092.284275 0.146756
BFGS: 66 00:30:35 -1092.289277 0.140391
BFGS: 67 00:30:36 -1092.294155 0.151884
BFGS: 68 00:30:36 -1092.298757 0.120791
BFGS: 69 00:30:36 -1092.303024 0.172591
BFGS: 70 00:30:38 -1092.307086 0.190299
BFGS: 71 00:30:39 -1092.311201 0.185194
BFGS: 72 00:30:39 -1092.315606 0.182864
BFGS: 73 00:30:39 -1092.320085 0.157522
BFGS: 74 00:30:40 -1092.323952 0.110593
BFGS: 75 00:30:40 -1092.327202 0.079652
BFGS: 76 00:30:43 -1092.330253 0.107233
BFGS: 77 00:30:43 -1092.333033 0.089981
BFGS: 78 00:30:45 -1092.335172 0.072620
BFGS: 79 00:30:46 -1092.336709 0.052808
BFGS: 80 00:30:46 -1092.338003 0.071102
BFGS: 81 00:30:47 -1092.339344 0.077075
BFGS: 82 00:30:47 -1092.340724 0.089346
BFGS: 83 00:30:47 -1092.342113 0.078452
BFGS: 84 00:30:48 -1092.343506 0.088089
BFGS: 85 00:30:49 -1092.344918 0.085656
BFGS: 86 00:30:49 -1092.346300 0.069588
BFGS: 87 00:30:50 -1092.347595 0.045075
Energy of MOF + H2O: -1092.348 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.149 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:30:50 -1077.148582 1.020844
BFGS: 1 00:30:50 -1077.189979 0.894522
BFGS: 2 00:30:51 -1077.241995 0.657588
BFGS: 3 00:30:51 -1077.289215 0.497955
BFGS: 4 00:30:51 -1077.307363 0.363833
BFGS: 5 00:30:52 -1077.324075 0.299232
BFGS: 6 00:30:52 -1077.338044 0.320841
BFGS: 7 00:30:52 -1077.350523 0.252410
BFGS: 8 00:30:53 -1077.357845 0.143537
BFGS: 9 00:30:53 -1077.362654 0.129393
BFGS: 10 00:30:53 -1077.367167 0.176404
BFGS: 11 00:30:54 -1077.371895 0.168085
BFGS: 12 00:30:54 -1077.376763 0.145785
BFGS: 13 00:30:54 -1077.381555 0.129512
BFGS: 14 00:30:55 -1077.386179 0.144063
BFGS: 15 00:30:55 -1077.390138 0.127339
BFGS: 16 00:30:55 -1077.393238 0.097245
BFGS: 17 00:30:56 -1077.395940 0.097807
BFGS: 18 00:30:56 -1077.398620 0.112935
BFGS: 19 00:30:56 -1077.401291 0.111198
BFGS: 20 00:30:57 -1077.403936 0.105303
BFGS: 21 00:30:57 -1077.406560 0.100539
BFGS: 22 00:30:57 -1077.409104 0.085803
BFGS: 23 00:30:58 -1077.411445 0.092324
BFGS: 24 00:30:58 -1077.413511 0.075492
BFGS: 25 00:30:58 -1077.415375 0.076522
BFGS: 26 00:30:59 -1077.417079 0.081047
BFGS: 27 00:30:59 -1077.418532 0.078568
BFGS: 28 00:30:59 -1077.419736 0.050562
BFGS: 29 00:31:00 -1077.420869 0.062214
BFGS: 30 00:31:00 -1077.422070 0.070660
BFGS: 31 00:31:00 -1077.423246 0.074456
BFGS: 32 00:31:01 -1077.424294 0.048426
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.8247209929397012
E_mof_deform = E_mof_adsorbed_state - E_mof_empty
print(f"E_mof_deform: {E_mof_deform}")E_mof_deform: 0.28716003740669294
E_ads = E_int + E_mof_deform
print(f"E_ads: {E_ads}")E_ads: -0.5375609555330083
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