mirror of
https://github.com/LCPQ/quantum_package
synced 2024-06-29 16:34:50 +02:00
Changed bitmask_reference to bitmask_cas
This commit is contained in:
parent
c6886056b3
commit
b358afb610
|
@ -8,6 +8,8 @@ module Bitmasks : sig
|
|||
bit_kind : Bit_kind.t;
|
||||
n_mask_gen : Bitmask_number.t;
|
||||
generators : int64 array;
|
||||
n_mask_cas : Bitmask_number.t;
|
||||
cas : int64 array;
|
||||
} with sexp
|
||||
;;
|
||||
val read : unit -> t option
|
||||
|
@ -18,6 +20,8 @@ end = struct
|
|||
bit_kind : Bit_kind.t;
|
||||
n_mask_gen : Bitmask_number.t;
|
||||
generators : int64 array;
|
||||
n_mask_cas : Bitmask_number.t;
|
||||
cas : int64 array;
|
||||
} with sexp
|
||||
;;
|
||||
|
||||
|
@ -53,14 +57,22 @@ end = struct
|
|||
;;
|
||||
|
||||
|
||||
let full_mask n_int =
|
||||
let range = "[1-"^
|
||||
(Int.to_string (Ezfio.get_mo_basis_mo_tot_num ()))^"]"
|
||||
in
|
||||
MO_class.create_active range
|
||||
|> MO_class.to_bitlist n_int
|
||||
;;
|
||||
|
||||
let read_generators () =
|
||||
if not (Ezfio.has_bitmasks_generators ()) then
|
||||
begin
|
||||
let n_int = read_n_int () in
|
||||
let range = "[1-"^
|
||||
(Int.to_string (Ezfio.get_mo_basis_mo_tot_num ()))^"]" in
|
||||
let act = MO_class.create_active range
|
||||
|> MO_class.to_bitlist n_int
|
||||
let n_int =
|
||||
read_n_int ()
|
||||
in
|
||||
let act =
|
||||
full_mask n_int
|
||||
in
|
||||
let result = [ act ; act ; act ; act ; act ; act ]
|
||||
|> List.map ~f:(fun x ->
|
||||
|
@ -76,6 +88,38 @@ end = struct
|
|||
|> Ezfio.flattened_ezfio
|
||||
;;
|
||||
|
||||
let read_n_mask_cas () =
|
||||
if not (Ezfio.has_bitmasks_n_mask_cas ()) then
|
||||
Ezfio.set_bitmasks_n_mask_cas 1
|
||||
;
|
||||
Ezfio.get_bitmasks_n_mask_cas ()
|
||||
|> Bitmask_number.of_int
|
||||
;;
|
||||
|
||||
|
||||
let read_cas () =
|
||||
if not (Ezfio.has_bitmasks_cas ()) then
|
||||
begin
|
||||
let n_int =
|
||||
read_n_int ()
|
||||
in
|
||||
let act =
|
||||
full_mask n_int
|
||||
in
|
||||
let result = [ act ; act ]
|
||||
|> List.map ~f:(fun x ->
|
||||
let y = Bitlist.to_int64_list x in y@y )
|
||||
|> List.concat
|
||||
in
|
||||
let cas = Ezfio.ezfio_array_of_list ~rank:3
|
||||
~dim:([| (N_int_number.to_int n_int) ; 2; 1|]) ~data:result
|
||||
in
|
||||
Ezfio.set_bitmasks_cas cas
|
||||
end;
|
||||
Ezfio.get_bitmasks_cas ()
|
||||
|> Ezfio.flattened_ezfio
|
||||
;;
|
||||
|
||||
let read () =
|
||||
if (Ezfio.has_mo_basis_mo_tot_num ()) then
|
||||
Some
|
||||
|
@ -83,6 +127,8 @@ end = struct
|
|||
bit_kind = read_bit_kind ();
|
||||
n_mask_gen = read_n_mask_gen ();
|
||||
generators = read_generators ();
|
||||
n_mask_cas = read_n_mask_cas ();
|
||||
cas = read_cas ();
|
||||
}
|
||||
else
|
||||
None
|
||||
|
@ -94,6 +140,8 @@ n_int = %s
|
|||
bit_kind = %s
|
||||
n_mask_gen = %s
|
||||
generators = %s
|
||||
n_mask_cas = %s
|
||||
cas = %s
|
||||
"
|
||||
(N_int_number.to_string b.n_int)
|
||||
(Bit_kind.to_string b.bit_kind)
|
||||
|
@ -101,6 +149,10 @@ generators = %s
|
|||
(Array.to_list b.generators
|
||||
|> List.map ~f:(fun x-> Int64.to_string x)
|
||||
|> String.concat ~sep:", ")
|
||||
(Bitmask_number.to_string b.n_mask_cas)
|
||||
(Array.to_list b.cas
|
||||
|> List.map ~f:(fun x-> Int64.to_string x)
|
||||
|> String.concat ~sep:", ")
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -165,6 +165,7 @@ let run ?(core="[]") ?(inact="[]") ?(act="[]") ?(virt="[]") ?(del="[]") ezfio_fi
|
|||
and extract_hole2 (_,_,h,_) = h
|
||||
and extract_particle2 (_,_,_,p) = p
|
||||
in
|
||||
(* --> TODO : This might be wrong *)
|
||||
let result_ref =
|
||||
let core = MO_class.create_inactive core_input in
|
||||
let cv = Excitation.create_single core virt in
|
||||
|
@ -183,6 +184,7 @@ let run ?(core="[]") ?(inact="[]") ?(act="[]") ?(virt="[]") ?(del="[]") ezfio_fi
|
|||
[ Bitlist.or_operator (extract_hole iv) (extract_hole cv);
|
||||
extract_particle iv ]
|
||||
in
|
||||
(* <-- TODO : This might be wrong *)
|
||||
|
||||
let n_single = Array.length single_excitations in
|
||||
let n_mask = Array.length double_excitations in
|
||||
|
@ -231,10 +233,10 @@ let run ?(core="[]") ?(inact="[]") ?(act="[]") ?(virt="[]") ?(del="[]") ezfio_fi
|
|||
Ezfio.ezfio_array_of_list ~rank:4 ~dim:([| (N_int_number.to_int n_int) ; 2; 6; n_mask|]) ~data:result_gen
|
||||
|> Ezfio.set_bitmasks_generators ;
|
||||
|
||||
(* Write reference masks *)
|
||||
Ezfio.set_bitmasks_n_mask_ref 1;
|
||||
Ezfio.ezfio_array_of_list ~rank:4 ~dim:([| (N_int_number.to_int n_int) ; 2; 2; 1|]) ~data:result_ref
|
||||
|> Ezfio.set_bitmasks_reference ;
|
||||
(* Write CAS reference masks *)
|
||||
Ezfio.set_bitmasks_n_mask_cas 1;
|
||||
Ezfio.ezfio_array_of_list ~rank:3 ~dim:([| (N_int_number.to_int n_int) ; 2; 1|]) ~data:result_ref
|
||||
|> Ezfio.set_bitmasks_cas ;
|
||||
|
||||
|
||||
;;
|
||||
|
|
|
@ -31,9 +31,6 @@ let build_mask from upto n_int =
|
|||
;;
|
||||
|
||||
|
||||
let failure s = raise (Failure s)
|
||||
;;
|
||||
|
||||
type t =
|
||||
| Core
|
||||
| Inactive
|
||||
|
@ -56,7 +53,7 @@ let run ?(core="[]") ?(inact="[]") ?(act="[]") ?(virt="[]") ?(del="[]") ezfio_fi
|
|||
|
||||
Ezfio.set_file ezfio_filename ;
|
||||
if not (Ezfio.has_mo_basis_mo_tot_num ()) then
|
||||
failure "mo_basis/mo_tot_num not found" ;
|
||||
failwith "mo_basis/mo_tot_num not found" ;
|
||||
|
||||
let mo_tot_num = Ezfio.get_mo_basis_mo_tot_num () in
|
||||
let n_int =
|
||||
|
@ -76,7 +73,7 @@ let run ?(core="[]") ?(inact="[]") ?(act="[]") ?(virt="[]") ?(del="[]") ezfio_fi
|
|||
match mo_class.(i-1) with
|
||||
| None -> mo_class.(i-1) <- t ;
|
||||
apply_class t tail;
|
||||
| x -> failure
|
||||
| x -> failwith
|
||||
(Printf.sprintf "Orbital %d is defined both in the %s and %s spaces"
|
||||
i (t_to_string x) (t_to_string t))
|
||||
end
|
||||
|
@ -104,7 +101,7 @@ let run ?(core="[]") ?(inact="[]") ?(act="[]") ?(virt="[]") ?(del="[]") ezfio_fi
|
|||
for i=1 to (Array.length mo_class)
|
||||
do
|
||||
if (mo_class.(i-1) = None) then
|
||||
failure (Printf.sprintf "Orbital %d is not specified (mo_tot_num = %d)" i mo_tot_num)
|
||||
failwith (Printf.sprintf "Orbital %d is not specified (mo_tot_num = %d)" i mo_tot_num)
|
||||
done;
|
||||
|
||||
|
||||
|
@ -171,18 +168,32 @@ let run ?(core="[]") ?(inact="[]") ?(act="[]") ?(virt="[]") ?(del="[]") ezfio_fi
|
|||
in
|
||||
|
||||
List.iter ~f:(fun x-> print_endline (Bitlist.to_string x)) result;
|
||||
|
||||
(* Write masks *)
|
||||
let result = List.map ~f:(fun x ->
|
||||
let y = Bitlist.to_int64_list x in y@y )
|
||||
result
|
||||
|> List.concat
|
||||
in
|
||||
|
||||
(* Write masks *)
|
||||
Ezfio.set_bitmasks_n_int (N_int_number.to_int n_int);
|
||||
Ezfio.set_bitmasks_bit_kind 8;
|
||||
Ezfio.set_bitmasks_n_mask_gen 1;
|
||||
Ezfio.ezfio_array_of_list ~rank:4 ~dim:([| (N_int_number.to_int n_int) ; 2; 6; 1|]) ~data:result
|
||||
|> Ezfio.set_bitmasks_generators ;
|
||||
|
||||
let result =
|
||||
let open Excitation in
|
||||
match aa with
|
||||
| Double _ -> assert false
|
||||
| Single (x,y) ->
|
||||
( MO_class.to_bitlist n_int (Hole.to_mo_class x) ) @
|
||||
( MO_class.to_bitlist n_int (Particle.to_mo_class y) )
|
||||
|> Bitlist.to_int64_list
|
||||
in
|
||||
Ezfio.set_bitmasks_n_mask_cas 1;
|
||||
Ezfio.ezfio_array_of_list ~rank:3 ~dim:([| (N_int_number.to_int n_int) ; 2; 1|]) ~data:result
|
||||
|> Ezfio.set_bitmasks_cas;
|
||||
;;
|
||||
|
||||
let ezfio_file =
|
||||
|
|
|
@ -3,6 +3,6 @@ bitmasks
|
|||
bit_kind integer
|
||||
N_mask_gen integer
|
||||
generators integer*8 (bitmasks_N_int*bitmasks_bit_kind/8,2,6,bitmasks_N_mask_gen)
|
||||
N_mask_ref integer
|
||||
reference integer*8 (bitmasks_N_int*bitmasks_bit_kind/8,2,2,bitmasks_N_mask_ref)
|
||||
N_mask_cas integer
|
||||
cas integer*8 (bitmasks_N_int*bitmasks_bit_kind/8,2,bitmasks_N_mask_cas)
|
||||
|
||||
|
|
|
@ -140,17 +140,17 @@ BEGIN_PROVIDER [ integer(bit_kind), generators_bitmask, (N_int,2,6,N_generators_
|
|||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ integer, N_reference_bitmask ]
|
||||
BEGIN_PROVIDER [ integer, N_cas_bitmask ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Number of bitmasks for reference
|
||||
! Number of bitmasks for CAS
|
||||
END_DOC
|
||||
logical :: exists
|
||||
PROVIDE ezfio_filename
|
||||
|
||||
call ezfio_has_bitmasks_N_mask_ref(exists)
|
||||
call ezfio_has_bitmasks_N_mask_cas(exists)
|
||||
if (exists) then
|
||||
call ezfio_get_bitmasks_N_mask_ref(N_reference_bitmask)
|
||||
call ezfio_get_bitmasks_N_mask_cas(N_cas_bitmask)
|
||||
integer :: N_int_check
|
||||
integer :: bit_kind_check
|
||||
call ezfio_get_bitmasks_bit_kind(bit_kind_check)
|
||||
|
@ -164,27 +164,29 @@ BEGIN_PROVIDER [ integer, N_reference_bitmask ]
|
|||
print *, 'Error: N_int is not correct in EZFIO file'
|
||||
endif
|
||||
else
|
||||
N_reference_bitmask = 1
|
||||
N_cas_bitmask = 1
|
||||
endif
|
||||
ASSERT (N_reference_bitmask > 0)
|
||||
ASSERT (N_cas_bitmask > 0)
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ integer(bit_kind), reference_bitmask, (N_int,2,2,N_reference_bitmask) ]
|
||||
BEGIN_PROVIDER [ integer(bit_kind), cas_bitmask, (N_int,2,N_cas_bitmask) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Bitmasks for reference determinants. (N_int, alpha/beta, hole/particle, reference)
|
||||
! Bitmasks for CAS reference determinants. (N_int, alpha/beta, CAS reference)
|
||||
END_DOC
|
||||
logical :: exists
|
||||
integer :: i
|
||||
PROVIDE ezfio_filename
|
||||
|
||||
call ezfio_has_bitmasks_reference(exists)
|
||||
call ezfio_has_bitmasks_cas(exists)
|
||||
print*,'exists = ',exists
|
||||
if (exists) then
|
||||
call ezfio_get_bitmasks_reference(reference_bitmask)
|
||||
call ezfio_get_bitmasks_cas(cas_bitmask)
|
||||
else
|
||||
reference_bitmask(:,:,1,1) = HF_bitmask
|
||||
reference_bitmask(:,:,2,1) = iand(not(HF_bitmask(:,:)),full_ijkl_bitmask(:,:))
|
||||
do i=1,N_cas_bitmask
|
||||
cas_bitmask(:,:,i) = iand(not(HF_bitmask(:,:)),full_ijkl_bitmask(:,:))
|
||||
enddo
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
@ -197,11 +199,3 @@ BEGIN_PROVIDER [ integer, i_bitmask_gen ]
|
|||
i_bitmask_gen = 1
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ integer, i_bitmask_ref ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Current bitmask for the reference
|
||||
END_DOC
|
||||
i_bitmask_ref = 1
|
||||
END_PROVIDER
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
AOs BiInts Bitmask Dets Electrons Ezfio_files Full_CI Generators_full Hartree_Fock MOGuess MonoInts MOs Nuclei Output Selectors_full Utils Molden FCIdump
|
||||
AOs BiInts Bitmask Dets Electrons Ezfio_files Full_CI Generators_full Hartree_Fock MOGuess MonoInts MOs Nuclei Output Selectors_full Utils Molden FCIdump Generators_CAS
|
||||
|
|
Loading…
Reference in New Issue
Block a user