mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-12-21 20:03:32 +01:00
Spherical works
This commit is contained in:
parent
57f8c0710c
commit
45d0c546ad
@ -6,16 +6,42 @@ type t =
|
||||
| Canonical of Mat.t
|
||||
| Svd of Mat.t
|
||||
|
||||
module Am = AngularMomentum
|
||||
module Bs = Basis
|
||||
module Cs = ContractedShell
|
||||
|
||||
|
||||
|
||||
let make_canonical_spherical ~thresh ~overlap basis =
|
||||
let ao_num = Bs.size basis in
|
||||
let cart_sphe = Mat.make ao_num ao_num 0.
|
||||
and i = ref 0
|
||||
and n = ref 0 in
|
||||
Array.iter (fun shell ->
|
||||
let submatrix =
|
||||
SphericalToCartesian.matrix (Cs.ang_mom shell)
|
||||
in
|
||||
ignore @@ lacpy ~b:cart_sphe ~br:(!i+1) ~bc:(!n+1) submatrix;
|
||||
i := !i + Mat.dim1 submatrix;
|
||||
n := !n + Mat.dim2 submatrix;
|
||||
) (Bs.contracted_shells basis);
|
||||
let s = gemm ~transa:`T ~m:!n cart_sphe overlap in
|
||||
let overlap = gemm s ~n:!n cart_sphe in
|
||||
let s = canonical_ortho ~thresh ~overlap (Mat.identity !n) in
|
||||
gemm cart_sphe ~k:!n s
|
||||
|
||||
let make_canonical ~cartesian ~thresh ~overlap =
|
||||
|
||||
|
||||
let make_canonical ~cartesian ~thresh ~basis ~overlap =
|
||||
let result =
|
||||
if cartesian then
|
||||
canonical_ortho ~thresh ~overlap (Mat.identity @@ Mat.dim1 overlap)
|
||||
else
|
||||
(* TODO *)
|
||||
canonical_ortho ~thresh ~overlap (Mat.identity @@ Mat.dim1 overlap)
|
||||
match basis with
|
||||
| None -> invalid_arg
|
||||
"Basis.t is required when cartesian=false in make_canonical"
|
||||
| Some basis ->
|
||||
make_canonical_spherical ~thresh ~overlap basis
|
||||
in
|
||||
Canonical result
|
||||
|
||||
@ -41,8 +67,8 @@ let make_lowdin ~thresh ~overlap =
|
||||
|
||||
|
||||
|
||||
let make ~cartesian ?(thresh=1.e-12) overlap =
|
||||
let make ~cartesian ?(thresh=1.e-12) ?basis overlap =
|
||||
(*
|
||||
make_lowdin ~thresh ~overlap
|
||||
*)
|
||||
make_canonical ~cartesian ~thresh ~overlap
|
||||
make_canonical ~cartesian ~basis ~thresh ~overlap
|
||||
|
@ -35,7 +35,7 @@ let make ?cartesian:(cartesian=true)
|
||||
{
|
||||
charge ;
|
||||
basis ; nuclei ; electrons ; overlap ;
|
||||
overlap_ortho = lazy (Orthonormalization.make ~cartesian (Lazy.force overlap));
|
||||
overlap_ortho = lazy (Orthonormalization.make ~cartesian ~basis (Lazy.force overlap));
|
||||
eN_ints = lazy (NucInt.of_basis_nuclei basis nuclei);
|
||||
kin_ints = lazy (KinInt.of_basis basis);
|
||||
ee_ints = lazy (ERI.of_basis basis);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
(** Conversion from spherical coordinate to cartesian corrdinates. *)
|
||||
|
||||
val matrix : AngularMomentum.t -> float array
|
||||
val matrix : AngularMomentum.t -> Lacaml.D.Mat.t
|
||||
(** Returns a transformation matrix to rotate between the basis of atom-centered
|
||||
spherical coordinates to x,y,z coordinates.
|
||||
|
||||
|
@ -197,6 +197,10 @@ let canonical_ortho ?thresh:(thresh=1.e-6) ~overlap c =
|
||||
gemm c u
|
||||
|
||||
|
||||
let debug_matrix name a =
|
||||
Format.printf "@[<2>%s =@\n@\n@[%a@]@]@\n@\n" name pp_mat a
|
||||
|
||||
|
||||
|
||||
(** {2 Printers} *)
|
||||
|
||||
|
@ -73,6 +73,8 @@ val canonical_ortho: ?thresh:float -> overlap:Lacaml.D.mat -> Lacaml.D.mat -> La
|
||||
(** Canonical orthogonalization. [overlap] is the overlap matrix, and the last argument
|
||||
contains the vectors to orthogonalize. *)
|
||||
|
||||
val debug_matrix: string -> Lacaml.D.mat -> unit
|
||||
(** Prints a matrix in stdout for debug *)
|
||||
|
||||
(** {2 Printers} *)
|
||||
val pp_float_array_size : Format.formatter -> float array -> unit
|
||||
|
Loading…
Reference in New Issue
Block a user