QCaml/mo/test/localization.ml

76 lines
1.8 KiB
OCaml

(* Tests *)
(* [[file:~/QCaml/mo/localization.org::*Tests][Tests:1]] *)
let test_localization =
let nuclei =
Particles.Nuclei.of_xyz_string
" 10
Hydrogen chain, d=1.8 Angstrom
H -4.286335 0.000000 0.000000
H -3.333816 0.000000 0.000000
H -2.381297 0.000000 0.000000
H -1.428778 0.000000 0.000000
H -0.476259 0.000000 0.000000
H 0.476259 0.000000 0.000000
H 1.428778 0.000000 0.000000
H 2.381297 0.000000 0.000000
H 3.333816 0.000000 0.000000
H 4.286335 0.000000 0.000000
" in
let basis_file = "/home/scemama/qp2/data/basis/sto-6g" in
let ao_basis =
Ao.Basis.of_nuclei_and_basis_filename ~nuclei basis_file
in
let charge = 0 in
let multiplicity = 1 in
let simulation =
Simulation.make ~charge ~multiplicity ~nuclei ao_basis
in
let hf =
Mo.Hartree_fock.make ~guess:`Hcore simulation
in
let mo_basis =
Mo.Basis.of_hartree_fock hf
in
let localized_mo_basis =
Mo.Localization.make
~kind:Mo.Localization.Boys
mo_basis
[4;5;6;7;8]
|> Mo.Localization.to_basis
in
Format.printf "%a" (Mo.Basis.pp ~start:1 ~finish:10) localized_mo_basis
(*
open Common
open Alcotest
let wd = Qcaml.root ^ Filename.dir_sep ^ "test" in
let test_xyz molecule length repulsion charge core =
let xyz = Nuclei.of_xyz_file (wd^Filename.dir_sep^molecule^".xyz") in
check int "length" length (Array.length xyz);
check (float 1.e-4) "repulsion" repulsion (Nuclei.repulsion xyz);
check int "charge" charge (Charge.to_int @@ Nuclei.charge xyz);
check int "small_core" core (Nuclei.small_core xyz);
()
let tests = [
"caffeine", `Quick, (fun () -> test_xyz "caffeine" 24 917.0684 102 28);
"water", `Quick, (fun () -> test_xyz "water" 3 9.19497 10 2);
]
*)
(* Tests:1 ends here *)