Nanostructuring of electron beams

The remarkable technological advancements that culminated in today’s powerful electron microscope have enabled scientists to traverse into new regimes of the nanoworld. However, the versatility of this complicated optical beamline allows for more than just inspecting atoms: by shaping the electron beam, new and interesting phenomena are sought after by the interaction of shaped beams with matter. Here, we review the recent newly-emerged field of electron beam shaping by thin film interaction of nanostructures and by interaction with shaped electrostatic fields. This article is dedicated to our friend Wolfgang P Schleich on the occasion of his 60th Birthday. Since 2014, Wolfgang has collaborated with us within the framework of a Deutsch-Israelische Projektkooperation project (supported by the Deutsche Forschungsgemeinschaft) entitled ‘Science and applications of electron wave-functions shaped and manipulated by engineered nano-holograms’, during which many of the concepts that we present here were developed.


Motivation
As charged particles, electrons are often treated in the classical framework of applied electric and magnetic forces. Experimental research in fields such as accelerator physics, free-electron lasers, semiconductor fabrication, circuit inspection, and electron microscopy, usually involves solenoids, quadrupoles, multipole correction elements, electrostatic and pulsed electric fields, radio-fRequency and THz-modulated fields, and similar devices and technology. The vast majority of these are used for the sole purpose of shaping the electron beam in space and time to be as small or short as possible.
In light optics, the shaping of light beams is already considered a fundamental tool used frequently in research and industry. The aim of this paper is to motivate and expose researchers in these and similar disciplines to the recently emerging field of electron beam shaping, a method that can readily shape the electron's wavefunction in a nearly-arbitrary manner, which cannot be done with the standard devices described above. We believe that shaped electron beams, as their photon brethren, will become a major catalyst in future theoretical and experimental research, and quite soon in industry.

Introduction
In 1961, Jönsson performed a pioneering experiment, demonstrating the interference of electrons that had passed through two slits (Jönsson 1961, Jönsson 1974. Although such an experiment had already been performed with light and the theory of wave interference had been established for many years, this was the first demonstration of the two slit experiment for a massive (and charged) particle, confirming that massive particles can behave as waves. The wave nature of the electron had already been demonstrated in 1927 by the diffraction experiments of Davisson and Germer (1927) from a Ni target. It was then followed by electron interference experiments, such as Möllenstedt and Duker's biprism interference (Möllenstedt and Düker 1956). However, Jönsson's experiment can be regarded as the first example of electron wavefront structuring using a mask, paving the way for extensive research on methods for manipulating the phase and amplitude of the wavefunction of an electron. In his paper, Jönsson described experimental challenges due to limitations in fabrication, which remained an obstacle until very recently (Frabboni et al 2012).
In 1947, Boersch discussed the idea of using the mean inner potential of a film of constant thickness to influence and induce a phase shift in an electron beam passing through it relative to vacuum (Boersch 1947). As in light optics, the wavefunction of an electron accumulates phase by passing through a material. In the case of a non-magnetic material, this contribution is proportional to the mean inner potential (Reimer and Kohl 2008), which is, to first approximation, a constant for each material. Without modern nano-machinery, Willasch and Müller embarked on the ambitious feat of fabricating profiled phase shifting plates using built-up contamination (Willasch 1975, Muller 1976). The next examples were made by electron beam hole drilling in AlF3 (Ito et al 1993, Bleloch et al 1998. It took approximately ten more years of technological advances before electron beam shaping evolved further. The advances in nano-fabrication that enabled this progress include the increasing availability of nano-machinery such as focused ion beam (FIB) milling and electron beam lithography (EBL) (Jesse et al 2016). The steady improvement of electron microscopes in terms of vacuum, stability, aberration mitigation, and coherence, as well as research and applications already conducted in light optics, have also been major catalysts. In light optics, extensive research has led to the commercialization of technologies such as lithography, diamond turning, and magnetorheological finishing, which allow for the arbitrary phase manipulation of light, whose wavelength ranges from hundreds of nanometers to a few microns. However, the wavelength of light also determines the order of magnitude of the smallest feature that one can create with the wave. The shaping of electron beams is therefore interesting because of their wavelength: 2 pm for a standard 300 keV electron microscope, which is five orders of magnitude smaller than that available in (visible) light optics, resulting in the potential to probe atomic systems, and in principle the sub-atomic regime.
As they are charged particles, electrons can be manipulated using electric and magnetic forces through the Lorentz equation. The round magnetic or electrostatic electron lenses as well as the non-rotationally symmetric multipole aberration correctors on modern transmission electron microscopes (TEMs) are all based on this principle. However, as a result of their wave characteristics, free-space paraxial electron beams, such as those in a TEM, are also governed by a wave equation that is identical in form to the paraxial Helmholtz equation used in light optics. By way of this analogy, many of the applications and knowledge that have been established for light can also be applied to electron optics. In this review, we primarily discuss electron beam shaping using Fourier holograms, which exploit the fact that, just as for light, the farfield of an electron wavefunction is its Fourier transform. Hence, the theory of Fourier optics can be applied. In particular, placing a mask in the path of a collimated electron beam will influence its wavefunction, such that, in the focal plane, it will be imprinted in some proportion with the Fourier transform of the mask.
Both the amplitude and the phase of an electron wavefunction can be manipulated using a thin hologram, in order to shape the beam to a desired form. An amplitude mask can contain one or more layers, in which one of the layers exhibits strong scattering and areas of it are removed, in order to allow transmission of the beam through these areas to form a specific shape. The phase of the wavefunction can be shaped by varying the thickness of either a thick and light material or a thin and heavy material. The primary disadvantage of using material masks for this purpose is unavoidable scattering, as discussed below.
A recent research topic that has sparked interest in the field of electron beam shaping involves the generation of beams that carry orbital angular momentum (OAM), such as vortex beams (Allen et al 1992). In 2010, Uchida and Tonomura focused an electron beam at the confluence of a naturally formed stack of graphite thin films, thereby imparting a spiral phase and creating a vortex electron beam (Uchida and Tonomura 2010). Subsequently, Verbeeck et al (2010) used fork-shaped amplitude masks to produce vortex beams, with the goal of using them as probes to detect magnetic circular dichroism, while McMorran et al (2011) demonstrated high quanta OAM beams of up to 100ħ. These studies were the precursors to a considerable amount of research on electron vortex beams, including the formation of vortex beams with the size of atoms (Verbeeck et al 2011); beams with even larger angular momentum and spiral masks ; demonstrating that an electron beam can be in a superposition of two orbital angular momenta ; and demonstrating interference between two parts of an electron wavefunction, each containing angular momentum .  generated vortex beams using a blazed grating (Harvey et al 2014), which potentially allows for increased efficiency in the first diffraction order, while Shiloh et al (2014) used a smooth, continuous phase mask, in which the wavefront remains on-axis and intensity is not lost to higher orders. Vortex beams have also been created using structured electromagnetic fields, for example by exploiting magnetic lens aberrations (Clark et al 2013, Petersen et al 2013, mode conversion from a Hermite-Gaussian beam (Schattschneider et al 2012) or a spin-polarized beam (Karimi et al 2012), and using a magnetic needle (Béché et al 2014, Blackburn andLoudon 2014) or electrostatic line charges (Pozzi et al 2017).
Another interesting family of electron beams are those that preserve their spatial shape during propagation (also called shape-preserving, or 'non-diffracting' beams). For example, Voloch-Bloch et al (2013) used amplitude masks to create the first electron Airy beams, whose shape is preserved along a curved trajectory.  generated the first electron Bessel beam using a kinoform phase mask, while Saitoh et al (2016) and Nambu et al (2017) used ringshaped and polygon-shaped annular slits to create nearly nondiffractive beams, and a recent paper reports an efficient electron axicon lens using a magnetic vortex for generating electron Bessel beams (Zheng et al 2017).
Whereas these works used beam shaping to form analytically-described wavefunctions, Shiloh et al (2014) showed that, by using phase retrieval algorithms and computer-generated phase holograms, nearly-arbitrary spatial shaping of an electron wavefunction is possible. The most significant advantage of using phase masks over amplitude masks resides in their transmission efficiency. Amplitude masks diffract the beam into many diffraction orders, of which only one of the orders is often of interest. In contrast, phase masks have the potential to manipulate the complete wavefunction, without losing intensity to higher orders. This property also removes the need to filter out unwanted diffraction orders. Harvey et al (2014) investigated the fabrication of phase masks for electrons, showing that the intensity of diffraction orders can be manipulated by controlling the thickness profile of the periods of a mask. As we show in section 3 below, onaxis phase masks can be used successfully to control and correct aberrations in electron microscopy (Shiloh et al 2016(Shiloh et al , 2018. However, unlike a light beam, an electron beam suffers both elastic and inelastic scattering events, which can result in a loss of signal and elevated background levels. Nevertheless, by using a modern high-brightness and coherent electron gun, these effects can often be filtered out or otherwise ignored, depending on the application goal (Shiloh et al 2018). Although similar works have been attempted using the off-axis scheme, unfortunately it has proved to be experimentally difficult in terms of fabrication, measurement procedure, and signal to noise ratio, and ultimately a viable resolution enhancement was not demonstrated , Linck et al 2017.
Other works in the field of electron beam shaping include the demonstration of the electron Talbot effect (McMorran and Cronin 2009); the modulation towards linear phase contrast in STEM by using a phase mask shaped as a zone plate (Ophus et al 2016); the demonstration of an electron hotspot smaller than the diffraction limit by using a super-oscillating electron beam (Remez et al 2017); the control and manipulation of three-dimensional (3D) shaping of electron beams (Shiloh and Arie 2017); the selective detection of a specific plasmon mode by using a two-lobed beam reproducing its symmetry (Guzzinati et al 2017); the measurement of a nanoscale out-of-plane magnetic field by interfering a highly twisted electron beam with a reference wave ; and the recent successful demonstration of the first dynamic electron modulator (the equivalent of a spatial light modulator) of 2×2 pixels, which opens the door to in situ dynamical electron beam shaping (Verbeeck et al 2018).
A different type of electron phase plate, rather than a phase mask, is a thin film placed in the Fourier plane of the electron lens. Such phase plates are intended to improve contrast in electron microscopy and do not fall within the scope of this paper. Comprehensive reviews of this topic have been published by Nagayama (2011) andGlaeser (2013).
In the following sections, we elaborate on research conducted by the authors, some of which has been mentioned above. We begin with theoretical background (section 2), and then review the subject of electron beam shaping using both patterned thin films (section 3) and structured electrostatic fields (section 4). We conclude with a summary and outlook.

Theoretical background
In this section, the basic equations that describe the key approximations that are used in the description of electronspecimen interactions are summarized briefly and applied to the case of homogeneous specimens at low resolution, as well as to simple and less simple configurations of electric and magnetic fields. The POA has been widely used for investigating interactions between electrons and electromagnetic fields (Pozzi et al 2014). A detailed derivation can be found elsewhere (Pozzi 2016). According to the POA, any electromagnetic field between planes z i and z i+1 along the optical axis z can be treated as a thin phase object. The corresponding transmission function T can be formulated as ) is the z component of the magnetic vector potential A (which is linked to the magnetic induction B by the relation B=∇×A), and e, λ, ħ and E are the absolute values of the electron charge, the de Broglie electron wavelength, the reduced Planck constant and the kinetic energy of electrons in the non-relativistic approximation, respectively. The integrations are performed along the trajectory of the incident electron beam, which is parallel to the optical axis z. For such weak fields, the multislice method does not usually need to be applied, and the integration limits can be extended to -¥ and , +¥ while the z coordinate in the transmission function can be chosen to be coincident with the object plane. Relativistic correction can be included if appropriate values of λ and E are used. As the effect of the tilt of the incident plane wave is normally negligible at high incident electron energies, the transmission function in equation (1) holds for generic illumination. The variation in electron amplitude in a very thick specimen, including the effect of high angle scattering and subsequent cut-off by an aperture, can be accounted for by introducing a real multiplicative amplitude term x y Amp , ( ) in the transmission function of the object in the form

Homogenous samples
The concept of mean inner potential U i , which describes the interaction of an electron beam with a material at a resolution at which single atoms or atomic columns are not resolved, has been discussed by Spence and co-workers (Spence 1993, O'Keeffe and Spence 1994, Saldin and Spence 1994, and measured using interferometric and holographic methods (e.g. Missiroli et al 1981). According to these results, in the absence of dynamical diffraction the phase shift is simply proportional to the product of the mean inner potential U i and the specimen thickness t.

Magnetic dipoles
Let us consider a small current loop located at the origin, with surface S , D  current I and a magnetic dipole moment given by the expression 1966). Its vector potential is where R x y z , , . =  ( ) According to equation (1), the contribution to the electron optical phase shift arising from the magnetic dipole is where r x y , . =  ( ) Note that the component m z of the magnetic dipole aligned with the direction of the electron beam has no effect, within the POA.
This expression can be extended to describe a flux tube consisting of a one-dimensional series of aligned magnetic dipoles. If n l is a constant number of elementary loops per unit length and these magnetic dipoles are aligned parallel to the y axis from -a to a, then the corresponding phase shift is By using the relation m I S, y = D and recalling that the magnetic field inside the flux tube is constant and equal to that of an ideal solenoid B n I l 0 m = and that B S , D = F we obtain the following expression for the phase shift: In the limit of a very long flux tube (a  ¥), i.e. the phase difference is constant and equal to that calculated by Ehrenberg and Siday (1949) and Aharonov and Bohm (1959).
The infinite magnetic flux tube discussed above is a limiting case that cannot be realized in practice. The closest approximation is a uniformly magnetized bar. A monopole field at the end of a magnetic bar was employed as a test specimen to show the pitfalls of the uncritical use of holographic reconstruction programs, which can result (in the case of undersampling) in the presence of apparent magnetic monopoles in reconstructed phase images (Pozzi 2002), long before its use to produce electron vortex beams (Béché et al 2014, Blackburn and Loudon 2014).

Electrostatic dipoles
In the electrostatic case, the scalar potential associated with an elementary dipole of moment p q l p p p , , and the corresponding phase shift is Also in this case, due to the POA, the z component of the electric dipole does not contribute to the phase shift. If the dipole is aligned along the x axis, then the same functional dependence is recovered, as for a magnetic dipole aligned along y.
By the same token, the phase shift resulting from a onedimensional series of aligned electrostatic dipoles is given by the expression where n el describes a constant density of electrostatic dipoles, which are aligned along the x axis and uniformly distributed along the y axis from −a to a. In the limit a→∞, Here, in contrast to the magnetic case, the phase shift can be varied continuously, depending on the orientation of the dipoles and the corresponding component of the dipole moment p x . The close analogy between the electrostatic and magnetic cases shows that the phase shift of a line of electrostatic dipoles is equivalent to that of a magnetic flux tube. Therefore, the phase around the extremity of an electric dipole line can be considered as the electrostatic analog of the phase from a magnetic monopole field at the end of a flux tube.
If a similar integration is performed, instead, along the x axis, taking into account that in this case p q x d , x = then the phase shift is given by the expression and is equivalent to the phase shift associated with a positive charge at (a, 0) and a negative charge at (−a, 0).

Electrostatic line charges
The former calculations can be carried out using tables of integrals (e.g. Gradshteyn and Ryzhik 2014). However, it is also worthwhile to use computer algebra software, such as Mathematica (Wolfram 1999), to investigate more elaborate charge distributions. In particular, equation (14) Any combination of line charges of constant charge density can be described by rotating and displacing the above expressions relative to a single line charge.
In particular, the case of a line charge in front of a conducting plane is equivalent, by the method of images, to two opposite line charges at double the distance (Matteucci et al 1992). When the two lines are parallel, the electrostatic analog of a magnetic bar is obtained, owing to the formal identity between the electrostatic and magnetic cases (Pozzi et al 2017). These analogies are summarized in figure 1.

Beam shaping using patterned thin films
In this section, we review several examples of work carried out by the present authors on the nanostructuring of thin films for use as optical elements for electron beams. We broadly categorize these elements in terms of the manipulation of the amplitude or phase of the electron beam, although a mixture of both effects is rarely avoidable. First, we discuss the use of amplitude holograms to generate vortex and Airy beams in an off-axis scheme and the generation of on-axis astigmatic Airy beams in order to characterize their acceleration coefficient. We then extend the holograms to yield 3D patterns. In the second part, we discuss the use of a variety of on-axis phase holograms, including those used for creating vortex and Hermite-Gauss beams, as well as nearly-arbitrary holograms generated using phase retrieval algorithms. An application to spherical aberration correction is then presented. The holograms are implemented in binary, continuous, pixelatedmatrix, and fractured designs.

Amplitude holograms
With regard to amplitude modulation, it is important to distinguish between amplitude modulation in light optics and electron optics. In general, while a few to a few tens of nm of metal would be sufficient to completely absorb light, it would require tens of μm of a high Z material to completely stop and absorb electrons that have been accelerated by 200-300 kV, which is the standard accelerating voltage used in modern electron microscopes. Therefore, the primary electron beam amplitude modulation mechanism that is relevant in the present work is the scattering of electrons to high angles, rather than absorption. A second important difference is that, through (inelastic) scattering, the energy (and therefore also the wavelength) of the electron changes, leading to decoherence of the beam. In contrast, light can only change its wavelength through nonlinear optical processes. The use of thin films as either phase or amplitude masks therefore results in a noisy background of inelastically scattered electrons. However, the scattering angles are, for most of the applications presented here, large enough that the spatially modulated area of the beam is practically unaffected. Much literature already exists on different kinds of vortices and associated holographic masks, and this is not the focus of the present review. However, here we present the interested reader with an elegant formulation for a fork grating, which yields vortex beams that are transversely arranged and correlated with the diffraction order of a modulated Bragg grating. A binary phase modulation can be expressed in the form In order to achieve a binary amplitude modulation (with values of 0 or 1), one could use h h 1 2. ¢ = + ( ) In this formulation, which can be regarded as a binary computergenerated hologram, 2πx/Λ is a linear grating along x with period Λ, on which the four-quadrant inverse-tangent function 5 modulates the spiral phase of the vortex, l being the topological charge. δ reduces fabrication errors in the center by preserving continuity: its value is chosen to be equal to zero (one) if l is odd (even). Δ is ideally set to zero, in which case only the odd diffraction orders emerge. If desired, it can be set to, e.g. D cos , p D = ( ) where the duty cycle D can be chosen so that both even and odd diffraction orders are visible.
In effect, Δ is a constant bias function that is added to the binarization scheme of the hologram, which in principle could also add a noisy background to the image. Figure 2 shows examples of amplitude masks generated using this expression. 4.1.2. Airy beams. Berry (1979) showed that there exists a peculiar and unique wave packet in quantum mechanics, which is termed the Airy beam and can be described either temporally or spatially. It propagates on a parabolic trajectory and is thus said to accelerate without an applied force. Although it is not square integrable and thus requires infinite energy to be produced, a truncated version has been implemented in light optics (Siviloglou et al 2007). Subsequent investigation has revealed that the centroid of the truncated beam propagates in a straight line-as expected -and thus Newton's laws still apply. Fortunately, the peculiar characteristics of this caustic phenomenon can still be observed before the beam disintegrates.
An Airy beam is characterized by an amplitude dependence that takes the form of the Airy function, ) where x 0 defines the transverse scale. Its parabolic trajectory coefficient, which is sometimes referred to as an where k DB is the (de Broglie) wave number. τ can also be termed a 'nodal trajectory coefficient'. The Airy function is then written in accordance with Newtonian mechanics. This relation implies that the infinite energy wave packet accelerates in free space with no external forces. An explanation based on geometrical optics treats the Airy beam as a caustic, so that every step forward in the propagation direction is manifested by the constructive interference of different rays from the forming aperture (or holographic mask), intersecting on a parabolic trajectory. This description also explains the beam's special self-healing characteristic.
Voloch-Bloch et al (2013) generated electron Airy beams for the first time using amplitude masks. The modulation was effected by milling a hologram pattern onto a 50 nm SiN membrane coated with 10 nm of Au. Several examples, some of which are elaborated on in the supplementary material in the 2013 paper, included on-axis and off-axis holograms of Airy beams similar to those shown in figure 3, as well as examples of vortex beams. The Airy beam's parabolic trajectory was explicitly measured by recording a focal series and compared to simulations. Additional comparisons were made by plotting the deflection of each diffraction order associated with different accelerations. Although this direct method of measurement is indisputable, since the Airy beam is already determined at the mask, a different method can be used to deduce the acceleration coefficient. We elaborate on this approach by introducing the astigmatic transformation in the following section. Another set of solutions of the same equation is the Hermite-Gauss family, this time in Cartesian coordinates. As they are solutions of the wave equation, these beams (and any wellapproximated ones) will ideally propagate without changing their shape, other than the magnification. It is therefore said that they are invariant under propagation, and hence also under Fourier transformation. A mathematical relation, which was extensively studied by Abramochkin and Volostnikov (1991) shortly before the conceptual breakthrough work of Allen et al (1992) on the OAM of light, exists between the two families. Concisely, the transformation between Hermite and Laguerre-Gauss modes is achieved by using an astigmatic transformation-effectively a cylindrical lens and a Fourier transform. An additional astigmatic phase must be removed at the diffraction plane to complete the transformation. The intensity pattern of the transformed beam suggests an interesting application. Assuming that a sample yields a pure vortex state (with a single integer value of OAM), one would not know without calibration and further processing the quantity of the OAM, since only a ring pattern would appear in the microscope. As the diameter of the ring is related to the OAM, the magnification of the microscope must be taken into account, among other parameters. Conversely, (one-dimensional) Hermite-Gauss modes appear as stripes, whose number is related to the mode order; by exploiting a one-to-one transformation between the two families using a cylindrical lens-i.e. by changing the stigmators' excitation in the electron microscope-a ring would transform into a set of stripes, and the OAM would be revealed immediately. We demonstrated this approach experimentally (Shiloh et al 2015), as a prelude to the interesting application of the measurement to the acceleration of an Airy beam. 4.1.4. The astigmatic airy beam. By using the astigmatic transformation, we have shown how one can deduce the acceleration coefficient of a two-dimensional (2D) Airy beam in one measurement. A comparison of a measured stigmatic and astigmatic Airy beam is shown in figure 3. Following a geometric optics derivation, denoting the normalized angular coordinate system , . In order to relate this normalized result to the astigmatism a and the transverse scale x 0 , one must recall the coordinate normalization and write the geometric angle a x .
x y X Y , 2 0 It is interesting to note that this method, which was first developed for electron beams, was later implemented using optical light beams (Singh et al 2015).
4.1.5. Extension to 3D shaped beams. Typically, computergenerated holography is used to shape one optical plane (the 'image' or 'reconstruction' plane), which is usually the focal plane of the focusing lens. In such cases, it would ideally coincide with the diffraction plane. If, however, an additional quadratic phase is encoded in the hologram, or a noncollimated beam is used as input, then an additional focusing or defocusing virtual lens would be introduced, effectively shifting the reconstruction plane away from the focal plane of the lens. This feature can be used to create reconstructions in more than one plane, or in many planes, thereby enabling a 3D shaped beam to propagate away from the hologram. One could argue that the cumulative effect, comprising a measured intensity pattern in 3D, is not a 'beam' per se, but rather a caustic defined by its highest intensity pattern. However, this discussion is beyond the scope of the present review.
In the case of off-axis holograms, as studied here, the reconstruction is in the first diffraction order. In order to avoid overlap with the unscattered zero order, we calculate the axial length Δ from the focal plane, where the first and zero orders overlap. If f is the focal length of the focusing lens positioned in the plane of the mask, and assuming plane wave (or collimated) illumination of the mask, Δ can be expressed in several useful ways: is the numerical aperture of the lens, D is the diameter of the mask, q l = L is the angle of the first diffraction order generated by a grating of period Λ, and λ is the wavelength of the coherent illumination. Concepts for calculating computer-generated holograms (i.e. the amplitude and phase of the mask) that would generate a desired 3D pattern were already studied by Brown and Lohmann (1969), and a vast amount of literature has been written since then. Lohmann suggested summing the contributions of point sources in different planes along the z axis by back propagation calculation, e.g. using a Fresnel propagator, which is probably the most fundamental approach. A related formalism is based on the inverted Gabor holographic technique (Latychevskaia and Fink 2016). While propagating the beam, point scatterers are added. The simulated wave is then inverted, resulting in a phase front of spherical waves in superposition. This is the phase that is required at the selected, simulated axial position to yield a 3D set of focal points in different axial planes along the propagation direction. An example of a pixelated computergenerated hologram is shown in figure 4.

Phase holograms
In light optics, phase-only holograms are advantageous over amplitude holograms due to their transmission efficiency. Aside from Fresnel reflection losses, which can be circumvented by using appropriate anti-reflective coatings, a glass slab is, to all intents and purposes, transparent to visible light, acting only to alter the phase of the impinging wavefront relative to that of a reference wavefront. A simple hologram would be a thin lens, which adds a transverse quadratic phase. A phase grating can be designed to steer light to a desired direction, split it, or perform other manipulations. In general, one can define two kinds of phase optics that are relevant for holograms: refractive optics, and diffractive optics. Diffractive-optical elements are optically thin, can be fabricated as binary elements, can provide opportunities for efficient chromatic aberration correction, and their design principles are useful in many fields of optics (Malacara-Hernández and Malacara-Hernández 2013). The primary disadvantage of a refractive scheme is the extended thickness and limited flexibility of the glass material that is required in such elements. A 'fractured' element attempts to take advantage of both worlds: it is a refractive element 'modulo 2π', making it thin, while retaining the refractive profile between adjacent phase jumps. We will show that, in electron optics, the refractive design can prove to be an easier route, at least fabrication-wise.
When designing a diffractive-optical element, whether it is binary, fractured or continuous, an important design question is related to the dynamic range of the element's phase contribution. The phase shift of a beam that passes through glass is proportional to the properties of the glass and -importantly-its thickness. For example, if a binary phase grating is designed and the height of the grating ridges is set so that they induce a π phase shift, then the resulting first positive and negative diffraction orders would be of highest intensity, while the zero order would have no intensity. This situation cannot be achieved using a binary amplitude grating, unless limitations are placed on the reference beam. In electron optics, since each added layer of material increases the probability of scattering, the material, design, and fabrication scheme must be chosen carefully.
4.2.1. Inducing a phase shift. Designing a diffractive-optical element from a silicon nitride membrane for electron beams produces an element that has similar properties to those for light. Taking account of relativistic correction, the phase shift induced by sending an electron beam through a non-magnetic membrane material, relative to vacuum, is given by the expression where t is the membrane thickness, λ is the electron wavelength, n is the refractive index for electrons (which is seldom used in the literature), and E m c 0 0 2 = and E eU = are the electron's rest and kinetic energies, respectively. U i is the mean inner potential of the material. For a 200 keV electron beam, the thickness that is required to generate a π phase shift in silicon nitride is approximately 42 nm. Since electron scattering by silicon nitride is relatively low, we consider it to be a nearly pure phase plate for our purpose. Modulation of the thickness of the membrane can then be used to create holograms for electrons, by imparting predesigned phase shifts to the illuminating electron wavefront.

Phase gratings and FIB Ga+implantation.
The ability to machine membranes to different thicknesses results in good control over a continuous range of phase shifts. The requirement to mill to a specific depth is crucial, as any deviation can result in excess intensity in the zero order beam. This excess intensity depends, among other things, on the kind of deviation and its periodicity. In general, since the deviations are mostly random, errors manifest themselves in the zero order beam. To this end, it is worth looking at the relationship between depth and phase shift for binary phase where Λ is the period of the grating and D is its duty cycle. As we have separated the zero order coefficient from the sum, it is immediately evident that any deviation from D=0.5, i.e. 50% duty cycle, results in intensity in the zero order beam. If a 50% duty cycle is chosen, then 2 2 81% 2 p = · ( ) of the intensity is equally halved between the first positive and negative orders, and the rest is scattered to higher orders. This, however, assumes that the phase grating is binary and that its thickness imparts a phase shift of exactly π. Assuming a thickness-dependent phase shift t , f ( ) the transfer function of a thin binary phase grating can in general be expressed in the form p t g g exp j 1 2 1 1 2. f =´+ +´-( ( )) ( ) ( ) By using this formulation, the intensity variation of the different orders as a function of thickness can be expressed in the form When fabricating a fine grating using FIB milling, as a result of the physical process and the diameter of the beam the deeper the groove the wider it becomes. If the resolution of the FIB is not a limiting factor, then, in order to compensate, the grooves should be thinner in design depending on their depth. Once this effect had been calibrated, we fabricated 53 such gratings, each with a 400 nm period, on a 100 nm thick silicon nitride membrane. Each grating in sequence was milled using a linearly-increasing beam dwell time, which is approximately proportional to milling depth. The duty cycle was set to 50%, so that the intensities in the different orders were reduced to the familiar forms I t cos 2 0 2 f = ( ( ) ) and I t 2 sin 2 .
The diffraction pattern of each grating was then recorded. By analyzing the intensities of the diffraction orders, we expected to verify the theoretical relationships, and the phase shift dependence.
The FIB milling process implants Ga ions into the membrane. By itself, ion implantation is not a problem for inducing predetermined beam phase shifts; at most, the additional inner potential could be compensated for by a simple adjustment of the design parameters. In the present case, varying amounts of ion implantation in different gratings, which are not linear in dwell time, are possible. In order to characterize the amount of implantation and its effect on the phase shift, a 5 nm layer of Ti was evaporated onto the unmilled side of a membrane for control purposes. We then used energy dispersive x-ray spectroscopy (EDS) to measure the chemical composition of each grating, paying particular attention to the amounts of Ga and Ti.
Measurements of the Ga/Ti fraction are presented in figure 5(a). By assuming, as is often the case, that the distribution of Ga in the sample is Gaussian, we fitted the results to the function bm Ga Ti a 1 exp , = is the grating number, and a and b are fitting parameters. We can repeat the analysis using the same fit parameter b from a different perspective: we fit the sinusoidal-like measured curves (see in figure 5(b)) using equation (24), with D=50% and where the phase shift has the same form as the Gaussian distribution, with 0 f a constant phase shift: As evident from the figure, the results fit remarkably well using the same fit parameter b. It is important to note that, although silicon nitride membranes have low electron scattering properties, some amplitude modulation still exists. In order to avoid this effect in the analysis, we normalized the intensities for each data point by the sum of energy in all three (−1, 0, and 1) diffraction orders for the measured grating, although this effect can be accounted for by reformulating the equations (Harvey et al 2014).

4.2.3.
On-axis computer-generated holograms. One of the advantages of using phase masks is that it is conceptually possible to impart full transmission efficiency to the zero order (on-axis) beam. In this way, the shaped beam has maximal intensity and there are no losses to higher diffraction orders. On-axis beam shaping is also possible using binary amplitude masks (Piestun et al 1997), albeit with greatly diminished efficiency, or increased background noise if the shaped pattern is designed axially out of the focal plane.
Two simple examples of on-axis binary and multilevelled, continuous masks are shown in figure 6. In figure 6(a), we milled two opposite quadrants to a depth equivalent to a π phase shift, so that a Gaussian beam impinging on the mask would result in a Hermite-Gaussian mode of order 1, 1, which is a solution of the wave equation. In figure 6(b), we produced a helical structure with one step of height equivalent to a 2π phase shift. This mask, when illuminated with a Gaussian beam, yields a Laguerre-Gauss mode of order 0, 1, which is also a vortex beam. In practice, the masks are illuminated with a circular top-hat beam, such that the emerging beams are not exact solutions, but are qualitatively similar to very high accuracy.
A nearly-arbitrary on-axis modulated beam can be designed using phase retrieval algorithms. One should not conclude that a unique solution for the phase must be found. In some cases, this is either impossible to achieve or such a solution does not exist. However, approximate solutions may prove to be sufficient to satisfy the goals of an experiment or application.
Calculation of the required phase in a plane that yields a desired intensity pattern in another plane, usually the diffraction plane, is a vast field of research, with roots in the work of Gerchberg and Saxton (Gerchberg 1972). The associated mathematical problem is non-convex, and during iterations the algorithm can 'fall' into local minima, from which it cannot recover. It was later shown that this algorithm is an example of the 'gradient-descent method' or the 'method of steepest descent', and much work has been contributed to the subject by Fienup et al (1978Fienup et al ( , 1982Fienup et al ( , 2013. Many other approaches to phase retrieval exist, including genetic algorithms, direct search algorithms, annealing, ptychography, and alternating projections.
We used such an algorithm to calculate and design the phase masks shown in figure 7. FIB milling was used to mill dips into a membrane, each with a depth corresponding to the calculated phase at that position. The resulting diffraction patterns exhibited some zero order intensity-mostly due to errors in fabrication-but our designed pattern still emerged.

Phase masks for optical aberration correction and
manipulation. The footprint of electromagnetic optical elements comprising an electron microscope is rather large, in comparison to thin film membranes, which can be used to shape the phase-front of an electron beam. Here, we describe different refractive-diffractive elements that are intended to induce known aberrations to the probe of a scanning TEM. We fabricated the elements, which are shown in figure 8, to investigate the prospects of aberration correction using thin films. These are: (a), (b) half-beam tilt, (c), (d) two-fold astigmatism, (e), (f) three-fold astigmatism, and (g), (h)  primary spherical aberration. The half-beam tilt structure was used primarily for assessment of the fabrication process. Circular illumination of the mask should result in half of the transmitted intensity propagating on-axis, while half should be tilted according to the blazed grating's period. Any deviations from a perfectly blazed grating, or other effects that may arise, such as from local charging of the structure, will distort the diffraction pattern. Specifically, periodic deviations (such as finite slopes at the phase jumps, a height deviating from 2π, or rounded edges of the grating teeth), would result in additional diffraction orders or distortions of the shapes of the transmitted and tilted beams.
Fabrication was carried out using FIB milling. The structures are of fractured design, and the cross-sections are correlated with the topographic profile of the structures-assuming a linear relationship between milling time and depth. Errors in fabrication typically arise from ion beam drift during milling, which can also be caused by local charging during such a prolonged process. Figure 8(g) shows a structure of the fractured design that induces spherical aberration in the beam. Primary spherical aberration behaves radially as r 4 . However, from this image and cross-section, after the first phase jump the slope changes sign. This is due to an added defocus term, i.e. ar 4 −br 4 , which allows us to design a structure with the same number of phase jumps that are spread differently in the radial direction. This approach eases the tolerance on fabrication that would otherwise be caused by the quartic rise in the radial frequency of the phase jumps. The additional defocus can be compensated for easily in the microscope.
We found that a simpler route to the fabrication of such elements avoids the phase jumps altogether, at the expense of using a thicker (4πrather than 2π-equivalent) membrane. This approach involves the following steps. Recalling that the phase shift associated with an electron passing through a nonmagnetic material with mean inner potential U i is C U t, E i j = where C E is a constant related to the electron's energy, and assuming the primary spherical aberration to be the dominant aberration of the probe-forming optics, the aberrated phase in radians can be written in the form where θ is the half-angle of the beam with respect to the optic axis, NA is the numerical aperture, C s is the spherical aberration coefficient, and λ is the electron's wavelength. We start with the known (e.g. from Willasch 1975) aberration function C z 2 2 s 4 2 c p q q l = -D ( ) / and define the numerical aperture, NA, as the angle θ at which no aberrations are present (χ=0). The resulting focal length, i.e. the defocus value Δz, is given by the expression z C NA 2.
s 2 D = Substituting this equation back gives equation (26) above.
We define a 2π phase shift as one cycle, abbreviated '1λ', and characterize the maximal phase difference induced by the aberrated phase using the figure of merit 'peak-tovalley' (Smith 2000), which is equivalent to C NA 16 q = This expression, in turn, is substituted back into Λ to yield the above result (in cycles).
In order to correct for spherical aberration, the thickness profile of the mask must satisfy 0. c j + = If we further define t 2p as the thickness that is required for one cycle, then the milled thickness profile of a refractive spherical aberration corrector is given by the expression where r max is the radius of the aperture stop, i.e. the radius that defines the numerical aperture of the probe-forming optics. The derivation is as follows. Starting from the relations and in terms of the maximal radius defining the numerical aperture of the probeforming system, i.e. using r D 2, max = we can understand equation (26) above.
The final thin film refractive spherical aberration corrector is shown in figure 9(a), with a thickness measurement given in figure 9(b). The thickness measurement was made using an interferometric light microscope that is able to resolve vertical changes on the sub-nm scale (courtesy of Nir Turko).

Beam shaping using structured electrostatic fields
In this section, we show how it is possible to shape electron wavefunctions using structured electrostatic fields based on the theoretical discussions presented in section 2. Recent applications to the generation of caustics and vortices based on electron waves are reviewed. Both simulated and experimental out-of-focus images and holographic measurements are reported, in order to illustrate phase shaping effects.

Simulation of defocused images
Out-of-focus images that are formed by illuminating a specimen using a coherent electron beam can be simulated by calculating the image wavefunction in the observation plane (X, Y, Z) using the Kirchhoff-Fresnel integral (Born andWolf 2013, Pozzi 2016) where λ is the de Broglie wavelength of the incident electrons, and β is a phase factor that is not relevant here as only the intensity, which is proportional to , 2 y | | is recorded in the observation plane.
x y Amp , ( ) is an amplitude function, which is used to describe the regions of the sample that are not transparent to the electron beam and x y , j ( ) is the phase induced by the structured electrostatic field. Plane wave illumination is assumed.

Caustics from oppositely-biased tips
Despite their ubiquity in nature, optical caustics play a crucial role in fundamental and applied optics. In electron optics, caustic patterns have been observed and utilized to characterize quadrupole magnets in terms of electromagnetic lens focus (Schneider 1957), to study time-dependent magnetic fields (Laroze and Rivera 2006), to measure lens aberrations (Kanaya and Kawakatsu 1960), and, recently, to produce electron vortex beams (Petersen et al 2013) and Airy beams (Voloch-Bloch et al 2013). Here, we show how two oppositely-biased metallic tips can be used to sculpt an electron plane wave inside a TEM, in order to generate caustic patterns in defocused bright-field images (Tavabi et al 2015).
Two electrochemically-etched needle-shaped tungsten tips were mounted in a NanoFactory single-tilt in situ electrical biasing TEM specimen holder, which was inserted into an FEI Titan 60-300 TEM equipped with a high-brightness field emission gun, a Lorentz lens, a Gatan imaging filter and a 2048×2048 pixel charge-coupled device camera. One of the tips was inserted in a specimen mount, while the other was placed in a tip, which is designed for applications in scanning tunneling microscopy. The tips could be positioned relative to each other in three dimensions using a piezo-driven system. They were aligned to be at the same height and approximately collinear, but opposite to each other. A potential difference was applied between them using an external power supply, in order to create an electric field between them to modulate the phase of an incident electron plane wave. Highly defocused bright-field images were then recorded to show the resulting interference patterns. The microscope was operated at an accelerating voltage of 300 kV using non-standard lens excitations to provide an optimally large field of view with high coherence and brightness. Figure 10(a) shows a defocused bright-field TEM image of the two tips, which are separated by 0.9 μm and imaged at a nominal defocus of −7 mm (underfocus, with the objective lens of the microscope focused above the specimen), initially without a potential difference applied between the tips. In this image, only Fresnel diffraction fringes around the two opaque tips are visible. The fact that the spacings of the Fresnel fringes around the tips are approximately equal confirms that they are at the same height in the electron beam direction. When a potential difference of 40 V is applied between the tips, a two-beam interference fringe pattern terminated by a two-wing caustic is formed close to the negatively-biased tip, while the wave field around the positively-biased tip takes the form of a magnified shadow image surrounded by Fresnel fringes. The interference pattern behaves similar to that observed for a single tip placed in front of a planar electrode (Pozzi et al 2014). If the potential difference between thee tips is increased further, then the overlap region close to the negatively-biased tip increases in width and the corresponding two-beam interference fringes become finer, as shown in figures 10(c) and (d) for potential differences of 60 and 100 V, respectively. Furthermore, two high-contrast folds start to appear at the termination of the interference fringes, eventually forming a butterfly-like pattern (figure 10(d)), with a fringe modulation where they cross.
Even though these images were recorded at the same defocus without adjusting the settings of the projector lenses in the microscope, there is a slight change in magnification and a small shift in their positions. These effects may arise from the non-standard lens settings used, as well as from slight changes in the excitations of the condenser lenses. As a result, accurate scale bars cannot be shown for these experimental images.
Simulations of the defocused images of caustic patterns were performed using the Kirchhoff-Fresnel integral based on a Fourier transform approach. A square region of size 4096×4096 pixels with a side of 8.192 μm was calculated and the central part was then displayed to match the field of view of the experimental images. A lateral offset of 2 μm was introduced and a linear phase contribution was subtracted to minimize artifacts due to boundary conditions. Additional test calculations of larger size and higher sampling density showed no significant differences.
In order to calculate the amplitude and phase of the transmission function of the specimen, the following procedures were adopted. An equipotential surface plot in the object plane was first calculated using equation (15) with C V =1 so that the values of potential of each tip could be determined, so that their shapes could be fitted. Assuming that the tips were opaque to the electrons, the amplitude Amp(x, y) was set to zero for values of potential inside the tips and unity outside. The value of C V was then rescaled so that the potential difference corresponded to the experimental value. Inserting these values into the expression for the phase in equation (16), the complete transmission function of the specimen was obtained.
The resulting simulated defocused images are shown in figures 11(a)-(d), each corresponding to the experimental conditions used in figure 10, i.e. for potential differences of (a) 0, (b) 40, (c) 60, and (d) 100 V, for a constant defocus of −7 mm. The amplitude function was calculated by taking values of 3.5 and −2.5 V for the potentials of the tips (C V =1), with two line charges (20 μm in length) aligned collinearly and separated by 0.9 μm. There is a satisfying degree of agreement between the experimental and simulated images.

Electron vortex beams from electrostatic monopoles
Electron vortex beams have recently been generated using the magnetic monopole field at one extremity of a dipole-like magnetic needle (Béché et al 2014, Blackburn andLoudon 2014). This approach is based on the magnetic Aharonov-Bohm effect (Aharonov and Bohm 1959) and relies on the fact that the magnetic field at the end of a long magnetic rod closely resembles the magnetic monopole that can be used to impart a vortex onto an electron beam. However, it is not straightforward to vary the topological charge of such electron vortices once the device is fabricated. In addition, the magnetic nature of the device prevents it from being used close to the strong magnetic lenses inside an electron microscope, in particular in the back focal plane of the objective lens. Furthermore, the physical endurance of a magnetic needle may be an obstacle to using such an approach to reach larger topological charges. However, these technical constraints can be overcome by using the electrostatic counterpart of the Aharonov-Bohm effect (Pozzi 2016) and, specifically, by using the electrostatic monopole field at the end of a dipole line (Pozzi et al 2017. Such an electrostatic dipole line can be approximated by two parallel wires in close proximity with a suitable potential difference between them. Two parallel charged wires of length 100 μm and separation 200 nm were selected for simulation. An equipotential surface plot in the object plane was calculated using equation (15) with C V =1, so that the values of potential of both wires could be determined, so that the shapes of the two wires could be fitted. The potentials are then chosen to be ±2 V. Assuming the wires were opaque to the electrons, the amplitude Amp(x, y) was set to zero inside the wires and unity outside. The phase shift was calculated for 300 kV electrons using equation (16). The resulting equiphase lines (with a spacing of π/4 radians), together with the amplitude, are shown in figure 12 in a square field of view that has a side of 1 μm. The white bars within the tip shadows mark the positions of the line charges. Upon applying a potential difference of 4 V, the maximum azimuthal phase difference accumulated between the two wires was 5.2 π. For the same shapes of the two wires, a variable potential difference and phase shift could be obtained by adjusting the value of C V . Figures 13(a)-(c) show simulated Fraunhofer and Fresnel images, as well as the phase profile of the Fresnel configuration for two charged wires of length 100 μm with a potential difference of 4 V between them. The aperture size is 20 μm. In practice, such a metallic aperture should be placed in a plane that is conjugate to that of the two wires, so as to not perturb the electric fields. Figure 13(a) shows the Fraunhofer diffraction image, i.e. the spatial frequency spectrum. The corresponding Fresnel diffraction image and its phase profile at a defocus value of 40 cm are shown in figures 13(b) and (c), respectively. We note that the Fraunhofer diffraction image does not show a clear zero-intensity center, which is typically observed in vortex beams. This effect is probably associated with the combined influence of diffraction from the shadow of the two wires and the finite separation between them. The very low contrast at the center of the Fresnel diffraction image clearly demonstrates the presence of the phase singularity in the center. By increasing the potential difference to 40 V, as shown in figures 13(d)-(f), the Fraunhofer diffraction image (figure 13(d)) has a clear intensity minimum and circular symmetry at its center, the radius of which increases with potential difference. The Fresnel diffraction image (figure 13(e)), together with its phase profile (figure 13(f)), show impressive contrast surrounding the center of the electrostatic monopole, as well as larger quanta of OAM. The experimental realization of such a device has recently been demonstrated .

Summary and outlook
In this manuscript, we have reviewed a selection of our recent efforts at shaping electron wavefunctions using either amplitude or phase masks that are generated using thicknessmodulated material films or structured electromagnetic fields from miniature devices. These approaches have been used successfully to generate electron vortex beams, Airy beams and caustics, as well as for 3D shaping and spherical aberration correction. Diffractive holograms and refractive phase masks are currently proving to be the most popular methods for such experiments, due to their fidelity and applicability. However,  since they are both based on sculpting thin films, their use always results in an intensity reduction due to absorption and scattering. Moreover, they are only able to impart static phase modulations to electrons of given energy. In contrast, the interaction between electrons and electromagnetic fields is attractive for applications due to the much higher (close to 100%) transmission efficiency and flexible tunablity. However, just as for aberration correctors for electron lenses (Clark et al 2013), structured electromagnetic fields are only applicable for producing limited kinds of electron wavefunctions, in contrast to spatial light modulator technologies, which have recently emerged as powerful tools for the on-demand creation of arbitrary optical fields in light optics (Forbes et al 2016). The next promising direction for electron wavefront shaping would be a dynamically programmable spatial electron modulator. The cornerstone of such a device is a tunable phase shifter, which can be produced in the form of a pixelated array and controlled independently. Similar ideas have been developed in reflective EBL using micron-sized electrostatic mirrors (Carroll 2015), and have recently been demonstrated using an array of 2×2 electrostatic einzel lenses (Verbeeck et al 2018). In the future, more pixel elements should be implemented to reproduce a desired phase profile with good quality. In order to determine the best phase shifting pixel elements, as well as their numbers and arrangements, synergy is required between analytical and numerical simulations and state-of-the-art microand nano-fabrication technologies.