From 951a4e35e03671199c6ba1bac23d2bddef4f0132 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Tue, 31 Mar 2015 09:31:59 +0200 Subject: [PATCH] CISD (SC)^2 into CISD (SC)^2 SELECTED cause is the name of the module --- ocaml/Input.ml | 1 - ocaml/Input_cisd_sc2.ml | 127 ------------------ ocaml/qp_edit.ml | 24 ++-- ocaml/test_input.ml | 8 +- .../cisd_sc2_selection.irp.f | 1 + 5 files changed, 14 insertions(+), 147 deletions(-) delete mode 100644 ocaml/Input_cisd_sc2.ml diff --git a/ocaml/Input.ml b/ocaml/Input.ml index 62de42f8..3c4c74d3 100644 --- a/ocaml/Input.ml +++ b/ocaml/Input.ml @@ -6,7 +6,6 @@ open Core.Std;; include Input_ao_basis;; include Input_bi_integrals;; include Input_bitmasks;; -include Input_cisd_sc2;; include Input_cisd_sc2_selected;; include Input_determinants;; include Input_electrons;; diff --git a/ocaml/Input_cisd_sc2.ml b/ocaml/Input_cisd_sc2.ml deleted file mode 100644 index ed046d79..00000000 --- a/ocaml/Input_cisd_sc2.ml +++ /dev/null @@ -1,127 +0,0 @@ -open Qptypes;; -open Qputils;; -open Core.Std;; - -module Cisd_sc2 : sig - type t = - { n_det_max_cisd_sc2 : Det_number_max.t; - pt2_max : PT2_energy.t; - do_pt2_end : bool; - } with sexp - ;; - val read : unit -> t option - val write : t -> unit - val to_string : t -> string - val to_rst : t -> Rst_string.t - val of_rst : Rst_string.t -> t option -end = struct - type t = - { n_det_max_cisd_sc2 : Det_number_max.t; - pt2_max : PT2_energy.t; - do_pt2_end : bool; - } with sexp - ;; - - let get_default = Qpackage.get_ezfio_default "cisd_sc2_selected";; - - let read_n_det_max_cisd_sc2 () = - if not (Ezfio.has_cisd_sc2_selected_n_det_max_cisd_sc2 ()) then - get_default "n_det_max_cisd_sc2" - |> Int.of_string - |> Ezfio.set_cisd_sc2_selected_n_det_max_cisd_sc2 - ; - Ezfio.get_cisd_sc2_selected_n_det_max_cisd_sc2 () - |> Det_number_max.of_int - ;; - - let write_n_det_max_cisd_sc2 n = - Det_number_max.to_int n - |> Ezfio.set_cisd_sc2_selected_n_det_max_cisd_sc2 - ;; - - - let read_pt2_max () = - if not (Ezfio.has_cisd_sc2_selected_pt2_max ()) then - get_default "pt2_max" - |> Float.of_string - |> Ezfio.set_cisd_sc2_selected_pt2_max - ; - Ezfio.get_cisd_sc2_selected_pt2_max () - |> PT2_energy.of_float - ;; - - let write_pt2_max p = - PT2_energy.to_float p - |> Ezfio.set_cisd_sc2_selected_pt2_max - ;; - - - let read_do_pt2_end () = - if not (Ezfio.has_cisd_sc2_selected_do_pt2_end ()) then - get_default "do_pt2_end" - |> Bool.of_string - |> Ezfio.set_cisd_sc2_selected_do_pt2_end - ; - Ezfio.get_cisd_sc2_selected_do_pt2_end () - ;; - - let write_do_pt2_end = - Ezfio.set_cisd_sc2_selected_do_pt2_end - ;; - - - let read () = - Some - { n_det_max_cisd_sc2 = read_n_det_max_cisd_sc2 (); - pt2_max = read_pt2_max (); - do_pt2_end = read_do_pt2_end (); - } - ;; - - let write { n_det_max_cisd_sc2 ; - pt2_max ; - do_pt2_end ; - } = - write_n_det_max_cisd_sc2 n_det_max_cisd_sc2; - write_pt2_max pt2_max; - write_do_pt2_end do_pt2_end; - ;; - - let to_string b = - Printf.sprintf " -n_det_max_cisd_sc2 = %s -pt2_max = %s -do_pt2_end = %s -" - (Det_number_max.to_string b.n_det_max_cisd_sc2) - (PT2_energy.to_string b.pt2_max) - (Bool.to_string b.do_pt2_end) - ;; - - let to_rst b = - Printf.sprintf " -Stop when the `n_det` > `n_det_max_cisd_sc2` :: - - n_det_max_cisd_sc2 = %s - -Stop when -E(PT2) < `pt2_max` :: - - pt2_max = %s - -Compute E(PT2) at the end :: - - do_pt2_end = %s - -" - (Det_number_max.to_string b.n_det_max_cisd_sc2) - (PT2_energy.to_string b.pt2_max) - (Bool.to_string b.do_pt2_end) - |> Rst_string.of_string - ;; - - include Generic_input_of_rst;; - let of_rst = of_rst t_of_sexp;; - -end - - diff --git a/ocaml/qp_edit.ml b/ocaml/qp_edit.ml index c60db6e2..df7635e0 100644 --- a/ocaml/qp_edit.ml +++ b/ocaml/qp_edit.ml @@ -12,7 +12,6 @@ open Core.Std;; type keyword = | Ao_basis | Bielec_integrals -| Cisd_sc2 | Cisd_sc2_selected | Determinants | Electrons @@ -24,16 +23,15 @@ type keyword = let keyword_to_string = function -| Ao_basis -> "AO basis" -| Bielec_integrals -> "Two electron integrals" -| Cisd_sc2 -> "CISD (SC)^2" -| Cisd_sc2_selected -> "CISD (SC)^2 selected" -| Determinants -> "Determinants" -| Electrons -> "Electrons" -| Full_ci -> "Selected Full-CI" -| Hartree_fock -> "Hartree-Fock" -| Mo_basis -> "MO basis" -| Nuclei -> "Molecule" +| Ao_basis -> "AO basis" +| Bielec_integrals -> "Two electron integrals" +| Cisd_sc2_selected -> "CISD (SC)^2" +| Determinants -> "Determinants" +| Electrons -> "Electrons" +| Full_ci -> "Selected Full-CI" +| Hartree_fock -> "Hartree-Fock" +| Mo_basis -> "MO basis" +| Nuclei -> "Molecule" ;; @@ -80,8 +78,6 @@ let get s = f Mo_basis.(read, to_rst) | Electrons -> f Electrons.(read, to_rst) - | Cisd_sc2 -> - f Cisd_sc2.(read, to_rst) | Cisd_sc2_selected -> f Cisd_sc2_selected.(read, to_rst) | Nuclei -> @@ -132,7 +128,6 @@ let set str s = | Hartree_fock -> write Hartree_fock.(of_rst, write) s | Full_ci -> write Full_ci.(of_rst, write) s | Electrons -> write Electrons.(of_rst, write) s - | Cisd_sc2 -> write Cisd_sc2.(of_rst, write) s | Cisd_sc2_selected -> write Cisd_sc2_selected.(of_rst, write) s | Bielec_integrals -> write Bielec_integrals.(of_rst, write) s | Determinants -> write Determinants.(of_rst, write) s @@ -183,7 +178,6 @@ let run check_only ezfio_filename = Electrons ; Bielec_integrals ; Hartree_fock ; - Cisd_sc2 ; Cisd_sc2_selected ; Full_ci ; Mo_basis; diff --git a/ocaml/test_input.ml b/ocaml/test_input.ml index d7e0c9d3..956fd745 100644 --- a/ocaml/test_input.ml +++ b/ocaml/test_input.ml @@ -61,13 +61,13 @@ let test_dets () = let test_cisd_sc2 () = Ezfio.set_file "F2.ezfio" ; - let b = match Input.Cisd_sc2.read () with + let b = match Input.Cisd_sc2_selected.read () with | Some x -> x | None -> assert false in - print_endline (Input.Cisd_sc2.to_string b); - let rst = Input.Cisd_sc2.to_rst b in - let b2 = match Input.Cisd_sc2.of_rst rst with + print_endline (Input.Cisd_sc2_selected.to_string b); + let rst = Input.Cisd_sc2_selected.to_rst b in + let b2 = match Input.Cisd_sc2_selected.of_rst rst with | Some x -> x | None -> assert false in diff --git a/src/CISD_SC2_selected/cisd_sc2_selection.irp.f b/src/CISD_SC2_selected/cisd_sc2_selection.irp.f index fb7de4cf..1c4b2ed0 100644 --- a/src/CISD_SC2_selected/cisd_sc2_selection.irp.f +++ b/src/CISD_SC2_selected/cisd_sc2_selection.irp.f @@ -68,6 +68,7 @@ program cisd_sc2_selected touch N_det psi_det psi_coef davidson_threshold davidson_criterion call diagonalize_CI_SC2 pt2 = 0.d0 + if(do_pt2_end)then threshold_selectors = 1.d0 call H_apply_PT2(pt2, norm_pert, H_pert_diag, N_st)