This commit is contained in:
Anthony Scemama 2018-02-01 19:10:20 +01:00
parent c666878dcd
commit b5ee17ca3e
1 changed files with 7 additions and 2 deletions

View File

@ -6,7 +6,7 @@ let factmax = 150
(** Generalized Boys function. Uses GSL's incomplete Gamma function.
maxm : Maximum total angular momentum
*)
let boys_function ~maxm t =
let rec boys_function ~maxm t =
match maxm with
| 0 ->
begin
@ -33,7 +33,12 @@ let boys_function ~maxm t =
let (dm, f) = factor.(i-1) in
factor.(i) <- (dm +. 1., f *. t_inv);
done;
Array.map (fun (dm, f) -> (incomplete_gamma dm t ) *. 0.5 *. f) factor
Array.map (fun (dm, f) ->
if dm = 0.5 then
(boys_function ~maxm:0 t).(0)
else
(incomplete_gamma dm t ) *. 0.5 *. f
) factor
end