NumericalDerivativesWorkChain

NumericalDerivativesWorkChain#

workchainaiida_vibroscopy.workflows.dielectric.numerical_derivatives.NumericalDerivativesWorkChain

Workchain carrying out numerical derivatives. It computes the first and second order derivatives of forces and polarization in respect to electric field, to obtain dielectric tensor, Born effective charges, non linear optical susceptibility and Raman tensors. Forces and polarization must be passed as TrajectoryData as a dictionary in `data`. Numerical derivatives can have different number of evaluation points, depending on order and accuracy. The price to pay is the standardization of the structure of the dictionary to pass to this namespace. To understand, let’s review the approach.In central differencs approach we need the evaluation of the function at the value we want the derivative (in our case at :math:`\mathcal{E}=0`, E is the electric field), and at displaced positions from this value. The evaluation of the function at these points will have weights (or coefficients), which depend on order and accuracy. For example: - :math:`\frac{df}{dx} = \frac{ 0.5 \cdot f(+1.0 \cdot h) -0.5 \cdot f(-1.0 \cdot h) }{h} +\mathcal{O}(h^2)` - :math:`\frac{d^2 f}{dx^2} = \frac{ 1.0 \cdot f(+1.0 \cdot h) -2.0 \cdot f(0. \cdot h) +1.0 \cdot f(-1.0 \cdot h) }{h^2} +\mathcal{O}(h^2)` Referring to the coefficients for each step as :math:`c_i`, where `i` is an integer, our convention is to put in sequence the Trajectory data with increasing numbers as labels, for example: | ‘0’: TrajectoryData for :math:`c_1`, | ‘1’: TrajectoryData for :math:`c_{-1}`, | ‘2’: TrajectoryData for :math:`c_2`, | ‘3’: TrajectoryData for :math:`c_{-2}`, | … This way to creating an analogous of an array with coefficients :math:`[c_1,c_{-1},c_2,c_{-2}, \dots]`. These dictionaries are going to be put as sub-dictionary in a general `data` dictionary. Each sub-dict has to be put with a key with suffix a number indicating which tensor component is referring to. In our case, we use a similar Voigt notation. Namely we have two cases: * first order derivatives: keys suffices are 0,1,2; 0 for :math:`[i,x]`, 1 for :math:`[i,y]`, 2 for :math:`[i,z]` (with :math:`i={x,y,z}`) * second order derivatives: keys suffices are 0,…5; 0 for :math:`[i,x,x]`, :math:`\dots` (as in Voigt), 5 for :math:`[i,x,y]` (with :math:`i={x,y,z}`) The prefix can be anything. Best practice is using ``field_`` with and underscorre as prefix. The Trajectory data for the :math:`c_0` coefficient (i.e. the one with :math:`\mathcal{E}=0`) must be passed with a different key, namely ``null_field``. This is to avoid errors and due to the fact that is common to the all derivatives.

Inputs:

  • central_difference, Namespace – The inputs for the central difference scheme.
    • accuracy, (Int, NoneType), optional – Central difference scheme accuracy to employ (i.e. number of points for derivative evaluation). This must be an EVEN positive integer number. If not specified, an automatic choice is made upon the intensity of the critical electric field.
    • diagonal_scale, Float, optional – Scaling factor for electric fields non parallel to cartesiaan axis (i.e. E –> scale*E).
    • electric_field_step, (Float, NoneType), optional – Electric field step in Ry atomic units used in the numerical differenciation. Only positive values. If not specified, an NSCF is run to evaluate the critical electric field; an electric field step is then extracted to secure a stable SCF.
  • data, Namespace – Namespace for passing TrajectoryData containing forces and polarization.
    • field_index_0, Namespace
    • field_index_1, Namespace
    • field_index_2, Namespace
    • field_index_3, Namespace
    • field_index_4, Namespace
    • field_index_5, Namespace
    • null_field, (TrajectoryData, NoneType), optional
  • metadata, Namespace
    • call_link_label, str, optional, is_metadata – The label to use for the CALL link if the process is called by another process.
    • description, (str, NoneType), optional, is_metadata – Description to set on the process node.
    • label, (str, NoneType), optional, is_metadata – Label to set on the process node.
    • store_provenance, bool, optional, is_metadata – If set to False provenance will not be stored in the database.
  • structure, StructureData, required
  • symmetry, Namespace
    • distinguish_kinds, Bool, optional – Whether or not to distinguish atom with same species but different names with symmetries.
    • is_symmetry, Bool, optional – Whether using or not the space group symmetries.
    • symprec, Float, optional – Symmetry tolerance for space group analysis on the input structure.

Outputs:

  • tensors, Namespace – Contains high frequency dielectric and Born effectivecharges tensors computed in Cartesian coordinates. Depending on the inputs, it can also contain the derivatives of the susceptibility in respect to the atomic positions (called Raman tensors) and the non linear optical susceptibility, always expressed in Cartesian coordinates.
  • units, Dict, optional – Units of the susceptibility derivatives tensors.

Outline:

run_results(Wrap up results from previous calculations.)