## Applying external fields

It is possible to apply electric and magnetic fields to a material investigated by Fleur. This is done by adding a fields element in the calculationSetup section of the input file.

### Applying magnetic fields

For the application of magnetic fields the fields element in the calculationSetup section looks like:

<fields b_field="0.1"/>

Specifying a $\vec{B}$ field in this way applies it to the whole unit cell. But it is also possible to only apply a $\vec{B}$ field to a certain atom. For this a special element has to be inserted into the respective atomSpecies section directly below the prodBasis and energyParameters entries. Such an element looks like:

<special b_field_mt="0.1"/>

If you are applying $\vec{B}$ fields in Fleur you should also be aware that:

• The implementation actually only adds simple Zeeman terms to the potential, not proper $\vec{B}$-fields.
• The fields are not taken into account when calculating the density-potential integrals which enter the total energy..
• Magnetic fields can be applied in film and bulk setups.

### Applying electric fields

There are two basic ways of specifying electric fields:

1. The values of the sheets of charge for external electric fields is set by requiring charge neutrality. Thus, most easily you can add or subtract a fractional charge by changing the number of valence electrons. The resulting field is shown in the external electric field section of the out file.
<bzIntegration valenceElectrons="8.00100000" ...

Note that adding too much charge to the valence electrons will result in a Fleur error.

1. For film unit cells more complex settings are possible using the <fields> tag in the calculationSetup section. This is done by placing a sheet of charge on either side of the film in the vacuum. In consequence an electric field perpendicular to the film surface is generated. To conserve charge neutrality of the unit cell the total charge added in this way has to be subtracted from the number of valenceElectrons in the film.

In detail the setup for the application of an electric field in this way looks like:

<fields zsigma="0.0" sig_b_1="0.0" sig_b_2="0.0" autocomp="T" dirichlet="F" eV="F">
<shape> shapestring </shape>
</fields>

The following attributes are provided:

• zsigma: The position of the sheets of charge relative to the vacuum boundary (set by default to 10 a.u. (= 5.291772 Å)).
• sig_b_1 and sig_b_2: for charges on the upper and lower plates (default 0.0). Setting these to different values enables to place an asymmetric field.
• autocomp: This switch makes sure that overall charge neutrality is automatically calculated.
• dirichlet: This switch enables the use of Dirichlet boundary conditions.
• eV: This switch is used to modify units in the dirichlet="T" case.
• In addition an (unlimited) number of <shape> tags can be given to specify inhomogenous fields.

Inhomogeneous fields can also be generated:

• 'sig_b_1/2' contain the additional (homogeneous) charge for the top and bottom sheet. By default, excess (positive/negative) charge of the film is compensated by equally charging the charge sheets; if 'autocomp' is false, the user has to do this manually. Note: Fleur requires an overall (film plus top plus bottom sheet) charge neutrality.
• The inhomogeneous charge can be placed using the in which strings are supplied. These strings specify the inhomogenous charges using the key-words rect, circ, rectSinX, polygon, and datafile. Their detailed syntax is:
rect <sheet> <x>,<y> <width>,<height> <charge> [options]

circ <sheet> <x>,<y> <radius> <charge> [options]

rectSinX <sheet> <x>,<y> <width>,<height>  <amplitude> <n> <delta> [options]

polygon <sheet> <n_points> <x1>,<x2> ... <x_n>,<y_n> <charge> [options]

datafile <filename> [zero_avg] [options]

Note that all positions and lengths are currently relative values (i.e. between 0 and 1). The sheet to be used can be set using , which can be either top, bot or topbot/bottop. Options are: add (default) to add the charge to the charge of previous tags or replace to use the new charge instead; zero to place the charge only to areas which were before zero, nonzero to place it at areas which where before nonzero or all (default) to place it in the whole area covered by the tag.

Note: The regions can exceed the unit cell plane and then cut off, e.g.

circ top 0,0  0.25  0.5

places half an electron in a quarter circle with origin (0,0). Note, however, that circ creates a perfect circle only on the grid; this generates a circle and not an ellipse only if the ''k1d''/''k2d'' ratio matches the crystal's ''a''/''b'' ratio.

rectSinX creates a sinodal potential in ''x'' direction (constant in ''y'' direction for any ''x'' value), i.e. {$V(x,y) = A \sin(2\pi nx + 2\pi\delta)$}, where ''A'' is the amplitude; however, the argument in apwefl is not ''A'' directly but {$A' = A L_z$}, where {$L_z$} is the number of points in ''z'' direction. Contrary to circ and rect, charges are masked out without being redistributed to non-masked positions. It is {$\int_0^{2\pi} A|\sin(x)| {\rm d}x = 4A'$}, n is the order and delta ({$\delta$}) the offset.

polygon creates a polygon-shaped charge distribution; note that the currently used algorithm does not always give the perfectly shaped polygon - and the edge points are not always included in the polygon.

The datafile reads the data from a file; if a zero_avg has been given, the charge is averaged to zero, i.e. only the inhomogeneous contributions are taken into account. The option replace/add is supported, but zero/not_zero is not. The syntax of the data file itself is as follows. First line: number of ''x'' and ''y'' points; second line: charge for point (x=1,y=2), third: (x=1,y=2) etc. The number of points must be 3*k1d and 3*k2d.

Example 1: To have two top plates (segments):

rect top 0,  0  0.5,1.0  0.2
rect top 0.5,0  0.5,1.0 -0.2

Example 2: To have a charged ring with 0.2e and -0.2e of charge evenly distributed outside this ring:

circ topBot 0.5,0.5 0.2  1           ! Create temporarily an inner ring
circ topBot 0.5,0.5 0.3  0.2 zero    ! Create outer ring
circ topBot 0.5,0.5 0.2  0   replace ! Delete inner ring
rect topBot 0,0     1,1 -0.2 zero    ! Place smeared opposite charge