Introduction
Within W-SLDA Toolkit we provide a script for generating custom SLDA functional: extensions/sldae/sldae-dev-tool.c
Within the script user can provide its own formulas for:
double ground_state_energy (int dn, double _x, int id []);
double chemical_potential (int dn, double _x, int id []);
double inverse_effective_mass (int dn, double _x, int id []);
double pairing_gap (int dn, double _x, int id []);
In return, the script generates a source file readable by W-SLDA Engine. Once the functional is created, it becomes available for all code within the toolkit.
Example: SLDAE with the effective mass equal 1
The function for the computation of the effective mass has been modified to:
double
inverse_effective_mass (int dn, double _x, int id [])
{
int ip0 [1] = {0}; double x0 = xm (dn, _x, ip0);
// ...
return x0;
}
Next, the code is compiled and executed:
[gabrielw@dell sldae]$ gcc sldae-dev-tool.c -lm -lgsl -lgslcblas -o sldae-dev-tool
[gabrielw@dell sldae]$ ./sldae-dev-tool
SLDAE DEV TOOLS
[padé[4/4] interpolation of sldae parameters p = {beta, gamma, B, C}]
p a1 x + a2 x^2 + a3 x^3 + c x^4
----- = ----------------------------------
p_ufg 1 + b1 x + b2 x^2 + b3 x^3 + c x^4
beta interpolation (beta_ufg = -0.481506)
iter = 46 f(x) = 1.110e-16
a1 = +0.797400;
a2 = +0.943961;
a3 = +1.037043;
b1 = +1.227062;
b2 = +2.126210;
b3 = +1.734795;
c = +0.523445;
b_functional interpolation (b_functional_ufg = -0.481506)
iter = 13 f(x) = 8.882e-16
a1 = +0.698112;
a2 = +0.034678;
a3 = +0.455138;
b1 = +0.353905;
b2 = +0.806444;
b3 = +0.403679;
c = -0.031327;
inverse_gamma interpolation (inverse_gamma_ufg = -0.094945)
iter = 14 f(x) = 1.821e-14
a1 = +2.713374;
a2 = +1.441196;
a3 = +3.700251;
b1 = +0.634303;
b2 = +3.522427;
b3 = +3.701347;
c = +1.877961;
c_functional interpolation (c_functional_ufg = -10.532397)
iter = 19 f(x) = 3.664e-15
a1 = +0.370145;
a2 = +1.041299;
a3 = +1.737347;
b1 = +2.458364;
b2 = +5.604947;
b3 = +3.828124;
c = +1.085400;
Parameters written to: sldae_parameters.h
Creating file: sldae_parameters.txt
Once the functional is generated user should inspect content of file sldae_parameters.txt
. It contains following columns:
# 1: lambda=a*k_F
# 2: ground_state_energy
# 3: inverse_effective_mass
# 4: chemical_potential
# 5: pairing_gap
# 6: beta_parameter
# 7: beta_parameter - PADE
# 8: b_functional
# 9: b_functional - PADE
#10: inverse_gamma_parameter
#11: inverse_gamma_parameter - PADE
#12: c_functional
#13: c_functional - PADE
In particular, it is important to confirm that PADE approximants correctly reproduce functions generated by analytical formulas. Note that W-SLDA Engine uses Pade approximants to deliver the highest performance.
[gabrielw@dell sldae]$ gnuplot
gnuplot> plot "sldae_parameters.txt" u 1:6 w l, "" u 1:7 w l
# and similar for other functions
Finally, file sldae_parameters.h
should be moved to folder hpc-engine
. From now new SLDAE functional will be used when FUNCTIONAL=SLDAE
is selected in predefines.
Collection of own SLDAE-like functionals
The information about PADE approximants for functional coefficients loded to the engine through the file hpc-engine\sldae_functional.h
, precisely:
// Select coefficients
#ifdef SLDAE_FORCE_A1
#include "sldae_parameters_A1.h"
#else
// default one
#include "sldae_parameters.h"
#endif
User can modify this section to form that uploads a correct file with the desired set of coefficients.