Methods for operando coherent X-ray diffraction of battery materials at the Advanced Photon Source

Bragg coherent X-ray diffraction imaging has become valuable for visualization of the structural, morphological and strain evolution of crystals in operando electrode materials. As the electrode material particles (either in a single-crystal form or an aggregation form of single crystals) are evenly dispersed and randomly oriented in the electrode laminate, the submicrometer-sized coherent X-ray beam can be used to probe the local properties of electrode material crystals using two approaches. Coherent multi-crystal diffraction provides collective structural information of phase transitions in tens of crystals simultaneously as well as the individual behavior from single crystals, which are oriented at the Bragg condition in the X-ray illumination volume. Bragg coherent diffractive imaging enables one to monitor the evolution of the morphology and strain in individual crystals. This work explores and highlights the Bragg coherent X-ray diffraction measurements of battery electrode materials in operando conditions at the 34-ID-C beamline at the Advanced Photon Source. The experiment is demonstrated with NaNi1/3Fe1/3Mn1/3O2, a sodium-ion cathode material loaded in a half cell. The paper will discuss, in detail, the beamline setup, sample mounting and handling, alignment strategies and the data acquisition protocols.


Introduction
The phase retrieval of diffraction with oversampling strategies was introduced by Sayre in 1952 (Sayre, 1952), though several decades would pass before coherent diffractive imaging (CDI) would be demonstrated with X-rays on a fabricated test pattern (Miao et al., 1999). A few years later, CDI techniques were applied to a gold nanoparticle in Bragg geometry to image 3D structure (Robinson et al., 2001) and the strain introduced by re-crystallization (Williams et al., 2003). In the Bragg coherent diffractive imaging (BCDI) experiment, fully coherent X-rays illuminate a single crystal that is within the coherence volume of the incident beam. Diffracted X-rays interfere about the Bragg peaks, and form coherent diffraction features about the center of the Bragg peak. One can measure the 3D coherent diffraction pattern in the vicinity of the Bragg peak, by rocking the crystal over a fraction of a degree in orientation relative to the incident beam. The 3D crystal structure and lattice distortion field can then be retrieved via phase retrieval to produce an image of the crystal. BCDI is highly sensitive to strains or the disorder/deviation in the highly periodic crystalline system. Transmission electron microscopy (TEM) has also been used to study strains in materials with very high spatial resolution (Cherkashin et al., 2017;Hÿ tch et al., 2008). However, due to the penetration power of X-rays, BCDI allows one to probe 3D strain infor-ISSN 1600-5775 mation non-destructively in operando materials with little specific sample preparation required. The white-beam Laue scanning microscope (Larson et al., 2002) and the threedimensional X-ray diffraction microscope (Schmidt et al., 2004) have also demonstrated the capabilities of strain imaging, though the spatial resolution of these methods has not yet reached below the size of typical battery cathode particles.
BCDI has been used substantially in three-dimensional strain studies, for example to study recrystallization (Williams et al., 2003), ion diffusion  and even to image the full strain tensor in a zinc oxide microcrystal (Newton et al., 2010). Due to the large penetration depth of X-rays and the nature of the BCDI technique, it has found strong application in in situ measurements. Shyprko's group at UCSD pioneered multi-crystal and single-crystal diffraction with coherent X-rays in operando lithium ion battery materials Singer et al., 2014Singer et al., , 2018. One of the most important topics in energy storage research is an understanding of the mechanisms of capacity decay during battery function. In rechargeable metal-ion batteries, it is well known that the electrochemistry behaves differently in the initial cycle and the battery experiences a relatively larger capacity loss than in later cycles. Wolf et al. (2017) have summarized the current techniques visualizing the electrochemical behavior in battery materials. X-ray powder diffraction (XRD) and X-ray spectroscopy provide the ensemble structure information and oxidation state of a specific chemical element for operando battery materials (Ren & Zuo, 2018). The full-field transmission X-ray microscope combined with X-ray absorption near the absorption edge gives local structural and oxidation state information in the field of view (Wang et al., 2013). However, the images are mostly two-dimensional projections of individual cathode particles. As discussed earlier, TEM and scanning electron microscopy (SEM) provide structural information at or near atomic resolution. However, operando measurements are limited by the nature of these techniques.
In a battery, the cathode, anode and electrolyte are the key components, which determine the battery performance. The cathode laminate is prepared as a slurry that is a mixture of active material, conductive carbon powder and binder at a specific weight ratio. Typically, the slurry is then applied onto a current collector and dried in a vacuum oven. Cathode materials are usually synthesized in two forms. One is primary particles, or single crystals, and the other is in secondary particles, which are aggregations of single crystals. The crystals/particles are randomly orientated and evenly dispersed in the cathode laminate. In this paper, the cathode crystal refers to the fundamental single crystal of the active cathode material regardless of primary or secondary particle form.
Bragg coherent X-ray diffraction (BCXD) can be exploited using two approaches for studies of electrode materials: coherent multi-crystal diffraction (CMCD) and BCDI. Using CMCD one records some fraction of the entire Debye-Scherrer ring at a reflection of interest, much like traditional powder diffraction but using a coherent beam and looking only at a small fraction of the entire powder pattern. With just tens of crystals giving signal to the measured diffraction pattern one can gain semi-statistical information on the behaviors of the cathode crystals and low-resolution information on the response of individual crystals to (dis)charge cycles. Hence, this technique fills in the capability gap between conventional XRD and BCDI. Table 1 provides the basic experimental parameters for XRD, CMCD and BCDI to clarify the differences and relationships. Previously, Singer et al. (2014) used this technique to study the LiNi 0.5 Mn 1.5 O 2 material evolution during an electrochemical reaction, especially near the two-phase coexistence state. BCDI measures the morphology and strain in single crystals. In one in situ study, a disconnection event of the cathode crystal from the conducting network was observed during discharge of the battery. An event like this can be induced for multiple reasons: the particle could shrink or move due to radiation-induced damage . CMCD and BCDI can be used individually or combined to study the operando battery materials.
In this paper we demonstrate operando measurements of BCXD from NaNi 1/3 Fe 1/3 Mn 1/3 O 2 (Xie et al., 2016), a sodiumion cathode material. The cathode material is loaded into a half cell and measured at the 34-ID-C beamline at the Advance Photon Source (APS) of Argonne National Laboratory. The fundamentals of BCDI, the beamline configuration and the sample screening are discussed in the following section. Both CMCD and BCDI measurements will then be described in detail. This work serves as a general guide for future CMCD and BCDI experiments on electrode materials in operando conditions.

Bragg coherent X-ray diffractive imaging
When a crystal is illuminated in an X-ray beam and its boundary is confined within a fully coherent volume, the  three-dimensional coherent X-ray diffraction pattern can be described by where xtal describes the electron density of the crystal, s xtal describes the surface shape of the crystal and U(r) describes the distortion field of the crystal lattice. Mathematically, equation (1) describes the modulus of a 3D Fourier transform of a complex function composed of the electron density of the finite-sized object and phase function representing the distortion of the lattice. As a result of measuring just the intensities of the pattern, the relative phase information of the recorded diffraction pattern is lost. Using oversampling data collection strategies combined with iterative phase-retrieval algorithms one can invert the Fourier transform of equation (1) and retrieve the complex electron density of the sample. The phase of the resulting image is a direct measure of the distortion of the lattice planes projected onto the direction of the measured Bragg peak q. Three-dimensional coherent diffraction patterns are recorded as illustrated in Fig. 1. The crystal is oriented at a given Bragg angle in the X-ray beam and rocked with small angular increments over a fraction of a degree about the Bragg condition. The detector is mounted distant from the sample, making sure the setup fulfills the oversampling requirement of at least two detector pixels for each coherent diffraction feature in the pattern. The detector plane is tangential to the Ewald sphere. It records 2D diffraction slices of the 3D diffraction pattern while the crystal is rocked about its Bragg condition. The rocking scan provides not only the 3D pattern that can be phased to retrieve images but also directly reveals useful information about the crystal. Take the diffraction pattern at the Bragg condition in Fig. 1 as an example. The higher-order diffraction intensities near the center of the Bragg intensity are diffraction fringes identical to those arising from a single slit discussed in introductory physics classes. In this context they are the superposition of diffracted X-rays from parallel crystal surfaces when illuminated by coherent X-rays. The scattering vector difference between adjacent fringes is a direct measure of the size of the crystal in the dimension perpendicular to those surfaces. The number of measured fringes N in a given direction reflects the spatial resolution of the data which is estimated as 1/N of the crystal size in the corresponding direction, though the resolution of images in BCDI depends on both the data and the phase-retrieval process.
To invert the measured diffraction pattern to an image, the 3D diffraction pattern is used to determine a support in real space that describes the entire diffracting volume. An initial guess is assigned in the real space, and fast Fourier transformation (FFT) is used to generate the diffraction pattern in reciprocal space. Then the measured diffraction pattern amplitude replaces the calculated pattern amplitude, which is then inverse Fourier transformed back to the real space. With appropriate real-space constraints, the reciprocal-space phase function can be optimized over iterations. These iterative algorithms were described by Fienup and are called Error Reduction (ER) and Hybrid Input-Output (HIO) (Fienup, 1982). One disadvantage of ER algorithm is that the result can be trapped at local minima. Therefore, HIO is run along with ER in an alternating fashion to improve the reliability of the converged solution (Millane & Stroud, 1997;Clark et al., 2012Clark et al., , 2015. Demonstration of BCDI measurements of an active electrode material (AEM) crystal. The diffraction patterns obtained from rocking the crystal about the Bragg condition can be phased to retrieve the structural and strain information.

Beamline layout
The 34-ID-C beamline at APS is dedicated to coherent X-ray diffraction experiments, particularly in the Bragg geometry. Fig. 2 shows a schematic of the beamline layout. The X-ray source is generated by a 3.0 cm-period undulator in the upstream half of sector 34 of the APS. The horizontal deflective mirror located at 29.6 m from the source is set to 5 mrad to filter out higher-order harmonics in the X-ray beam and provide separation of the beam from that of the other undulator at sector 34. The so-called 'pink beam' reflected from the mirror is monochromated by the Si (111) doublecrystal monochromator located at 46.1 m from the source. The monochromator at 34-ID-C works in the range 5-15 keV. Typically, 9 keV X-rays are selected for BCDI experiments. There are two sets of beam-defining slits located after the monochromator, at approximately 50 m, to further collimate the beam prior to focusing onto the sample. The X-ray beam is collimated to partially coherent or fully coherent beam depending on the requirements of the measurement. The pencil beam is then focused by a pair of Kirkpatrick-Baez (KB) mirrors onto the sample (Kirkpatrick & Baez, 1948). The focal size is $ 600 nm in each direction. The depth of focus is approximately 2 mm. If needed, the KB mirrors can be moved out of the beam path so that a pencil beam with the size of the fine-slit openings will illuminate the sample.

Sample stage
The sample is mounted in customized sample holders for coin cells and AMPIX cells, and there is also a solution for pouch cells. The holders will be described in detail in the following sections. The sample holder is placed with a kinematic mount on the sample stage. Fig. 3 illustrates the goniometer setup. The sample holder is sitting on top of a piezo precision motion stage capable of nanometre precision positioning in 3D with a range of less than 100 mm. Underneath are the coarse x, y and z motor stages which have a range of tens of millimetres and micrometre precision. Underneath the linear positioners are the angle orientation motors , and '. Forming an Eularian cradle, these motors can be combined to orient an arbitrary set of lattice planes in a sample at the Bragg condition. Mechanic drawing of the goniometer tower.

Figure 2
Schematic of the 34-ID-C beamline.

Diffractometer and detection
Prior to mounting samples, the focused X-ray beam is carefully aligned to the center of the sample manipulation circles illustrated in Fig. 3. Therefore, when a crystal is centered in the X-ray beam it is guaranteed to be at the center of the diffractometer in two of the three directions. Later in this text we discuss a standard method to align the sample in the third dimension.
In this experiment, two detector setups are used for measurements. The charge-coupled device (CCD) (Princeton Instrumentation) is mounted on a stage anchored onto the optical table. This stage allows us to adjust the detector height, detection angle and detector-to-sample distance freely within a small range. The CCD has 1300 Â 1340 pixels with 20 mm Â 20 mm pixel size that allows us to resolve diffraction features at a much closer detector distance. The disadvantage is the reproducibility of the detector position from one experiment to the next, and the CCD has a long readout time of 1-2 s. The Timepix (Amsterdam Scientific Instruments) direct photoncounting detector is mounted on a rail along the diffractometer arm. It has 512 Â 512 pixels with 55 mm Â 55 mm pixel size and can move along the rail from 0.3 m to 3 m away from the sample. The diffractometer arm can rotate outboard up to 45 and rotate up to more than 45 . The Timepix detector is used to capture single Bragg peaks, and measure the patterns while rocking the crystal. During data collection, a vacuum flightpath is mounted in between the sample and the detector to reduce the air scattering and absorption. For both the CCD and Timepix, the detection area is the full chip. However, one can save just a region of interest to reduce the data storage space.

Sample preparation
The ideal sample for BCDI measurements is perfect prismatic-shaped crystals with low strain in their pristine state, so that when strain is induced during the electrochemical reaction it can be observed as a significant phase shift introduced by the strain of the lattice . Crystals with strong intrinsic strains or other mosaic structure are less suitable for BCDI measurements as the phase structure in the pristine image will already be very highly structured and the effects of electrochemistry may be overwhelmed (Shi et al., 2013).
One major challenge in the experiment is the crystal stability under intense X-ray illumination. Often, crystals have been observed to move in the beam for various reasons, for example electrochemical interaction between the crystal and the electrolyte, radiation pressure or radiation-induced thermal expansion (Kim et al., 2016;Liang et al., 2018). While searching for a suitable signal, it is quite common to see Bragg peaks flash across the detector as a crystal rotates spontaneously into and out of a diffraction condition. Secondary particles are assemblies of nanoscale crystals that are a few micrometres in diameter. In general, crystals dispersed directly in the binding materials seem to be more mobile in the X-ray beam. Crystals that are embedded in secondary particles are relatively stable, perhaps because they are confined in their position by the adjacent crystals in the particle. However, crystals synthesized directly into secondary particles will often be severely twinned. Twinning shows up in BCDI as a strong phase structure, akin to a mosaic spread. Therefore, finding an isolated diffraction signal from individual grains in a secondary assembly can be difficult.
There are a few ways to alleviate crystal instability. In coin cells settled overnight, the crystals appear to be more stable than those freshly made. Also, the crystals in pre-cycled cells appear to be much more stable. The cathode laminate preparation also influences the positional and angular stability of a crystal. When making the cathode laminate, it appears to be advantageous to press the cathode coating very firmly. In addition, we still need to explore the range of binders available for battery cathode construction. Currently we have observed that polytetrafluoroethylene (PTFE) gives the best stability. These empirical rules also apply to the cathode materials with secondary particles. Laminate thickness and binder ratio are also very important factors for the sample preparation. However, these factors are sample dependent and require optimization in each.

Sample screening
The candidate samples are screened mainly by three criteria: crystal size, quality and stability. The crystal dimension should not exceed the illumination volume for a fully coherent focused X-ray beam. The coherent beam focused by KB mirrors is typically 600 nm. The optimized crystal size is 100-500 nm, so that the crystal does not exceed the uniform coherent area of the incident beam and will give strong diffraction signals. When a strong peak is found on the detector the precision stages can be used to determine the size of the crystal. If one scans the crystal across the beam and sees a width that is greater than the size of the beam, this is a strong indication that the particle is too large. If a suitably sized crystal is located, one typically measures it for several rocking scans over a 30 min time period to determine whether the crystal is moving or rotating significantly in the beam. For BCDI phase retrieval to work well, one also requires the Bragg peak to have a well defined intense center. As reported by Shi et al. (2013), when strain in the sample is so severe that the Bragg peak shows strong distortion, one must resort to model-based phasing methods to retrieve an image.

Sample cell setup
Currently most operando BCDI measurements of battery materials are performed in coin cells. Fig. 4(a) shows a schematic of a standard CR2032 coin cell anatomy, prepared for BCDI measurements. There are through-holes punched at the center of both shells of 1-2 mm diameter. The holes are sealed with polyamide tape on the outside surface of the shells. The coin cell is loaded in the following sequence: top shell, spacer, cathode laminate, separator soaked with electrolyte, anode research papers 224 Luxi Li et al. Coherent X-ray diffraction of battery materials laminate, spacer and bottom shell. Fig. 4(b) shows the standard holder for coin cells at the APS 34-ID-C beamline. The two parts of the holder are connected by four screws, sandwiching the coin cell. Each side has an aluminium plate sticking out for connection to cyclers. On the base of the coin cell holder, there is a kinematic mount. The counterpart is mounted on the sample stage. When mounting the sample for measurement, it is preferred to put the cathode on the downstream side of the X-ray beam, so that the diffracted beam is less attenuated or influenced by the sample environment.
The AMPIX cell, designed by Chapman's group (Borkiewicz et al., 2012) for in situ battery measurements, can be reserved from the Material Structural Group at APS. There is also an AMPIX cell holder for measurements at the 34-ID-C beamline. The advantage of the AMPIX cell is that the opening is sealed with conductive glassy carbon, in comparison with coin cells sealed with non-conductive polyamide tape, which may cause disconnection in the opening area or inhomogeneous pressure across the opening. In addition, the polyamide tape cannot seal the battery for more than a few days. The coin cells with through holes often experience electrolyte leakage. However, due to the low cost and convenience, coin cells are commonly used for in situ battery measurements. New sealing materials are being investigated to mitigate the conductivity issues. Pouch cells can also be used in the BCXD measurements.

Experimental protocols
In this paper, the coin cell setup is used to demonstrate the experimental protocols. Once a coin cell is loaded into the holder and mounted onto the sample stage, the battery voltage is checked to verify that the mounting is successful. Then the cycler clamps will be connected to the two electrodes to ensure the setup will remain undisturbed for the duration of the experiment. The extents of the coin cell aperture are then determined by translating the battery across the X-ray beam using the positioning stages on the diffractometer and monitoring the transmitted beam intensity. The limits of travel are recorded to ensure that one does not waste time trying to find a measurable signal with the beam outside of the aperture. Fig. 5 shows a schematic of the diffraction techniques described here. Commonly for XRD measurements, the area detector is positioned very close to the sample, so that it can capture multiple rings of the powder diffraction which are then azimuthally averaged to produce the usual powder diffraction pattern. The typical XRD beam is millimetres in size and illuminates millions of crystals. The resultant XRD signals provide an ensemble average of the structural information of the battery material. Traditional in situ XRD measurements of cathode materials are highly recommended prior to the CMCD and BCDI because the total shift of a given Bragg peak can be determined and used to guide positioning of the detector for coherent diffraction measurements.   Schematic of X-ray diffraction techniques used to study battery materials. The XRD image is an example of a 2D powder diffraction pattern of a sodium-ion battery material, measured at the 11-ID-C beamline, APS. CMCD and BCDI images are measured from the same sample at the 34-ID-C beamline, APS. The rough distances of the detector are illustrated for each case, though the exact distances are dependent on many variables. All three images are for demonstration. CMCD at 34-ID-C typically uses the same focused X-ray beam used for BCDI measurements with a size of $ 600 nm. With typical cathode crystal sizes in the 100-500 nm range and cathode sheets in the 10-100 mm thickness range, there are typically only hundreds of crystals illuminated within the depth of focus of the X-ray optics. Since CMCD only measures a partial diffraction ring at a specific reflection, there will be ten or fewer crystals contributing to a single measurement. A CCD camera is used to measure Bragg peaks from the crystals that happen to be oriented in the specific Bragg condition, such as those portrayed in the green box of Fig. 5. The coin cell is oriented perpendicular to the incident beam. The CCD is usually located about 20 cm from the sample stage and the height is adjusted to capture the diffraction ring of interest. At this distance the 25 mm detector area subtends a solid angle of about 7 . The CCD is carefully positioned to ensure the given powder diffraction ring is symmetric across the detector to enable straightforward data reduction.

Coherent multi-crystal diffraction
CMCD captures semi-statistical as well as individual diffraction information of crystals in the X-ray illumination volume. An advantage of the focused X-ray beam for these measurements is that one captures this semi-statistical information as a function of the local battery environment. To gain a full picture of the electrochemical activity across the entire opening of the cell one can raster scan the sample across the beam in two dimensions. Often a poorly constructed coin cell can be quickly identified by the fact that crystals near the edge of the opening show electrochemical response and those near the center will be inactive. Additionally, if the diffraction signal for individual crystals is strong, the focusing optics can be removed and the measurements carried out with a beam that is several hundred micrometres in size. This can significantly increase the number of crystals one observes on the diffraction ring.
The coherence of the incident beam and subsequent diffraction can also give access to local structural behavior of the individual crystals contributing to the CMCD pattern. As Singer et al. (2014) showed, the coherent diffraction recorded from the individual crystals in the CMCD pattern can be analyzed for the presence in multiple structural phases in individual particles. This sensitivity to local structure in multiple individual crystals simultaneously allows one to bridge the gap in understanding between traditional in situ XRD and the very specific single-crystal imaging performed with BCDI.
Operando CMCD measurements are recorded continuously throughout the (dis)charge cycle. Movie S1 in the supporting information is an example of CMCD data measured from an operando coin cell in a full (dis)charge cycle.

Bragg coherent diffractive imaging
5.2.1. Searching for candidate crystals. Just as was the case in the CMCD measurements, due to the small illumination volume of the focused X-ray beam ($ 600 nm) only a few hundred crystals are illuminated by X-rays. The possibility of finding a crystal oriented in the specific detector orientation is limited. The first step is to search for Bragg peaks from suitable crystals. We typically open the beam-defining slits to an aperture many times the coherence length; this gives sufficient flux to discover small crystals as well as the crystals oriented slightly off the perfect Bragg angle. The Timepix detector is moved to the closest position to the sample; at 34-ID-C this is 300-400 mm, so that the detector can capture a relatively large solid angle at the correct diffraction angle for the reflection of interest. A common strategy to finding a crystal is to scan the sample position across the beam while recording the integrated intensity on the detector as a function of position. Positions with large intensity can later be investigated for the presence of a suitable diffraction pattern. The candidates we search for should have very focused Bragg intensity with well resolved coherent scattering features surrounding the Bragg peak. Figure S1 of the supporting information shows examples of Bragg peaks observed during the crystal search, where panel (c) is an example of a desired diffraction pattern for BCDI measurements. The crystal should also be positionally stable. Typically, one scans the piezo precision stage to align the crystal to the center of the beam. If the width of the integrated intensity profile is larger than the size of the focused X-ray beam (typically 600 nm), this indicates that the crystal is larger than the beam itself. In this case another crystal must be found. If the found crystal fits within the beam, the next thing to do is optimize the Bragg angle by scanning the orientation of the crystal with the beam. This is done by measuring a short rocking curve and adjusting the angle to the peak of the integrated intensity profile. Once the crystal satisfies the screening criteria and is roughly aligned in the X-ray beam, the next step is to ensure it is aligned to the center of the diffractometer. Typically, a few hours are required to identify and align several crystals for measurement.
5.2.2. Alignment to the center of rotation. The candidate crystal can be a few hundred nanometres in size and buried deep within the electrode laminate, so that there is no direct way to visualize the position, and it is often away from the center of the diffractometer displaced along the beam. Therefore, the diffraction signal is monitored as an indirect way to align the crystal. Figure S2 of the supporting information shows a schematic of the crystal centering alignment. When the crystal is located at or close to the center of rotation, the rocking curve will typically have a width of a few tenths of a degree, and the evolution of coherent features in the pattern as a function of angle will be smooth and consistent from one angle to the next. If the crystal is located away from the center of the diffractometer it will simply move out of the X-ray beam during a rocking scan. This is also evident in the evolution of the coherent diffraction pattern as a function of angle. If the pattern simply turns on and off with little evolution of the diffraction pattern features, one is seeing the crystal translate through the beam instead of rotating within it.
The alignment strategy proceeds as follows, as is illustrated in Fig. S2. Assuming the crystal is located downstream of the center of rotation, when we move by a small increment (+0.1 ) a translation using the horizontal stage is needed to research papers move the sample back to the beam. The greater the horizontal motion required to place the crystal back in the beam, the further off the crystal is downstream of the diffractometer center. Hence, return to the original value and reposition the crystal in the X-ray beam, then move the crystal along the X-ray beam some distance upstream (typically 0.1 mm). Repeat the rotation of and realignment with the beam until no further realignment is required, indicating that the sample is near the center of rotation of the diffractometer. For fine adjustment, repeat the entire procedure for larger steps of and subsequently smaller translations along the beam. At the 34-ID-C beamline, there are automated macros for translating the sample upstream or downstream while maintaining alignment with the X-ray beam, once one knows the required direction to move the sample.
5.2.3. Data collection and analysis. Once the crystal is aligned to the center of rotation and moved to the Bragg condition, the next step is aligning the Bragg peak to the center of the area detector and properly position the detector sufficiently away from the sample to over-sample the diffraction pattern. While conventional wisdom dictates that a single coherent feature be sampled with just a single pixel, with the interference troughs in between also being sampled (Fienup, 1982), typically a much greater sampling will improve the robustness of the phase retrieval and improve the images (Ö ztü rk et al., 2017). Therefore, it might be necessary to move the detector further from the sample along the diffractometer arm to permit the diffraction pattern to spread out across more pixels of the area detector. A vacuum flightpath should be added between the sample and the Timepix detector to reduce the air scattering and absorption of the diffracted X-rays. The last step is to reduce the fine beam-defining slit gap to ensure the crystal is illuminated by a fully coherent X-ray beam and adjust the data acquisition time to account for the reduced incident flux.
Apart from the BCDI measurements, the battery cycler is set up with the desired cycling rate and with an idle period, usually 5-10 min, at the beginning of the cycle. The BCDI measurements are controlled by a scan macro that performs repeated measurements in a loop fashion. Each iteration of the loop starts with a fine alignment of crystal position and orientation to account for drifts of the instrumentation over time. After alignment a single 3D BCDI measurement is made. Typical rocking curve parameters are a AE 0.3 rotation range with 0.01 step size. This protocol is repeated throughout the data collection with individual scans taking about 10-20 min. During this time any changes that occur in the battery will only add artifacts to the images and reduce the image resolution. The cycler macro and the scan macro can be started simultaneously with independent recording of time stamps to correlate the charge state with the BCDI images acquired.
The BCDI measurements of battery crystals are recorded in situ under operando condition. The Bragg peak may drift, shift and deform during the electrochemical reaction due to structural evolution of the material. In this case, the CMCD plays a very important role in the BCDI measurement. The CMCD results predict the possibility of how the single-crystal diffraction pattern might change during the cycle. If the CMCD measurement shows a solid solution behavior and the diffraction pattern drifts towards to larger d-spacing, it is highly likely that the sample will do the same during the BCDI measurements in the same voltage range. Because the Timepix detector is located far away from the sample, the coherent Bragg diffraction pattern may move out of the detector's field of view. It is then possible to plan an adjustment of the diffractometer arm to accommodate the shift. In case of phase transition, the situation might become more complicated. The diffraction patterns may drift to a different d-spacing and meanwhile the shape of the pattern may evolve. In addition, the crystal might have experienced displacement as well as rotation during the phase transition, and the Bragg peak might also move along the Ewald sphere. Every material shows a different behavior in the (dis)charge cycle. To reduce the risk of losing the crystal during the BCDI measurements, multiple crystals can be selected and measured back to back. The scan macro can be adjusted to accommodate this option. Also, Bragg peaks from different reflections can be used for BCDI measurement within the instrumentation limits. Usually reflections with the strongest intensities are chosen for BCDI measurements. The acquired data are then analyzed by the iterative phase-retrieval method, which is available at the 34-ID-C beamline. The program details of the phase-retrieval programs have been given by Clark et al. (2012Clark et al. ( , 2015. These programs include an ability to correct for distortions in the diffraction patterns caused by the propagation, and subsequent scattering, of the beam through material following the crystal of interest. This correction is akin to a partial coherence effect that would indeed blur the diffraction pattern through incomplete interference. Hruszkewycz et al. (2010) showed that isolated aberrations in the coherent diffraction pattern needed to fulfill a specific criterion to have any noticeable effect on the retrieved image. Since our diffracted beam traverses many hundreds of other cathode crystals and the conducting backer foil, we conclude that single aberrations do not pose a risk to these methods. Instead, the randomness of the sample stack contributes an average blurring to the diffraction patterns that is accounted for by the partial coherence correction described by Clark et al. (2012). Fig. 1 illustrates a 3D data set and the image that can be retrieved from such data. The 3D diffraction pattern shows nice fringes due to coherent diffraction from smooth surfaces of the crystal. In the retrieved image the rendering is an isocontour in the amplitude (electron density). The coloring of that surface is representative of the phase of the complex density representing the local distortion of the lattice. Here a NaNi 1/3 Fe 1/3 Mn 1/3 O 2 single crystal was measured in pristine state. The crystal is 200 nm in the largest dimension and 50 nm in the smallest.

Development in progress
Typically, the battery sample should be studied by in situ XRD, CMCD and BCDI in sequence. However, to reduce the total research papers data acquisition time and the radiation dose to the sample, CMCD and BCDI measurements can be performed simultaneously. This is typically done for well studied materials, from which the behavior is easily predicted. Both the CMCD and BCDI setup can be arranged without conflict. The difficulty here is that the CCD detector can require up to 2 s of readout time depending on the detection readout area. The mechanical beam shutter located upstream of the sample is synchronized to the CCD and remains shut during the readout time. Therefore, the Timepix should be set to have a wait time identical to the CCD readout time throughout the entire measurement. This feature is currently under development and has made promising progress.
During BCDI measurements, the Bragg peak may shift due to phase transition or move along the Ewald sphere due to small rotation of the crystal. The Bragg peak will be partially recorded or completely missed unless the detector position is adjusted to follow the signal. The diffractometer arm is automated to follow the movement of the Bragg peak and adjust the diffraction pattern to the center of the Timepix detector. However, this feature only works with a slow and traceable change. Large/sudden position and/or orientation change will result in irretrievable loss of the crystal diffraction signal.
Also, an effort is underway to make the scanning process more robust to beam loss in the synchrotron. Currently the sample position can be lost when the beam is down for hours, and the battery cycler continues to run regardless. Another issue related to the fine alignment occurs when Bragg peaks from mobile crystals show up on the area detector. If the alien signal is bright it may be identified by the alignment function in the loop as the maximum signal in the scan, leading to erroneous positioning away from the actual crystal of interest.
The proposed APS Upgrade will include a new multi-bend achromat storage ring. The resulting improvement in coherent flux is expected to be as high as two orders of magnitude, combined with modern beamlines to take full advantage of the source. This will directly reduce the total data acquisition time and also improve the detected signal-to-noise ratio for coherent diffraction experiments.

Conclusion
In this work, we describe CXD measurements of battery materials in operando conditions at the 34-ID-C APS beamline. CMCD provides the average structural information of tens of crystals as well as individual information of several crystals orientated in the Bragg condition in the X-ray illumination volume. BCDI probes the evolution of morphological and strain field information of single crystals. Together with powder XRD, the X-ray diffraction experiments form a pipeline to visualize the ensemble average, local average with a few grains and single-crystal behavior of battery materials under operando conditions. This paper described the fundamentals of CXD, sample screening and beamline setup and the experiment protocols in detail. It serves to guide future in situ battery studies with CMCD and BCDI.