External module function spindensity_coeff - used by densplt, spins, display_density,display_densities

In order to calculate spindensities the following function has to be present in the module file *.so:

extern "C" void spindensity_coeff(Vector &aSlm, int & xyz, double *T,Vector &Hxc, 
   Vector & Hext,double *gJ,Vector &MODPAR,char **sipffilename,ComplexMatrix & Icalc_parstorage);

Note for windows users with MINGW the declaration should be extern "C" __declspec(dllexport) void spindensity_coeff(...).

The meaning of the symbols is as follows:

  on input
    xyz         direction index 1,2,3 = x,y,z (component for the spindensity vector to be calculated)
    T           temperature[K]
    Hxc        vector of exchange field [meV] (can be n-dimensional, for a set of n operators)
     Hext      external magnetic field [T]
    gJ          Lande factor
    MODPAR      Vector with Parameters  read in single ion property file
    sipffilename    file name of the single ion parameter file
    Icalc_parstorage parameter matrix (initialized by Icalc_parameter_storage_matrix_init)
                   it should/may contain any information, e.g. population numbers of the
				   states (imaginary part of row 0)
                   and eigenvalues (real part of row 0) with values set by the most recent call
                   for this ion (making use of this matrix is optional)
  on output
    aSlm         Output single ion moments =expectation values of
                coefficients of Zlm R^2(r) at a given temperature T and
                effective field H

The module function must perform the following tasks:

  1. calculate the coefficients of $Z_l^m R^2(r)$ in the expansion of the spin density vector $M^S_{x,y,z}=\sum_{l,m} a^{x,y,z}_{S,lm} Z_l^m R^2(r)$ The output Vector alm(1,...,49) should contain $a^{x,y,z}_{S,lm}$ in the following order (lm): 00,1-1, 10,11, 2-2, 2-1,20,21,22, 3-3, 3-2, ...,65,66
  2. if $T<0$ all quantities should be evaluated assuming that all Boltzmann probabilities $p_i$ are zero except for the state number $n=(-T)$, for which the probability $p_n=1$.