Watching in situ the hydrogen diffusion dynamics in magnesium on the nanoscale

See allHide authors and affiliations

Science Advances  08 May 2020:
Vol. 6, no. 19, eaaz0566
DOI: 10.1126/sciadv.aaz0566


Active plasmonic and nanophotonic systems require switchable materials with extreme material contrast, short switching times, and negligible degradation. On the quest for these supreme properties, an in-depth understanding of the nanoscopic processes is essential. Here, we unravel the nanoscopic details of the phase transition dynamics of metallic magnesium (Mg) to dielectric magnesium hydride (MgH2) using free-standing films for in situ nanoimaging. A characteristic MgH2 phonon resonance is used to achieve unprecedented chemical specificity between the material states. Our results reveal that the hydride phase nucleates at grain boundaries, from where the hydrogenation progresses into the adjoining nanocrystallites. We measure a much faster nanoscopic hydride phase propagation in comparison to the macroscopic propagation dynamics. Our innovative method offers an engineering strategy to overcome the hitherto limited diffusion coefficients and has substantial impact on the further design, development, and analysis of switchable phase transition as well as hydrogen storage and generation materials.


Switchable optical and nanophotonic systems are of ever-increasing interest not only from a fundamental (15) but also from an applied standpoint (613). Materials with prominent metal to insulator phase transitions (14, 15) are prime candidates for such systems and have thus been investigated in great detail. The extreme change of the optical properties at the transition from the metallic to the dielectric phase renders them highly relevant for switchable optical and active plasmonic systems.

One prominent and archetypical material system is magnesium (Mg), which has been widely studied, however, mainly in the context of hydrogen storage (1623). In its initial metallic state, Mg shows large free electron densities accompanied with comparably small parasitic loss and is consequently an excellent plasmonic material (24, 25). Exposing Mg to hydrogen (H2) induces the phase transition from metallic Mg to dielectric magnesium (di)hydride (MgH2), a highly transparent dielectric material. The MgH2 phase can be reversed into the metallic Mg state, making the phase transition fully cyclical. Conceptually, this allows us to controllably and reversibly switch the plasmonic resonances of Mg nanostructures on and off. First studies proved the applicability of the Mg-MgH2 phase transition for switchable metasurfaces (26) enabling dynamic holography (27) or dynamic plasmonic color displays (28, 29).

Widespread applications are thus far hindered by a number of limiting factors and obstacles such as the volume expansion of the material upon hydrogenation (30), poor cyclability, limited hydrogen diffusion coefficients, and similar. While measurable progress has been made in the understanding of nanoscale diffusion (31, 32), a number of application-related obstacles and the strategies to overcome these are related to the following unanswered questions at the boundary between the micro- and nanoscale: Is the comparably slow macroscopic diffusion limited by an intrinsically limited nanoscopic diffusion? What is the influence of the grain boundaries, the nanoscale crystallinity and the crystallite formation of the Mg films on the macroscopic diffusion (33)? Why does alloying of Mg with, e.g., nickel (Ni) increase the diffusion coefficient, nanoscopically speaking (3438)? Answering these questions will lay out new routes to improving the material systems and bringing them closer to the proposed applications.

The aforementioned challenges underline that an in-depth nanoscale investigation of the switching behavior with chemical specificity is highly desired. In our contribution, we present a definite analysis using scattering-type scanning near-field optical microscopy (s-SNOM) (3947). We introduce, on the one hand, a technique that allows an in situ imaging of the hydrogenation dynamics of Mg to investigate the influence of nanoscale morphology and crystallinity on the hydride formation process with the high spatial resolution, in this case less than 20 nm. On the other hand, we demonstrate that we can exploit the existence of a strong phonon mode in the dielectric MgH2 state to achieve unprecedented chemical resolution and specificity between the metallic and dielectric state of our switchable material system. It becomes possible to spatially visualize in situ the hydrogenation process with nanometer resolution and image the nanoscopic influence of small grain boundaries in great detail, in contrast to previous studies (32). We conclude that individual crystallites load hydrogen on substantially shorter time scales than the bulk macroscopic film. Our results suggest that the limited macroscopic hydrogenation speed is related to the prominent crystallite and grain boundary formation in Mg films, highlighting the possibility for future improvements.

In addition, our method is applicable for investigations on several other gas-in-metal systems, where the gas causes a sufficient change in the optical properties of the pristine metal. Especially for hydrogen storage, hydrogen generation (48), and electrochemical applications, the influence of, e.g., grain boundaries in a huge diversity of material systems is of great interest.


The main idea of our method is sketched in Fig. 1A. We use gold grids precoated with a 2 to 3 nm palladium (Pd) thin film. Subsequently, we thermally evaporate 10 nm Pd, 5 nm titanium (Ti), and 50 nm Mg thin films. The Pd acts as a catalytic layer, splitting the hydrogen molecules and enabling the diffusion into the Mg film (49, 50). Ti is used to prevent alloying of Mg and Pd, which would cause the formation of a hydrogen diffusion barrier (51, 52). Mounting the grids into a homebuilt gas cell, hydrogen gas can access the free-standing thin films from below, while the top Mg surface is accessible for the s-SNOM measurements. Scanning the tip of the s-SNOM over the exposed Mg surface, we can observe and investigate in situ the time dynamics of the hydride formation and the diffusion of hydrogen into the film with nanometer resolution. All measurements are performed at room temperature. Note that due to oxidization of the surface of Mg, a thin MgO layer is formed (see Materials and Methods for further information about the influence of MgO). However, as discussed below, it is transparent at our imaging frequency of the MgH2 phonon and is barely influencing our s-SNOM measurement.

Fig. 1 In situ s-SNOM principle.

(A) Schematic drawing of the principle for in situ s-SNOM. We use free-standing thin films realized by thermally evaporating 10 nm Pd, 5 nm Ti, and 50 nm Mg on a Pd-Au membrane. This allows hydrogenation from below. The metalized AFM tip of the s-SNOM setup is scanning the top surface to investigate the local optical properties, while the Mg thin film is absorbing hydrogen. In addition, a characteristic IR phonon of MgH2 enables chemically specific imaging. The Mg layer is in contact with air, causing oxidization. However, the very thin MgO layer is transparent for imaging at the frequency of the MgH2 phonon and is barely influencing our s-SNOM measurements. (B and C) Optical images (taken in reflection) showing the s-SNOM cantilever and the free-standing Mg film in its pristine state and after 60 min of hydrogen gas exposure (2% at 1 bar), respectively. Photo credits: J. Karst (University of Stuttgart).

In Fig. 1 (B and C), optical images (taken in reflection) depict the s-SNOM cantilever and the surface of the Mg film in its pristine state and after 60 min of hydrogenation. The film is exposed to a H2 concentration of 2% in nitrogen (N2) at 1 bar pressure with a flow rate of 0.3 liter/min. The highly reflective metallic Mg film switches to dielectric MgH2, which appears black. In addition, we marked the reference position, where we take reference s-SNOM measurements to normalize all near-field s-SNOM measurements (see Materials and Methods for information about the reference measurements).

As a first step, we are introducing the main measurement quantities and their respective importance in our experimental routine in Fig. 2. Generally speaking, an s-SNOM measurement delivers two main quantities: topological information and information about the local optical properties, i.e., the complex dielectric function of the sample surface (44). The atomic force microscopy (AFM) cantilever is raster scanned over the sample surface and delivers the surface topography. An incident light field is additionally scattered from the oscillating tip and reports information about the local nanoscopic interaction of this light field with the sample surface. Appropriate demodulation and detection techniques allow inferring on the local optical properties with nanoscale resolution (see Materials and Methods for detailed information about the measurement setup).

Fig. 2 Near-field appearance of the Mg-MgH2 phase transition.

(A to D) s-SNOM measurements depicting the same area of a 50 nm Mg film in its pristine state and after 10 min of hydrogenation at room temperature. (A) The topography depicts the expansion of the individual nanocrystallites of the polycrystalline Mg film during hydrogenation. (B) The mechanical phase φmech indicates clear grain boundaries between the individual nanocrystallites of the polycrystalline Mg film. By applying an edge detection filter, we extract a mask of these grain boundaries. (C) The scattering amplitude s4 (fourth demodulation order) drops when metallic Mg changes to dielectric MgH2. However, the scattering amplitude is also highly influenced by the surface roughness, as grain boundaries are visible in the two-dimensional (2D) scans plotted in (C). This leads to an inaccuracy in the determination where Mg has switched to MgH2, as both, a change in the optical properties and a change in the surface morphology/roughness, change the scattering amplitude. (D) The scattering phase φ4 displays a very high material contrast between metallic Mg (blue appearance) and dielectric MgH2 (red appearance). This is achieved by performing s-SNOM measurements at a characteristic IR phonon resonance of MgH2 and allows a chemically specific nanoscale imaging of the hydrogen diffusion without the influence of the surface topography. The 2D images are overlaid with the grain boundary mask from (B). (E) Nano-FTIR spectra of the near-field scattering phase taken on Mg (blue) and MgH2 (red). The plot shows the average and SD of four positions each. The distinct phonon resonance of MgH2 peaks at v¯=1320 cm1 and causes a maximum scattering phase difference of Δφ ≈ 130° between MgH2 and Mg.

Typical s-SNOM measurements of the same area of a Mg film are depicted in Fig. 2 (A to D). For comparison, we plot these measurements for the film in its pristine state (left columns) and after 10 min of hydrogenation (right columns). All measurements of one column are acquired simultaneously in one single s-SNOM scan. Panels A and B of Fig. 2 depict the information obtained from the AFM part of the s-SNOM, which are the surface topography or height variation of the surface and the mechanical cantilever oscillation phase, respectively. As seen, the visibility of the boundaries between individual grains is much higher in the mechanical phase as compared to the topography. Consequently, we use the mechanical phase for a grain boundary extraction.

As mentioned, the tip is illuminated with a strong light field to probe the local optical properties of the material. Panels C and D of Fig. 2 depict the near-field scattering amplitude and phase, respectively. The tip illumination frequency is v¯=1280 cm1 (λ = 7.6 μm). We find that the scattering amplitude is influenced by changes in the local optical properties and by changes of the film topography. Consequently, it is close to impossible to disentangle these two independent processes from the data. In contrast, the scattering phase shown in Fig. 2D exhibits supreme phase contrast between Mg (blue) and MgH2 (red), without any detectable influence of sample topography and morphology. The reason for this remarkable finding, which is at the heart of our technique, lies with a characteristic infrared (IR) phonon of MgH2 at about 1320 cm−1. This resonant phenomenon leads to a substantial increased local absorption of the incident radiation, placing our experiments in the strong absorption regime (53). Strong absorption is known to influence both scattering amplitude and phase (54). However, we find that in our case, the impact on the scattering phase is much larger as compared to the scattering amplitude. Thus, the MgH2 phonon causes a distinct signature of the hydrogenated areas compared to the metallic regions in which this phonon is absent. A comparison of the scattering phase material contrast for different illumination frequencies is shown in fig. S2.

To prove the resonant nature of this enhancement phenomenon, we have studied the scattering phase in dependence of the wavelength of the exciting radiation. The spectral dependence of the near-field scattering phase is plotted in Fig. 2E for MgH2 (red) and Mg (blue) (see Materials and Methods and fig. S3 for further information). The solid thin lines indicate the average of four positions, whereas the SD is plotted in lighter colors in the background. One can see the signature of an IR phonon resonance around v¯=1320 cm1. We ascribe this resonant enhancement to the known phonon mode of MgH2 in this spectral region (55). In stark contrast, the scattering phase of metallic Mg is spectrally flat over the entire spectral range. The corresponding spectra of the scattering amplitude for Mg and MgH2 can be found in fig. S4. As expected, we find a dispersive line shape in the scattering amplitude spectrum for MgH2. Furthermore, we can see that the strong absorption causes, as mentioned above, a much higher contrast between Mg and MgH2 in the scattering phase than in the amplitude. This is in good quantitative and qualitative agreement with contrast calculations via the extended dipole model (56). These results can be found in figs. S4 and S5. This remarkable finding consequently enables chemically specific imaging of the Mg/MgH2 phase transition and, in combination with the grain boundary mask from the mechanical phase measurement, allows us to precisely track hydride formation.

Following the aforementioned findings, we are investigating the hydrogenation of our free-standing Mg films by inspection of the scattering phase maps. To facilitate interpretation, we overlay these phase maps with the grain boundaries as extracted from the mechanical phase maps. We show these combined maps in Fig. 3 for selected time steps of the in situ hydrogen absorption process in Mg. All images show the same area of the film, which is achieved by pre- and postmeasurement drift correction (see Materials and Methods for details).

Fig. 3 Chemically specific in situ nanoscale imaging of the diffusion dynamics of hydrogen into a 50nm Mg thin film.

We plot 2D s-SNOM images of the scattering phase φ4 at several time steps of the hydrogen loading process. See the Supplementary Materials for a video of the nanoscale hydrogen diffusion process, showing also the corresponding scattering amplitude images, and Materials and Methods for details about the exact measurement and hydrogenation procedure. All scans are performed with an illumination frequency of v¯=1280 cm1. Hydrogenated areas (dielectric MgH2) lead to a large shift of the optical phase compared to metallic Mg, as visualized by a blue-to-red transition. An overlay with grain boundary masks allows an excellent tracking of the MgH2 formation and a detailed study of the diffusion mechanism of hydrogen in Mg thin films. We find that hydride formation is nucleated at grain boundaries and is followed by a growth process of these nucleation centers. The hydrogenation front progresses from grain to grain until channels of MgH2 have formed all over the film surface. The phase formation stops, although the surface is not completely switched from Mg to MgH2.

Our in situ nanoimaging of the hydrogenation dynamics of Mg gives us the unique opportunity to understand the nanoscale hydride phase formation in Mg in detail. Before hydrogenation, we observe a nearly constant scattering phase over the entire field of view, indicating a pure metallic Mg state. After t = 2.5 min, we see that the hydrogenation of Mg to MgH2 starts at several positions simultaneously. Most probably, hydrogen enters the film via weak spots (see fig. S6) from below. Note that due to the finite thickness of the film and the hydrogen exposure from below, we observe a superposition of vertical and lateral hydride phase propagation. The first hydride formation occurs directly at the grain boundaries, which matches our expectation as the grain boundaries are known as fast diffusion paths in Mg (31). From here, hydrogen permeates laterally into adjoining grains/single nanocrystallites until they are fully loaded. Note that, as the hydrogen is delivered from below, the hydride formation might also have the possibility to start from the bottom edge of a grain/lower grain boundary. This nucleation and growth process dominates for the first 10 min. Simultaneously, a hydrogenation front progresses from grain to grain, causing the size of the hydrogenated areas to grow until several of these areas combine. This leads to the formation of channels of MgH2 all over the film surface. The width of these channels is on the order of several tens of nanometers, and they are caused by hydrogenated and unhydrogenated Mg, which is in stark contrast to previous studies where similar linear arrangements on the tens of micrometer scale have been found (23). After t = 20 min, the hydrogen absorption becomes substantially slower. We attribute this to the well-known formation of a blocking layer inside the Mg film (see again fig. S6 for more information about the vertical diffusion hypothesis) (16, 57). MgH2 itself acts as a diffusion barrier for hydrogen and thus prevents continued hydrogenation of the film. Carefully comparing the optical phase maps, one can already qualitatively assess that the hydride phase front propagation stops after 30 min. This behavior can also be found quantitatively when examining the time dynamics of the total scattering amplitude and phase, which can be found in fig. S7. Interestingly, even after 60 min of hydrogen exposure and saturation, the film surface has not completely hydrogenated and shows a MgH2 content of only 38% in the probed surface layer. This is also observed at a different illumination frequency. Figure S10 shows that, in both cases, the unhydrogenated material is left, which is, on first sight, unexpected from literature for Mg (21), but has also been found in hydrogenated niobium films (58). However, we explain this behavior, on the one hand, again with the formation of the blocking layer, which halts the vertical hydrogen front progression (59), leaving areas at the surface in the pristine state (see fig. S6). On the other hand, as our samples are hydrogenated from below, Mg has no direct exposure to hydrogen gas, but only Pd does (see Fig. 1A). Because of the large volume expansion during hydrogenation of the rough Mg film, cracks form and can cause individual Mg grains to be decoupled either from adjoining Mg/MgH2 grains or from hydrogen-delivering PdHx/TiHx below. Consequently, hydrogen can leak out at the top of the Mg surface as it can pass the Mg film without any contact to Mg and leave unhydrogenated areas/grains. We also studied hydrogen desorption, which can be found in figs. S8 and S9.

We have seen that our in situ technique allows us to track the hydrogenation of the metallic Mg film with very high spatial resolution, measurably larger as compared to conventional optical microscopy. Consequently, further analysis of the data shown in Fig. 3 will allow us to distinguish between the nanoscopic and macroscopic hydride phase propagation dynamics in Mg, providing valuable insight into the fundamental hydrogenation processes. Already quantitatively, it can be seen that individual grains seem to switch on very short time scales compared to the progression of the hydrogenation in the entire film. The individual hydrogen loading times of four selected crystallites are extracted from the data shown in Fig. 3 and are depicted in Fig. 4 in direct comparison with the loading dynamics of the entire film. The data extraction works as follows. The hydrogen loading of the individual grain is tracked by determining the relative hydrogenated area AMgH2(t)/AGrain, where AMgH2(t) is the total hydrogenated grain area at time t and AGrain is the total size of the grain after hydrogenation. The data are shown color-coded according to the marked positions of the grains in the scattering phase image of the pristine Mg film on the right. The same procedure is applied to determine the hydrogen loading dynamics of the entire film. Here, we used two different methods to normalize the hydrogenated film area AMgH2(t). The solid line and squares represent the dynamics when normalizing to the area of the entire measured film (including unhydrogenated areas) →AMgH2(t)/AEntire Film. The dashed line represents the dynamics when normalizing only to the maximum hydrogenated area of the entire film →AMgH2(t)/AHydrogenated Film. When comparing film and grains, we find that, no matter which normalization we choose, the individual grains load much faster. From the inset in Fig. 4, showing a zoom-in of 1 to 10 min, we find that all grains are fully loaded within only a few minutes. In particular, grain 2 reaches a loading of 75% of its total surface area in less than 2 min. This behavior is a clear indication that the limited hydrogen diffusion in Mg films, as observed in many experimental studies, is not related to the nanoscopic diffusion and is thus fundamentally limited but lies with the morphology of the film itself. After every individual grain, the hydrogenation of the film stops and requires a new nucleation spot before the next grain transforms. This indicates that a tailoring of grain size and an increase of the grain boundary or nucleation site density are a promising route to decrease the film hydrogen loading times.

Fig. 4 Dynamics of the hydride phase propagation in individual grains versus the entire film.

We plot the relative hydrogenated area AMgH2(t)/AGrain/Film in dependence of the hydrogen diffusion time. The relative hydrogenated area is obtained by determining the total area of MgH2 (from the optical phase data shown in Fig. 3) in four individual grains and in the entire film, respectively. Then, we normalize it to the size of the respective grain and entire film, respectively. In addition, we plot the relative hydrogenated area in the whole film when normalized to the maximum hydrogenated area of the entire film. The analyzed grains are marked in the near-field scattering phase image of the pristine Mg film on the right with the respective color. The inset shows a zoom-in of the time dependency of the hydride formation between 1 and 10 min, allowing a better comparison of the loading times. The loading in individual Mg grains is faster than the diffusion of hydrogen in the entire film. We observe, e.g., for grain 2, a loading of 75% of its area in less than 1 min.

As mentioned above, we observe substantial amounts of pristine metallic Mg on the surface of our films, even after 60 min of hydrogenation. Comparing our results to literature findings, this behavior appears unexpected as the film is expected to have fully hydrogenated after saturation (21). This apparent contradiction can be explained when closely examining the changing film morphology and particularly the film expansion. Figure 5A depicts the topography of the film after 2, 10, 20, and 60 min of hydrogen exposure. The surface roughness changes drastically during the hydrogenation process. After 2 min, we find a finely structured surface with small peaks, which are mostly located at grain boundaries. After 10 min, the peaks are almost completely gone, and the film starts to expand quickly vertically and also most probably laterally. The more hydrogen is absorbed, the rougher the surface becomes, and large hills and valleys are formed after 60 min of hydrogen diffusion (the time dependency of the surface roughness is shown in fig. S7, where we find a fast and large increase and end with a very high value of root mean square of 6.6 nm for a 50 nm film). From this topography, we can calculate the local vertical expansion by referencing the height value at each pixel to the corresponding height value of the pristine Mg film (see Materials and Methods for details). We obtain the images shown in Fig. 5B for 2, 10, 20, and 60 min. The respective histograms of these images are shown in Fig. 5C. We find from the local vertical expansion that for the first 2 min, the expansion is mostly limited to grain boundaries, where we observed the small peaks in the topography. Further film expansion is mostly limited to whole grains that expand, in part, by more than 60%. In addition, there are areas/grains that show a negative vertical expansion. This can be explained with our free-standing film. In contrast to a pinned film on a substrate, our film can expand during hydrogenation not only in the positive z direction but also in the negative z direction. This causes a large change of the surface roughness, leading to not only very high but also small negative expansion values. In general, we find that the histogram of the vertical expansion becomes broader the longer hydrogen is absorbed, which coincides with the increase of the surface roughness for longer H2 diffusion. In addition, the average vertical expansion, which is obtained by integrating the respective histogram, increases with longer hydrogen diffusion (see Fig. 5D). We reach a maximum average expansion of 25.8% after 60 min of hydrogenation. As already mentioned, a completely hydrogenated Mg film should expand, on average, by approximately 30% in volume. Our free-standing film is still clamped on the grid, causing most of the expansion to happen vertically and not laterally. The small lateral expansion leads to the bulging of the film. Consequently, our value of 25.8% results in a hydrogenated Mg volume of approximately 86%, meaning that most of the volume below the measured area of the Mg film has switched to MgH2. This finding alleviates the apparent contradiction observed in the data of Fig. 3. Our in situ s-SNOM technique is highly surface sensitive, and we are thus measuring mainly the surface (5 to 10 nm) of the film that retains metallic Mg, while the film as a whole is close to fully hydrogenated (see Materials and Methods about the imaging depth). This behavior additionally supports our assumption of the formation of the blocking layer and the leakage of hydrogen at the top surface. We have thus found that, in contrast to common expectation for such a thin 50-nm film (21), a certain fraction of Mg remains metallic. This so far unknown aspect might offer additional adjustment possibilities for future material engineering. Furthermore, it was shown that quantitative investigations of vertical material compositions are possible using s-SNOM measurements (60, 61). Comparing multilayered finite dipole models with experimental tomographic s-SNOM data will allow to study, e.g., the local hydrogenation depth in our Mg/MgH2 films.

Fig. 5 Vertical expansion during hydrogenation.

(A) Topography of the Mg thin film after 2, 10, 20, and 60 min of hydrogen exposure. First, there are small peaks appearing. The longer the hydrogenation takes, the rougher/more uneven the surface becomes. (B and C) 2D images of the local vertical expansion and their histograms for the same time steps as in (A) showing a local vertical expansion of more than 60%. The average vertical expansion is calculated by integrating each histogram. (D) Average vertical expansion versus time. For a fully hydrogenated Mg film, one would expect the expansion to be 30%. As the hydrogen absorption in our 50-nm Mg film has saturated while still areas of metallic Mg were left, we reach a maximum average vertical expansion of approximately 25%. This can be explained with the hydrogenation front propagation in the vertical direction through the Mg film as indicated in fig. S6.


In conclusion, we have investigated the nanoscale hydrogen diffusion dynamics in an in situ environment using s-SNOM. A characteristic IR phonon resonance of MgH2 enabled chemical specificity to unambiguously track the hydride formation, nucleation, and lateral growth. We find that this process is highly influenced by the nanoscale morphology of the Mg film. This morphology seems to be mainly responsible for the slow hydrogen diffusion through the entire film. The hydrogenation stopped before the entire film is switched, leaving areas of metallic Mg within the dielectric MgH2. From the analysis of the local and average vertical expansion, we can deduce that a MgH2 blocking layer has formed below the surface, preventing further hydrogen diffusing through the film. In addition, we have proven that individual Mg grains show hydrogen loading dynamics that are faster than the dynamics on the macroscopic film scale. This behavior is caused by an effective averaging over single nanocrystallites and grain boundaries. Thus, we expect, on the one hand, thin films with large monocrystalline grains to exhibit a measurably faster overall hydrogen diffusion coefficient. On the other hand, as our findings have shown that the hydrogenation requires nucleation at grain boundaries, an increased grain boundary density should also speed up the overall hydrogenation process. This could explain the substantial improvement of hydrogen diffusion coefficients in alloyed Mg systems, such as MgxNiy thin films (62), in which we observe very small grains and thus large grain boundary densities. Our findings have immediate implications for a number of active optical and plasmonic systems, where Mg but also other phase transition materials are being used. Our work is an important step forward in enhancing and understanding the diffusion kinetics, dynamics, and efficiency of phase change as well as a huge variety of hydrogen storage and generation materials.


Fabrication of free-standing films

To enable in situ s-SNOM measurements, we use transmission electron microscopy (TEM) gold grids (Substratek, Ted Pella Inc.), which are precoated with a 2- to 3-nm-thin Pd film and have the following properties: pitch, 83 μm; hole width, 58 μm; and bar width, 25 μm. We thermally evaporate 10-nm Pd, 5-nm Ti, and 50-nm Mg with an evaporation rate of 1 ± 0.2 Å/s, 1 ± 0.2 Å/s, and 4.5 ± 0.5 Å/s, respectively (without breaking the vacuum in between two consecutive evaporation steps). During evaporation, the sample is kept at a constant temperature of T = 20 ° C. Consequently, at the holes of the TEM grid, we obtain free-standing thin films.

s-SNOM measurement principle including reference

For all s-SNOM measurements, a commercial s-SNOM (neaSNOM, neaspec) equipped with a liquid nitrogen–cooled mercury-cadmium-telluride detector is used. A platinum-iridium–coated AFM tip with a tip radius of 25 nm and a cantilever resonance frequency of approximately 285 kHz (NanoWorld Arrow, NCPt) serves as near-field probe. We are using a pseudo-heterodyne interferometric lock-in detection of the backscattered light from the tip and surrounding sample to obtain the optical near-field information (63). Using the sidebands of the fourth harmonic (n = 4) of the cantilever oscillation frequency ωtip, we obtain the amplitude s4 and phase φ4 of the scattered electric field. The approach curves are shown in fig. S1 for the demodulation orders n = 2, 3, and 4 after 0, 10, and 30 min of H2 diffusion, respectively, revealing a characteristic near-field decay over the length scale of the tip radius. For the tip illumination, a parametric frequency converter system (Alpha-HP, Stuttgart Instruments) and a subsequent difference-frequency generation allows us to tune the illumination wavelength in the mid-IR from λ = 1.4 μm to λ = 20 μm (64). To specifically address individual phonon resonances, the output radiation of the aforementioned light source is filtered with a grating monochromator to below 10 cm−1 full width at half maximum.

Our in situ s-SNOM measurements of the hydrogenation of Mg are taken on the free-standing film, where hydrogen can directly access the Pd film via a homebuilt gas flow cell from below. The measured area is 1 μm × 1 μm with a resolution of 100 pixels × 100 pixels. First, we take an s-SNOM scan of the pristine Mg film while flushing the flow cell with pure N2. When the scan is finished, we add 2% of H2 in N2 to hydrogenate the sample for a time t. Subsequently, we turn H2 off and flush again with pure N2 to keep the Mg/MgH2 film in its current state and to prevent the desorption of hydrogen during the s-SNOM scan. We take another scan and repeat this procedure until the hydrogenation saturates and no more hydrogen is absorbed.

We take reference measurements to normalize and correct our near-field scattering amplitude and phase data. As marked in Fig. 1C, the reference measurements are taken on the grid, as here the Mg film is not influenced by the hydrogenation and stays in its pristine state for the whole 60 min of H2 exposure. We take a reference s-SNOM measurement (1 μm × 1 μm with a resolution of 50 pixels × 50 pixels) after each hydrogenation time step t and correct the near-field scattering amplitude s and phase φ as followssi,j,norm(t)=si,j(t)s¯ref(t)φi,j,norm(t)=φi,j(t)φ¯ref(t)where i,j denote the pixel coordinate in the respective s-SNOM measurement; si,j,norm(t) and φi,j,norm(t) denote the normalized/corrected scattering amplitude and phase value of this pixel, respectively; si,j(t) and φi,j(t) denote the raw values of the pixel; and s¯ref(t) and φ¯ref(t) are the mean values of the scattering amplitude and phase of the reference measurement, respectively.

Influence of MgO

There is always a very thin self-terminating layer of MgO (approximately 5 nm) being formed on the surface. However, as neither Mg, MgO (65), nor any Mg(OH)x compounds (66, 67) but only MgH2 has a characteristic material resonance at our imaging wavelength, we can tell with certainty where MgH2 is formed and where it is not. In addition, as MgO and Mg(OH)x are dielectric materials, we expect them to be mostly transparent at the imaging wavelength in our near-field s-SNOM measurements.

Nano-FTIR spectra and scattering phase contrast

The near-field spectra of Mg and MgH2 in Fig. 2E are measured using the Nano–Fourier transform IR (FTIR) module of our s-SNOM using homodyne detection (68, 69). The spectra are measured on a sample where the Mg and MgH2 phases coexist but are spatially well separated (see fig. S3 for more details). We observe a large SD on MgH2 for v¯<1400 cm1. The origin lies within the measurement principle to obtain the Nano-FTIR scattering phase spectra. It is based on stitching together 17 individual spectra as it is shown in detail in fig. S3. Between the measurement of two individual spectra, we have to reposition our sample to compensate for sample drift. The inaccuracy in this repositioning causes an error in the scattering phase spectrum, which seems to be large on the rough MgH2 for wave numbers v¯<1400 cm1.

Imaging depth

In the scattering phase images in Fig. 3, we find a typical phase difference of Δφ4 ≈ 120° between Mg and MgH2. However, there are areas where a phase shift of only Δφ4 ≈ 60° occurs, letting them appear white on the chosen color map. The reason lies within the imaging depth of s-SNOM. The laser illumination of the s-SNOM tip region induces a dipole in the tip, leading to a strong field enhancement in its apex region. This dipole interacts with the probed material via an induced mirror dipole at a finite depth in the material, giving feedback about the material’s local dielectric function (43). Thus, the imaging depth is strongly dependent on the local material. As we are imaging (highly) absorptive materials (Mg, MgH2) in the IR, we expect the imaging depth to be small (5 to 10 nm below the surface) (7072). The 5-nm MgO layer should be partly transparent at the imaging wavelength. Consequently, the material below the surface influences the measured near-field scattering amplitude and phase. At positions where MgH2 is formed just below the surface but a small layer of the material above is still metallic Mg, we have to assume an effective local dielectric function with contributions from both Mg and MgH2. This lowers the probed local absorption and consequently leads to a reduced near-field scattering phase shift of Δφ4 ≈ 60°.

Drift correction

To be able to show the same area of the Mg film during hydrogenation, we have to compensate for sample drift not only between two subsequent s-SNOM measurements but also during a single s-SNOM measurement. This is done by premeasurement repositioning of the sample followed by a postmeasurement drift correction. Here, we track the position of two fixed points in each frame at time t manually and compensate for the drift by shifting and stretching the x-y grid of the respective s-SNOM scan. We obtain for each frame an x′-y′ grid, where the pixels of each s-SNOM scan correspond to the almost same positions of the Mg/MgH2 film. Subsequently, we interpolate the respective data onto the original x-y grid and crop the area that lies within all s-SNOM scans.

Vertical expansion

The vertical expansion is determined from the height data of the time series of s-SNOM (AFM) measurements. First, we calculate the incremental vertical expansion between consecutive s-SNOM scans. Afterward, the total vertical expansion is obtained by summing up all previous incremental vertical expansions. In detail:

The incremental vertical expansion VEi,j(tn) of pixel i,j of the s-SNOM scan at time step tn is calculated asVEi,j(tn)=zi,j(tn)zi,j(tn1)Δz(tn)dMgwhere zi,j(tn) is the height of the pixel at time step tn, zi,j(tn − 1) is the height of the same pixel at the previous time step tn−1, and dMg = 50 nm is the total thickness of the pristine Mg film. During the hydrogenation, the film exhibits an overall bulging that we have to account for by introducing a correction factor Δz(tn). We define it as follows (23).

First, the lateral length scale of the bulging is large compared to the measured field of view (see Fig. 1). Second, the time difference Δt = tntn−1 between two consecutive s-SNOM scans is so small that the change of the respective topography is small, too, and only small incremental height adjustments have to be made. This is the reason why we assume a constant height correction factor for all measured pixels. In addition, as the film mostly expands in the positive z direction, the small changes of the topography happen at high film positions. Thus, we select a thin layer of pixels at low z values to calculate the incremental correction factor Δz(tn). It is given asΔz(tn)=z2nm(tn)¯z2nm(tn1)¯where z2nm(tn)¯ and z2nm(tn1)¯ denote the mean height value of all pixels at time step tn and tn−1, respectively, which lie within the lowest 2 nm of the respective height scan. These pixels are marked for each time step in fig. S11.

Note that we cannot always choose the same pixels in every topography scan to calculate Δz. The reason lies within the local film expansion due to hydrogenation at individual areas. In addition, it is almost impossible to perfectly correct the s-SNOM data for a sample drift (see procedure above). This means that the pixels would not correspond to the exact same position of the film surface. Consequently, this would lead to an overestimation of the vertical expansion.

Last, the total vertical expansion of pixel i, j after time step tn, as plotted in Fig. 5 (B and C), is then calculated relative to t0 = 0 min by adding all previous incremental vertical expansions, namelyVEtot,i,j(tn)=k=1n VEi,j(tk)


Supplementary material for this article is available at

This is an open-access article distributed under the terms of the Creative Commons Attribution-NonCommercial license, which permits use, distribution, and reproduction in any medium, so long as the resultant use is not for commercial advantage and provided the original work is properly cited.


Acknowledgments: We would like to thank R. Griessen (Vrije Universiteit Amsterdam) for input and scientific discussions. A. Steinmann, T. Steinle, and F. Mörz are acknowledged for contributions to the experimental setup. Funding: We acknowledge the financial support from the European Research Council (ERC Advanced Grant Complexplas), Bundesministerium für Bildung und Forschung, Deutsche Forschungsgemeinschaft (SPP1839 Tailored Disorder and SPP1391 Ultrafast Nanooptics), Carl-Zeiss Stiftung, and Baden-Württemberg Stiftung. Author contributions: H.L. and H.G. conceived the project. J.K. carried out the SNOM experiments and the data analysis. T.W. and J.K. performed the contrast calculations. F.S., H.L., and M.H. contributed to the measurements, data analysis, and sample fabrication. H.G. supervised the project. All authors discussed the results and contributed to the writing of the manuscript. Competing interests: The authors declare that they have no competing interests. Data and materials availability: All data needed to evaluate the conclusions in the paper are present in the paper and/or the Supplementary Materials. Additional data related to this paper may be requested from the authors.

Stay Connected to Science Advances

Navigate This Article