mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-08-28 23:42:00 +02:00
Introduced Alcotest
This commit is contained in:
parent
4dec632e5a
commit
125e5dac4c
1
.merlin
1
.merlin
@ -1,5 +1,6 @@
|
|||||||
PKG str unix bigarray lacaml
|
PKG str unix bigarray lacaml
|
||||||
S .
|
S .
|
||||||
|
S Test
|
||||||
S Nuclei
|
S Nuclei
|
||||||
S CI
|
S CI
|
||||||
S Utils
|
S Utils
|
||||||
|
@ -18,7 +18,7 @@ ALL_EXE=$(ALL_BYTE) $(ALL_NATIVE)
|
|||||||
|
|
||||||
default: $(ALL_EXE) doc
|
default: $(ALL_EXE) doc
|
||||||
|
|
||||||
tests: $(ALL_TESTS)
|
tests: run_tests.native
|
||||||
|
|
||||||
QCaml.odocl: $(MLIFILES)
|
QCaml.odocl: $(MLIFILES)
|
||||||
ls $(MLIFILES) | sed "s/\.mli//" > QCaml.odocl
|
ls $(MLIFILES) | sed "s/\.mli//" > QCaml.odocl
|
||||||
@ -48,7 +48,7 @@ doc: QCaml.odocl
|
|||||||
$(OCAMLBUILD) -ocamlc ocamlcp $*.byte -use-ocamlfind $(PKGS)
|
$(OCAMLBUILD) -ocamlc ocamlcp $*.byte -use-ocamlfind $(PKGS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(OCAMLBUILD) -clean # rm -rf _build $(ALL_EXE) $(ALL_TESTS) *.native *.byte
|
$(OCAMLBUILD) -clean # rm -rf _build $(ALL_EXE) *.native *.byte
|
||||||
|
|
||||||
debug: run_integrals.native
|
debug: run_integrals.native
|
||||||
./debug.sh
|
./debug.sh
|
||||||
|
@ -6,5 +6,5 @@ Requirements
|
|||||||
* Zarith : Arbitrary-precision integers
|
* Zarith : Arbitrary-precision integers
|
||||||
* gmp : GNU Multiple Precision arithmetic library
|
* gmp : GNU Multiple Precision arithmetic library
|
||||||
* odoc-ltxhtml : https://github.com/akabe/odoc-ltxhtml
|
* odoc-ltxhtml : https://github.com/akabe/odoc-ltxhtml
|
||||||
|
* Alcotest : Lightweight testing framework
|
||||||
|
|
||||||
|
24
SCF/Guess.ml
24
SCF/Guess.ml
@ -51,3 +51,27 @@ let make ?(nocc=0) ~guess ao_basis =
|
|||||||
| `Huckel -> Huckel (huckel_guess ao_basis nocc)
|
| `Huckel -> Huckel (huckel_guess ao_basis nocc)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let test_case ao_basis =
|
||||||
|
|
||||||
|
let test_hcore () =
|
||||||
|
match make ~guess:`Hcore ao_basis with
|
||||||
|
| Hcore matrix ->
|
||||||
|
let a = Lacaml.D.Mat.to_array matrix in
|
||||||
|
let reference =
|
||||||
|
Lacaml.D.Mat.add
|
||||||
|
(Lazy.force ao_basis.AOBasis.eN_ints |> NucInt.matrix)
|
||||||
|
(Lazy.force ao_basis.AOBasis.kin_ints |> KinInt.matrix)
|
||||||
|
|> Lacaml.D.Mat.to_array
|
||||||
|
in
|
||||||
|
Array.iteri (fun i x ->
|
||||||
|
Alcotest.(check (array (float 1.e-15))) "same guess" a.(i) x) reference
|
||||||
|
| _ -> assert false
|
||||||
|
|
||||||
|
in
|
||||||
|
[
|
||||||
|
"HCore", `Quick, test_hcore;
|
||||||
|
]
|
||||||
|
|
||||||
|
@ -10,4 +10,4 @@ type t = guess
|
|||||||
val make : ?nocc:int -> guess:[ `Hcore | `Huckel ] -> AOBasis.t -> t
|
val make : ?nocc:int -> guess:[ `Hcore | `Huckel ] -> AOBasis.t -> t
|
||||||
|
|
||||||
|
|
||||||
|
val test_case : AOBasis.t -> unit Alcotest.test_case list
|
||||||
|
2
_tags
2
_tags
@ -1,4 +1,4 @@
|
|||||||
true: package(str,unix,bigarray,lacaml)
|
true: package(str,unix,bigarray,lacaml,alcotest)
|
||||||
<*.byte> : linkdep(Utils/math_functions.o), custom
|
<*.byte> : linkdep(Utils/math_functions.o), custom
|
||||||
<*.native>: linkdep(Utils/math_functions.o)
|
<*.native>: linkdep(Utils/math_functions.o)
|
||||||
<odoc-ltxhtml>: not_hygienic
|
<odoc-ltxhtml>: not_hygienic
|
||||||
|
2
opam
2
opam
@ -20,5 +20,5 @@ remove: [
|
|||||||
["ocamlfind" "remove" "QCaml"]
|
["ocamlfind" "remove" "QCaml"]
|
||||||
]
|
]
|
||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" "lacaml" {build}
|
"ocamlfind" "lacaml" "alcotest" {build}
|
||||||
]
|
]
|
||||||
|
12
run_tests.ml
Normal file
12
run_tests.ml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
let basis_file = "test_files/cc-pvdz"
|
||||||
|
let nuclei_file = "test_files/h2o.xyz"
|
||||||
|
|
||||||
|
let simulation_closed_shell =
|
||||||
|
Simulation.of_filenames ~charge:0 ~multiplicity:1 ~nuclei:nuclei_file basis_file
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let () =
|
||||||
|
Alcotest.run "SCF test" [
|
||||||
|
"Guess", Guess.test_case simulation_closed_shell.Simulation.ao_basis;
|
||||||
|
]
|
26
test_files/caffeine.xyz
Normal file
26
test_files/caffeine.xyz
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
24
|
||||||
|
Caffeine
|
||||||
|
1 -3.3804130 -1.1272367 0.5733036
|
||||||
|
7 0.9668296 -1.0737425 -0.8198227
|
||||||
|
6 0.0567293 0.8527195 0.3923156
|
||||||
|
N -1.3751742 -1.0212243 -0.0570552
|
||||||
|
C -1.2615018 0.2590713 0.5234135
|
||||||
|
C -0.3068337 -1.6836331 -0.7169344
|
||||||
|
C 1.1394235 0.1874122 -0.2700900
|
||||||
|
N 0.5602627 2.0839095 0.8251589
|
||||||
|
O -0.4926797 -2.8180554 -1.2094732
|
||||||
|
C -2.6328073 -1.7303959 -0.0060953
|
||||||
|
O -2.2301338 0.7988624 1.0899730
|
||||||
|
H 2.5496990 2.9734977 0.6229590
|
||||||
|
C 2.0527432 -1.7360887 -1.4931279
|
||||||
|
H -2.4807715 -2.7269528 0.4882631
|
||||||
|
H -3.0089039 -1.9025254 -1.0498023
|
||||||
|
H 2.9176101 -1.8481516 -0.7857866
|
||||||
|
H 2.3787863 -1.1211917 -2.3743655
|
||||||
|
H 1.7189877 -2.7489920 -1.8439205
|
||||||
|
C -0.1518450 3.0970046 1.5348347
|
||||||
|
C 1.8934096 2.1181245 0.4193193
|
||||||
|
N 2.2861252 0.9968439 -0.2440298
|
||||||
|
H -0.1687028 4.0436553 0.9301094
|
||||||
|
H 0.3535322 3.2979060 2.5177747
|
||||||
|
H -1.2074498 2.7537592 1.7203047
|
3371
test_files/cc-pvdz
Normal file
3371
test_files/cc-pvdz
Normal file
File diff suppressed because it is too large
Load Diff
5486
test_files/cc-pvqz
Normal file
5486
test_files/cc-pvqz
Normal file
File diff suppressed because it is too large
Load Diff
4273
test_files/cc-pvtz
Normal file
4273
test_files/cc-pvtz
Normal file
File diff suppressed because it is too large
Load Diff
5
test_files/h2o.xyz
Normal file
5
test_files/h2o.xyz
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
3
|
||||||
|
Water
|
||||||
|
O 0. 0. 0.
|
||||||
|
H -0.756950272703377558 0. -0.585882234512562827
|
||||||
|
H 0.756950272703377558 0. -0.585882234512562827
|
Loading…
Reference in New Issue
Block a user