Adsorption Energies#
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 (\(E_{\mathrm{ads}}\)) 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
Get 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.
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-1p1")
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")
Adsorption energy of CO2 in Mg-MOF-74: -0.459 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, \(E_{\mathrm{MOF}}\), 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, \(E_{x}(r_{y})\) corresponds to the energy of \(x\) determined from geometry optimization of \(y\).
First, we obtain the energy of the empty MOF from relaxation of only the MOF: \(E_{\mathrm{MOF}}(r_{\mathrm{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 17:40:32 -1077.274064 0.206406
BFGS: 1 17:40:33 -1077.276781 0.152729
BFGS: 2 17:40:33 -1077.281941 0.169925
BFGS: 3 17:40:33 -1077.284772 0.155757
BFGS: 4 17:40:33 -1077.288839 0.108771
BFGS: 5 17:40:34 -1077.291021 0.086444
BFGS: 6 17:40:34 -1077.293363 0.093432
BFGS: 7 17:40:34 -1077.295418 0.100123
BFGS: 8 17:40:34 -1077.297833 0.102533
BFGS: 9 17:40:35 -1077.300014 0.091607
BFGS: 10 17:40:35 -1077.302010 0.079039
BFGS: 11 17:40:35 -1077.304135 0.105565
BFGS: 12 17:40:35 -1077.306719 0.087942
BFGS: 13 17:40:35 -1077.309518 0.086326
BFGS: 14 17:40:36 -1077.312262 0.086859
BFGS: 15 17:40:36 -1077.314703 0.106259
BFGS: 16 17:40:36 -1077.316988 0.106218
BFGS: 17 17:40:36 -1077.319481 0.085555
BFGS: 18 17:40:37 -1077.322263 0.109636
BFGS: 19 17:40:37 -1077.325137 0.148680
BFGS: 20 17:40:37 -1077.327761 0.125943
BFGS: 21 17:40:37 -1077.329921 0.069101
BFGS: 22 17:40:38 -1077.331952 0.087271
BFGS: 23 17:40:38 -1077.334271 0.125219
BFGS: 24 17:40:38 -1077.336831 0.166677
BFGS: 25 17:40:38 -1077.339542 0.145540
BFGS: 26 17:40:38 -1077.342150 0.087624
BFGS: 27 17:40:39 -1077.344541 0.076201
BFGS: 28 17:40:39 -1077.346895 0.148940
BFGS: 29 17:40:39 -1077.349783 0.170210
BFGS: 30 17:40:39 -1077.352528 0.109281
BFGS: 31 17:40:40 -1077.354750 0.070308
BFGS: 32 17:40:40 -1077.356775 0.089705
BFGS: 33 17:40:40 -1077.358658 0.124285
BFGS: 34 17:40:40 -1077.360601 0.108062
BFGS: 35 17:40:41 -1077.362469 0.068628
BFGS: 36 17:40:41 -1077.364167 0.070218
BFGS: 37 17:40:41 -1077.365713 0.105454
BFGS: 38 17:40:41 -1077.367259 0.104212
BFGS: 39 17:40:41 -1077.368766 0.062866
BFGS: 40 17:40:42 -1077.370138 0.057317
BFGS: 41 17:40:42 -1077.371376 0.060553
BFGS: 42 17:40:42 -1077.372459 0.063719
BFGS: 43 17:40:42 -1077.373428 0.057310
BFGS: 44 17:40:43 -1077.374370 0.049863
Energy of empty MOF: -1077.374 eV
Next, we add the H2O guest molecule and relax the MOF + adsorbate to obtain \(E_{\mathrm{MOF+H2O}}(r_{\mathrm{MOF+H2O}})\).
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 17:40:43 -1091.565588 1.145036
BFGS: 1 17:40:43 -1091.585061 0.314149
BFGS: 2 17:40:44 -1091.590210 0.243429
BFGS: 3 17:40:44 -1091.608171 0.237244
BFGS: 4 17:40:44 -1091.614633 0.227934
BFGS: 5 17:40:44 -1091.625217 0.186791
BFGS: 6 17:40:44 -1091.632358 0.178914
BFGS: 7 17:40:45 -1091.640627 0.175117
BFGS: 8 17:40:45 -1091.648039 0.184537
BFGS: 9 17:40:45 -1091.656145 0.160886
BFGS: 10 17:40:45 -1091.663842 0.178475
BFGS: 11 17:40:46 -1091.672297 0.188742
BFGS: 12 17:40:46 -1091.682083 0.157490
BFGS: 13 17:40:46 -1091.692984 0.177259
BFGS: 14 17:40:46 -1091.704436 0.158179
BFGS: 15 17:40:47 -1091.715513 0.191660
BFGS: 16 17:40:47 -1091.725713 0.197832
BFGS: 17 17:40:47 -1091.735328 0.163718
BFGS: 18 17:40:47 -1091.745543 0.151487
BFGS: 19 17:40:48 -1091.754026 0.170812
BFGS: 20 17:40:48 -1091.761494 0.153574
BFGS: 21 17:40:48 -1091.767896 0.152666
BFGS: 22 17:40:48 -1091.774205 0.165975
BFGS: 23 17:40:49 -1091.780888 0.135420
BFGS: 24 17:40:49 -1091.788355 0.180996
BFGS: 25 17:40:49 -1091.794277 0.204552
BFGS: 26 17:40:49 -1091.800638 0.131358
BFGS: 27 17:40:50 -1091.806521 0.189921
BFGS: 28 17:40:50 -1091.812306 0.199108
BFGS: 29 17:40:50 -1091.817179 0.151675
BFGS: 30 17:40:50 -1091.822210 0.100140
BFGS: 31 17:40:50 -1091.826300 0.125306
BFGS: 32 17:40:51 -1091.832527 0.177257
BFGS: 33 17:40:51 -1091.837117 0.246259
BFGS: 34 17:40:51 -1091.842041 0.112723
BFGS: 35 17:40:51 -1091.845768 0.331068
BFGS: 36 17:40:52 -1091.850859 0.173915
BFGS: 37 17:40:52 -1091.858471 0.159568
BFGS: 38 17:40:52 -1091.865275 0.141596
BFGS: 39 17:40:52 -1091.872000 0.140017
BFGS: 40 17:40:53 -1091.878251 0.262571
BFGS: 41 17:40:53 -1091.880032 0.588490
BFGS: 42 17:40:53 -1091.887182 0.553625
BFGS: 43 17:40:53 -1091.893871 0.243462
BFGS: 44 17:40:54 -1091.900095 0.173441
BFGS: 45 17:40:54 -1091.916067 0.229129
BFGS: 46 17:40:54 -1091.924433 0.394303
BFGS: 47 17:40:54 -1091.938022 0.277795
BFGS: 48 17:40:55 -1091.953670 0.412525
BFGS: 49 17:40:55 -1091.973841 0.632635
BFGS: 50 17:40:55 -1091.966227 1.475651
BFGS: 51 17:40:55 -1092.004470 0.338104
BFGS: 52 17:40:56 -1092.020438 0.279720
BFGS: 53 17:40:56 -1092.069137 0.312401
BFGS: 54 17:40:56 -1092.085514 0.293877
BFGS: 55 17:40:56 -1092.120694 0.500612
BFGS: 56 17:40:56 -1092.131632 0.300470
BFGS: 57 17:40:57 -1092.141938 0.368384
BFGS: 58 17:40:57 -1092.157469 0.274600
BFGS: 59 17:40:57 -1092.168870 0.261842
BFGS: 60 17:40:57 -1092.183643 0.342880
BFGS: 61 17:40:58 -1092.192102 0.393559
BFGS: 62 17:40:58 -1092.205685 0.377111
BFGS: 63 17:40:58 -1092.216061 0.291054
BFGS: 64 17:40:58 -1092.226039 0.177720
BFGS: 65 17:40:59 -1092.233082 0.113505
BFGS: 66 17:40:59 -1092.238998 0.113588
BFGS: 67 17:40:59 -1092.244746 0.105426
BFGS: 68 17:40:59 -1092.250212 0.111471
BFGS: 69 17:41:00 -1092.255272 0.106868
BFGS: 70 17:41:00 -1092.260458 0.082812
BFGS: 71 17:41:00 -1092.264917 0.090099
BFGS: 72 17:41:00 -1092.268913 0.107374
BFGS: 73 17:41:01 -1092.272530 0.158159
BFGS: 74 17:41:01 -1092.275932 0.175230
BFGS: 75 17:41:01 -1092.279211 0.162491
BFGS: 76 17:41:01 -1092.282793 0.102374
BFGS: 77 17:41:02 -1092.285395 0.087613
BFGS: 78 17:41:02 -1092.287943 0.101089
BFGS: 79 17:41:02 -1092.290281 0.087236
BFGS: 80 17:41:02 -1092.292212 0.084661
BFGS: 81 17:41:02 -1092.294006 0.068738
BFGS: 82 17:41:03 -1092.295334 0.082177
BFGS: 83 17:41:03 -1092.296777 0.075001
BFGS: 84 17:41:03 -1092.298168 0.074787
BFGS: 85 17:41:03 -1092.299870 0.080198
BFGS: 86 17:41:04 -1092.301485 0.093441
BFGS: 87 17:41:04 -1092.303257 0.089735
BFGS: 88 17:41:04 -1092.304985 0.065218
BFGS: 89 17:41:04 -1092.306460 0.054504
BFGS: 90 17:41:05 -1092.307880 0.056996
BFGS: 91 17:41:05 -1092.309024 0.079525
BFGS: 92 17:41:05 -1092.310036 0.078919
BFGS: 93 17:41:05 -1092.310861 0.060195
BFGS: 94 17:41:06 -1092.311605 0.043808
Energy of MOF + H2O: -1092.312 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 \(E_{\mathrm{MOF}}(r_{\mathrm{MOF+H2O}})\).
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.091 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 \(r_{\mathrm{MOF+H2O}}\) 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 17:41:06 -1077.090965 0.985175
BFGS: 1 17:41:06 -1077.123218 0.872596
BFGS: 2 17:41:06 -1077.172475 0.828379
BFGS: 3 17:41:07 -1077.211683 0.537124
BFGS: 4 17:41:07 -1077.231224 0.437196
BFGS: 5 17:41:07 -1077.247355 0.285082
BFGS: 6 17:41:07 -1077.258277 0.259765
BFGS: 7 17:41:07 -1077.267627 0.245924
BFGS: 8 17:41:08 -1077.277316 0.218152
BFGS: 9 17:41:08 -1077.284142 0.155352
BFGS: 10 17:41:08 -1077.289077 0.141834
BFGS: 11 17:41:08 -1077.293063 0.143239
BFGS: 12 17:41:09 -1077.296541 0.154024
BFGS: 13 17:41:09 -1077.301524 0.166590
BFGS: 14 17:41:09 -1077.305752 0.148458
BFGS: 15 17:41:09 -1077.310046 0.137638
BFGS: 16 17:41:10 -1077.313990 0.158453
BFGS: 17 17:41:10 -1077.318311 0.163430
BFGS: 18 17:41:10 -1077.322952 0.147507
BFGS: 19 17:41:10 -1077.326595 0.124098
BFGS: 20 17:41:11 -1077.329154 0.116937
BFGS: 21 17:41:11 -1077.331502 0.112661
BFGS: 22 17:41:11 -1077.334041 0.123195
BFGS: 23 17:41:11 -1077.336969 0.117150
BFGS: 24 17:41:11 -1077.339758 0.098412
BFGS: 25 17:41:12 -1077.342049 0.086787
BFGS: 26 17:41:12 -1077.344088 0.081969
BFGS: 27 17:41:12 -1077.345741 0.072426
BFGS: 28 17:41:12 -1077.347509 0.083065
BFGS: 29 17:41:13 -1077.349064 0.100321
BFGS: 30 17:41:13 -1077.350804 0.078688
BFGS: 31 17:41:13 -1077.352093 0.053317
BFGS: 32 17:41:13 -1077.353411 0.063705
BFGS: 33 17:41:14 -1077.354725 0.080573
BFGS: 34 17:41:14 -1077.356153 0.087970
BFGS: 35 17:41:14 -1077.357804 0.073980
BFGS: 36 17:41:14 -1077.359317 0.071549
BFGS: 37 17:41:15 -1077.360581 0.073345
BFGS: 38 17:41:15 -1077.361812 0.070452
BFGS: 39 17:41:15 -1077.363257 0.085557
BFGS: 40 17:41:15 -1077.364389 0.068871
BFGS: 41 17:41:15 -1077.365512 0.051325
BFGS: 42 17:41:16 -1077.366577 0.063766
BFGS: 43 17:41:16 -1077.367710 0.068426
BFGS: 44 17:41:16 -1077.369058 0.079957
BFGS: 45 17:41:16 -1077.370341 0.048902
Energy of re-relaxed empty MOF: -1077.370 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 (\(E_{\mathrm{MOF}}\) 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.689 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 \(E_{\mathrm{int}}\) and \(E_{\mathrm{MOF,deform}}\), respectively, as
\(E_{\mathrm{int}}\) describes host host–guest interactions for the MOF in the adsorbed state only. \(E_{\mathrm{MOF,deform}}\) 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.9721068143840466
E_mof_deform = E_mof_adsorbed_state - E_mof_empty
print(f"E_mof_deform: {E_mof_deform}")
E_mof_deform: 0.2834048271179199
E_ads = E_int + E_mof_deform
print(f"E_ads: {E_ads}")
E_ads: -0.6887019872661266
\(E_{\mathrm{int}}\) is equivalent to \(E_{\mathrm{ads}}\) 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.