The Drude-Lorentz fit program was developed by Hame Sehmi,
Wolfgang Langbein and Egor Muljarov to fit material permittivity
with a generalized Drude-Lorentz model (also known as critical
point model).

- Load data that you want to fit:

- If you are using the provided Johnson-Christy data click the Load button and select one of three files, the name of the file should be visible next to the button:
- Gold - JCDataAu.dat

- Silver - JCDataAg.dat
- Copper - JCDataCu.dat
- If you want to use your own data you have to provide your own data file with a suited format:
- The data file must be a table of 5 columns.
- First column is energy (frequency will also work).
- Second column is the refractive index (n).
- Third coulmn is the RMS error of the refractive index (if not available use 1).
- Fourth coulmn is the absorption index (k).
- Fifth coulmn is the experimental error for absorption index (if not available use 1).
- Adjust parameters:
- Choose the maximum number of Lorentz poles
*L*to be used. The fit will increase*L*from 0 to this number. For example, if*L*=3 is selected as the maximum, then curves for*L*=0,1,2,3 will be calculated and shown on the figure.

- The slider for maximum energy
*E*_max will, by default, select the total number of data points to fit. This can be adjusted to select fewer data points.**Note that E_min is always the lowest enery in the data set and is not adjustable.**

- By default the provided experimental errors are used, uncheck the box if a constant error of unity should be used.
- The background epsilon can be fixed to a specific value is
needed, otherwise it will also be optimized.

- For the
*L*=1 fit one can select to first use for each*E*_max using random guesses or just for the maximum E_max. - If the refinement option is selected, start values from the
*L*Lorentz poles are additionally used for*L*-1 poles, for each*L*. This can yield an improvement if the global minimum had not yet been found while increasing*L*.**This option can be selected while a calculation still running.** - Once all the parameters have been chosen you can run the program. Most options will become fixed at this point to keep consistency. They will become modifiable again once the calculation is complete. The calculation can be stopped at any time, keeping as output the actual status.
- The figure in the main panel shows how the S-values are being calculated:
*L*=0 (Drude only) will be calculated quickly due to few parameters being optimized.*L*=1 will calculate using random guesses until the cut-off criterion has been met (see paper Section IV B). All minima found are shown in red until the taken as correct when the lowest three minima found are within 10% relative value.

*L*>1 does not use random guess values, but the poles for*L*-1 plus one additional pole at*E*_max (see paper for details) .**Note that after each***L*has been calculated there is a 'smoothing**function' which improves S-valuas starting values the nearest neighbours (calculation cannot be stopped here).**- The program only calculates for energy ranges were the number of data values to be fitted exceeds the number of parameters.
- Once the calculation has completed the 'GRAPHS' button will
open a new panel to display the experimental and model
permittivity.

- There is a checkbox option to show the refractive and
absorption index instead. Select the desired
*L*and click on the slider to display results. **The save button will save the current model data at the experimental energies as modelFit.dat in the current directory.**- After the calculation has finished the results are saved in the current directory (view in excel or similar) in the following output files:
- error.dat contains the S-values calculated up to the maximum L chosen.
- paramNumPoles
*L*.dat has a list of parameters for all energy ranges for a specific*L.*There will be*L*+1 files showing parameter lists for the respective number of Lorentz poles.

Hame Sehmi, Wolfgang Langbein and Egor Muljarov, 20/12/2016, updated ...