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
  • Initialization of the st wslda solvers

Initialization of the st wslda solvers · Changes

Page history
Update Initialization of the st wslda solvers authored Feb 20, 2026 by Gabriel Wlazłowski's avatar Gabriel Wlazłowski
Show whitespace changes
Inline Side-by-side
Initialization-of-the-st-wslda-solvers.md
View page @ f185da55
...@@ -15,13 +15,13 @@ The simplest way to start the self-consistent process is to initialize buffers w ...@@ -15,13 +15,13 @@ The simplest way to start the self-consistent process is to initialize buffers w
inittype 0 # 0 - create uniform solution and start from it inittype 0 # 0 - create uniform solution and start from it
``` ```
Alternatively, if a uniform solution is already existing the user can read it from file: Alternatively, if a uniform solution already exists the user can read it from a file:
```bash ```bash
inittype 10 # 10 - read uniform solution from file `inprefix`/uniform.solution inittype 10 # 10 - read uniform solution from file `inprefix`/uniform.solution
inprefix test # uniform solution is stored in this location inprefix test # uniform solution is stored in this location
``` ```
Following flags in the *input* file are used to control the generation process of the uniform solution: The following flags in the *input* file are used to control the generation process of the uniform solution:
```bash ```bash
# ----------- IN CASE OF: inittype=0 ---------------- # ----------- IN CASE OF: inittype=0 ----------------
# init0Na 28.0 # requested number of particles of type a, default=Na # init0Na 28.0 # requested number of particles of type a, default=Na
...@@ -36,9 +36,9 @@ Following flags in the *input* file are used to control the generation process o ...@@ -36,9 +36,9 @@ Following flags in the *input* file are used to control the generation process o
init0debug 1 # debug level, default=0 (no debug info), 1 (basic debug info), 2 (detailed debug info) init0debug 1 # debug level, default=0 (no debug info), 1 (basic debug info), 2 (detailed debug info)
init0save 1 # 0 - no saving of solution to file, 1 - save solution to the file init0save 1 # 0 - no saving of solution to file, 1 - save solution to the file
``` ```
Note that, many of them are commented out, and then the values are taken from corresponding tags of the main code. Note that many of them are commented out, and the values are then taken from the corresponding tags in the main part.
For spin symmetric systems to code typically converges without any problems. For spin-imbalanced systems, the uniform solution typically is hard to obtain. To overcome this problem, we introduced a method where we start from the solution at finite temperature `init0Tstart` and we gradually decrease the temperature to destination temperature `init0Tstop` with step `init0DeltaT`. Such a problematic case is shown below (for `temperature 0.01`): For spin-symmetric systems, the code typically converges without problems. For spin-imbalanced systems, the uniform solution is typically hard to obtain. To overcome this problem, we introduced a method that starts from the solution at a finite temperature `init0Tstart` and gradually decreases the temperature to the destination temperature `init0Tstop` with a step `init0DeltaT`. Such a problematic case is shown below (for `temperature 0.01`):
``` ```
# CREATING UNIFORM SOLUTION... # CREATING UNIFORM SOLUTION...
# DEBUG: n_a=0.017708, n_b=0.018750 # DEBUG: n_a=0.017708, n_b=0.018750
...@@ -63,7 +63,7 @@ For spin symmetric systems to code typically converges without any problems. For ...@@ -63,7 +63,7 @@ For spin symmetric systems to code typically converges without any problems. For
# UNIFORM SOLUTION: energy_kin= 1.923270037681, energy_pot= -0.526501268447, energy_pair= -0.967234017120, energy_tot= 0.429534752115 # UNIFORM SOLUTION: energy_kin= 1.923270037681, energy_pot= -0.526501268447, energy_pair= -0.967234017120, energy_tot= 0.429534752115
# UNIFORM SOLUTION: nwf=970 # UNIFORM SOLUTION: nwf=970
``` ```
It was obtained for default values, and the code indicates `# WARNING: MAXITER REACHED!` which means that the self-consistency was not obtained. However, when setting: It was obtained with default values, and the code indicates `# WARNING: MAXITER REACHED!`, indicating that self-consistency was not achieved. However, when setting:
```bash ```bash
init0Tstart 0.1 # start temperature, in units of eF, init0Tstart 0.1 # start temperature, in units of eF,
``` ```
...@@ -110,20 +110,20 @@ we obtain: ...@@ -110,20 +110,20 @@ we obtain:
# UNIFORM SOLUTION: nwf=970 # UNIFORM SOLUTION: nwf=970
``` ```
Depending on the settings you will need to also modify other `init0` parameters. Depending on the settings, you will also need to modify other `init0` parameters.
_NOTE_: You can check the correctness of settings of the uniform solver by using `solve-uniform` tool. For more info see [here](Checking correctness of settings). _NOTE_: You can check the correctness of the settings of the uniform solver by using the `solve-uniform` tool. For more info, see [here](Checking-correctness-of-settings).
# Starting from checkpoint # Starting from checkpoint
The code can be initialized by an already existing solution generated by `st-wslda`. The code can be initialized by an already existing solution generated by `st-wslda`.
It is the most commonly used option. To activate this option you need to set: It is the most commonly used option. To activate this option, you need to set:
```bash ```bash
inittype 5 # 5 - start from st-wslda checkpoint, inprefix points to folder with checkpoint binary file inittype 5 # 5 - start from st-wslda checkpoint, inprefix points to folder with checkpoint binary file
inprefix test inprefix test
``` ```
## Using checkpoint generated by code of lower dimension ## Using a checkpoint generated by the code of a lower dimension
The Toolkit allows for initializing higher dimensional calculations via checkpoint generated by lower-dimensional code, for example, 3D code can be initialized by checkpoints generated by 2D or 1D code. The Toolkit allows initializing higher-dimensional calculations using checkpoints generated by lower-dimensional code; for example, 3D code can be initialized using checkpoints generated by 2D or 1D code.
![rising-dim](uploads/a34ad26a27b5f4a77bb51ef1ea13b689/rising-dim.png) ![rising-dim](uploads/a34ad26a27b5f4a77bb51ef1ea13b689/rising-dim.png)
In the case of resizing the checkpoint file, a message of this type will be provided on `stdout`: In the case of resizing the checkpoint file, a message of this type will be provided on `stdout`:
``` ```
...@@ -134,15 +134,15 @@ In the case of resizing the checkpoint file, a message of this type will be prov ...@@ -134,15 +134,15 @@ In the case of resizing the checkpoint file, a message of this type will be prov
# INSPECTING CHECKPOINT FILE `test/checkpoint.dat` # INSPECTING CHECKPOINT FILE `test/checkpoint.dat`
# CHECKPOINT FOR 2D LATTICE: [NX,NY,NZ]=[8,10,12], [DX,DY,DZ]=[1.000,1.000,1.000], [LX,LY,LZ]=[8.000,10.000,12.000] # CHECKPOINT FOR 2D LATTICE: [NX,NY,NZ]=[8,10,12], [DX,DY,DZ]=[1.000,1.000,1.000], [LX,LY,LZ]=[8.000,10.000,12.000]
# !!! --- WARNING --- WARNING --- WARNING --- WARNING --- WARNING --- WARNING --- !!! # !!! --- WARNING --- WARNING --- WARNING --- WARNING --- WARNING --- WARNING --- !!!
# Dimensonality of the lattice has changed! # Dimensionality of the lattice has changed!
# The code will change dimensionality of given checkpoint data to the new lattice. # The code will change the dimensionality of the given checkpoint data to the new lattice.
# !!! --- ------- --- ------- --- ------- --- ------- --- ------- --- ------- --- !!! # !!! --- ------- --- ------- --- ------- --- ------- --- ------- --- ------- --- !!!
# LOADING CHECKPOINT FILE `test/checkpoint.dat` # LOADING CHECKPOINT FILE `test/checkpoint.dat`
# CONVERTING CHECKPOINT FILE: 2D --> 3D # CONVERTING CHECKPOINT FILE: 2D --> 3D
``` ```
## Using checkpoint generated on a lattice with different resolution. ## Using a checkpoint generated on a lattice with a different resolution.
If provided checkpoint file is generated on a lattice with different resolution, than specified in `predefines.h`, then [automatic interpolation](Automatic interpolations) will be applied. If the provided checkpoint file is generated on a lattice with a different resolution than specified in `predefines.h`, then [automatic interpolation](Automatic-interpolations) will be applied.
# Custom initialization of the solver # Custom initialization of the solver
The static codes can start the self-consistent process from arbitrary initial conditions. To activate this option user must specify in the input file: The static codes can start the self-consistent process from arbitrary initial conditions. To activate this option user must specify in the input file:
...@@ -150,7 +150,7 @@ The static codes can start the self-consistent process from arbitrary initial co ...@@ -150,7 +150,7 @@ The static codes can start the self-consistent process from arbitrary initial co
inittype -1 # -1 - custom initialization inittype -1 # -1 - custom initialization
``` ```
Using this functionality it is mandatory to initialize value of potentials via `modify_potentials(...)` routine. Initializtion iteration has index `it=-1`. Below we present example of such initialization. Using this functionality, it is mandatory to initialize the value of potentials via the `modify_potentials(...)` routine. Initialization iteration has index `it=-1`. Below we present an example of such initialization.
```c ```c
void modify_potentials(int it, wslda_density h_densities, wslda_potential h_potentials, double *params, size_t extra_data_size, void *extra_data) void modify_potentials(int it, wslda_density h_densities, wslda_potential h_potentials, double *params, size_t extra_data_size, void *extra_data)
{ {
...@@ -172,7 +172,7 @@ void modify_potentials(int it, wslda_density h_densities, wslda_potential h_pote ...@@ -172,7 +172,7 @@ void modify_potentials(int it, wslda_density h_densities, wslda_potential h_pote
h_densities.rho_a[ixyz]=h_densities.rho_b[ixyz]=0.018; // guess for the density, here I set constant value h_densities.rho_a[ixyz]=h_densities.rho_b[ixyz]=0.018; // guess for the density, here I set constant value
// all potentials must be filled, since they are used to construct BdG matrix // all potentials must be filled, since they are used to construct the BdG matrix
h_potentials.delta[ixyz]=0.1 + I*0.0; // guess for delta h_potentials.delta[ixyz]=0.1 + I*0.0; // guess for delta
h_potentials.alpha_a[ixyz]=h_potentials.alpha_b[ixyz]=1.0; // bare mass h_potentials.alpha_a[ixyz]=h_potentials.alpha_b[ixyz]=1.0; // bare mass
h_potentials.V_a[ixyz]=h_potentials.V_b[ixyz]=0.0; // no mean-field h_potentials.V_a[ixyz]=h_potentials.V_b[ixyz]=0.0; // no mean-field
...@@ -180,7 +180,7 @@ void modify_potentials(int it, wslda_density h_densities, wslda_potential h_pote ...@@ -180,7 +180,7 @@ void modify_potentials(int it, wslda_density h_densities, wslda_potential h_pote
h_potentials.A_a_y[ixyz]=h_potentials.A_b_y[ixyz]=0.0; // no current potentials h_potentials.A_a_y[ixyz]=h_potentials.A_b_y[ixyz]=0.0; // no current potentials
h_potentials.A_a_z[ixyz]=h_potentials.A_b_z[ixyz]=0.0; // no current potentials h_potentials.A_a_z[ixyz]=h_potentials.A_b_z[ixyz]=0.0; // no current potentials
ixyz++; // go to next point, it should be last line of the triple loop ixyz++; // go to next point, it should be the last line of the triple loop
} }
// my guess for chemical potentials // my guess for chemical potentials
...@@ -192,4 +192,4 @@ void modify_potentials(int it, wslda_density h_densities, wslda_potential h_pote ...@@ -192,4 +192,4 @@ void modify_potentials(int it, wslda_density h_densities, wslda_potential h_pote
} }
``` ```
Note, that when you initialize the solver manually you may break the internal integrity of data, and it can impact the convergence properties of the code. In such case, it is suggested to [disable mixing in the first iteration](https://gitlab.fizyka.pw.edu.pl/wtools/wslda/-/wikis/Convergence-control#disabling-mixing-in-the-first-iteration). When applied this option, the integrity of data will be retrieved after the first iteration. Note that when you initialize the solver manually, you may compromise the internal integrity of the data, which can affect the code's convergence properties. In such a case, it is suggested to [disable mixing in the first iteration](Convergence-control#disabling-mixing-in-the-first-iteration). When this option is applied, the data integrity will be retrieved after the first iteration.
Clone repository

Content of Documentation
Official webpage
W-BSK Toolkit