From e3fff202b8fd352745bbe81828c5896677029db3 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 25 Dec 2014 23:53:29 +0100 Subject: [PATCH] Added MD5 key in AOs for check in MOs --- data/basis/3-21++g | 2 +- data/basis/6-31g | 2 +- data/basis/6-31g_star | 2 +- data/basis/ano-rcc | 2 +- data/basis/ano-roos-dz | 2 +- data/basis/ano-roos-tz | 2 +- data/basis/aug-cc-pvdz | 2 +- data/basis/aug-cc-pvqz | 2 +- data/basis/aug-cc-pvtz | 2 +- data/basis/cc-pcvdz | 2 +- data/basis/cc-pcvqz | 2 +- data/basis/cc-pcvtz | 2 +- data/basis/cc-pvtz | 2 +- data/basis/vdz | 2 +- data/ezfio_defaults | 2 +- ocaml/Input_ao_basis.ml | 52 +++++++++++++++++++++++----------------- ocaml/Input_mo_basis.ml | 23 ++++++++++++++++++ ocaml/MO_label.ml | 6 ++--- ocaml/qp_edit.ml | 1 + src/AOs/aos.ezfio_config | 1 + src/AOs/aos.irp.f | 9 +++++++ src/MOs/mos.ezfio_config | 1 + src/MOs/utils.irp.f | 1 + 23 files changed, 84 insertions(+), 40 deletions(-) diff --git a/data/basis/3-21++g b/data/basis/3-21++g index bb91a24c..b9acfb4d 100644 --- a/data/basis/3-21++g +++ b/data/basis/3-21++g @@ -279,7 +279,7 @@ S 1 P 1 1 0.0331000 1.0000000 -PHOSPHOROUS +PHOSPHORUS S 3 1 1054.9000000 0.0655410 2 159.1950000 0.3840360 diff --git a/data/basis/6-31g b/data/basis/6-31g index 8f8bd10e..27dcc6dd 100644 --- a/data/basis/6-31g +++ b/data/basis/6-31g @@ -314,7 +314,7 @@ S 1 P 1 1 0.0778369 1.00000000 -PHOSPHOROUS +PHOSPHORUS S 6 1 19413.3000000 0.0018516 2 2909.4200000 0.0142062 diff --git a/data/basis/6-31g_star b/data/basis/6-31g_star index b0b86019..b56d1efe 100644 --- a/data/basis/6-31g_star +++ b/data/basis/6-31g_star @@ -330,7 +330,7 @@ P 1 D 1 1 0.4500000 1.0000000 -PHOSPHOROUS +PHOSPHORUS S 6 1 19413.3000000 0.0018516 2 2909.4200000 0.0142062 diff --git a/data/basis/ano-rcc b/data/basis/ano-rcc index 97fac3b7..4a032eee 100644 --- a/data/basis/ano-rcc +++ b/data/basis/ano-rcc @@ -3340,7 +3340,7 @@ G 2 1 0.5188000000 -1.01551992 2 0.2041000000 1.11150702 -PHOSPHOROUS +PHOSPHORUS S 17 1 296647.5500000000 -0.00027797 2 42380.0300000000 -0.00091959 diff --git a/data/basis/ano-roos-dz b/data/basis/ano-roos-dz index fff7bd81..9031d664 100644 --- a/data/basis/ano-roos-dz +++ b/data/basis/ano-roos-dz @@ -1519,7 +1519,7 @@ D 5 4 0.1224809 0.11387560 5 0.0489924 -0.98489900 -PHOSPHOROUS +PHOSPHORUS S 17 1 296647.5500000 0.00006562 2 42380.0300000 0.00046254 diff --git a/data/basis/ano-roos-tz b/data/basis/ano-roos-tz index 459ea1a4..ef9302d1 100644 --- a/data/basis/ano-roos-tz +++ b/data/basis/ano-roos-tz @@ -2056,7 +2056,7 @@ F 4 3 0.1680153 -0.47263890 4 0.0672061 1.1086961 -PHOSPHOROUS +PHOSPHORUS S 17 1 296647.5500000 0.00006562 2 42380.0300000 0.00046254 diff --git a/data/basis/aug-cc-pvdz b/data/basis/aug-cc-pvdz index 481f6cd2..f37d8aa7 100644 --- a/data/basis/aug-cc-pvdz +++ b/data/basis/aug-cc-pvdz @@ -578,7 +578,7 @@ D 1 D 1 1 0.0823000 1.0000000 -PHOSPHOROUS +PHOSPHORUS S 11 1 94840.0000000 0.255509D-03 2 14220.0000000 0.198193D-02 diff --git a/data/basis/aug-cc-pvqz b/data/basis/aug-cc-pvqz index d5c3f1a5..fbce5349 100644 --- a/data/basis/aug-cc-pvqz +++ b/data/basis/aug-cc-pvqz @@ -940,7 +940,7 @@ G 1 G 1 1 0.2120000 1.0000000 -PHOSPHOROUS +PHOSPHORUS S 13 1 615200.0000000 0.247450D-04 2 92120.0000000 0.192465D-03 diff --git a/data/basis/aug-cc-pvtz b/data/basis/aug-cc-pvtz index 552510f1..041ab2a1 100644 --- a/data/basis/aug-cc-pvtz +++ b/data/basis/aug-cc-pvtz @@ -750,7 +750,7 @@ F 1 F 1 1 0.1250000 1.0000000 -PHOSPHOROUS +PHOSPHORUS S 13 1 312400.0000000 0.576960D-04 2 46800.0000000 0.448296D-03 diff --git a/data/basis/cc-pcvdz b/data/basis/cc-pcvdz index a112ed34..81a8c641 100644 --- a/data/basis/cc-pcvdz +++ b/data/basis/cc-pcvdz @@ -534,7 +534,7 @@ D 1 D 1 1 5.8060000 1.0000000 -PHOSPHOROUS +PHOSPHORUS S 11 1 94840.0000000 0.255509D-03 2 14220.0000000 0.198193D-02 diff --git a/data/basis/cc-pcvqz b/data/basis/cc-pcvqz index e55e0d6f..0a6a9c04 100644 --- a/data/basis/cc-pcvqz +++ b/data/basis/cc-pcvqz @@ -995,7 +995,7 @@ G 1 G 1 1 8.5770000 1.0000000 -PHOSPHOROUS +PHOSPHORUS S 13 1 615200.0000000 0.247450D-04 2 92120.0000000 0.192465D-03 diff --git a/data/basis/cc-pcvtz b/data/basis/cc-pcvtz index b1793cb4..2c164c22 100644 --- a/data/basis/cc-pcvtz +++ b/data/basis/cc-pcvtz @@ -745,7 +745,7 @@ F 1 F 1 1 7.0010000 1.0000000 -PHOSPHOROUS +PHOSPHORUS S 13 1 312400.0000000 0.576960D-04 2 46800.0000000 0.448296D-03 diff --git a/data/basis/cc-pvtz b/data/basis/cc-pvtz index f05b02c4..60bc501e 100644 --- a/data/basis/cc-pvtz +++ b/data/basis/cc-pvtz @@ -642,7 +642,7 @@ D 1 F 1 1 0.3360000 1.0000000 -PHOSPHOROUS +PHOSPHORUS S 13 1 312400.0000000 0.576960D-04 2 46800.0000000 0.448296D-03 diff --git a/data/basis/vdz b/data/basis/vdz index e377a348..ef7d0c5d 100644 --- a/data/basis/vdz +++ b/data/basis/vdz @@ -242,7 +242,7 @@ P 1 P 1 1 0.10008513762 1.0000000 -PHOSPHOROUS +PHOSPHORUS S 5 1 8002.4795106 0.57503489302E-02 2 1203.6813590 0.43007628959E-01 diff --git a/data/ezfio_defaults b/data/ezfio_defaults index 9cc29c1b..5dd5d00a 100644 --- a/data/ezfio_defaults +++ b/data/ezfio_defaults @@ -22,7 +22,7 @@ determinants threshold_generators 0.99 threshold_selectors 0.999 read_wf False - s2_eig True + s2_eig False full_ci n_det_max_fci 10000 diff --git a/ocaml/Input_ao_basis.ml b/ocaml/Input_ao_basis.ml index cd13fc88..a17e6c91 100644 --- a/ocaml/Input_ao_basis.ml +++ b/ocaml/Input_ao_basis.ml @@ -92,22 +92,6 @@ end = struct |> Array.map ~f:AO_expo.of_float ;; - let read () = - if (Ezfio.has_ao_basis_ao_basis ()) then - Some - { ao_basis = read_ao_basis (); - ao_num = read_ao_num () ; - ao_prim_num = read_ao_prim_num (); - ao_prim_num_max = read_ao_prim_num_max (); - ao_nucl = read_ao_nucl (); - ao_power = read_ao_power (); - ao_coef = read_ao_coef () ; - ao_expo = read_ao_expo () ; - } - else - None - ;; - let to_long_basis b = let ao_num = AO_number.to_int b.ao_num in let gto_array = Array.init (AO_number.to_int b.ao_num) @@ -137,12 +121,41 @@ end = struct (Array.to_list gto_array) (Array.to_list b.ao_nucl) ;; - let to_basis b = to_long_basis b |> Long_basis.to_basis ;; + let to_md5 b = + let short_basis = to_basis b in + Basis.to_md5 short_basis + ;; + + + let read () = + if (Ezfio.has_ao_basis_ao_basis ()) then + begin + let result = + { ao_basis = read_ao_basis (); + ao_num = read_ao_num () ; + ao_prim_num = read_ao_prim_num (); + ao_prim_num_max = read_ao_prim_num_max (); + ao_nucl = read_ao_nucl (); + ao_power = read_ao_power (); + ao_coef = read_ao_coef () ; + ao_expo = read_ao_expo () ; + } + in + to_md5 result + |> MD5.to_string + |> Ezfio.set_ao_basis_ao_md5 ; + Some result + end + else + None + ;; + + let to_rst b = let print_sym = let l = List.init (Array.length b.ao_power) ~f:( @@ -198,11 +211,6 @@ Basis set :: extract_basis s ;; - let to_md5 b = - let short_basis = to_basis b in - Basis.to_md5 short_basis - ;; - let to_string b = Printf.sprintf " ao_basis = %s diff --git a/ocaml/Input_mo_basis.ml b/ocaml/Input_mo_basis.ml index 5ad982ac..f02dbfa9 100644 --- a/ocaml/Input_mo_basis.ml +++ b/ocaml/Input_mo_basis.ml @@ -8,6 +8,7 @@ module Mo_basis : sig mo_label : MO_label.t; mo_occ : MO_occ.t array; mo_coef : (MO_coef.t array) array; + ao_md5 : MD5.t; } with sexp ;; val read : unit -> t option @@ -19,6 +20,7 @@ end = struct mo_label : MO_label.t; mo_occ : MO_occ.t array; mo_coef : (MO_coef.t array) array; + ao_md5 : MD5.t; } with sexp ;; @@ -32,6 +34,26 @@ end = struct |> MO_label.of_string ;; + let read_ao_md5 () = + let ao_md5 = + match (Input_ao_basis.Ao_basis.read ()) with + | None -> failwith "Unable to read AO basis" + | Some result -> Input_ao_basis.Ao_basis.to_md5 result + in + let result = + if not (Ezfio.has_mo_basis_ao_md5 ()) then + begin + MD5.to_string ao_md5 + |> Ezfio.set_mo_basis_ao_md5 + end; + Ezfio.get_mo_basis_ao_md5 () + |> MD5.of_string + in + if (ao_md5 <> result) then + failwith "The current MOs don't correspond to the current AOs."; + result + ;; + let read_mo_tot_num () = Ezfio.get_mo_basis_mo_tot_num () |> MO_number.of_int @@ -74,6 +96,7 @@ end = struct mo_label = read_mo_label () ; mo_occ = read_mo_occ (); mo_coef = read_mo_coef (); + ao_md5 = read_ao_md5 (); } else None diff --git a/ocaml/MO_label.ml b/ocaml/MO_label.ml index f8de6210..72bca28f 100644 --- a/ocaml/MO_label.ml +++ b/ocaml/MO_label.ml @@ -20,13 +20,13 @@ let to_string = function ;; let of_string s = - match String.lowercase s with + match String.lowercase (String.strip s) with | "guess" -> Guess | "canonical" -> Canonical | "natural" -> Natural | "localized" -> Localized | "orthonormalized" -> Orthonormalized | "none" -> None - | _ -> failwith "MO_label should be one of: - Guess | Orthonormalized | Canonical | Natural | Localized | None." + | _ -> (print_endline s ; failwith "MO_label should be one of: +Guess | Orthonormalized | Canonical | Natural | Localized | None.") ;; diff --git a/ocaml/qp_edit.ml b/ocaml/qp_edit.ml index 39e4fa25..000eec78 100644 --- a/ocaml/qp_edit.ml +++ b/ocaml/qp_edit.ml @@ -159,6 +159,7 @@ let run ezfio_filename = Hartree_fock ; Cisd_sc2 ; Full_ci ; + Mo_basis; Determinants ; ] in diff --git a/src/AOs/aos.ezfio_config b/src/AOs/aos.ezfio_config index 662209f0..adcc5636 100644 --- a/src/AOs/aos.ezfio_config +++ b/src/AOs/aos.ezfio_config @@ -7,5 +7,6 @@ ao_basis ao_prim_num_max integer = maxval(ao_basis_ao_prim_num) ao_coef double precision (ao_basis_ao_num,ao_basis_ao_prim_num_max) ao_expo double precision (ao_basis_ao_num,ao_basis_ao_prim_num_max) + ao_md5 character*(32) diff --git a/src/AOs/aos.irp.f b/src/AOs/aos.irp.f index 613fdabd..10174e66 100644 --- a/src/AOs/aos.irp.f +++ b/src/AOs/aos.irp.f @@ -159,3 +159,12 @@ BEGIN_PROVIDER [ integer, ao_nucl, (ao_num)] call ezfio_get_ao_basis_ao_nucl(ao_nucl) END_PROVIDER +BEGIN_PROVIDER [ character*(32), ao_md5 ] + BEGIN_DOC +! MD5 key characteristic of the AO basis + END_DOC + implicit none + PROVIDE ezfio_filename + call ezfio_get_ao_basis_ao_md5(ao_md5) +END_PROVIDER + diff --git a/src/MOs/mos.ezfio_config b/src/MOs/mos.ezfio_config index b43f23b9..b0971eb8 100644 --- a/src/MOs/mos.ezfio_config +++ b/src/MOs/mos.ezfio_config @@ -3,4 +3,5 @@ mo_basis mo_coef double precision (ao_basis_ao_num,mo_basis_mo_tot_num) mo_label character*(64) mo_occ double precision (mo_basis_mo_tot_num) + ao_md5 character*(32) diff --git a/src/MOs/utils.irp.f b/src/MOs/utils.irp.f index 7e23f744..e182744c 100644 --- a/src/MOs/utils.irp.f +++ b/src/MOs/utils.irp.f @@ -7,6 +7,7 @@ subroutine save_mos call ezfio_set_mo_basis_mo_tot_num(mo_tot_num) call ezfio_set_mo_basis_mo_label(mo_label) + call ezfio_set_mo_basis_ao_md5(ao_md5) allocate ( buffer(ao_num,mo_tot_num) ) buffer = 0.d0 do j = 1, mo_tot_num