.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples\02_example_einzel_focusing.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_02_example_einzel_focusing.py: Unipotential Lenses -------------------------------- Einzel lenses are three cylindrical lenses arranged in a specific pattern: the first electrode is grounded (0V), the second is at its focus_voltage, and the third is also grounded at (0V). They're called unipotential lenses because they can provide beam focusing and defocusing without affecting the beam's net energy, which reduces (sometimes!) the behavior we saw in cylindrical electrodes. Always make sure the aperture_center (in grid units) aligns with the center of the r_range() when you parameterize your beam. We'll first examine an example of an einzel lens used for focusing, which happens when the polarity of the focus_voltage is the same as the polarity of the charge- either negative to negative, or positive to positive. We'll thus set it to -500V, with initial electron energies at 1keV. Observe the bulge, and then the focal point. .. GENERATED FROM PYTHON SOURCE LINES 11-42 .. image-sg:: /auto_examples/images/sphx_glr_02_example_einzel_focusing_001.png :alt: Picht, Display Options :srcset: /auto_examples/images/sphx_glr_02_example_einzel_focusing_001.png :class: sphx-glr-single-img .. code-block:: Python :lineno-start: 12 import numpy as np from picht import ElectronOptics, ElectrodeConfig import matplotlib.pyplot as plt system = ElectronOptics(nr=100, nz=600, axial_size=0.6, radial_size = 0.1) system.add_einzel_lens( position=20.0, width=300.0, aperture_center=50.0, aperture_width=48.0, outer_diameter=50.0, focus_voltage=-500 ) potential = system.solve_fields() trajectories = system.simulate_beam( energy_eV= 1000, start_z=0, r_range=(0.045, 0.055), angle_range=(0, 0), num_particles=10, simulation_time=1e-7 ) figure = system.visualize_system( trajectories=trajectories, display_options=[True, False, False, False]) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 5.834 seconds) .. _sphx_glr_download_auto_examples_02_example_einzel_focusing.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 02_example_einzel_focusing.ipynb <02_example_einzel_focusing.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 02_example_einzel_focusing.py <02_example_einzel_focusing.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 02_example_einzel_focusing.zip <02_example_einzel_focusing.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_