diff --git a/Basis/ERI.ml b/Basis/ERI.ml index a6782c9..c3dbefa 100644 --- a/Basis/ERI.ml +++ b/Basis/ERI.ml @@ -89,12 +89,22 @@ let to_file ~filename basis = let shell_q = shell_pairs.(k).(l) in + let swap = + Array.length shell_q < Array.length shell_p + in + (* Compute all the integrals of the class *) let cls = - if Array.length shell_q < 2 then - contracted_class_shell_pairs ~schwartz_p ~schwartz_q shell_p shell_q + if swap then + if Array.length shell_p < 2 then + contracted_class_shell_pairs ~schwartz_p:schwartz_q ~schwartz_q:schwartz_p shell_q shell_p + else + contracted_class_shell_pairs_vec ~schwartz_p:schwartz_q ~schwartz_q:schwartz_p shell_q shell_p else - contracted_class_shell_pairs_vec ~schwartz_p ~schwartz_q shell_p shell_q + if Array.length shell_q < 2 then + contracted_class_shell_pairs ~schwartz_p ~schwartz_q shell_p shell_q + else + contracted_class_shell_pairs_vec ~schwartz_p ~schwartz_q shell_p shell_q in (* Write the data in the output file *) @@ -111,7 +121,10 @@ let to_file ~filename basis = let l_c = basis.(l).Contracted_shell.indice + l_c + 1 in let xl = to_int_tuple powers_l in let key = - Zkey.of_int_tuple (Zkey.Twelve (xi,xj,xk,xl)) + if swap then + Zkey.of_int_tuple (Zkey.Twelve (xk,xl,xi,xj)) + else + Zkey.of_int_tuple (Zkey.Twelve (xi,xj,xk,xl)) in let value = Zmap.find cls key