mirror of
https://github.com/LCPQ/quantum_package
synced 2025-01-03 10:05:57 +01:00
Added default for n_int in ocaml
This commit is contained in:
parent
a4688e7500
commit
9bce6b8a2e
@ -62,6 +62,13 @@ let of_int64_list l =
|
|||||||
List.flatten result
|
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 zero n_int =
|
||||||
let n_int = N_int_number.to_int n_int in
|
let n_int = N_int_number.to_int n_int in
|
||||||
let a = Array.init n_int (fun i-> 0L) in
|
let a = Array.init n_int (fun i-> 0L) in
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
open Core.Std;;
|
open Core.Std;;
|
||||||
|
open Qptypes;;
|
||||||
|
|
||||||
(** Variables related to the quantum package installation *)
|
(** Variables related to the quantum package installation *)
|
||||||
|
|
||||||
@ -9,3 +10,32 @@ Please source the quantum_package.rc file."
|
|||||||
| Some x -> x
|
| 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
|
||||||
|
;;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
let (/) (a:string) (b:string) = a^"/"^b;;
|
let (/) (a:string) (b:string) = a^"/"^b;;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,7 +59,10 @@ let run ?(core="[]") ?(inact="[]") ?(act="[]") ?(virt="[]") ?(del="[]") ezfio_fi
|
|||||||
failure "mo_basis/mo_tot_num not found" ;
|
failure "mo_basis/mo_tot_num not found" ;
|
||||||
|
|
||||||
let mo_tot_num = Ezfio.get_mo_basis_mo_tot_num () in
|
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
|
let mo_class = Array.init mo_tot_num ~f:(fun i -> None) in
|
||||||
|
@ -30,23 +30,44 @@ let input_data = "
|
|||||||
|
|
||||||
* MO_number : int
|
* MO_number : int
|
||||||
assert (x > 0) ;
|
assert (x > 0) ;
|
||||||
|
if (x > 1000) then
|
||||||
|
warning \"More than 1000 MOs\";
|
||||||
if (Ezfio.has_mo_basis_mo_tot_num ()) then
|
if (Ezfio.has_mo_basis_mo_tot_num ()) then
|
||||||
assert (x <= (Ezfio.get_mo_basis_mo_tot_num ()));
|
assert (x <= (Ezfio.get_mo_basis_mo_tot_num ()));
|
||||||
|
|
||||||
* AO_number : int
|
* AO_number : int
|
||||||
assert (x > 0) ;
|
assert (x > 0) ;
|
||||||
|
if (x > 1000) then
|
||||||
|
warning \"More than 1000 AOs\";
|
||||||
if (Ezfio.has_ao_basis_ao_num ()) then
|
if (Ezfio.has_ao_basis_ao_num ()) then
|
||||||
assert (x <= (Ezfio.get_ao_basis_ao_num ()));
|
assert (x <= (Ezfio.get_ao_basis_ao_num ()));
|
||||||
|
|
||||||
* N_int_number : int
|
* N_int_number : int
|
||||||
assert (x > 0) ;
|
assert (x > 0) ;
|
||||||
|
if (x > 100) then
|
||||||
|
warning \"N_int > 100\";
|
||||||
if (Ezfio.has_determinants_n_int ()) then
|
if (Ezfio.has_determinants_n_int ()) then
|
||||||
assert (x == (Ezfio.get_determinants_n_int ()));
|
assert (x == (Ezfio.get_determinants_n_int ()));
|
||||||
|
|
||||||
* Det_number : int
|
* Det_number : int
|
||||||
assert (x > 0) ;
|
assert (x > 0) ;
|
||||||
|
if (x > 100000000) then
|
||||||
|
warning \"More than 100 million determinants\";
|
||||||
if (Ezfio.has_determinants_det_num ()) then
|
if (Ezfio.has_determinants_det_num ()) then
|
||||||
assert (x <= (Ezfio.get_determinants_det_num ()));
|
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=
|
let parse_input input=
|
||||||
|
print_string "let warning = print_string;;\n" ;
|
||||||
let rec parse result = function
|
let rec parse result = function
|
||||||
| [] -> result
|
| [] -> result
|
||||||
| ( "" , "" )::tail -> parse result tail
|
| ( "" , "" )::tail -> parse result tail
|
||||||
|
@ -22,8 +22,9 @@ header = """
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.check_output("git status".split())
|
# subprocess.check_output("git status".split())
|
||||||
has_git = True
|
# has_git = True
|
||||||
|
pass
|
||||||
except OSError:
|
except OSError:
|
||||||
has_git = False
|
has_git = False
|
||||||
|
|
||||||
|
@ -84,11 +84,14 @@ subroutine map_init(map,keymax)
|
|||||||
print *, 'Unable to allocate map'
|
print *, 'Unable to allocate map'
|
||||||
stop 5
|
stop 5
|
||||||
endif
|
endif
|
||||||
!sze = max(sqrt(map%map_size/16.d0),2048.d0)
|
|
||||||
sze = 2
|
sze = 2
|
||||||
|
!$OMP PARALLEL DEFAULT(NONE) SHARED(map,sze) PRIVATE(i)
|
||||||
|
!$OMP DO SCHEDULE(STATIC,512)
|
||||||
do i=0_8,map%map_size
|
do i=0_8,map%map_size
|
||||||
call cache_map_init(map%map(i),sze)
|
call cache_map_init(map%map(i),sze)
|
||||||
enddo
|
enddo
|
||||||
|
!$OMP ENDDO
|
||||||
|
!$OMP END PARALLEL
|
||||||
map%sorted = .True.
|
map%sorted = .True.
|
||||||
|
|
||||||
call omp_unset_lock(map%lock)
|
call omp_unset_lock(map%lock)
|
||||||
|
Loading…
Reference in New Issue
Block a user