1(*
2 Copyright (C) 2017 M.A.L. Marques
3
4 This Source Code Form is subject to the terms of the Mozilla Public
5 License, v. 2.0. If a copy of the MPL was not distributed with this
6 file, You can obtain one at http://mozilla.org/MPL/2.0/.
7*)
8
9(* One should be able to simplify this by evaluating explicitly the Stoll
10   decomposition of the exchange functional *)
11
12$define lda_c_pw_params
13$define lda_c_pw_modified_params
14$include "lda_c_pw.mpl"
15
16b97mv_ux    := (mgamma, x) -> mgamma*x^2/(1 + mgamma*x^2):
17
18(* article uses t = 2 tau convention *)
19b97mv_wx_ss := (t, dummy) -> (K_FACTOR_C - t)/(K_FACTOR_C + t):
20b97mv_wx_os := (ts0, ts1) -> (K_FACTOR_C*(ts0 + ts1) - 2*ts0*ts1)/(K_FACTOR_C*(ts0 + ts1) + 2*ts0*ts1):
21
22b97mv_g := (mgamma, wx, cc, n, xs, ts0, ts1) ->
23  add(cc[i][1]*wx(ts0, ts1)^cc[i][2]*b97mv_ux(mgamma, xs)^cc[i][3], i=1..n):
24
25if evalb(Polarization = "ferr") then
26  b97mv_fpar  := (rs, z, xs0, xs1, ts0, ts1) ->
27    +     f_pw(rs, 1) * b97mv_g(b97mv_gamma_ss, b97mv_wx_ss, b97mv_par_ss, b97mv_par_n, xs0, ts0, 0):
28
29  b97mv_fos := (rs, z, xs0, xs1, ts0, ts1) -> 0:
30else
31  b97mv_fpar  := (rs, z, xs0, xs1, ts0, ts1) ->
32    + lda_stoll_par(f_pw    , rs,  z,  1) * b97mv_g(b97mv_gamma_ss, b97mv_wx_ss, b97mv_par_ss, b97mv_par_n, xs0, ts0, 0)
33    + lda_stoll_par(f_pw    , rs, -z, -1) * b97mv_g(b97mv_gamma_ss, b97mv_wx_ss, b97mv_par_ss, b97mv_par_n, xs1, ts1, 0):
34
35  b97mv_fos := (rs, z, xs0, xs1, ts0, ts1) ->
36    lda_stoll_perp(f_pw, rs, z)
37    * b97mv_g(b97mv_gamma_os, b97mv_wx_os, b97mv_par_os, b97mv_par_n, sqrt(xs0^2 + xs1^2)/sqrt(2), ts0, ts1):
38end if:
39
40b97mv_f :=  (rs, z, xs0, xs1, ts0, ts1) ->
41  + b97mv_fpar(rs, z, xs0, xs1, ts0, ts1)
42  + b97mv_fos(rs, z, xs0, xs1, ts0, ts1):
43