Better tests

This commit is contained in:
Anthony Scemama 2020-12-07 14:12:35 +01:00
parent 59980ed51c
commit 51b1d0d002
4 changed files with 7 additions and 4 deletions

View File

@ -7,6 +7,9 @@ default: build
build:
dune build
doc:
dune build @doc
test:
dune runtest -f

View File

@ -35,7 +35,7 @@ let huckel_guess ao_basis =
| _nocc ->
Matrix.init_cols ao_num ao_num (fun i j ->
if (i<>j) then
c *. (overlap%:(i,j)) *. (diag%.(i) +. diag%.(j))
c *. (overlap%:(i,j)) /. ((overlap%:(i,i)) *. (overlap%:(j,j)) ) *. (diag%.(i) +. diag%.(j))
else
diag%.(i)
)

View File

@ -19,6 +19,6 @@ let tests =
let simulation = Simulation.make ~nuclei ao_basis in
let hf = Mo.Hartree_fock.make ~guess:`Huckel simulation in
Format.printf "%a" (Mo.Hartree_fock.pp) hf;
check (float 1.e-10) "Energy" (-76.0267987006) (Mo.Hartree_fock.energy hf);
check (float 2.e-10) "Energy" (-76.0267987005) (Mo.Hartree_fock.energy hf);
]

View File

@ -19,9 +19,9 @@ let tests =
let simulation = Simulation.make ~nuclei ao_basis in
let hf = Mo.Hartree_fock.make ~guess:`Huckel simulation in
Format.printf "%a" (Mo.Hartree_fock.pp) hf;
check (float 1.e-10) "Energy" (-76.0267987006) (Mo.Hartree_fock.energy hf);
check (float 2.e-10) "Energy" (-76.0267987005) (Mo.Hartree_fock.energy hf);
let e_mp2 = Perturbation.Mp2.make ~frozen_core:true hf in
Printf.printf "%s\n" (string_of_float e_mp2);
check (float 1.e-10) "MP2" (-0.201621141207) (e_mp2)
check (float 1.e-9) "MP2" (-0.2016211415) (e_mp2)
]