Statistical thermodynamics is one of the pillars of the atomistic theory of matter1,2,3. In this context, the partition function plays a central role, bridging the distribution of states in a given system with macroscopic quantities, such as the free energy or specific heats. Because of the astronomically large number of available microstates in a typical many-molecule ensemble, extracting thermodynamic quantities through partition functions is elusive for all, but the simplest of molecular systems. Alone for a single molecule, the configurational component4 of the classical partition function5 reads,

where R is the number of distinguishable atoms, V is the volume and U the potential energy of a specific microstate configuration. This configurational partition function, depending on the positional part of the spatial degrees of freedom and the potential energy only, can be expressed as4,

provided that each microstate i corresponds to a uniquely defined configuration x1, …, zR and that the configurational space N is complete.

The advent of nanoscale science offers to drastically reduce the configurational space N by molecular constraining. The most striking achievements have been obtained by intricate measurements at non-equilibrium conditions. For instance, single-molecule fluorescence grants access to the dynamics of large-amplitude conformational changes6,7, and force measurements with sharp probes or molecular tweezers8,9,10,11,12 can be related to single-molecule thermodynamics13,14,15,16. In addition, other nanoscale investigations were reported implying ensemble averaging of many-molecule distributions17,18,19,20. The commonality of these examples is that they rely on ensemble- or time-averaging a collection of observable macromolecular features that are fundamentally sub-molecular in nature. Therefore, microscopic thermodynamic information, that is, microstate probabilities with atomic precision, is usually lost21,22. However, it is clear that the exploration of the spatial degrees of freedom underlying the configurational partition function can be expressed geometrically for a given system.

From the modelling point of view, molecular dynamic (MD) simulations currently provide a central approach to compute microstate probabilities with atomic precision23. With the use of classical force fields (FFs) and emerging strategies such as network projections21,24, MD simulations allow computing equilibrium microstate probabilities with millions of microscopic molecular states and microsecond timescales, thereby offering the possibility of full convergence to the ergodic limit. A drawback in MD modelling is the dependence on FF validation, which limits its use to well-known systems. Because of this inherent restriction, a common strategy in single-molecule experiments has become to calculate zero-temperature potential energy surfaces through ab initio methods and assume their relevance for finite-temperature experiments25,26,27,28.

Altogether, neither experimental nor simulation techniques have tackled temperature-dependent free energies of single molecules in well-defined equilibrium environments with sub-molecular resolution. The ability to do so provides not only fundamental insights and multiple prospects for single-molecule thermodynamics, but also may be regarded as the basis for new types of sensors, computing and encryption protocols in molecular science.

Using surface-confined nanoporous metal-organic nanomeshes (MONs) on a weakly corrugated Ag(111) surface, exploration of the equilibrium thermodynamics of single caged species at equilibrium conditions becomes possible. The generic recipe for the preparation of two-dimensional (2D) MONs is the deposition of multitopic ligands on an atomistically clean planar substrate (for example, silver, copper) followed by evaporation of a transition metal (for example, cobalt, iron) and annealing under ultrahigh vacuum (UHV) conditions to induce metal-directed assembly of coordination networks29,30,31,32,33,34. MONs provide versatile scaffolds to confine atoms or molecules31,33,35, tune interfacial electronic landscapes35,36 and steer metal growth29. They constitute 2D analogues of the broader field of three-dimensional (3D) reticular and framework chemistry37, where confined dynamics can be investigated38.

Herein, we exploit the molecular confinement as a platform to directly probe time-average patterns (TAPs) expressing a multitude of single-molecule states. Importantly, with the reduced space, ab initio parameterization of molecular FFs is possible, allowing MD sampling and extraction of equilibrium microstate probability distributions with atomic precision. To tackle this issue, we implement a projection of the configurational partition function in real space (which effectively constitutes a projection of the microstate probability distribution4) and establish its correlation with the experimental TAPs. We use this approach to quantify ergodicity at the nanoscale, computing free energy differences between experimentally accessible TAPs and simulations amounting to 0.5 kcal mol−1 at 250 K and with sub-molecular resolution. This quantification allows by-design (predictive39) thermodynamics and grants access to customized potential energy landscapes, which can be used to encrypt/decrypt information in (x, y, T) space at the ergodic limit. These latter findings and concepts provide intriguing analogies to the recently reported holographic encoding based on surface-confined fermionic states designed by molecular manipulation protocols40.


Preparation of nanopores trapping single molecules

The dynamic behaviour of organic molecules at homogenous surfaces has been extensively studied and deep insight has been gained in their mobility characteristics. Using scanning tunnelling microscopy (STM) investigations, molecular-level characterization of individual diffusing species became possible41. Notably the translation or rotational motions of aromatic flat-lying species could be followed in exquisite detail, and evidence appeared that the formation of supramolecules or nanoarchitectures leads to special mobility scenarios where intermolecular interactions sensitively interfere27,42,43.

Through adequate assembly protocols we prepared MONs with mainly single molecules captured in the hexagonal pores. The STM image and model in Fig. 1 depict a porous network structure defining a regular honeycomb superlattice from para-sexiphenyl-dicarbonitrile, with threefold lateral coordination to Co centres. By caging an additional rod-like single linker, a system is at hand whose dynamics can be followed in detail by temperature-controlled measurements, because the regular shape, nm extension and aspect ratio of the molecule are favourable for identification in STM data (all images presented in this work exclusively show nanopores in which a single molecule is trapped). Note that the length of the molecule (29.6 Å) is comparable to the size of the network pore (rim-to-rim distance of 58 Å).

Figure 1: Confinement of single molecules in a surface-supported two-dimensional metal-organic nanomesh.
figure 1

(a) Perspective scanning tunnelling microscopy (STM) image recorded at 8 K showing the static configuration: in two of the honeycomb pore hosts an individual immobilized sexiphenyl dicarbonitrile molecule has been trapped (emphasized by a light colour). (b) Model showing the registry of the metal-organic superlattice with the underlying Ag(111) substrate (Co centres with lateral threefold coordination to CN groups are shown in pink). The caged unit (with N-to-N distance of 29.6 Å indicated in cyan) is oriented along high-symmetry substrate directions and attached to the nanomesh rim by weak non-covalent bonding. The nanopore’s outer diameter is 67 Å.

Upon positioning a guest species in the regular nanopore of a MON, the 2D thermal motions become restricted to a patch of nanometre dimensions (specifically, to the ~24-nm2 van der Waals cavity of the network for the system under investigation32), and at the same time are influenced by the presence of the nanomesh rims that represent unsurmountable walls, provided the thermal excitations are reasonably low. As a consequence, the number of available microstates of the system reduces markedly, opening the possibility to perform simulations at the ergodic (predictive) limit. Previous STM studies31,32 of 2D MONs on the Ag(111) surface under UHV conditions based on the Co-directed assembly of dicarbonitrile oligophenyls44 revealed caged supramolecular dynamers in propeller-like trimeric configurations33. Interestingly, the findings testified reversible switching from a 2D chiral six-star pattern at 87 K to a higher-symmetry twelve-star pattern at 145 K, as a consequence of rapid chirality interconversions. Such pattern modulation suggests that specific pattern coding via energy landscape design and encryption through temperature control is possible. This offers the possibility of encrypting/decrypting information by thermodynamic design alone, that is, at the ergodic limit. Indeed, a thermodynamically encrypted pattern is uniquely defined and more predictable than a kinetic one.

Equilibrium states and dynamics of caged single molecules

The guest species’ thermal motions are frozen at T=8±1 K, under which conditions low-temperature STM data reveal (Fig. 2a) their preferred attachment via a carbonitrile (CN) group to the MON honeycomb’s rim close to the vertices (cf. Fig. 1b). The backbone orientation follows low-index <10> substrate directions, and for symmetry reasons 12 such equivalent configurations coexist. With slightly higher temperatures a one-dimensional (1D) guided diffusion27 sets in, as illustrated by the image sequence in Fig. 2b–f obtained at 28 K. During this lateral motion, the guest molecules follow the phenylene backbone of a honeycomb segment while keeping their orientation. Intermediate states between the preferred corner positions often imply a fractional imaging (Fig. 2c,e) of the guest, due to the reduced residence time of these states being shorter than the minimum measurement period with the employed scanning frequency and area. Accordingly, guests in corner positions are associated with the highest occurrence probability, which similarly appears in a statistical analysis of an ensemble (cf. Fig. 2h–l).

Figure 2: STM imaging and thermodynamic methods addressing caged single molecules at varying temperatures (8 K (blue), 30 K (yellow) and 82 K (orange)).
figure 2

(a) STM image of static configurations with caged immobilized single guests in the hexagonal pores at Tsample=8±1 K. (bf) STM image sequence following the guided 1D thermal motion of a guest along a honeycomb rim in a selected pore at Tsample=30±1 K, associated with a path between two equivalent microstates. Models are superimposed (tunnelling parameters VB=2.0 V, IT=0.1 nA; average time lapse 720 s). (g) Time-averaged pattern of the previous sequence using molecular models indirectly rendered through equation (2). (hk) Statistical analysis of overview STM data recorded at 30±1 K, identifying different microstates and their occupation frequency. (l) Transient configuration identified in a close-up measurement, elusive in large-area surveys. (m) Ensemble-averaged pattern (EAP) of a distribution of 86 molecular models with the microstate weights as shown in hk, indirectly rendered using equation (2). (n) High intrapore mobility at Tsample=82±1 K: rapid diffusion with preferential occupation of microstates identified at lower temperatures lead to a characteristic STM imaging pattern with sixfold symmetry. (o) High-resolution single-molecule time-average pattern (TAP) in an individual pore at 82±1 K: the main features are reproduced by the overlay of consecutive 30±1 K EAP in m; (pu). Scale bars, 29 Å.

Upon further increase of the temperature, a fundamentally different imaging regime unfolds, reflecting a high mobility of single guests, which is clearly distinct from related effects with caged supramolecules (cf. Supplementary Fig. 1). This is illustrated by the STM data, recorded at 82±1 K, depicted in Fig. 2n,o: now exactly the same characteristic pattern with sixfold symmetry is identified in all occupied pores. From the thermodynamic viewpoint, the caged species now perform both translational and rotational motion in the pore. Thus, rapid intrapore thermal motions including transient occupation of all accessible states occurs, with hopping rates largely exceeding that of the fast-scanning direction (typically 4 Hz). Accordingly, the imaging process renders an intrapore corrugation pattern with intensity maxima retracing the preferred configurations33,45,46,47.

Direct vs indirect thermodynamic averaging in real space

Low-temperature STM imaging is often used to reveal microstates, that is, single-molecule configurations corresponding to local energy minima. At such cryogenic conditions, the statistical occurrence of the different microstates not necessarily represents an equithermal molecular distribution, due to possible kinetic trapping of intermediate microstates39. One apparent solution to this problem would be a statistical analysis at a temperature where transitions between the intermediate microstates of interest occur, such that equilibration of the molecular ensemble becomes possible. In our system, these transitions set in at T≈30 K as demonstrated by the experimental STM time frames in Fig. 2b–f, where a caged molecule diffuses along a honeycomb segment from an initial position designated G to the opposite G′ (vide infra). It is illustrative to represent the situation in graphical form as a TAP, which can be indirectly constructed by dividing the pore space in a pixel-wise fashion. Note that the term ‘indirect’ refers to the mathematical reconstruction of an observable from isolated samples. By averaging the pixel-wise occupation probability p we have,

where M is the number of the considered time frames. The parameter s equals 1 if a molecule populates the volume represented by the pixel and 0 otherwise. The example in Fig. 2g depicts the so-constructed TAP using the very limited serial data set of Fig. 2b–f, whence we find the same occupation probability for the five apparent microstates along the pore segment instead of the proper statistical weights. In other words, because of the relevant timescales, pore-state equilibrium properties were not extracted reliably.

According to the ergodic theorem, a second strategy consists in analysing extensive data sets to construct the ensemble-averaged pattern (EAP) at the same temperature by the indirect means of equation (1), where M now refers to the number of inspected pores. For large numbers, all relevant microstates should be observed with the appropriate statistical weights. When 86 single-molecule-occupied pores are measured at 30±1 K and analysed, we find that 76 are distributed among microstates G and G′ (Fig. 2h,i), while 10 correspond to intermediate microstates I and I′ (Fig. 2j,k), that is, there is an occupation probability of 0.88 for G,G′. The rendering of the pertaining EAP is illustrated in Fig. 2m and captures basic statistical characteristics of the system. However, a transient microstate C that could be identified in close-up measurements (cf. Fig. 2l) proved elusive in the overview scans, since it is too short-lived. These limitations demonstrate that for addressing single-molecule thermodynamics of molecular species in caging environments, indirect TAP- or EAP-averaging methods may be insufficient or even misleading.

For an increased acquisition frequency of microstate statistics, raising the temperature is an efficient means to boost diffusion rates. Confining the single molecule to a specific nanoscopic area is hereby essential for keeping the accessible microstate space constant. Thus, ergodic microstates sampling within a well-defined environment becomes possible, and we can directly measure TAPs representing equilibrium properties. For our system a wide temperature range (between 70 and 145 K) exists, where the dynamic behaviour of single caged molecules produces quasi-static topographies for the reasons addressed above, and all occupied pores show exactly the same TAP. An exemplary situation is depicted in Fig. 2n, where seven filled pores were simultaneously monitored at 82±1 K, all exhibiting the same distinct hexagonally symmetric pattern. High-resolution data (Fig. 2o) reveal that its main features can be mimicked by symmetry operations obeying the signature of the nanopore (Fig. 2p–u, where the contrast is normalized for clarity) applied to the previous indirect EAP model (Fig. 2m). These experimental patterns present a direct visualization concerning the projection of the pertaining molecular configurational partition functions and notably reflect both 2D translational, rotational, and part of the vibrational motions of the caged molecules under equilibrium conditions. Accordingly, we can interpret them as a projected partition functions (PPF) for individual caged molecules in the framework of Boltzmann statistics1,3,48 (vide infra). It is worth mentioning that the classical configurational partition function does not take into account electronically excited states, and the treatment in the next sections supposes molecules in their ground electronic configuration. This is a good approximation considering the experimental conditions (T<150 K).

Energy landscape and modelling

The analysis of STM results indicates an energetically favourable microstate where the confined molecule resides near one pore vertex. The high-resolution STM image with the atomic models for the underlying Ag(111) (cf. Fig. 3a, silver atoms as dark-grey spheres, the Co-adatoms (red) and molecules (black, white and blue)) shows how this ‘ground’ microstate G aligns along the surface lattice in a <10> direction. For a model description of the system by MD simulations at finite temperature, high-quality FFs have to be developed. Accordingly, an all-atom MD model of the pore was constructed using customized FF parameterization (see Supplementary Figs 2–8). Initially, the electrostatic potential of the empty pore was parameterized to the density functional theory (DFT) electrostatic potential of the full unit cell (Fig. 3b). Subsequently, the ground state geometry was calculated using DFT, reproducing the experimentally observed microstate G (Fig. 3c). Then, the molecule was translated in perpendicular orientation along the honeycomb segment, while keeping a constant distance of 2.18 Å between the rim atoms and the nitrogen of the guest at an adsorption height of 3.0 Å. For reproducing the energy landscape, the FF’s electrostatic parameters and ad hoc image charges were fitted (Fig. 3d) to match the DFT results (Fig. 3d, blue line). For the sake of MD sampling efficiency, the electrostatic parameters are tuned to underestimate the DFT barriers between the microstates, while reproducing the microstate energy differences (Fig. 3d, green line). Despite this approximation, we find that the rotation rates of a caged trimeric dynamer in a pore with our model at 250 K of (5.6±2.6) × 107 Hz are in good agreement with experimental rotation rates of 1.8 × 108 Hz (ref. 49). Note how the DFT and FF landscape sets the scene for the STM observations depicted in Fig. 2h–k: the second-most favourable microstate is the ‘intermediate’ microstate I2, lying 20 meV above the G microstate. Intriguingly, Fig. 3d also reveals how the microstate minima (red arrows) closely follow the surface corrugation rather than the non-covalent interactions with the pore rim. Nevertheless, the energetically favoured G microstate seems to be at an ideal position between biphenyl hydrogens as previously reported for the underlying non-covalent interaction scheme between CN groups and phenyl rings50,51.

Figure 3: Energy landscape of single guest translated along the honeycomb rim.
figure 3

(a) STM image at 8 K showing the favoured microstate of a caged molecule. (b) Electrostatic potential slab at a height of 3 Å from the Ag(111) obtained from solving the Poisson equation for a density functional theory (DFT) generated density, and from force-field (FF) point charges. The white (neutral charge) areas inside the pores correspond to the position of the Ag(111) surface layer atoms. (c) The fully relaxed molecule at the G microstate using DFT-D level of theory. (d) The force-field (red and green lines) and DFT (blue line) energies of a molecule translated across the path shown in Fig. 2b–f with a distance of 2.18 Å between the terminal N and the pore rim. Scale bars, 20 Å.

Image free energy and MD analysis

Next, we introduce a method to model and analyse the TAPs in a local, pixel-wise fashion by MD simulation sampling. As a simple test case, the guided diffusion along a single decorated pore rim is considered, that is, we hypothesize a simple 1D dynamic regime. This essentially implies that an equilibrium situation exists corresponding to the experimental EAP at 30±1 K (cf. Fig. 2m). Note again, such an illustrative 1D diffusion scenario cannot be addressed by an STM TAP (imaging at slightly higher temperatures causes spurious 2D intrapore diffusion pathways). Using equation (3) and two MD relaxed frames (M=2), a pore state consisting of the G,G′ microstates with a 50% population each (Fig. 4a) can be rendered. For comparison, Fig. 4b depicts in detail the previous 86-frame indirect EAP extracted from STM data (cf. Fig. 2m). Herein, the occupation probability for the microstate G is 0.44, which amounts to a combined G,G′ occupation probability pref=0.88 (that is, the experimental value). To detail the following image free energy analysis, a normalized free energy difference is defined between molecular reference states (e.g. A or B) as , where R is the ideal gas constant (free energies are henceforth expressed in terms of T−1 to show clear differences over a range of temperatures). Considering the state composed by microstates G,G′ with respect to the EAP at 30 K, with pref A=1 and pref B=0.88, respectively, this free energy difference amounts to .

Figure 4: Images as quantitative thermodynamic measurements of a guided diffusion scenario.
figure 4

(a) Rendering of the static microstates G,G′. (b) Ensemble-average (EAP) image-rendering of 86 experimental molecular microstates at 30 K through using equation (2). (c) Sum over states (zpixel) along the pore rim at T=30 K, obtained by means of equation (5), with M equalling 4 × 104 frames obtained from molecular dynamics (MD) simulations (See Methods). (d,e) Schematics of the configurational partition function per pixel in e. exemplifying how microstates with non-equal Boltzmann weights per pixel are summed to a single pixel in d within the current implementation of equation (5) (see Methods). (f) The probability of a pixel along the blue coordinate in c, using the zpixel method. The same coordinate for an alternative exponential average re-weighting ppixel method (orange). A simple exponential average p*pixel (black) is also shown for comparison (see Supplementary Fig. 10). (g) The Boltzmann distribution of the green and yellow pixel shown in f. (h) Normalized free energies from the sum over states and ensemble average patterns (ac). Error bars are s.d. Scale bars, 10 Å.

Notably, we can obtain the normalized free energy from graphical real-space analysis to establish quantitative correlations to molecular-level spatially resolving experimental techniques. By substituting pref from molecular reference microstates to pixel reference microstates, a free energy now associated with projected microstates is obtained by summing over the image (projected) pixels,

Equation (4) can also be used to compare molecular microstates under certain conditions, namely if the number of pixels (area or volume) between two states does not overlap. For instance, using pref A=0.5 (in Fig. 4a a value exclusive to the G′ molecular microstate area), for the reference state G′,G representation in Fig. 4a, . For Fig. 4b with pref B=0.44, . By taking the difference between the former and latter pore states we recover a free energy difference of , close to the value determined above. Likewise, the free energy of the G′G molecular state can be recovered by adding the degeneracy of −R ln(2) to the G′ molecular state (that is, , ). These examples compare molecular microstates with few overlapping pixels, a condition not always fulfilled. Thus equation (4) formally compares pixel or projected microstates, rather than molecular ones. Importantly, an image free energy can also be measured from a microstate probability projected onto a real-space reaction coordinate. For this, we project (see Supplementary Equations 1–6) the configurational partition function in pixels, zpixel,

where β=kT−1 and Ui is an improved potential energy of the ith-microstate configuration (with 3R atomic coordinates x1, ..., zR) with respect to the G ground state of the whole system. The r.h.s. of equation (5) shows that to extract the N configurational microstates from a homogenous MD sampling space (MD frames), a delta function is used: delta (δik) equals 0 when the ith-microstate’s configuration is repeated and 1 otherwise.

Equation (5) is an exact projection of the configurational partition function for three degrees of freedom if the N microstate space is complete and the pixel volume is small enough to avoid spatial degeneracy (see below). For the single confined molecules in Figs 4 and 5, we use an effective pixel projection size of 1.0 Å3 in a 80 × 80 × 8-Å3 box, forming a 51,200 entry matrix. A 3D box/matrix is chosen to include all configurations (that is, different interphenyl torsion angles, backbone bending and so on). The size of the box was chosen for diagnosis and image-rendering purposes, as well as to include the immobile MON frame. Using the r.h.s. of equation (5) with the number of MD frames amounting to 5 × 104 as sampled by MD (see Methods), we construct the numerical PPF matrix at 30 K, rendering the position of the carbon atoms with pixels (Fig. 4c). The method is again easily understood by tracing a blue line across the so-constructed PPF matrix in Fig. 4c. First, a single pixel zpixel is highlighted across the profile, as illustrated with a rectangular box in Fig. 4d. Our computational implementation of equation (5) (see Methods) makes the value of a single pixel correspond to the sum over a single Boltzmann distribution as illustrated in green in Fig. 4e. Actual pixel values for Fig. 4c are highlighted in green and red in Fig. 4f,g. As such, this practical implementation of integrating a pixel projection over energy levels, rather than configurational states, is exact only for independent particles (see Supplementary Equations 1–6 and Supplementary Fig. 13). The independent particle approximation disregards the density-of-states contribution in a single pixel but partially considers it between pixels, as illustrated in Fig. 4e,g. Subsequently, equation (4) can be applied to the atomistic simulation in Fig. 4c (using pref as the value corresponding to the area of the molecule) leading to .

Figure 5: Time-averaged patterns and their modelling.
figure 5

(a) High-resolution STM time-averaged pattern (TAP) at 82±2. (b) Projected partition function (PPF) renderings of a single molecule in the pore at 80 K. Blue triangle side 9.5 Å. (c,d) STM TAP and PPF at 145±5 K and 145 K, respectively. The tunnelling parameters in (a,c) are VB=50 mV, It=100 pA. (e) Differences between TAP and the PPF through image free energy of a single confined molecule at different temperatures computed using the r.h.s. of equation (5) in equation (4). The normalization is carried out using pref as the maximum value in the confined pore. The inset shows the linear fit F (T−1)=−15.0+176 T−1 using data between 180 and 500 K. (f) Changes in the 2D pattern of the projected partition functions vs temperature. Images were rendered using carbon pixel projections in the aromatic backbone only with a pixel size of 1 Å3. Free energies were extracted from similar images rendered by decreasing their resolution to 80 × 80 pixels. Situations at 20 K and 500 K are not experimentally accessible (see text). (g) The molecular velocity distribution in molecular dynamics (MD) simulations at 250 K of single 1 Å2 pixels in the centre of the pore and near the rim. Maxwell–Boltzmann fits show the respective pixel temperatures. Inset: the frame average of the MD sampling at 250 K. Error bars are s.d. Scale bars, 10 Å.

The free energy between our computation model and the G,G′ state, , is in agreement with the value calculated from the indirect EAP in Fig. 4b, . Thus, the difference between our computational method (involving zpixel applied to our atomistic simulation) and experiment (EAP) is 0.15 cal mol−1 K−1. Such free energy comparison between projected states is expected to complement current structure–model correlations by, for example, root mean square atomic deviations.

It is worth mentioning that alternate analysis methods can also be employed to re-weight MD’s configurations52,53 or histograms54. Figure 4f depicts the probability along the blue coordinate in Fig. 4c using the zpixel method and averaging methods; the exponential re-weighting method52 (ppixel) and a simple exponential average (p*pixel) (Supplementary Fig. 10). The single exponential average p*pixel (black line) serves to exemplify the exponentially weighted MD distribution without removal of repeated configurational states, yielding a marked probability asymmetry of the G state and heavily underestimating the probability of the I1 state. Hence, it is clear that only re-weighting methods can be compared with the zpixel method. However, re-weighting methods are only valid for a correct MD distribution (which is not always available, cf. next section), whereas the zpixel method just requires homogeneous sampling of the configurational space. Moreover, the zpixel method is a powerful diagnosis tool for atomistic parameterizations: because equation (5) is not an average, it takes only one microstate in the pore (out of hundreds of thousands of microstates) with an energy deviation of less than 10 meV (that is, the energy difference between G and I2) to completely disagree with the experiment. One commonality of the analysis methods is that they show that the local minimum energy I1 is underestimated in our atomistic model (Supplementary Fig. 9) and the state is readily sampled in the simulations (Fig. 4c). Nevertheless, states I1 and I2 are only 2 Å apart and thus the precision of the parameterization is comparable to the experimental resolution (Fig. 4b). Given a set of MD frames sampled at specific temperatures, our method can be used to calculate the free energy for all points in temperature space below the MD sampling temperature (Fig. 4h). The free energy’s absolute minimum for our one-molecule system is also shown, which is a measure of the minimum pixel occupation of one molecule. With equation (5) and the aforementioned examples at hand, it becomes clear that at the ergodic limit, a complete energy microstate space in the pore system can be sampled for the temperature of choice. At this point, the zpixel method becomes the projected configurational partition function for our experimental system. Altogether, the PPF is a powerful weighting method for homogeneous sampling, which can be implemented for large temperature differences, provided a ground state can be uniquely defined and sampled.

Direct STM TAP as a PPF

Because a direct TAP in STM through the confinement approach satisfies ergodicity, an equilibrium normalized free energy can be correctly and sub-molecularly measured at experimental temperatures. Moreover, with the numerical method for the sum over states, a direct correlation between the STM TAP imaging and the corresponding calculated PPF modelling is possible. Figure 5a shows the STM TAP image at 82±2 K, whereby the measured corrugation amplitudes are normalized to the occupation probabilities of black (0) and white (1), respectively (see Methods). The data nicely correlate with the PPF modelling at T=80 K (Fig. 5b), constructed using again MD-frame sampling by μs-long Langevin MD simulations (see Methods, note that STM TAP images are now compared with PPFs further reduced to two dimensions). The blue arrows in the experimental and simulated images also show how it is possible to even reproduce geometrical features with marginal occupation probabilities, which we attribute to a diagonal adsorption microstate (see Supplementary Fig. 9e,j). Note how sub-molecular geometrical features present in the high-resolution STM TAP image can be reproduced in great detail when using smaller matrix pixel sizes of 0.5 Å and fitting the atoms with Gaussian envelopes (see the triangle in inset Fig. 5a,b; such resolution is computationally very expensive and its broad application not practicable).

Interestingly, the PPF in Fig. 5b appears to overestimate the experimental TAP occupation probabilities near the hexagon’s centre. We attribute the discrepancy to decreased sampling near the pore edges. Notably, the intrinsically limited thermalization of the simulated hexagonal nanomesh (see Methods) artificially increases the amount of states sampled in the pore centre. This is shown in Fig. 5g, revealing that the temperature near the rim is reduced (T≈223 K) from the original configuration space sampled at 250 K. We then examined the STM data at the experimental maximum temperature of 145 K (Fig. 5c; upon exceeding this temperature the guest species leave the pores and move across the entire nanomesh), implying orders of magnitude higher diffusion rates compared with the previous 82-K situation. Under such conditions, the main TAP features are retained along with the reduced occupation probability at the pore centre (Fig. 5d).

Free energies can be extracted as detailed in the previous section. For this, we use pref=max(p), setting the occupation probability of the most probable pixel state to 1 at finite temperature in the pore. Figure 5e shows now the quantitative correlation of the PPF vs direct TAP values at T=80 and 145 K, respectively. For instance, at 80 K the difference is as small as 0.2 cal mol−1 K−1 (0.5 kcal mol−1 at 250 K). Note how the normalized occupation probability, and thus the free energy difference, between projected pixel states near the G state and the C state is reduced with increasing temperature. The inset of Fig. 5e shows the plot of the free energy vs T−1 between 180 and 500 K, where the image entropy () and image enthalpy () of the PPF method can be estimated. The entropy (a measure of the available area in the pore) amounts to and . At high temperature, the enthalpy contribution to the image free energy, which can be written , vanishes and the image entropy agrees with the image free energy for an homogeneous pore area, −15.5 cal mol−1 K−1.

Figure 5f summarizes the modulation of the PPF over a wide temperature range. The chosen colour coding emphasizes the details between the PPFs at 20, 80 and 145 K, which arise due to the increasing occupation of a manifold of microstates. These findings demonstrate the evolution of distinct patterns in (x, y, T)-space at the ergodic limit. Figure 5f also includes a hypothesized PPF modelled at 500 K, where a purely entropic situation (homogeneous pore sampling) might be experimentally expected. However, the PPF retains an articulated pattern near the pore’s centre, exemplifying the aforementioned temperature gradient and thus a slight underestimation of the image’s entropy.


The experimental demonstration of direct visualization of partition function projections along with its formalism put forward in Supplementary Equations 1–6 grants access to the bottom-up design of probability distributions directly correlated with the 3D potential space occupied by molecules. This has important implications in thermodynamic computing, encoding and probing in real space. For instance, we can systematically design the potential energy landscape for encoding information in (x, y, T)-space, which approach extends and complements the holographic encoding schemes reported previously exploiting 2D fermionic states tailored by molecular manipulation40.

The specific example chosen is the enthalpy-driven expression of the letters I, L and U (Fig. 6a–c). The nanopore’s potential energy landscape is modulated by oxidizing two cobalts in the rim and reducing a molecule. In this configuration, a single ground state adjacent to the pore’s rim is favoured, thereby providing the letter I at very low temperatures. At intermediate temperatures, the molecule occupies with significant probability its second-most favourable state by binding to the oxidized cobalt coordination node, thereby tracing an L-like configuration. Finally, at higher temperatures, additionally, population of a third microstate valley around a configuration pointing towards a second oxidized cobalt results in a U-shaped pattern. Figure 6d,e depicts the simulated PPF images demonstrating the simple enthalpy-driven scheme. By sequentially changing the PPF temperature from 30 to 1 to 300 K, the encrypted message reads ‘L I U’, acronym of Linköping University. Although the realization of the corresponding experimental system would require further major efforts, it can be concluded from the modelling alone that the PPF method acts as a powerful local-temperature probe or alternatively as a sensor, allowing fast prototyping of thermodynamic encryption and decryption schemes.

Figure 6: Simulated thermodynamic encoding of the acronym L I U.
figure 6

(ac) The energy landscape of the grid is modified to favour a single non-degenerate I ground state at low temperatures, a degenerate L average at medium temperatures and a U-shape at high temperatures. The landscape is steered by reducing a single-rim molecule adding –0.7 negative charge (blue oval) and oxidizing the cobalt coordination spheres (red circles). (d) The acronym L I U can be decrypted by changing the temperature from 30 to 1 K and then to 300 K. (e) Projected partition functions at 30, 1 and 300 K from a M=5 × 104 sampling space. A Gaussian filter was applied to the projections.

We have established a quantitative link between visualizations of simulated projected spatial partition functions and experimental STM time-averaged patterns in confined spaces and at different temperatures. Because of the confining nature of the employed single-molecule environment, both experiment and simulation represent thermal equilibrium whence single-molecule ergodicity applies. This allows for visualizations of thermodynamic probability distributions in position–temperature space with sub-nm resolution, opening up the field of thermodynamic information encoding. We expect rapid advances in custom-design systems yielding informed thermodynamic patterns through a varying temperature-dependent signature. Our investigations suggest the realization of nanoscopic thermal probe/sensors that thermodynamically encrypt/decrypt information. Apart from such emerging fields, our observations in confined spaces, theories and methods have immediate applications in the study of phase transitions, ergodicity breaking and analytical development of FFs and density functionals. We foresee that further simulations and observations of PPFs will continue with the quantitative elucidation of molecular interactions and reactions at finite temperatures in real time, with sub-nm spatial resolution.


Sample preparation and scanning tunnelling microscopy

All experiments were performed under UHV conditions using a home-built liquid-He-cooled low-temperature STM with cryoshields. The employed Ag(111) substrate was prepared by cycles of Argon sputtering and annealing. Sexiphenyl dicarbonitrile molecules were deposited from a quartz crucible in a molecular beam source at 572 K, with the substrate kept at 300 K. Sub-monolayer molecular films were subsequently exposed to a beam of Co atoms to induce the metal-directed assembly of a MON. Further molecules were added at 144 K at distinct sub-monolayer coverages to obtain a preferential decoration of honeyomb pores by monomers. All the STM images shown were recorded with ~4 Hz frequency in fast-scanning direction and subject to line-wise levelling. Data presented in this work exclusively show nanopores in which a single molecule is trapped.

Density functional theory

The periodic DFT calculations were performed with the Vienna ab-initio simulation package (VASP) code55, with the ion–core interactions described by the projector-augmented wave method56. The Perdew-Burke-Ernzerhof (PBE) functional57 was used, together with the Grimme correction58, to include van der Waals interactions. Note, that the Grimme correction was not included between Ag atoms, to avoid unphysical shrinking of the Ag slab. If not indicated otherwise, the calculations were done with a 400-eV plane wave cutoff, and the 1st Brillouin zone was sampled by the Gamma point only. A slab of three layers represented the silver surface. In the structural optimizations, the atoms in the molecules, Co-adatoms and the atoms in the outermost Ag surface layer were allowed to relax until the residual forces acting on each atom were smaller than 0.03 eV Å−1.

Molecular dynamics

All-atom MD simulations were performed with the CHARMM 36b2 Package59 using the scripts provided in the Supplementary Data. The simulation system featured 7,811 atoms (carbon, nitrogen, hydrogen, silver and cobalt atoms) in an isolated nanopore with infinite non-bonded cutoffs. Langevin and Nose–Hoover thermostats were used with three different thermostat friction coefficients and integration timesteps of 2 fs. The SHAKE60 module was used to constrain all C–C and H—C bond lengths. The C22 parameters were used for providing C and H bending, dihedral and vdW parameters during MD simulations. Thus, only rotational, translational and some vibrational degrees of freedom are considered in our system. All electrostatics and adsorption vdW parameters (Supplementary Tables 1 and 2) were parameterized following procedures shown in Supplementary Figs 2–7. The metal substrate and the metal-organic framework pore were kept fixed during the simulations. For sampling the microstates bound to a honeycomb segment in Fig. 4, Langevin59 MD simulations with a friction of 0.01 ps−1 were performed at a temperature of 100 K. This temperature is chosen to allow the molecule to diffuse from the microstate in G to the intermediate ones, but not to adjacent pore sides on the microsecond timescale. For sampling the whole pore in Fig. 5, Langevin59 MD simulations were recorded at higher temperatures (T=250 K), as a means to achieve homogeneous sampling of the pore at the simulation timescales. To obtain the MD frames in equation (5), three independent 600-ns trajectories with integration steps of 0.002 ps were combined, at temperatures given in the text.

PPF method

The PPF formalism is developed in the Supplementary Equations 1–6. Essentially, using the r.h.s. of equation (5), each pixel projection (calculated by the Boltzmann weight of each MD configuration divided by the number of occupied pixels in a 3D matrix or mesh) is integrated over energy (levels) rather than configurations (states) for sake of computationally efficiency (cf. Supplementary Figs 11–14). This integration over levels is performed by removing probability degeneracy per pixel with precision of two significant figures. Because the density of states is not explicit in this implementation, it deviates from the exact result in special cases, as discussed in the Supplementary Fig. 15. The potential energy used for the PPF method employs the electrostatic energy plus the hydrogens’ CHARMM LJ intermolecular interactions with the pore only. These energies are offset by the global G ground microstate (Supplementary Fig. 16), with energy of −0.997 eV (−23.0 kcal mol−1) for use as Ui in equation (5). Detailed information on this computation and scripts are provided in the Supplementary Discussion and Supplementary Methods. Uncertainties in the normalized free energies from the PPF and indirect TAP and EAP methods were computed from the s.d. for pixel size renderings between 1, 0.9 and 0.8 Å. For the direct TAP from experimental STM images, the s.d. are computed allowing 20% changes in the STM image contrast. Convergence of the MD simulations was deduced from the image free energy analysis (Supplementary Fig. 17). For the TAP analysis of STM images in Fig. 5a,b a Gaussian filter was first applied, followed by cropping to 80 × 80 Å. The area not belonging to molecular confinement was removed with a hexagonal mask and replaced by superposed models of the honeycomb pores. The empty area’s colour code was adjusted to the colour of one adjacent empty pore in the same STM image and the whole picture subsequently equalized until the empty area featured a colour black with an ASCII value of zero. All direct TAP and PPF images shown in the main text are rendered with a linear extrapolation made with the program V_SIM of the CNRS, CEA and INRIA ( Except for Figs. 4a-c which are rendered with a pixel size of 1.5 Å for clarity, all the free energies were extracted directly with equation (4) from images as-rendered and presented in this work (in ASCII file format with a resolution of 80 × 80 pixels, excluding superposed frame models and by means of the script in the Supplementary Data). For the thermodynamic encryption in Fig. 6, an MD simulation was performed at 400 K with the same parameters except the charge in two parameterized cobalt atoms (that is, the coordination sphere of the cobalt) was set to 0.15. A third cobalt between them was also slightly oxidized to a charge of 0.025. The two central carbons of a neighbour molecule were assigned a charge of 0.35 each. The PPF analysis was then performed with the same charge modifications at the temperatures described in the text.

Additional information

How to cite this article: Palma, C.-A. et al. Visualization and thermodynamic encoding of single-molecule partition function projections. Nat. Commun. 6:6210 doi: 10.1038/ncomms7210 (2015).