# 4. Calculation

The kite.Calculation object carries the information about the to-be-calculated quantities, i.e. the target functions. Key parameters of the calculation are included here, such as number of Chebyshev moments and number of disorder realizations. These are used by KITEx to calculate the spectral coefficients subsequently used by KITE-tools at the post-processing stage, e.g. to reconstruct the full energy dependence of the desired target function (see [worflow]). The parameters given in the Examples are optimized for a standard desktop computer.

The target functions currently available are:

KITE's first release was restricted to two-dimensional systems. However, since then, there has been an efford to expand the functionalties to three-dimensional systems. In the current release, most functionalities are compatible with 3D systems. For details, check the table below:

- Extensivelly used and checked

- Implemented

- Not yet implemented

Processing the output of singleshot_conductivity_dc

singleshot_conductivity_dc() works different from the other target-functions in that it just requires a single run with KITEx. Post-processing with KITE-tools is not required, and instead the required single-shot values of the DC-conductivity can be retrieved directly from the HDF5-file once KITEx has run. You can extract the results from the HDF5 file as explained in the tutorial, with "output.h5" the name of the HDF5 file processed by KITEx:

 1 2 3 4  import numpy as np from h5py import File condDC = File("output.h5", "r+")['Calculation']['singleshot_conductivity_dc']['SingleShot'] np.savetxt("condDC.dat",condDC) 

All target functions require the following parameters:

• num_moments
Defines the number of moments of the Chebyshev expansion and hence the energy resolution of the calculation; see Documentation.
• num_random
Defines the number of random vectors used in the stochastic trace evaluation.
• num_disorder
Defines the number of disorder realizations (and specifies the boundary twist angles if the "random" boundary mode is chosen).

Some parameters are specific of the target function:

• direction
Specifies the component of the linear (longitudinal: ('xx', 'yy', 'zz'), transversal: ('xy', 'yx', 'xz', 'yz')) or the nonlinear conductivity tensor (e.g., 'xyx' or 'xxz') to be calculated.
• temperature (can be modified at post-processing level)
Temperature of the Fermi-Dirac distribution used to evaluate optical and DC conductivities. temperature specifies the quantity $$k_B T$$, which has units of energy. For example, if the hoppings are given in eV, temperature must be given in eV.
• num_points (can be modified at post-processing level)
Number of energy points used by the post-processing tool to output the density of states.
• energy
Selected values of Fermi energy at which we want to calculate the singleshot_conductivity_dc.
• eta
Imaginary term in the denominator of the Green's function required for lattice calculations of finite-size systems, i.e. an energy resolution (can also be seen as a controlled broadening or inelastic energy scale). For technical details, see Documentation.

The calculation is structured in the following way:

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 calculation = kite.Calculation(configuration) calculation.dos( num_points=1000, num_random=10, num_disorder=1, num_moments=512 ) calculation.conductivity_optical( num_points=1000, num_random=1, num_disorder=1, num_moments=512, direction='xx' ) calculation.conductivity_dc( num_points=1000, num_moments=256, num_random=1, num_disorder=1, direction='xy', temperature=1 ) calculation.singleshot_conductivity_dc( energy=[(n / 100.0 - 0.5) * 2 for n in range(101)], num_moments=256, num_random=1, num_disorder=1, direction='xx', eta=0.02 ) calculation.conductivity_optical_nonlinear( num_points=1000, num_moments=256, num_random=1, num_disorder=1, direction='xxx', temperature=1.0, special=1 ) 

Note

The user can decide what functions are used in a calculation. However, it is not possible to configure the same function twice in the same Python script (HDF5 file).

When these objects are defined, we can export the file that will contain set of input instructions for KITEx using the kite.config_system function: function:

kite.config_system(lattice, configuration, calculation, filename='test.h5')


#### Running a Calculation¶

To run the code and to post-process it, run from the kite/-directory

./build/KITEx test.h5
./tools/build/KITE-tools test.h5


KITE-tools output

The output of KITE-tools is dependent on the target function. Each specific case is described in the API. The output is generally a "*.dat"-file where the various columns of data contain the required target functions.

### Visualizing the Output Data¶

After calculating the quantity of interest and post-processing the data, we can plot the resulting data with the following script:

 1 2 3 4 5 data=np.loadtxt('dos.dat') plt.plot(data[:,0], data[:,1]) plt.xlabel('E (eV)') plt.ylabel('DOS (a.u)') 

If you want to go through these steps in a more streamlined fashion, you can use a Bash script, for example:

  1 2 3 4 5 6 7 8 9 10 #!/bin/bash file_out=example1 # name of python script that exports the HDF5-file file_in=example1 # name of the exported HDF5-file python ${file_out}.py # make a model ./KITEx${file_in}.h5 # run Kite ./tools/KITE-tools \${file_in}.h5 # run the post-processing steps python plot_dos.py # display the data