Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • wslda wslda
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • wtools
  • wsldawslda
  • Wiki
  • External potentials

External potentials · Changes

Page history
Update External potentials authored Feb 19, 2026 by Gabriel Wlazłowski's avatar Gabriel Wlazłowski
Show whitespace changes
Inline Side-by-side
External-potentials.md
View page @ c8454c89
[[_TOC_]]
# Form of the functional
W-SLDA codes minimize functional of the generic form:
W-SLDA codes minimize the functional of the generic form:
```math
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
```
where:
* $`\mathcal{E}_{\textrm{edf}}(n,\nu,\ldots)`$ is energy density functional which defines the physical system,
* $`V_{\sigma}^{\textrm{(ext)}}(r)`$ is spin dependent external potential, and $`\mu_{\sigma}`$ are chemical potentials (Lagrange multipliers) for constraining particle number.
* $`V_{\sigma}^{\textrm{(ext)}}(r)`$ is a spin-dependent external potential, and $`\mu_{\sigma}`$ are chemical potentials (Lagrange multipliers) for constraining particle number.
* $`\Delta^{\textrm{(ext)}}(r)`$ is external pairing potential,
* $`\vec{v}_{\sigma}^{\textrm{(ext)}}(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).
The w-SLDA toolkit provides a flexible framework that allows for the custom definition of all these terms. User must provide the body of the following functions contained in the 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)`$
```c
......@@ -22,13 +24,17 @@ W-SLDA toolkit provides flexible framework that allows for custom definition of
* 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 params array of input parameters, before the 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)
{
// double x = DX*(ix-NX/2);
// double y = DY*(iy-NY/2); // for 1d code iy will be always 0
// double z = DZ*(iz-NZ/2); // for 1d and 2d codes iz will be always 0
// ADD HERE FORMULA FOR V_ext(r)
double V_ext = 0.0;
......@@ -47,20 +53,24 @@ double v_ext(int ix, int iy, int iz, int it, int spin, double *params, size_t ex
* 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 params array of input parameters, before the 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)
{
// double x = DX*(ix-NX/2);
// double y = DY*(iy-NY/2); // for 1d code iy will be always 0
// double z = DZ*(iz-NZ/2); // for 1d and 2d codes iz will be always 0
// 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. Namely:
*Note*: Due to technical reasons, this function differs with respect to return type between `st-wslda` and `td-wslda` codes. Namely:
* `st-wslda`: return type must be C99 [double complex](https://en.cppreference.com/w/c/numeric/complex)
* `td-wslda`: return type must be compatible with [CUDA Complex](https://thrust.github.io/doc/group__complex__numbers.html)
......@@ -77,13 +87,17 @@ double complex delta_ext(int ix, int iy, int iz, int it, double complex delta, d
* @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 params array of input parameters, before the 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)
{
// double x = DX*(ix-NX/2);
// double y = DY*(iy-NY/2); // for 1d code iy will be always 0
// double z = DZ*(iz-NZ/2); // for 1d and 2d codes iz will be always 0
// ADD HERE FORMULAS FOR vec{v}_ext=(vx, vy, vz)
double v_ext;
if(coordinate==XAXIS) v_ext=0.0;
......
Clone repository

Content of Documentation
Official webpage
W-BSK Toolkit