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(* type: mgga_exc *)
10(* prefix:
11  mgga_c_bc95_params *params;
12
13  assert(p->params != NULL);
14  params = (mgga_c_bc95_params * )(p->params);
15*)
16
17$define lda_c_pw_params
18$define lda_c_pw_modified_params
19$include "lda_c_pw.mpl"
20
21(* The B97 function g *)
22bc95_gpar  := (xs, ts) -> ts*Fermi_D(xs, ts)/(K_FACTOR_C*(1 + params_a_css*xs^2)^2):
23bc95_gperp := (xs0, xs1) -> 1/(1 + params_a_copp*(xs0^2 + xs1^2)):
24
25(* The parallel and perpendicular components of the energy *)
26if evalb(Polarization = "ferr") then
27  bc95_fpar  := (rs, z, xs0, xs1, ts0, ts1) ->
28    f_pw(rs, 1)*bc95_gpar(xs0, ts0):
29
30  bc95_fperp := (rs, z, xs0, xs1) -> 0:
31else
32  bc95_fpar  := (rs, z, xs0, xs1, ts0, ts1) ->
33    + lda_stoll_par(f_pw, rs,  z,  1) * bc95_gpar(xs0, ts0)
34    + lda_stoll_par(f_pw, rs, -z, -1) * bc95_gpar(xs1, ts1):
35
36  bc95_fperp := (rs, z, xs0, xs1) ->
37    lda_stoll_perp(f_pw, rs, z) * bc95_gperp(xs0, xs1):
38end if:
39
40f_bc95 := (rs, z, xs0, xs1, ts0, ts1) ->
41  + bc95_fpar (rs, z, xs0, xs1, ts0, ts1)
42  + bc95_fperp(rs, z, xs0, xs1):
43
44f := (rs, z, xt, xs0, xs1, us0, us1, ts0, ts1) ->
45 f_bc95(rs, z, xs0, xs1, ts0, ts1):
46
47