Hex: src/interfaces.h File Reference

| Hex 2.2 Hydrogen-electron collision solver

Functions
interfaces.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Functions

void | hex_initialize_ (const char *dbname)
| Initialize the environment. More...
void | hex_initialize (const char *dbname)
void | hex_new_ ()
| Create new database. More...
void | hex_new ()
void | hex_import_ (const char *sqlname)
| Import SQL batch file. More...
void | hex_import (const char *sqlname)
void | hex_update_ ()
| Update integral and complete cross section. More...
void | hex_update ()
void | hex_optimize_ ()
| Optimize the SQLite database file. More...
void | hex_optimize ()
void | hex_dump_ (const char *dumpname)
| Dump contents of the T-matrix table. More...
void | hex_dump (const char *dumpname)
void | hex_scattering_amplitude_ (int *ni, int *li, int *mi, int *nf, int *lf, int *mf, int *S, int *nEnergies, double *energies, int *nAngles, double *angles, double *result, double *extra)
| Scattering anplitude (Fortran). More...
void | hex_scattering_amplitude (int ni, int li, int mi, int nf, int lf, int mf, int S, int nEnergies, double *energies, int nAngles, double *angles, double *result, double *extra)
| Scattering anplitude (C). More...
void | hex_scattering_amplitude_dir_ (int *ni, int *li, int *mi, int *nf, int *lf, int *mf, int *S, double *E, int *N, double *alpha, double *beta, double *gamma, double *angles, double *result)
| Scattering anplitude for non-aligned impact direction (Fortran). More...
void | hex_scattering_amplitude_dir (int ni, int li, int mi, int nf, int lf, int mf, int S, double E, int N, double alpha, double beta, double gamma, double *angles, double *result)
| Scattering anplitude for non-aligned impact direction (C). More...
void | hex_differential_cross_section_ (int *ni, int *li, int *mi, int *nf, int *lf, int *mf, int *S, int *nEnergies, double *energies, int *nAngles, double *angles, double *dcs, double *extra)
| Differential cross section (Fortran). More...
void | hex_differential_cross_section (int ni, int li, int mi, int nf, int lf, int mf, int S, int nEnergies, double *energies, int nAngles, double *angles, double *dcs, double *extra)
| Differential cross section (C). More...
void | hex_complete_cross_section_ (int *ni, int *li, int *mi, int *nf, int *lf, int *mf, int *N, double *energies, double *ccs, int *Nall, int *npws, int *pws)
| Complete cross section (Fortran). More...
void | hex_complete_cross_section (int ni, int li, int mi, int nf, int lf, int mf, int N, double *energies, double *ccs, int *Nall, int npws, int *pws)
| Complete cross section (C). More...

## Function Documentation

## ◆ hex_complete_cross_section()

void hex_complete_cross_section | ( | int | ni,
|  | int | li,
|  | int | mi,
|  | int | nf,
|  | int | lf,
|  | int | mf,
|  | int | N,
|  | double * | energies,
|  | double * | ccs,
|  | int * | Nall,
|  | int | npws,
|  | int * | pws
| ) |  |

C prototype.

Parameters

  ni | Initial atomic principal quantum number.
  li | Initial atomic orbital quantum number.
  mi | Initial atomic magnetic quantum number.
  nf | Final atomic principal quantum number.
  lf | Final atomic orbital quantum number.
  mf | Final atomic magnetic quantum number.
  N | Sample count.
  energies | Real array of impact energies in Rydbergs.
  ccs | Real array of length N to contain the cross sections.
  Nall | Number of energies available in database; will be set if `ccs` is set to null pointer.
  pws | List of requested partial waves (or null pointer for all).
  npws | Size of `pws`.

## ◆ hex_complete_cross_section_()

void hex_complete_cross_section_ | ( | int * | ni,
|  | int * | li,
|  | int * | mi,
|  | int * | nf,
|  | int * | lf,
|  | int * | mf,
|  | int * | N,
|  | double * | energies,
|  | double * | ccs,
|  | int * | Nall,
|  | int * | npws,
|  | int * | pws
| ) |  |

Fortran prototype equivalent to

subroutine complete_cross_section (ni,li,mi,nf,lf,mf,N,energies,ccs,Nall)
integer, intent(in) :: ni,li,mi
integer, intent(in) :: nf,lf,mf
integer, intent(in) :: n
double precision, dimension(N) :: energies
double precision, dimension(2*N) :: ccs
integer, intent(out) :: nall

Parameters

  ni | Initial atomic principal quantum number.
  li | Initial atomic orbital quantum number.
  mi | Initial atomic magnetic quantum number.
  nf | Final atomic principal quantum number.
  lf | Final atomic orbital quantum number.
  mf | Final atomic magnetic quantum number.
  N | Sample count.
  energies | Real array of impact energies in Rydbergs.
  ccs | Real array of length N to contain the cross sections.
  Nall | Number of energies available in database; will be set if `ccs` is set to null pointer.
  pws | List of requested partial waves (or null pointer for all).
  npws | Size of `pws`.

## ◆ hex_differential_cross_section()

void hex_differential_cross_section | ( | int | ni,
|  | int | li,
|  | int | mi,
|  | int | nf,
|  | int | lf,
|  | int | mf,
|  | int | S,
|  | int | nEnergies,
|  | double * | energies,
|  | int | nAngles,
|  | double * | angles,
|  | double * | dcs,
|  | double * | extra
| ) |  |

C prototype.

Parameters

  ni | Initial atomic principal quantum number.
  li | Initial atomic orbital quantum number.
  mi | Initial atomic magnetic quantum number.
  nf | Final atomic principal quantum number.
  lf | Final atomic orbital quantum number.
  mf | Final atomic magnetic quantum number.
  S | Total spin (0 = singlet, 1 = triplet).
  E | Impact energy in Rydbergs.
  N | Sample count.
  angles | Real array of length N containing scattering angles.
  dcs | Real array of length N to contain the cross sections.

## ◆ hex_differential_cross_section_()

void hex_differential_cross_section_ | ( | int * | ni,
|  | int * | li,
|  | int * | mi,
|  | int * | nf,
|  | int * | lf,
|  | int * | mf,
|  | int * | S,
|  | int * | nEnergies,
|  | double * | energies,
|  | int * | nAngles,
|  | double * | angles,
|  | double * | dcs,
|  | double * | extra
| ) |  |

Fortran prototype equivalent to

subroutine hex_differential_cross_section (ni,li,mi,nf,lf,mf,S,E,N,angles,dcs)
integer, intent(in) :: ni,li,mi
integer, intent(in) :: nf,lf,mf
integer, intent(in) :: s,n
double precision, intent(in) :: e
double precision, dimension(N) :: angles
double precision, dimension(2*N) :: dcs

Parameters

  ni | Initial atomic principal quantum number.
  li | Initial atomic orbital quantum number.
  mi | Initial atomic magnetic quantum number.
  nf | Final atomic principal quantum number.
  lf | Final atomic orbital quantum number.
  mf | Final atomic magnetic quantum number.
  S | Total spin (0 = singlet, 1 = triplet).
  E | Impact energy in Rydbergs.
  N | Sample count.
  angles | Real array of length N containing scattering angles.
  dcs | Real array of length N to contain the cross sections.

## ◆ hex_dump()

void hex_dump | ( | const char * | dumpname | ) |

## ◆ hex_dump_()

void hex_dump_ | ( | const char * | dumpname | ) |

The output can be used to construct an equivalent table. The corresponding code is

sqlite> .mode insert
sqlite> select * from tmat

## ◆ hex_import()

void hex_import | ( | const char * | sqlname | ) |

## ◆ hex_import_()

void hex_import_ | ( | const char * | sqlname | ) |

The effect of this function should be equivalent to direct use of sqlite3 program:

sqlite3 hex.db < batchfile.sql

The function uses one line at a time and splits the lines into statements on semicolons. For this reason it does not allow multi-line statements. The statements produced by computational modules have always one statement per line.

Parameters

  sqlname | Zero-terminated character string.

## ◆ hex_initialize()

void hex_initialize | ( | const char * | dbname | ) |

## ◆ hex_initialize_()

void hex_initialize_ | ( | const char * | dbname | ) |

The function will open existing database with path specified in "dbname". If the database does not exist, a new empty database will be created. Also, all registered variables will be given chance to initialize by the function

Variable::initialize (sqlitepp::session & db)

This can be used to register special functions needed later in the SQL statements. For example the variable IntegralCrossSection registeres two functions: the simple square root and a more complicated numerical integrator that uses ClenshawCurtis quadrature.

The function "initialize" also disables journalling to speed up insertion of data.

Parameters

  dbname | Zero-terminated character string.

## ◆ hex_new()

void hex_new | ( |  | ) |

## ◆ hex_new_()

void hex_new_ | ( |  | ) |

This will create the necessary table structure in a new empty database. It is necessary to call initialize first, so that the databse file is created and opened. The tables are created by the call to

Variable::SQL_CreateTable();

for every registered variable. The return value is a vector of SQL statement which are executed.

## ◆ hex_optimize()

void hex_optimize | ( |  | ) |

## ◆ hex_optimize_()

void hex_optimize_ | ( |  | ) |

Reduces the occupied space using the VACUUM statement.

## ◆ hex_scattering_amplitude()

void hex_scattering_amplitude | ( | int | ni,
|  | int | li,
|  | int | mi,
|  | int | nf,
|  | int | lf,
|  | int | mf,
|  | int | S,
|  | int | nEnergies,
|  | double * | energies,
|  | int | nAngles,
|  | double * | angles,
|  | double * | result,
|  | double * | extra
| ) |  |

C prototype.

Parameters

  ni | Initial atomic principal quantum number.
  li | Initial atomic orbital quantum number.
  mi | Initial atomic magnetic quantum number.
  nf | Final atomic principal quantum number.
  lf | Final atomic orbital quantum number.
  mf | Final atomic magnetic quantum number.
  S | Total spin (0 = singlet, 1 = triplet).
  nEnergies | Number of supplied impact energies.
  energies | Real array of length `nEnergies` containing impact energies in Rydbergs.
  nAngles | Number of supplied angles.
  angles | Real array of length `nAngles` containing scattering angles.
  result | Complex array of length `nEnergies*nAngles` (or real array of twice that length) to contain the amplitudes.
  extra | Extrapolated result (w.r.t. partial waves); optional - can be set to zero.

## ◆ hex_scattering_amplitude_()

void hex_scattering_amplitude_ | ( | int * | ni,
|  | int * | li,
|  | int * | mi,
|  | int * | nf,
|  | int * | lf,
|  | int * | mf,
|  | int * | S,
|  | int * | nEnergies,
|  | double * | energies,
|  | int * | nAngles,
|  | double * | angles,
|  | double * | result,
|  | double * | extra
| ) |  |

Fortran prototype equivalent to

subroutine scattering_amplitude (ni,li,mi,nf,lf,mf,S,E,N,angles,result)
integer, intent(in) :: ni,li,mi
integer, intent(in) :: nf,lf,mf
integer, intent(int) :: s,n
double precision, intent(in) :: e
double precision, dimension(N) :: angles
double precision, dimension(2*N) :: result

Parameters

  ni | Initial atomic principal quantum number.
  li | Initial atomic orbital quantum number.
  mi | Initial atomic magnetic quantum number.
  nf | Final atomic principal quantum number.
  lf | Final atomic orbital quantum number.
  mf | Final atomic magnetic quantum number.
  S | Total spin (0 = singlet, 1 = triplet).
  nEnergies | Number of supplied impact energies.
  energies | Real array of length `nEnergies` containing impact energies in Rydbergs.
  nAngles | Number of supplied angles.
  angles | Real array of length `nAngles` containing scattering angles.
  result | Complex array of length `nEnergies*nAngles` (or real array of twice that length) to contain the amplitudes.
  extra | Extrapolated result (w.r.t. partial waves); optional - can be set to zero.

## ◆ hex_scattering_amplitude_dir()

void hex_scattering_amplitude_dir | ( | int | ni,
|  | int | li,
|  | int | mi,
|  | int | nf,
|  | int | lf,
|  | int | mf,
|  | int | S,
|  | double | E,
|  | int | N,
|  | double | alpha,
|  | double | beta,
|  | double | gamma,
|  | double * | angles,
|  | double * | result
| ) |  |

C prototype.

See hex_scattering_amplitude_dir_ for theory.

Parameters

  ni | Initial atomic principal quantum number.
  li | Initial atomic orbital quantum number.
  mi | Initial atomic magnetic quantum number.
  nf | Final atomic principal quantum number.
  lf | Final atomic orbital quantum number.
  mf | Final atomic magnetic quantum number.
  S | Total spin (0 = singlet, 1 = triplet).
  E | Impact energy in Rydbergs.
  N | Sample count.
  alpha | Impact angle (first of Euler angles).
  beta | Impact angle (second of Euler angles).
  gamma | Impact angle (third of Euler angles).
  angles | Real array of length N containing scattering angles.
  result | Complex array of length N (or real array of length 2N) to contain the amplitudes.

## ◆ hex_scattering_amplitude_dir_()

void hex_scattering_amplitude_dir_ | ( | int * | ni,
|  | int * | li,
|  | int * | mi,
|  | int * | nf,
|  | int * | lf,
|  | int * | mf,
|  | int * | S,
|  | double * | E,
|  | int * | N,
|  | double * | alpha,
|  | double * | beta,
|  | double * | gamma,
|  | double * | angles,
|  | double * | result
| ) |  |

This function will evaluate the scattering amplitude when the projectile is coming in a direction different from the quantization axis, i.e. when

\[ \mathbf{k}_i \neq (0, 0, k_i) \,. \]

In that case the of the scattering amplitude can be computed using Wigner d-function and all possible amplitudes from scattering between various magnetic levels. The reason for this is that such situation is equivalent to a change of the quantization axis by the same amount. To be precise, it is

\[ T_{n_f l_f m_f \leftarrow n_i l_i m_i} = \sum_{m_i' m_f'} D_{m_i' m_i}^{l_i} D_{m_f' m_f}^{l_f \ast} T_{n_f l_f m_f' \leftarrow n_i l_i m_i'} \,. \]

Fortran prototype equivalent to

subroutine scattering_amplitude (ni,li,mi,nf,lf,mf,S,E,N,angles,result)
integer, intent(in) :: ni,li,mi
integer, intent(in) :: nf,lf,mf
integer, intent(int) :: s,n
double precision, intent(in) :: e
double precision, dimension(N) :: angles
double precision, dimension(2*N) :: result

Parameters

  ni | Initial atomic principal quantum number.
  li | Initial atomic orbital quantum number.
  mi | Initial atomic magnetic quantum number.
  nf | Final atomic principal quantum number.
  lf | Final atomic orbital quantum number.
  mf | Final atomic magnetic quantum number.
  S | Total spin (0 = singlet, 1 = triplet).
  E | Impact energy in Rydbergs.
  N | Sample count.
  alpha | Impact angle (first of Euler angles).
  beta | Impact angle (second of Euler angles).
  gamma | Impact angle (third of Euler angles).
  angles | Real array of length N containing scattering angles.
  result | Complex array of length N (or real array of length 2N) to contain the amplitudes.

## ◆ hex_update()

void hex_update | ( |  | ) |

## ◆ hex_update_()

void hex_update_ | ( |  | ) |

This function is used after import of T-matrices. All variables will be given chance to update themselves using the function

Variable::SQL_Update();

which returns SQL statement that should do the update. If a variable uses other variables besides T-matrices for its update, it must be inserted to VariableList AFTER those variables, because the order of update is set by the order in the list.