REMARK : the command to run this example are preceeded
by >> in the text. All the rest is comment

To calculate an absorption spectra you need to run  three programs 

-da0amaS
-estraidipoliS
-componispettro

***************************************************************************
                     da0amaS
***************************************************************************
da0amaS is used to calculate the different contributions to the Hamiltonian
and write them to different files for subsequent use.
First an LDA spherical self-consistent atom is calculated.
Then the contributions are calculated and written to files.

These contributions are the 
--------------------------------


- 2body electron-electron interaction of the external shell,
- the interaction of external shell with neighbooring atoms
- the interation of the exchange field with the electrons spin
- All the remaining terms ( kinetic part, nucleus attraction,
   inner shells electron-electron interactions)

All these contribution are written to files in the form of a sparse matrix. 

A file called "fileatomo" is written separately, containing 
the description of the determinant basis used and the wavefunctions

The other programs will use these files to calculate the dipolar
elements and to re-compose the hamiltonian and invert it.

When you recompose the hamiltonian you will be able to give
different weights to each contribution. 
For example the weight given to the
 2body electron-electron interaction of the external shell,
allows you to take into account the hybridization of external shells
as in the Theo Thole model.
   
NOW let us run da0amaS for the Fed6 atom
---------------------------------------------------
>> da0amaS inputaFed6 parametrihfs  denergia  cristallo

Let us have a look to the input files. 

First inputaFed6
--------------------------

X----------------------------------------------------------
1  { Number of NL structure }
6  { Number of nl level  }
  { quantum number for each nl level  }
1 0 { 1s }
2 0 { 2s }
2 1 { ... }
3 0 
3 1
3 2
   { number of electrons for each nl level }
 2 2 6  2 6  6
99  { Total spin Jz along   Z}
-30  40  { MinSz MaxSz }
scaricanientemomentiopzioni
X----------------------------------------------------------
comments are enclosed in {}.
The number of NL structure is usually always 1. In principle
 the program has been written to deal with multiconfigurations
but I never runned it in this mode.
Please note that in this example all the shell are filled except the n=3,l=2 one
which has 6 electrons. The program generates all the determinant corresponding
to the partially filled shells, satisfying the following conditions :

  - The total spin along Z is used  to limit the determinants to those
    having that precise Jz. If you put 99 no restriction is applied
    ( put 99.5 for an odd number of electrons )

  _ The total Sz is within the limits MinSz, MaxSz. Put big number for no
    restriction.

Finnaly the file is ended by a string. This string is check for keyword
contained inside.
For example the substring "scarica" triggers the writing of contributions 
to files
The substring "nientemomenti" tells the program not to calculate
the moments L**2 S**2 Sz L*S on the total atom and partially
on each shell. Otherwise if the hamiltonian were diagonalised
(this happens when the substring "diagonalizza" is present)
the expectation value of these operators would be calculated
for each found eigenvector... but it takes time... 


Let  us have a look to the input file "parametrihfs"
-------------------------------------------------------


X--------------------------------------------------------------------------
26  400
0.000001  90
X-------------------------------------------------------------------------
26 is Z
400 is the number of points used in the (logaritmic) radial grid
when solving self-consistenly the LDA atom.
0.000001 and 90 are the starting radius(A.U.) and final radius of the radial grid



Now the file "denergia"
----------------------------
This file contains an energy in A.U. generally small. If
the substring "diagonalizza" is not present in the options string the value
this number does not matter.
Otherwise it determins the energy range, starting from the lowest energy,
 in which the eigenvalue are searched by the Sparsa library.



Finally the "cristallo" file:
------------------------------


X-------------------------------------------------------------------
1     { Number of reductions of the Slater integrals  between a
        given orbital and all the others 
      }
5  1  {  all the slater integrals between orbital number 5
         and another are multiplied by 1.
         Putting 1  corresponds to no reduction at all,
         but its use in conjunction with the substring "scarica"
         triggers the writing of the contribution coming from 
         the electron-electron contributions of orbital #5
         with the others to a separate file.

         Please note that 5 correspond to the n=3,l=2 shell
         (0 correspond to n=1,l=0 )
        }
1          { Number of reduction between two given orbitals     }

5 5 1  { All the interaction between orbital #5 and orbital #5 are
         multiplied by 1.
         Same comments as above
       }

1     { Number of shell which are sensitive to the exchange field 
      }
5 1   {  The shell #5 feels an exchange field of 1UA.
         of couse  1UA is science-fiction but what we want here is just
         to trigger the writing of the exchange contribution to a file
         to be used for a  subsequent recomposition.
       }
5       { shell # on which the crystal field is active.
          Put -1 for no field
	}
1 0 0 0 1  { finally the crystal field }
0 0 0 0 0
0 0 2 0 0
0 0 0 0 0
1 0 0 0 1
X-------------------------------------------------------------------------------------

The program generates the files :


 - fileatomo  containig the determinants and the wave functions ( it contains also eigenvector/eigenvalue if the substring "diagonalizza" is present )
 - H0base     containing the base contribution
 - HCrist     containing the crystal field contribution
 - Scambioguscio5  contribution of the exchange field on shell #5
 - slaterridottiDguscio5_5  containing electron-electron conbtibution for electrons 
                            on shell #5 with another on #5
 - slaterridottiSguscio5  containing electron-electron contribution for electrons 
                            on shell #5 with another on a different shell  
                       

We now move all these files on a separate directory for subsequent use :
-------------------------------------------------------------------------

>> mkdir base
>> mv fileatomo H0base HCrist Scambioguscio5 slaterridottiDguscio5_5 slaterridottiSguscio5 base/

Now we prepare the excited atom 
---------------------------------

>> da0amaS inputaFe2p5d7  parametrihfs  denergia  cristallo
>> mkdir eccitato 
>> mv fileatomo H0base HCrist Scambioguscio5 slaterridottiDguscio5_5 slaterridottiSguscio5 eccitato/


Extraction of the squared dipoles
----------------------------------

>> estraidipoliS base/fileatomo eccitato/fileatomo  

that generates the  files

- dipoliMinus.dat 
- dipoliPlus.dat  
- dipoliZ.dat 


Spectra Generation
________________________________


Now we are ready to calculate the spectra :

>> componispettro dipoliPlus.dat dipoliZ.dat dipoliMinus.dat 3   base/H0base 1  base/slaterridottiDguscio5_5  1 base/slaterridottiSguscio5 1 eccitato/H0base   eccitato/slaterridottiDguscio5_5  eccitato/slaterridottiSguscio5  0.001 0.0001    25.7   26.8  100   fileallargamenti 


The number 3 means that we are summing 3 contributions for the base state and 3 for the excited state

these contributions are 

  base/H0base   with weight    1
  base/slaterridottiDguscio5_5   with weight    1
  base/slaterridottiSguscio5     with weight    1

for the base

For the excited they are 

	eccitato/H0base
	eccitato/slaterridottiDguscio5_5 
	eccitato/slaterridottiSguscio5
 

with the same weights as for the base


0.001UA  is the energy range within which the Hamiltonian is diagonalised for the base state


0.0001UA is temperature 


25.7   26.8UA e la gamma energetica in cui calcolare lo spettro

100 est le numero di punti intermediari

The File "allargementi" is a two columns file :
energy  width
...      .....

For a given photon energy the file  is interpolated for the line width.



The result is written on the file  risultato
having four columns :

energiaUA  absorpiton+ absorpionZ absorption-



Ciao
