|
|
# Form of the functional
|
|
|
W-SLDA codes minimize functional of generic form:
|
|
|
![E=\int \mathcal{E}_{\textrm{edf}}(n,\nu,\ldots)\,d^3r-\sum_{\sigma}\int\left(\mu_{\sigma}-V_{\sigma}^{\textrm{(ext)}}(r)\right)n_{\sigma}(r)\,d^3r-\int\left(\Delta^{\textrm{(ext)}}(r)\nu^*(r)+\textrm{h.c.}\right)d^3r-\sum_{\sigma}\int \vec{v}_{\sigma}^{\textrm{(ext)}}(r)\cdot\vec{j}_{\sigma}(r)\,d^3r](https://render.githubusercontent.com/render/math?math=E%3D%5Cint%20%5Cmathcal%7BE%7D_%7B%5Ctextrm%7Bedf%7D%7D(n%2C%5Cnu%2C%5Cldots)%5C%2Cd%5E3r-%5Csum_%7B%5Csigma%7D%5Cint%5Cleft(%5Cmu_%7B%5Csigma%7D-V_%7B%5Csigma%7D%5E%7B%5Ctextrm%7B(ext)%7D%7D(r)%5Cright)n_%7B%5Csigma%7D(r)%5C%2Cd%5E3r-%5Cint%5Cleft(%5CDelta%5E%7B%5Ctextrm%7B(ext)%7D%7D(r)%5Cnu%5E*(r)%2B%5Ctextrm%7Bh.c.%7D%5Cright)d%5E3r-%5Csum_%7B%5Csigma%7D%5Cint%20%5Cvec%7Bv%7D_%7B%5Csigma%7D%5E%7B%5Ctextrm%7B(ext)%7D%7D(r)%5Ccdot%5Cvec%7Bj%7D_%7B%5Csigma%7D(r)%5C%2Cd%5E3r)
|
|
|
where:
|
|
|
* ![\mathcal{E}_{\textrm{edf}}(n,\nu,\ldots)](https://render.githubusercontent.com/render/math?math=%5Cmathcal%7BE%7D_%7B%5Ctextrm%7Bedf%7D%7D(n%2C%5Cnu%2C%5Cldots)) is energy density functional which defines the physical system,
|
|
|
* ![V_{\sigma}^{\textrm{(ext)}}(r)](https://render.githubusercontent.com/render/math?math=V_%7B%5Csigma%7D%5E%7B%5Ctextrm%7B(ext)%7D%7D(r)) is spin dependent external potential, and ![\mu_{\sigma}](https://render.githubusercontent.com/render/math?math=%5Cmu_%7B%5Csigma%7D) are chemical potentials (Lagrange multipliers) for constraining particle number.
|
|
|
* ![\Delta^{\textrm{(ext)}}(r)](https://render.githubusercontent.com/render/math?math=%5CDelta%5E%7B%5Ctextrm%7B(ext)%7D%7D(r)) is external pairing potential,
|
|
|
* ![\vec{v}_{\sigma}^{\textrm{(ext)}}(r)](https://render.githubusercontent.com/render/math?math=%5Cvec%7Bv%7D_%7B%5Csigma%7D%5E%7B%5Ctextrm%7B(ext)%7D%7D(r)) is external velocity field.
|
|
|
|
|
|
W-SLDA toolkit provides flexible framework that allows for custom definition of all these terms. User must provide body of following functions contained in file: *problem-definition.h*. Each function can be parametrized by [User defined parameters](User defined parameters).
|
|
|
|
|
|
# Definition of the external potential ![V_{\sigma}^{\textrm{(ext)}}(r)](https://render.githubusercontent.com/render/math?math=V_%7B%5Csigma%7D%5E%7B%5Ctextrm%7B(ext)%7D%7D(r))
|
|
|
```c
|
|
|
/**
|
|
|
* EXTERNAL POTENTIAL V_ext
|
|
|
* @param ix x-coordinate from range [0,NX), to convert to Cartesian use: x = DX*(ix-NX/2)
|
|
|
* @param iy y-coordinate from range [0,NY), to convert to Cartesian use: y = DY*(iy-NY/2),
|
|
|
* NOTE: in case of 1d code iy=0
|
|
|
* @param iz z-coordinate from range [0,NZ), to convert to Cartesian use: z = DZ*(iz-NZ/2)
|
|
|
* NOTE: in case of 1d and 2d codes iz=0
|
|
|
* @param it iteration number
|
|
|
* @param spin spin indicator, value from set {SPINA,SPINB}
|
|
|
* @param params array of input parameters, before call of this routine the params array is processed by process_params() routine
|
|
|
* @param extra_data_size size of extra_data in bytes, if extra_data size=0 the optional data is not uploaded
|
|
|
* @param extra_data optional set of data uploaded by load_extra_data()
|
|
|
* @return value of the external potential V_spin(x,y,z)
|
|
|
* */
|
|
|
double v_ext(int ix, int iy, int iz, int it, int spin, double *params, size_t extra_data_size, void *extra_data)
|
|
|
{
|
|
|
// ADD HERE FORMULA FOR V_ext(r)
|
|
|
double V_ext = 0.0;
|
|
|
|
|
|
return V_ext;
|
|
|
}
|
|
|
```
|
|
|
|
|
|
# Definition of the external pairing potential ![\Delta^{\textrm{(ext)}}(r)](https://render.githubusercontent.com/render/math?math=%5CDelta%5E%7B%5Ctextrm%7B(ext)%7D%7D(r))
|
|
|
```c
|
|
|
/**
|
|
|
* EXTERNAL PAIRING POTENTIAL Delta_ext
|
|
|
* @param ix x-coordinate from range [0,NX), to convert to Cartesian use: x = DX*(ix-NX/2)
|
|
|
* @param iy y-coordinate from range [0,NY), to convert to Cartesian use: y = DY*(iy-NY/2)
|
|
|
* NOTE: in case of 1d code iy=0
|
|
|
* @param iz z-coordinate from range [0,NZ), to convert to Cartesian use: z = DZ*(iz-NZ/2)
|
|
|
* NOTE: in case of 1d and 2d codes iz=0
|
|
|
* @param it iteration number
|
|
|
* @param delta - value of delta computed self-consistently for given iteration it.
|
|
|
* @param params array of input parameters, before call of this routine the params array is processed by process_params() routine
|
|
|
* @param extra_data_size size of extra_data in bytes, if extra_data size=0 the optional data is not uploaded
|
|
|
* @param extra_data optional set of data uploaded by load_extra_data()
|
|
|
* @return value of external pairing potential Delta_{ext}(x,y,z)
|
|
|
* */
|
|
|
double complex delta_ext(int ix, int iy, int iz, int it, double complex delta, double *params, size_t extra_data_size, void *extra_data)
|
|
|
{
|
|
|
// ADD HERE FORMULA FOR Delta_ext(r)
|
|
|
double complex D_ext = 0.0 + I*0.0;
|
|
|
|
|
|
return D_ext;
|
|
|
}
|
|
|
```
|
|
|
*Note*: Due to technical reasons this function differs with respect to return type between `st-wslda` and `td-wslda` codes. Namly:
|
|
|
* `st-wslda`: return type must be C99 [double complex](https://en.cppreference.com/w/c/numeric/complex)
|
|
|
* `st-wslda`: return type must be compatible with [CUDA Complex](https://thrust.github.io/doc/group__complex__numbers.html)
|
|
|
|
|
|
# Definition of the external velocity field ![\vec{v}_{\sigma}^{\textrm{(ext)}}(r)](https://render.githubusercontent.com/render/math?math=%5Cvec%7Bv%7D_%7B%5Csigma%7D%5E%7B%5Ctextrm%7B(ext)%7D%7D(r))
|
|
|
```c
|
|
|
/**
|
|
|
* EXTERNAL VELOCITY FIELD vec[v]_ext
|
|
|
* @param ix x-coordinate from range [0,NX), to convert to Cartesian use: x = DX*(ix-NX/2)
|
|
|
* @param iy y-coordinate from range [0,NY), to convert to Cartesian use: y = DY*(iy-NY/2)
|
|
|
* NOTE: in case of 1d code iy=0
|
|
|
* @param iz z-coordinate from range [0,NZ), to convert to Cartesian use: z = DZ*(iz-NZ/2)
|
|
|
* NOTE: in case of 1d and 2d codes iz=0
|
|
|
* @param it iteration number
|
|
|
* @param spin spin indicator, value from set {SPINA,SPINB}
|
|
|
* @param coordinate - Cartesian coordinate of the external velocity vector that should be computed, value from set {XAXIS, YAXIS, ZAXIS}
|
|
|
* NOTE: for 1d code only XAXIS is requested, for 2d code XAXIS and YAXIS are requested.
|
|
|
* @param params array of input parameters, before call of this routine the params array is processed by process_params() routine
|
|
|
* @param extra_data_size size of extra_data in bytes, if extra_data size=0 the optional data is not uploaded
|
|
|
* @param extra_data optional set of data uploaded by load_extra_data()
|
|
|
* @return value of the external velocity vector v_ext(x,y,z)
|
|
|
* */
|
|
|
double velocity_ext(int ix, int iy, int iz, int it, int spin, int coordinate, double *params, size_t extra_data_size, void *extra_data)
|
|
|
{
|
|
|
// ADD HERE FORMULAS FOR vec{v}_ext=(vx, vy, vz)
|
|
|
double v_ext;
|
|
|
if(coordinate==XAXIS) v_ext=0.0;
|
|
|
if(coordinate==YAXIS) v_ext=0.0;
|
|
|
if(coordinate==ZAXIS) v_ext=0.0;
|
|
|
|
|
|
return v_ext;
|
|
|
}
|
|
|
``` |
|
|
\ No newline at end of file |