{'fraction_non_alphanumeric': 0.03132187055087066, 'fraction_numerical': 0.014565764976453838, 'mean_word_length': 4.626309303758472, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Experimental demonstration of pitfalls and remedies for precise force deconvolution in frequency-modulation atomic force microscopy

Frequency-modulation atomic force microscopy provides an outstanding precision of the measurement of chemical bonding forces. However, as the cantilever oscillates with an amplitude A that is usually on the order of atomic dimensions or even larger, blurring occurs. To extract a force versus distance curve from an experimental frequency versus distance spectrum, a deconvolution algorithm to recover the force from the experimental frequency shift is required. It has been recently shown that this deconvolution can be an ill-posed inversion problem causing false force-distance curves. Whether an inversion problem is well- or ill-posed is determined by two factors: the shape of the force-distance curve and the oscillation amplitude used for the measurement. A proper choice of the oscillation amplitude as proposed by the in ection point test of Sader et al. [Nat. Nanotechnol. 13, 1088 (2018)] should avoid ill-posedness. Here, we experimentally validate their in ection point test by means of two experimental data sets: force-distance spectra over a single carbon monoxide molecule as well as a Fe trimer on Cu(111) measured with a set of deliberately chosen amplitudes. Furthermore, we comment on typical pitfalls which are caused by the discrete nature of experimental data and provide MATLAB code which can be used by everyone to perform this test with their own data.


I. INTRODUCTION
Chemical bonding forces and -energies with their characteristic distance dependence can be measured precisely by atomic force microscopy (AFM). 1 Frequencymodulation AFM (FM-AFM), 2 the most precise version of AFM, translates an averaged bonding force gradient into a frequency shift ∆f of a cantilever that oscillates at amplitude A. Precise measurements of bonding forces have been obtained for silicon in 2001, 3 and in 2007, the chemical identity of surface atoms was achieved by force spectroscopy. 4 These experiments were obtained with silicon cantilevers with a stiffness on the order of 10 N/m and with relatively large oscillation amplitudes on the order of about 10 nm. Although a study from 1999 5 suggested that optimized signal-to-noise ratio (SNR) is obtained for oscillation amplitudes that are on the order of the decay length of the chemical interactions (around 50 pm), large amplitudes are required for stability when using soft silicon cantilevers 6 as in the experiments listed above. 3,4 Today, many experimenters use self-detecting quartz cantilevers with a stiffness on the order of 1 kN/m (qPlus sensors) that allow the use of small oscillation amplitudes on the order of the SNR optimizing value of about 50 pm. Over the last decade, hundreds of notable results in modern areas of condensed matter physics have been obtained were small amplitudes were used, ranging from the measurements of forces acting during atomic manipulation, 7 the first imaging of organic molecules with atomic resolution, 8,9 topological insulators, 11 resolution of spin, 10 the introduction of new inert probe tips, 12 superlubricity, 13 carbon nanoribbons, 14,15 polarity compensation mechanisms in insulating perovskites, 16 , atomic silicon logic, 17 the observation of transitions from physisorption to chemisorption, 18 the atomically precise measurement of chemical reactivity of iron clusters 19 and atomically resolved studies of petroleum. 20,21 Today, the benefits of small amplitude operation have even been made possible for silicon cantilevers with a stiffness also on the order of 1 kN/m and a low-noise optical detector. 22 It is important to note that atomic force microscopy goes beyond imaging, and the experimental force versus distance data can be compared to theory, e.g. to density functional theory. 23 The precise extraction of the bonding forces from experimental frequency shifts is a sizable challenge, in particular for small oscillation amplitudes and complex bonding situations that involve multiple inflection points 24 as observed in recently in transitions from physisorption to chemisorption. 18 The frequency shift ∆f (z) is analytically given by a convolution of the force F (z) with a weight function in an interval set by the sensor oscillation amplitude A: 25 where z is the tip-sample distance of closest approach, i.e. the lower turnaround point of the tip oscillation, f 0 is the unpertubed resonance frequency and k is the stiffness of the force sensor. In order to obtain F (z) from a ∆f (z) curve, Eq. (1) must be deconvoluted or -seen from a mathematical perspective -inverted. Various solutions exist for this inversion: analytical methods in the limit of very small 2 or very big oscillation amplitudes, 26 iterative methods 27,28 and more complex techniques which requires knowledge of the amplitudes and phases of higher harmonics 29 or the frequency shift as a function of amplitude. 30 Both the Sader-Jarvis 31 and matrix method of Giessibl 25 can be used for force deconvolution with any oscillation amplitude and both methods are established and widely used. However, a recent study by Sader et al. 24 (1)]. If the curvature of F (z) changes too rapidly in that interval, information is lost in ∆f and the inversion problem becomes ill-posed. This happens at an inflection point where the curvature changes its sign. In that case, the recovered force curve deviates from the actual one for z values smaller than the position of the inflection point. This motivated the development of a test for the validity of the force deconvolution, the so-called inflection point test. 24 Here, we explore the inflection point test in more detail and demonstrate by means of two experimental data sets how to acquire valid force-distance curves using the inflection point test. MATLAB code that was developed in this work to test discrete data is available in the supplementary material and can be used by everyone to easily perform this test with their own data.

II. THE INFLECTION POINT TEST
A. Theory Figure 1 visualizes all steps of the inflection point test. 24 Starting from a ∆f (z) curve, this data is deconvoluted (with any method) to obtain the force-distance curve. The test requires that the closest tip-sample distance in this curve is defined as z = 0. If the F (z) curve contains no inflection points the force deconvolution is valid. In case there are one or more inflection points, the test must be applied to the inflection point z inf with the largest z value. To validate the force deconvolution for z > ∼ z inf the inequality of the so-called S-factor, must be checked (n prime marks denote the n-th derivative of F with respect to z). If this inequality holds, the inversion problem is well-posed for any amplitude and, therefore, the force deconvolution is valid. If not, the next step is to check whether the chosen amplitude meets the condition Here, L inf = −F (z inf )/F (z inf ) and quantifies the length scale for variation in the F (z) curve. In case Eq.
(3) is satisfied the force deconvolution is valid, otherwise, it maybe ill-posed and the amplitude must be adjusted according to Eq. (3) to obtain a reliable force curve. Instead of Eq. (2), also the condition for A can be checked directly since Eq. (2) is derived from this condition. If  the amplitude chosen in the measurement leads to a potentially ill-posed force deconvolution and the measurement cannot be repeated with a properly selected amplitude, only the force-distance curve at z > ∼ z inf − A is reliably deconvoluted. In case the force-distance curve contains more than one inflection point, the test must be repeated for each inflection point in descending order of z since the force deconvolution might only be valid to the next inflection point at a smaller z value.

B. Practical Implementation
The inflection point test requires the first and third derivative of F (z) at each inflection point z inf . However, for experimental data, both the determination of inflection points as well as the calculation of F (z) and F (z) are not trivial due to the discrete nature of the data and noise. Small, arbitrary jumps between subsequent data points cause a set of fake inflection points (especially, for F ≈ 0 at z 0) and each numerical derivative of such jumps greatly amplifies the noise. To overcome these issues, the data must be filtered. Here, we decided to use MATLAB and smooth the force curve with a smoothing spline fit. 32 This function fits piecewise polynomials to the data, controlled by a smoothing parameter p, and has three advantages compared to a running average or Gaussian filter. First, the shape of the force curve doesn't get distorted like when averaging over a few pixels so that extrema keep their magnitude. Second, since the smoothed curve consists of a set of polynomials, the function differentiate can calculate the first and second derivative of the force curve by simply calculating the analytical derivative of the polynomials, without creating additional noise. Third, the function feval allows the resolution in z to be easily increased by a factor of 10 to enhance the accuracy. The third derivative of F (z) is determined from another smoothing spline fit to F (z) using the same p value and evaluating its second spatial derivative. The parameter p must be selected by the user in a way that the fit in a small region around the tested inflection point [see Fig. 2(b)] is as smooth as possible (since this curve will be differentiated three times) but still reflects the data without any distortion. Consequently, the inflection point positions must be estimated by eye at first. With a chosen p value, the code determines their exact z positions automatically by looking for sign changes in F (z) for all z values smaller than the position of the steepest slope in the smoothed force curve which usually excludes fake inflection points in the noise. If there is more than one inflection point and the fit to F (z) is not sufficiently good for all inflection points, separate smoothing parameters p must be used for each test of each inflection point. For this case (and if the described method doesn't detect all inflection points), the code allows to manually restrict the z range. Finally, the inflection point test can be performed. MATLAB code for this smoothing, differentiation and implementation of the inflection point test is available in the supplementary material.

A. Experimental details
In the following, we demonstrate how to perform the inflection point test utilizing two experimental, i. e. discrete data sets: ∆f (z) spectra taken with a monoatomic metal tip and various amplitudes over the center of (1) a carbon monoxide (CO) molecule and (2) a single Fe trimer, both on Cu(111). Experiments were carried out with a custom-built, combined scanning tunneling and atomic force microscope operating at a temperature of 5.9 K. A qPlus sensor 33 equipped with an etched bulk tungsten tip, f 0 = 20452 Hz (20438 Hz for the second data set) and k = 1800 N/m was used and operated in frequency-modulation mode. 2 The amplitude was calibrated by recording the change in the z position of the piezo when changing the oscillation amplitude in constant-current feedback mode. 34,35 A bias of −1 mV (−0.5 mV for the second data set) was applied to the tip. Less than 0.01 monolayers of CO molecules were dosed on a Cu(111) sample which has been cleaned by repeated sputter and anneal cycles in advance. After this, a similar amount of single Fe adatoms was evaporated onto the surface and Fe trimers were created by their lateral manipulation. The first example is a data set taken over the center of a CO molecule adsorbed on Cu(111). Figure 2(a) shows short-range ∆f (z) curves, i.e. the differences between ∆f (z) spectra over the center of the CO molecule and over the bare Cu(111) surface, 3 for five different amplitudes. For each amplitude, the z position of the tip was adjusted prior to each measurement such that the turnaround points of the tip oscillation close to the sample of all spectra coincide in the same z position defined as z rel = 0 in Fig. 2. Any z drift was compensated in the post-processing by calculating the absolute tipsample distance based on the conductance and relating all measurements with each other. In order to suppress noise in the force-distance curves, all ∆f sr (z) curves were smoothed using MATLAB's smoothing spline fit 32 prior to the force deconvolution [solid lines in Fig. 2(a)]. In addition, since both the Sader-Jarvis and matrix methods require ∆f = 0 at the largest z value (otherwise, this will cause deconvolution errors), ? but the corresponding ∆f sr values exhibit an offset for all experimental data due to noise, these offsets were subtracted. Furthermore, for the matrix method, all ∆f sr (z) curves were interpolated to a finer spacing d between subsequent data points (A/d = 50) to avoid known numerical artifacts ? and down-sampled again after deconvolution. Figure 2(b) shows the short-range F (z) curves as deconvoluted from the smoothed ∆f sr (z) curves by the Sader-Jarvis and matrix method for five different amplitudes, respectively. The z axis is identical to Fig. 2(a). Although five different amplitudes with their different particular z starting points were used, all force-distance curves overlap. This is as expected by theory since the tip probed the force F (z) within the same z range, just with different amplitudes and, therefore, a different amplitude weighting according to Eq. (1). Small discrepancies between the curves arise from possible lateral offsets when re-positioning the tip over the molecule and deconvolution errors which can be up to 8 %. 31,37? z (pm) Selecting the force-distance curve measured with A = 50 pm in Fig. 2(b), the inflection point test at the curve's single inflection point z inf = 24 pm yields a S-factor of −0.86, i. e. a value larger than −1. Therefore, the force deconvolution is well-posed for any amplitude. This is also seen in the overlapping of all five F sr (z) curves with different amplitudes and proven by inflection point tests for all curves which all yield well-posed behavior for all chosen amplitudes. A different situation is given for short-range spectra over the center of a single Fe trimer on Cu(111). Figure  3(a) shows the short-range frequency shift vs. distance curves measured with four different amplitudes. Data processing and z axis definition are done in analogy to before. While the F sr (z) curves in Fig. 3(b) are almost identical for z > 120 pm, their shapes start to deviate for smaller distances. The biggest differences are given for the F sr (z) curves deconvoluted with the Sader-Jarvis method for the amplitudes of 30 and 50 pm: its curve measured with 30 pm shows an offset compared to the other curves, its curve measured with 50 pm an almost twice as big force gradient and an about 230 pN weaker force at z = 15 pm compared to the rest which exceeds known deconvolution errors. 31,37? All F sr (z) curves exhibit two inflection points. Consequently, the inflection point test must be started at the outermost inflection point. For the curve derived from the measurement with A = 50 pm, the latter is located at z inf,1 = 143 pm. The test for this point yields S(F ) = −7.1 which is smaller than −1 pointing to potential ill-posedness per Eq. (2). According to Eq. (3), the force deconvolution is only well-posed if the oscillation amplitude is outside the range between 27 and 71 pm. In fact, the force curves derived from the measurements within that amplitude range (30 and 50 pm) show a very different shape than the curves outside this range (10 and 100 pm). They are the result of an ill-posed force deconvolution and those curves cannot be trusted for z < z inf − A. Therefore, a second test at the closer inflection point at z ≈ 50 pm is superfluous.
Following the inflection point test result, an amplitude chosen outside of the stated range should lead to wellposed behavior. The inflection point test of the 10 pm force-distance curve at the outermost inflection point z inf,1 again leads to a very similar amplitude range of 26 to 71 pm for possible ill-posedness. Since the amplitude is now chosen outside this range, its force-distance curve is reliable also left from this inflection point and the next inflection point at z inf,2 = 46 pm can be tested. This results in a S-factor of −0.76 indicating that the force deconvolution is well-posed for any oscillation amplitude. Indeed, both the F sr (z) curves derived from the measurement with 10 and 100 pm match each other for both the Sader-Jarvis and the matrix method for the whole z range of the spectra. We note that, for this specific case, the matrix method returns virtually the same force-distance for all given amplitudes (as long as the spacing between the data points is sufficiently small). ? Other measurements show the matrix method exhibiting stronger variations with amplitude than the Sader-Jarvis method when the inversion is ill-posed. 24 Thus, it is always important to avoid force reconstruction when the inversion is ill-posed, regardless of the chosen deconvolution method. The inflection point test provides users with the means to achieve this goal.

IV. SUMMARY
In summary, we have explored the inflection point in detail which allows one to discriminate well-and possibly ill-posed behavior of the force deconvolution. On the basis of two examples, we have demonstrated how to apply this test to discrete experimental data. MATLAB code which semi-automates the tests and was also used in this work is available in the supplementary material. Finally, we note that a correct amplitude and piezo calibration is crucial and that the inflection point test might yield oscillation amplitudes which do not maximize the signal-to-noise ratio. 5 However, these amplitudes should be used nonetheless in order to reliably measure forces with frequency-modulation atomic force microscopy.
See supplementary material for the MATLAB file ifptest.m.
We thank John Sader for helpful discussions and the Deutsche Forschungsgemeinschaft for funding within research Project No. CRC 1277, project A02.