mirror of
https://github.com/LCPQ/quantum_package
synced 2024-12-23 04:43:50 +01:00
Added ~mo_tot_num in MO_number.of_int
This commit is contained in:
parent
4bae97159b
commit
ea1a4523c1
@ -106,13 +106,14 @@ let of_mo_number_list n_int l =
|
|||||||
|
|
||||||
let to_mo_number_list l =
|
let to_mo_number_list l =
|
||||||
let a = Array.of_list l in
|
let a = Array.of_list l in
|
||||||
|
let mo_tot_num = MO_number.get_mo_tot_num () in
|
||||||
let rec do_work accu = function
|
let rec do_work accu = function
|
||||||
| 0 -> accu
|
| 0 -> accu
|
||||||
| i ->
|
| i ->
|
||||||
begin
|
begin
|
||||||
let new_accu =
|
let new_accu =
|
||||||
match a.(i-1) with
|
match a.(i-1) with
|
||||||
| Bit.One -> (MO_number.of_int i)::accu
|
| Bit.One -> (MO_number.of_int ~mo_tot_num:mo_tot_num i)::accu
|
||||||
| Bit.Zero -> accu
|
| Bit.Zero -> accu
|
||||||
in
|
in
|
||||||
do_work new_accu (i-1)
|
do_work new_accu (i-1)
|
||||||
|
@ -177,9 +177,10 @@ end = struct
|
|||||||
let n_int = read_n_int () in
|
let n_int = read_n_int () in
|
||||||
if not (Ezfio.has_determinants_psi_det ()) then
|
if not (Ezfio.has_determinants_psi_det ()) then
|
||||||
begin
|
begin
|
||||||
|
let mo_tot_num = MO_number.get_mo_tot_num () in
|
||||||
let rec build_data accu = function
|
let rec build_data accu = function
|
||||||
| 0 -> accu
|
| 0 -> accu
|
||||||
| n -> build_data ((MO_number.of_int n)::accu) (n-1)
|
| n -> build_data ((MO_number.of_int ~mo_tot_num:mo_tot_num n)::accu) (n-1)
|
||||||
in
|
in
|
||||||
let det_a = build_data [] (Ezfio.get_electrons_elec_alpha_num ())
|
let det_a = build_data [] (Ezfio.get_electrons_elec_alpha_num ())
|
||||||
|> Bitlist.of_mo_number_list n_int
|
|> Bitlist.of_mo_number_list n_int
|
||||||
@ -246,8 +247,8 @@ end = struct
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
let to_rst b =
|
let to_rst b =
|
||||||
let mo_tot_num = Ezfio.get_mo_basis_mo_tot_num ()
|
let mo_tot_num = Ezfio.get_mo_basis_mo_tot_num () in
|
||||||
|> MO_number.of_int in
|
let mo_tot_num = MO_number.of_int mo_tot_num ~mo_tot_num:mo_tot_num in
|
||||||
let det_text =
|
let det_text =
|
||||||
List.map2_exn ~f:(fun coef det ->
|
List.map2_exn ~f:(fun coef det ->
|
||||||
Printf.sprintf " %f\n%s\n"
|
Printf.sprintf " %f\n%s\n"
|
||||||
@ -313,8 +314,8 @@ Determinants ::
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
let to_string b =
|
let to_string b =
|
||||||
let mo_tot_num = Ezfio.get_mo_basis_mo_tot_num ()
|
let mo_tot_num = Ezfio.get_mo_basis_mo_tot_num () in
|
||||||
|> MO_number.of_int in
|
let mo_tot_num = MO_number.of_int mo_tot_num ~mo_tot_num:mo_tot_num in
|
||||||
Printf.sprintf "
|
Printf.sprintf "
|
||||||
n_int = %s
|
n_int = %s
|
||||||
bit_kind = %s
|
bit_kind = %s
|
||||||
|
@ -36,12 +36,6 @@ let input_data = "
|
|||||||
* Non_empty_string : string
|
* Non_empty_string : string
|
||||||
assert (x <> \"\") ;
|
assert (x <> \"\") ;
|
||||||
|
|
||||||
* 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
|
* AO_number : int
|
||||||
assert (x > 0) ;
|
assert (x > 0) ;
|
||||||
@ -138,27 +132,36 @@ let input_data = "
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
let untouched = "
|
let untouched = "
|
||||||
(*
|
module MO_number : sig
|
||||||
module Determinant : sig
|
|
||||||
type t with sexp
|
type t with sexp
|
||||||
val to_int64_array : t -> int64 array
|
val to_int : t -> int
|
||||||
val of_int64_array : int64 array -> t
|
val get_mo_tot_num : unit -> int
|
||||||
|
val of_int : ?mo_tot_num:int -> int -> t
|
||||||
val to_string : t -> string
|
val to_string : t -> string
|
||||||
end = struct
|
end = struct
|
||||||
type t = int64 array with sexp
|
type t = int with sexp
|
||||||
let to_int64_array x = x
|
let get_mo_tot_num () =
|
||||||
let of_int64_array x =
|
if (Ezfio.has_mo_basis_mo_tot_num ()) then
|
||||||
if (Ezfio.has_determinants_n_int ()) then
|
Ezfio.get_mo_basis_mo_tot_num ()
|
||||||
begin
|
else
|
||||||
let n_int = Ezfio.get_determinants_n_int () in
|
0
|
||||||
assert ((Array.length x) = n_int*2)
|
let to_int x = x
|
||||||
end
|
let of_int ?mo_tot_num x = ( assert (x > 0) ;
|
||||||
; x
|
if (x > 1000) then
|
||||||
let to_string x = Array.to_list x
|
warning \"More than 1000 MOs\";
|
||||||
|> List.map ~f:Int64.to_string
|
let mo_tot_num = match mo_tot_num with
|
||||||
|> String.concat ~sep:\", \"
|
| Some i -> i
|
||||||
|
| None -> get_mo_tot_num ()
|
||||||
|
in
|
||||||
|
begin
|
||||||
|
match mo_tot_num with
|
||||||
|
| 0 -> ()
|
||||||
|
| i -> assert ( x <= i )
|
||||||
|
end
|
||||||
|
; x )
|
||||||
|
|
||||||
|
let to_string x = Int.to_string x
|
||||||
end
|
end
|
||||||
*)
|
|
||||||
|
|
||||||
"
|
"
|
||||||
|
|
||||||
@ -166,12 +169,12 @@ let template = format_of_string "
|
|||||||
module %s : sig
|
module %s : sig
|
||||||
type t with sexp
|
type t with sexp
|
||||||
val to_%s : t -> %s
|
val to_%s : t -> %s
|
||||||
val of_%s : %s -> t
|
val of_%s : %s %s -> t
|
||||||
val to_string : t -> string
|
val to_string : t -> string
|
||||||
end = struct
|
end = struct
|
||||||
type t = %s with sexp
|
type t = %s with sexp
|
||||||
let to_%s x = x
|
let to_%s x = x
|
||||||
let of_%s x = ( %s x )
|
let of_%s %s x = ( %s x )
|
||||||
let to_string x = %s.to_string x
|
let to_string x = %s.to_string x
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -184,13 +187,18 @@ let parse_input input=
|
|||||||
| [] -> result
|
| [] -> result
|
||||||
| ( "" , "" )::tail -> parse result tail
|
| ( "" , "" )::tail -> parse result tail
|
||||||
| ( t , text )::tail ->
|
| ( t , text )::tail ->
|
||||||
let name , typ = String.lsplit2_exn ~on:':' t
|
let name,typ,params,params_val =
|
||||||
|
match String.split ~on:':' t with
|
||||||
|
| [name;typ] -> (name,typ,"","")
|
||||||
|
| name::typ::params::params_val -> (name,typ,params,
|
||||||
|
(String.concat params_val ~sep:":") )
|
||||||
|
| _ -> assert false
|
||||||
in
|
in
|
||||||
let typ = String.strip typ
|
let typ = String.strip typ
|
||||||
and name = String.strip name in
|
and name = String.strip name in
|
||||||
let typ_cap = String.capitalize typ in
|
let typ_cap = String.capitalize typ in
|
||||||
let newstring = Printf.sprintf template name typ typ typ typ typ typ typ
|
let newstring = Printf.sprintf template name typ typ typ params_val typ typ
|
||||||
( String.strip text ) typ_cap
|
typ typ params ( String.strip text ) typ_cap
|
||||||
in
|
in
|
||||||
List.rev (parse (newstring::result) tail )
|
List.rev (parse (newstring::result) tail )
|
||||||
in
|
in
|
||||||
|
@ -3,7 +3,7 @@ program H_CORE_guess
|
|||||||
character*(64) :: label
|
character*(64) :: label
|
||||||
mo_coef = ao_ortho_lowdin_coef
|
mo_coef = ao_ortho_lowdin_coef
|
||||||
TOUCH mo_coef
|
TOUCH mo_coef
|
||||||
label = "H_CORE_GUESS"
|
label = "Guess"
|
||||||
call mo_as_eigvectors_of_mo_matrix(mo_mono_elec_integral,size(mo_mono_elec_integral,1),size(mo_mono_elec_integral,2),label)
|
call mo_as_eigvectors_of_mo_matrix(mo_mono_elec_integral,size(mo_mono_elec_integral,1),size(mo_mono_elec_integral,2),label)
|
||||||
call save_mos
|
call save_mos
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user