Automated piezoresponse force microscopy domain tracking during fast thermally stimulated phase transition in CuInP2S6

Real-time tracking of dynamic nanoscale processes such as phase transitions by scanning probe microscopy is a challenging task, typically requiring extensive and laborious human supervision. Smart strategies to track specific regions of interest (ROI) in the system during such transformations in a fast and automated manner are necessary to study the evolution of the microscopic changes in such dynamic systems. In this work, we realize automated ROI tracking in piezoresponse force microscopy during a fast (≈0.8 °C s−1) thermally stimulated ferroelectric-to-paraelectric phase transition in CuInP2S6. We use a combination of fast (1 frame per second) sparse scanning with compressed sensing image reconstruction and real-time offset correction via phase cross correlation. The applied methodology enables in situ fast and automated functional nanoscale characterization of a certain ROI during external stimulation that generates sample drift and changes local functionality.


Introduction
Dynamic transformations taking place at the nanoscale are key to understanding many diverse phenomena in nanoscience, ranging from cell division [1] in biology to molecule diffusion [2] and translocation [3] in chemistry, or ferroelectric domain switching [4] in physics. However, tracking specific regions of interest (ROI) at such minute length scales during such dynamic processes via scanning probe microscopy (SPM) is usually very challenging, commonly requiring extensive human supervision. Importantly, thermal drift becomes a critical technical barrier when exploring the effects of fast thermal fluctuations, where experiments are done away from equilibrium, to gain insight in dynamic transformations in the sample's structure/function relationship. For the case of SPMs, often either the piezoelectric positioners of the microscope gradually accumulate The United States Government retains and the publisher, by accepting the article for publication, acknowledges that the United States Government retains a nonexclusive, paid-up, irrevocable, worldwide license to publish or reproduce the published form of this manuscript, or allow others to do so, for the United States Government purposes. The Department of Energy will provide public access to these results of federally sponsored research in accordance with the DOE Public Access Plan (http://energy.gov/ downloads/doe-public-access-plan). * * Authors to whom any correspondence should be addressed.
Original content from this work may be used under the terms of the Creative Commons Attribution 4.0 licence. Any further distribution of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI. error as they scan or the structure under study migrates due to thermal drift, which results in the ROI falling out of the scanned area, hindering stable imaging of the same region over time. This is particularly the case when exploring changes as a function of temperature, for example, when imaging nanomechanical properties in polymers approaching glass transition [5], ion activation in solid oxide fuel cells [6], or ferroelectric properties across the transition temperature [7]. Such experimental problems need to be solved automatically and in real-time to access the interesting physics taking place at fast time scales and across large temperature ranges (such as domain wall dynamics, surface charging and so forth) and to avoid time-consuming data post-processing to correct for it [8].
Moreover, facilitating functional imaging across the transition can enable improved temporal and thermal resolution, as opposed to the traditional solutions of waiting at a specific temperature for stabilization of the scanner prior to imaging [4,7] or the loose of 2D spatial resolution in the case where the temperature is changed during the imaging so that the slow scan axis of the SPM is read as the temperature variation [9,10]. To achieve such goal, both a combination of fast 2D functional imaging scheme and specific real-time ROI tracking strategy must be combined. Recently, sparse scans using spiral trajectories have been used in scanning transmission electron microscope (STEM) [11] and SPM [12] coupled with image reconstruction algorithms to perform fast functional mapping, reducing acquisition times and, thus improving temporal resolution. Therefore, they look like a great candidate to image fast thermally excited phase transitions. Additionally, digital image registration algorithms, such as phase cross correlation [13] or Kalman filters [14] have been applied to SPM datasets to correct for translative offsets between consecutive images, allowing for e.g. the investigation of DNA molecular diffusion [2] or the monitoring of individual benzene molecules on Ag surfaces [15] or to account for drifting between consecutive line scans [16]. Although these methods have been heavily used, they are typically implemented with traditional raster scan trajectories, which are commonly slow. This means that to enable object tracking, the scan must be sufficiently large enough that the drift remains relatively small (at most, half the scan width/ height assuming the object is centered in the original frame) between any two scans. This leads to a tradeoff in the resolution that needs to be made to ensure stable tracking, and becomes problematic when the drift is large, such as the case when the temperature of the sample is changed. Furthermore, other advantages of the use of sparse spiral trajectories over the classic raster scans, is the less aggressive scan paths for the XY piezo scanners, that suffer highly non-uniform accelerations when trajectory drastically changes direction (like at the edge of the raster scan), and the minimization of tip and sample perturbation (as less sample regions are scanned), increasing probe life and reducing sample damage (specifically relevant for soft or fragile samples and for quantitative SPM methods like kelvin probe force microscopy [17], scanning dielectric microscopy [18,19] or nanomechanical mapping [20] among others, where quantification or resolution is highly affected by tip and sample geometry).
Here, we develop a method combining fast 1 frame per second (fps) sparse scanning piezoresponse force microscopy (PFM) with spiral trajectories and image reconstruction algorithms with automated ROI tracking based on phase cross correlation algorithm. First, we demonstrate the ROI tracking methodology by correcting the thermal drift in a micropatterned sample, through the topography channel. Then, we use it to track the evolution of a specific domain in CuInP 2 S 6 during a fast thermally stimulated ferroelectric to paraelectric phase transition, at a rate of ≈0.8°C s −1 . This approach can be easily extended to map other functional properties of interest acquired via SPM (Kelvin probe force microscope, conductive AFM etc) or scanning electron microscope or STEM in more general cases (where an electron beam is scanned rather than a probe) thus enabling viable pathways for ROI tracking and automatization for self-driving microscopes [21].

Materials and methods
The spiral scanning AFM is achieved using a Cypher AFM (Asylum research an Oxford Instruments company) controlled via FPGA using a custom-built LabVIEW/python interface that drives the tip motion following a spiral trajectory while, PFM is performed simultaneously using an external lock-in amplifier (Zurich Instruments, HF2LI). The tips used are commercially available ElectriMulti75-G (BudgetSensors), with a free resonance frequency of ≈75 KHz, a contact resonance frequency of ≈350 kHz and a spring constant of ≈3 N m −1 . A bias amplitude of 1 V applied close to the contact resonance frequency of the cantilever was used for the PFM measurements. The python scripts used for control, automatization and data analysis can be found in: https:// github.com/mchecanu/Fast-automated-drift-correction. The sample is composed of exfoliated flakes of CIPS-IPS transferred directly onto a fold substrate with the Scotch tape transfer method. The gold substrate was glued to a commercial atomic force microscopy steel disk and put on a commercial temperature control stage. The temperature was controlled using the commercial sample stage from Asylum research an Oxford Instruments with temperature control. The AFM experiments were performed in air environment.

Results
To demonstrate the methodology, we start by correcting the thermal drift in a micropatterned sample, through the topography channel. In figure 1(a), a schematic of the spiral tip trajectory used is shown. In figure 1(b), we present the experimental workflow that we use. Here, we perform a series of fast (1 s) sparse scans with a spiral trajectory by driving the lateral stage motion using externally generated voltage signals routed to the X and Y stage positioners of the AFM through the controller of the microscope. The spiral scan signals are generated using a field programmable gate array (FPGA) with high speed analog output channels controlled through a custom-built LabVIEW/python interface, as explained in more detail elsewhere [12]. The experimental data (topography, piezoresponse, etc) is acquired using the analog input channels of the FPGA, further processed internally to create images, and then transferred to Python for more complex image analysis. To recover the full 2D maps from the sparse scans, python programs were developed to perform 'inpainting' by means of compressed sensing (CS) [12,22,23] image reconstruction. Details of the CS implementation can be found in [11]. Generally, CS is an elegant method for obtaining solutions to an unknown system and allows for image reconstruction from fewer points than is required by the Nyquist-Shannon sampling theorem [24]. However, CS may be associated with other limitations such as reconstruction accuracy which could be addressed via more advanced reconstruction methods like Gaussian Process (GP) [12,25,26]. The choice of CS over GP, was driven by its relatively higher computation speed needed to achieve realtime tracking (even though GP usually outperforms CS in terms of accuracy [12]).
To achieve the ROI tracking, after each scan we update the position of the spiral scan for the next frame using the calculated offset to compensate for drift. Such offset is calculated with respect to the previous scan using phase cross-correlation [13]. Phase cross correlation is an image registration algorithm that allows to calculate translative offsets between two similar images using fast Fourier transforms (see figure 1(c)). Details of the mathematical formulation of it can be found elsewhere [13]. We implemented it in our code using the phase_cross_correlation function of the scikit-image python package [27], which needs the reference image and the moving image as inputs, and returns the shift vector (in pixels) required to register the moving image with the reference image. Thus, it is a suitable algorithm to track dynamical processes where there is a translative movement, but the features in the image do not change substantially. For an image series that undergoes major changes over time, it is sufficient if some regions of the sample remain stable. Also, native features or positional marks can be used with that aim [2], helping the algorithm to perform the offset correction. More rigorous image registration methods [28] can also be used in case of nonlinear distortions introduced by scanning artifacts, but for this study these were not deemed necessary.
To illustrate the workflow, we show an implementation of this methodology to track of a specific aluminum pillar (micropatterned sample) on a gold substrate. Here, we induce sample drift by heating the sample stage from 30°C to 70°C in 40 s (1°C s −1 ). The imaging speed was 1 fps, the total number of internal spirals was 16 and the image reconstruction was performed using CS. In figures 2(a), (b), we show one every 10th frame of the reconstructed image stack acquired during the thermal ramping. First (figure 2(a)), without the ROI tracking algorithm applied to illustrate the extent of the image drift under such conditions, and second ( figure 2(b)) with the ROI tracking algorithm in place, where the same pillar is imaged across the whole image stack. To illustrate the total displacement of the pillars, in figure 2 we compare the original pillar position (blue dashed line) with the final location (red dashed line). When no ROI tracking is applied, we can observe that the pillar has moved ∼2 μm from the initial position. See also animation of the full dataset without shift correction in supplementary information S1. When ROI tracking is applied, the pillar remains in the same exact location (blue and red dashed lines overlap along all the frames). This is because the center coordinates of the scan have been corrected in real time, thus tracking the pillar movement. A small deviation from the initial position can happen in single frames, but those can be corrected in subsequent frames. See also, an animation of the full dataset with shift correction in supplementary information S2.
Finally, in figure 2(c) we plot the accumulated corrected drift as a function of time as the updated (X 0 ,Y 0 ) position of the center of the sparse spiral scan. Note that the accumulated drift in pixels, is converted into an offset (which is in voltage space for the piezos), and this conversion is achieved through multiplication by a factor that is obtained dividing the maximum voltage amplitude sent to the XY piezos by the image pixel size (128 in this case). Similar methodologies had been demonstrated previously to track topographic changes [2,15], for the case of classical raster-scan images, but not for spiral scans. However, here we are interested in the tracking of functional rather than purely topographic structures in a fast manner (see supplementary information S3-S5 for the application of the methodology to track domain wall drift in periodically pooled lithium niobate).
To demonstrate this, the microscope is operated in single frequency PFM [29] mode so that the electromechanical response of the sample is measured. In figure 3, we show the fast tracking of ferroelectric domains during a thermally induced phase transition in copper indium thiophosphate flake, CuInP 2 S 6 (CIPS). CIPS is a van der Waals room temperature ferroelectric with a T C ∼ 42°C. When synthesized with Cu deficiencies, a non-ferroelectric Cufree phase, namely In 4/3 P 2 S 6 (IPS), forms and exerts chemical pressure over the CIPS domains. Due to the arrangement of In 3+ ions and vacant sites in the octahedral network the inclusion of IPS leads to an increase in the CIPS T C (up to ∼62°C). In figure 3(a), we show the topography image acquired using normal raster scan of a ≈95 nm thick flake, prepared using the exfoliation method, as explained in [30] and deposited onto a clean gold surface. Next to it we see the zoomed in (white dashed square) PFM amplitude map where we can identify the characteristic ferroelectric Cu rich domains (CIPS) and the nonferroelectric Cu-free domains (IPS). Subsequently, in figure 3(b) we show the PFM channel of the fast spiral scanned region reconstructed using CS where we can identify the same domains as in figure 3(a), which will be our ROI.
After a ROI is selected, we trigger the order-disorder phase-transition in the CIPS regions of the sample by heating up the sample holder above the Curie temperature of the material (in this case we ramp the temperature from 55°C to 80°C) and simultaneously perform the fast functional imaging at 1 fps with the automatic ROI tracking. The heating results in a reduction in the measured PFM amplitude approaching the transition temperature. We note that in this case, the signal does not completely disappear as electrostatic artifacts [31] and ionic effects [7] also contribute to the PFM signal even above T C . In supplementary material S6, we show the results of the fast PFM imaging during the phase transition without the automated ROI tracking. In there, we can observe the initial domains present in our ROI move out of the scan area hindering the study of the signal coming from the ROI versus temperature image stack. However, in figure 3(c), when the ROI tracking algorithm is applied, the microscope self-drives following the movement of the same CIPS-IPS domains of the initial ROI, and therefore the physics of interest can be studied while out of equilibrium throughout the phase transition. The animations showing all the frames acquired with and without ROI tracking can be found in supplementary material S7 and S8 respectively.
The temperature of the sample displayed in the figure is the temperature of the sample holder. The temperature of the sample is hard to determine accurately when fast temperature changes are being triggered as it will depend on diffusion of the heat, thermal conductivities, and losses of the substrate where the sample is glued and the material itself, as there is no time for thermal stabilization during the experiment. However, the qualitative decrease that we observe in the PFM amplitude as we ramp the temperature indicates that the phase transition temperature is reached. It should be noted that in principle the surface temperature of the sample can be measured through other methods, for instance through a pasted thermocouple. Therefore, here the small hysteresis observed is likely due to kinetic effect from the thermal lag. Additionally, during the temperature ramping, the sample experiences not only XY drift, but also Z drift and thermal expansion/contraction. For the current experimental setup to work, such Z movement, needs to be within the Z range of the Z piezo scanner of the AFM used (6 μm in the case of Cypher). If the Z-drift goes out of this 6 μm range, the Z piezo would be out of range not able to compensate and track for the sample topography. For the temperature ranges used in this work (55°C-80°C for the CIPS case and 30°C-70°C for the micropatterned sample) such conditions were fulfilled. In the case of the CIPS sample, a big difference in the Z drift and thermal expansion was found if measurements we performed in CIPS flakes versus measurements performed in the bulk CIPS crystal (mm thick), the latter experiencing a bigger Z drift. In the future, it should be possible to implement a coarse motion in Z to allow for larger temperature ranges to be accessed in an automated way, which we considered out of the scope for this work.
The relevance of this work relies on the combination of fast (1 fps) functional imaging is with ROI tracking, which allows for fast out-of-equilibrium functional dynamics to be studied on the same local region of the sample, drastically improving the sampling along the time/temperature axis. Thus, this opens new possibilities for using SPM to the study faster dynamic changes than previously possible while also greatly reducing the effects of drift. For the case of ferroelectric materials, phase transitions with varying cooling/ heating rates would be a straight-forward application.

Conclusions
We have designed and implemented a method to automatically track a ROI during functional PFM based on a combination of fast sparse scanning, image reconstruction, and phase cross-correlation. We have proved its ability to track a nanopillar movement at 1 fps. We also have proved its application to follow specific ferroelectric domain through a fast (≈0.8°C s −1 ) thermally driven phase transitions in CIPS-IPS flakes. We envision this approach will be crucial for selfdriving microscopes and in general in the field of computer vision.