10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-07-11 22:03:37 +02:00
This commit is contained in:
Anthony Scemama 2018-02-11 02:41:55 +01:00
commit f17a72428b

View File

@ -558,47 +558,47 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
match Contracted_shell.(totAngMom shell_a, totAngMom shell_b, match Contracted_shell.(totAngMom shell_a, totAngMom shell_b,
totAngMom shell_c, totAngMom shell_d) with totAngMom shell_c, totAngMom shell_d) with
| Angular_momentum.(S,S,S,S) -> | Angular_momentum.(S,S,S,S) ->
contracted_class.(0) <- contracted_class.(0) <-
begin begin
try try
let expo_inv_p = let expo_inv_p =
Vec.init np (fun ab -> sp.(ab-1).ShellPair.expo_inv) Vec.init np (fun ab -> sp.(ab-1).ShellPair.expo_inv)
and expo_inv_q = and expo_inv_q =
Vec.init nq (fun cd -> sq.(cd-1).ShellPair.expo_inv) Vec.init nq (fun cd -> sq.(cd-1).ShellPair.expo_inv)
in in
let coef = let coef =
let result = Mat.make0 nq np in let result = Mat.make0 nq np in
Lacaml.D.ger Lacaml.D.ger
(Vec.of_array @@ filter_q shell_q.ContractedShellPair.coef) (Vec.of_array @@ filter_q shell_q.ContractedShellPair.coef)
(Vec.of_array @@ filter_p shell_p.ContractedShellPair.coef) (Vec.of_array @@ filter_p shell_p.ContractedShellPair.coef)
result; result;
result result
in in
let zm_array = Mat.init_cols np nq (fun i j -> let zm_array = Mat.init_cols np nq (fun i j ->
try try
if (abs_float coef.{j,i} ) < 1.e-3*.cutoff then if (abs_float coef.{j,i} ) < 1.e-3*.cutoff then
raise NullQuartet; raise NullQuartet;
let expo_pq_inv = let expo_pq_inv =
expo_inv_p.{i} +. expo_inv_q.{j} expo_inv_p.{i} +. expo_inv_q.{j}
in in
let center_pq = let center_pq =
Coordinate.(sp.(i-1).ShellPair.center |- sq.(j-1).ShellPair.center) Coordinate.(sp.(i-1).ShellPair.center |- sq.(j-1).ShellPair.center)
in in
let norm_pq_sq = let norm_pq_sq =
Coordinate.dot center_pq center_pq Coordinate.dot center_pq center_pq
in in
let zero_m_array = let zero_m_array =
zero_m ~maxm:0 ~expo_pq_inv ~norm_pq_sq zero_m ~maxm:0 ~expo_pq_inv ~norm_pq_sq
in in
zero_m_array.(0) zero_m_array.(0)
with NullQuartet -> 0. with NullQuartet -> 0.
) in ) in
Mat.gemm_trace zm_array coef Mat.gemm_trace zm_array coef
with (Invalid_argument _) -> 0. with (Invalid_argument _) -> 0.
end end
| _ -> | _ ->
let coef = let coef =