External module function Icalc_parameter_storage_matrix_init - used by mcphas,singleion,spins and densplt,mcdiff

This routine is optional, i.e. it may be programmed, but is not absolutely necessary. Before any call to Icalc this function will be called. subsequent calls to Icalc will provide this matrix to Icalc, Icalc may set values to this matrix to be read in the next call of Icalc.

This feature provides the designer of a single ion module with the possiblity to store information for subsquent calls of Icalc, usually the eigenvalues and eigenstates of a problem. This can be very useful to accelerate computations. For example, in mcphas meanfield iterations require to solve a similar eigenvalue problem in each iteration step. Therefore the mcphas module provides to the single ion module on every call to the function Icalc the parmeter matrix which the module stored in its last call for a specfic ion in the magnetic unit cell.

At the start of the programs mcphas mcdiff singleion the function Icalc_parameter_storage_matrix_init is called (if present in the module) and it should initialize a Complex Matrix by a command such as

(*parstorage)=ComplexMatrix(0,nofrows,1,nofcols);

and fill this matrix with sensible numerical values, in particular for the effective field, temperature given at the input of this function. Parameters MODPAR and Lande Factor gJ may be used for this purpose.

The routine should look similar to

#include "vector.h"          // MatPack vector class must be included

#ifdef __linux__
extern "C" void Icalc_parameter_storage_matrix_init(
#else
extern "C" __declspec(dllexport) void Icalc_parameter_storage_matrix_init(
#endif
// on output
                     ComplexMatrix * parstorage,    // storage matrix
// on input
                       Hxc ,                 //   vector of exchange field [meV] (can be n-dimensional, for a set of n operators)
                       Hext,                 // external magnetic field [T]
                      double *g_J,           // Input Lande g-factor
                      double &T,             // Input temperature (K)
                      Vector &MODPAR,     // Input vector of parameters 
                                          //from single ion property file
                      char **sipffilename)// Single ion properties filename
{ // ... some code to compute eigenvectors and eigenvalues

// dimension matrix
(*parstorage)=ComplexMatrix(0,nofrows,1,nofcols);

// fill matrix with values
int l,m;
          for(l=1;l<=nofrows;++l)for(m=1;m<=nofcols;++m)
          {(*parstorage)(l,m)=complex <double> ( 4 , 2);}
                 // instead of 4 and 2 put the real 
                 //and imaginary parts to be stored
}