Plasmonic tetramer antennas based on single-crystalline gold flakes
===================================================================

The last use case demonstrates how to generate a complex pattern with beam path optimization.

The sample is a mono-crystalline gold flake in which a tetramer is patterned. The tetramer consist of four circular
monomers. All four monomers are arranged rotation invariant around the origin and every monomer touches two others
tangentially.

Due to heat (and other) problems while patterning, the pattern design had to be optimized. The pattern is split in three
parts. First, the inner regions is milled out followed by the outer region. Finally, single line, "8"-like shaped cuts
around two paired monomers are made to separate the monomers. In doing so, a minimal gap distance between the monomers
is achieved.

The beam path for the inner and outer parts are generated by offsetting. On the one hand, this results in nearly perfect
edges around the monomers but introduces sharp cuspy beam paths on the other hand. The cuspy regions exhibit a much
higher local dose than the rest of the beam paths. To evade this problem, the dwell times are adjusted to minimize the
variance of the local doses.

The figure below shows the conceptual pattern design and mill settings, the local doses on a beam paths
before and after optimization and the relative change of the dwell time per point.

.. figure:: /_static/tetramer_figure.png
    :align: center
    :width: 250px

The python code to generate the pattern can be found
`here <https://gitlab.com/viggge/fib-o-mat/-/blob/master/use_cases/oligomere.py>`__.

Run the code with

.. code-block:: bash

    $ python oligomere.py --monomers 4 --radius 0.05 --inner-repeats 2 --outer-repeats 2 --mono-repeats 4 --pitch-inner 0.0005 --pitch-outer 0.0005 --offset-delta 0.00025 --dwell-time 5 --outer-margin 0.04

for example.
