From 51b1d0d0020482a2ef8548b20035ce5997fbdae8 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 7 Dec 2020 14:12:35 +0100 Subject: [PATCH] Better tests --- Makefile | 3 +++ mo/lib/guess.ml | 2 +- mo/test/hf.ml | 2 +- perturbation/test/mp2.ml | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 448d954..c759075 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,9 @@ default: build build: dune build +doc: + dune build @doc + test: dune runtest -f diff --git a/mo/lib/guess.ml b/mo/lib/guess.ml index 83c4970..17af71b 100644 --- a/mo/lib/guess.ml +++ b/mo/lib/guess.ml @@ -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) ) diff --git a/mo/test/hf.ml b/mo/test/hf.ml index 72925b0..2442aa5 100644 --- a/mo/test/hf.ml +++ b/mo/test/hf.ml @@ -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); ] diff --git a/perturbation/test/mp2.ml b/perturbation/test/mp2.ml index d2ffc80..efe3cdd 100644 --- a/perturbation/test/mp2.ml +++ b/perturbation/test/mp2.ml @@ -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) ]