diff --git a/ocaml/Bitlist.ml b/ocaml/Bitlist.ml index 659b9495..02cc680f 100644 --- a/ocaml/Bitlist.ml +++ b/ocaml/Bitlist.ml @@ -62,6 +62,13 @@ let of_int64_list l = List.flatten result ;; +(* Compute n_int *) +let n_int_of_mo_tot_num mo_tot_num = + let bit_kind_size = Bit_kind_size.to_int Qpackage.bit_kind_size in + N_int_number.of_int ( (mo_tot_num-1)/bit_kind_size + 1 ) +;; + +(* Create a zero bit list *) let zero n_int = let n_int = N_int_number.to_int n_int in let a = Array.init n_int (fun i-> 0L) in diff --git a/ocaml/Qpackage.ml b/ocaml/Qpackage.ml index 69c0d6d9..603cbaa1 100644 --- a/ocaml/Qpackage.ml +++ b/ocaml/Qpackage.ml @@ -1,4 +1,5 @@ open Core.Std;; +open Qptypes;; (** Variables related to the quantum package installation *) @@ -9,3 +10,32 @@ Please source the quantum_package.rc file." | Some x -> x ;; +let bit_kind_size = + let filename = root^"/src/Bitmask/bitmasks_module.f90" in + if not (Sys.file_exists_exn filename) then + raise (Failure ("File "^filename^" not found")); + + let in_channel = In_channel.create filename in + let lines = In_channel.input_lines in_channel in + In_channel.close in_channel; + + let rec get_data = function + | [] -> raise (Failure ("bit_kind_size not found in "^filename)) + | line::tail -> + let line = + begin match String.split ~on:'!' line |> List.hd with + | Some x -> x + | None -> "" + end in + begin match (String.rsplit2 ~on:':' line) with + | Some (_ ,buffer) -> + begin match (String.split ~on:'=' buffer |> List.map ~f:String.strip) with + | ["bit_kind_size"; x] -> + Int.of_string x |> Bit_kind_size.of_int + | _ -> get_data tail + end + | _ -> get_data tail + end + in + get_data lines +;; diff --git a/ocaml/Qputils.ml b/ocaml/Qputils.ml index 79d8bd9c..ca042fc2 100644 --- a/ocaml/Qputils.ml +++ b/ocaml/Qputils.ml @@ -1,3 +1,4 @@ let (/) (a:string) (b:string) = a^"/"^b;; + diff --git a/ocaml/qp_set_mo_class.ml b/ocaml/qp_set_mo_class.ml index 2a6ba253..203ec0bb 100644 --- a/ocaml/qp_set_mo_class.ml +++ b/ocaml/qp_set_mo_class.ml @@ -59,7 +59,10 @@ let run ?(core="[]") ?(inact="[]") ?(act="[]") ?(virt="[]") ?(del="[]") ezfio_fi failure "mo_basis/mo_tot_num not found" ; let mo_tot_num = Ezfio.get_mo_basis_mo_tot_num () in - let n_int = N_int_number.of_int (Ezfio.get_determinants_n_int ()) in + let n_int = + try N_int_number.of_int (Ezfio.get_determinants_n_int ()) + with _ -> Bitlist.n_int_of_mo_tot_num mo_tot_num + in let mo_class = Array.init mo_tot_num ~f:(fun i -> None) in diff --git a/ocaml/qptypes_generator.ml b/ocaml/qptypes_generator.ml index 767b7703..0cab22d7 100644 --- a/ocaml/qptypes_generator.ml +++ b/ocaml/qptypes_generator.ml @@ -30,23 +30,44 @@ let input_data = " * MO_number : int assert (x > 0) ; + if (x > 1000) then + warning \"More than 1000 MOs\"; if (Ezfio.has_mo_basis_mo_tot_num ()) then assert (x <= (Ezfio.get_mo_basis_mo_tot_num ())); * AO_number : int assert (x > 0) ; + if (x > 1000) then + warning \"More than 1000 AOs\"; if (Ezfio.has_ao_basis_ao_num ()) then assert (x <= (Ezfio.get_ao_basis_ao_num ())); * N_int_number : int assert (x > 0) ; + if (x > 100) then + warning \"N_int > 100\"; if (Ezfio.has_determinants_n_int ()) then assert (x == (Ezfio.get_determinants_n_int ())); * Det_number : int assert (x > 0) ; + if (x > 100000000) then + warning \"More than 100 million determinants\"; if (Ezfio.has_determinants_det_num ()) then assert (x <= (Ezfio.get_determinants_det_num ())); + +* Bit_kind_size : int + begin match x with + | 8 | 16 | 32 | 64 -> () + | _ -> raise (Failure \"Bit_kind_size should be (8|16|32|64).\") + end; + +* Bit_kind : int + begin match x with + | 1 | 2 | 4 | 8 -> () + | _ -> raise (Failure \"Bit_kind should be (1|2|4|8).\") + end; + " ;; @@ -66,6 +87,7 @@ end ;; let parse_input input= + print_string "let warning = print_string;;\n" ; let rec parse result = function | [] -> result | ( "" , "" )::tail -> parse result tail diff --git a/scripts/update_README.py b/scripts/update_README.py index 652d5904..268c960e 100755 --- a/scripts/update_README.py +++ b/scripts/update_README.py @@ -22,8 +22,9 @@ header = """ """ try: - subprocess.check_output("git status".split()) - has_git = True +# subprocess.check_output("git status".split()) +# has_git = True + pass except OSError: has_git = False diff --git a/src/Utils/map_module.f90 b/src/Utils/map_module.f90 index a92bd868..a4c8c282 100644 --- a/src/Utils/map_module.f90 +++ b/src/Utils/map_module.f90 @@ -84,11 +84,14 @@ subroutine map_init(map,keymax) print *, 'Unable to allocate map' stop 5 endif -!sze = max(sqrt(map%map_size/16.d0),2048.d0) sze = 2 + !$OMP PARALLEL DEFAULT(NONE) SHARED(map,sze) PRIVATE(i) + !$OMP DO SCHEDULE(STATIC,512) do i=0_8,map%map_size call cache_map_init(map%map(i),sze) enddo + !$OMP ENDDO + !$OMP END PARALLEL map%sorted = .True. call omp_unset_lock(map%lock)