10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-22 20:35:19 +01:00

Fixed QMCPACK bugs (Issue #154)

This commit is contained in:
Anthony Scemama 2016-03-07 20:13:43 +01:00
parent 92094534e2
commit 6b3ba6a99e
7 changed files with 25 additions and 19 deletions

View File

@ -11,7 +11,8 @@ module Determinants_by_hand : sig
psi_coef : Det_coef.t array; psi_coef : Det_coef.t array;
psi_det : Determinant.t array; psi_det : Determinant.t array;
} with sexp } with sexp
val read : unit -> t option val read : unit -> t
val read_maybe : unit -> t option
val write : t -> unit val write : t -> unit
val to_string : t -> string val to_string : t -> string
val to_rst : t -> Rst_string.t val to_rst : t -> Rst_string.t
@ -210,13 +211,6 @@ end = struct
let read () = let read () =
if (Ezfio.has_mo_basis_mo_tot_num ()) then if (Ezfio.has_mo_basis_mo_tot_num ()) then
let n_det =
read_n_det ()
in
if ( (Det_number.to_int n_det) > n_det_read_max ) then
None
else
Some
{ n_int = read_n_int () ; { n_int = read_n_int () ;
bit_kind = read_bit_kind () ; bit_kind = read_bit_kind () ;
n_det = read_n_det () ; n_det = read_n_det () ;
@ -224,6 +218,17 @@ end = struct
psi_coef = read_psi_coef () ; psi_coef = read_psi_coef () ;
psi_det = read_psi_det () ; psi_det = read_psi_det () ;
} }
else
failwith "No molecular orbitals, so no determinants"
;;
let read_maybe () =
let n_det =
read_n_det ()
in
if ( (Det_number.to_int n_det) < n_det_read_max ) then
try Some (read ()) with
| Failure _ -> None
else else
None None
;; ;;

View File

@ -36,7 +36,7 @@ let bind_socket ~socket_type ~socket ~address =
| 0 -> failwith @@ Printf.sprintf | 0 -> failwith @@ Printf.sprintf
"Unable to bind the %s socket : %s " "Unable to bind the %s socket : %s "
socket_type address socket_type address
| -1 -> (); | -1 -> ()
| i -> | i ->
try try
ZMQ.Socket.bind socket address; ZMQ.Socket.bind socket address;

View File

@ -43,9 +43,7 @@ let psi_det () =
failwith "Error reading EZFIO file"; failwith "Error reading EZFIO file";
Ezfio.set_file ezfio_filename; Ezfio.set_file ezfio_filename;
let psi_det = let psi_det =
match Input.Determinants_by_hand.read () with Input.Determinants_by_hand.read ()
| Some psi_det -> psi_det
| _ -> failwith "Error reading the mo set"
in in
Input.Determinants_by_hand.to_rst psi_det Input.Determinants_by_hand.to_rst psi_det
|> Rst_string.to_string |> Rst_string.to_string
@ -56,5 +54,5 @@ let psi_det () =
let () = let () =
basis (); basis ();
mo (); mo ();
psi_det (); psi_det ()

View File

@ -1,7 +1,7 @@
open Core.Std open Core.Std
let () = let () =
Message.of_string "new_job tcp://127.0.0.1 inproc://ao_ints:12345 ao_integrals" Message.of_string "new_job ao_integrals tcp://127.0.0.1 inproc://ao_ints:12345"
|> Message.to_string |> Message.to_string
|> print_endline |> print_endline
; ;
@ -37,7 +37,7 @@ let () =
; ;
try try
Message.of_string "new_job inproc://ao_ints tcp://127.0.0.1:12345 ao_integrals" Message.of_string "new_job ao_integrals inproc://ao_ints tcp://127.0.0.1:12345"
|> Message.to_string |> Message.to_string
|> print_endline |> print_endline
; ;

View File

@ -14,6 +14,12 @@ program qmcpack
enddo enddo
enddo enddo
call ezfio_set_ao_basis_ao_coef(ao_coef) call ezfio_set_ao_basis_ao_coef(ao_coef)
do j=1,mo_tot_num
do i=1,ao_num
mo_coef(i,j) *= 1.d0/ao_coef_normalization_factor(i)
enddo
enddo
call save_mos
call system('rm '//trim(ezfio_filename)//'/mo_basis/ao_md5') call system('rm '//trim(ezfio_filename)//'/mo_basis/ao_md5')
call system('$QP_ROOT/src/qmcpack/qp_convert_qmcpack_to_ezfio.py '//trim(ezfio_filename)) call system('$QP_ROOT/src/qmcpack/qp_convert_qmcpack_to_ezfio.py '//trim(ezfio_filename))

View File

@ -75,7 +75,7 @@ let get s =
| Ao_basis -> | Ao_basis ->
f Ao_basis.(read, to_rst) f Ao_basis.(read, to_rst)
| Determinants_by_hand -> | Determinants_by_hand ->
f Determinants_by_hand.(read, to_rst) f Determinants_by_hand.(read_maybe, to_rst)
{section_to_rst} {section_to_rst}
end end
with with

View File

@ -50,9 +50,6 @@ END_PROVIDER
enddo enddo
enddo enddo
ao_coef_normalization_factor(i) = 1.d0/sqrt(norm) ao_coef_normalization_factor(i) = 1.d0/sqrt(norm)
do j=1,ao_prim_num(i)
ao_coef_normalized(i,j) = ao_coef_normalized(i,j) * ao_coef_normalization_factor(i)
enddo
enddo enddo
END_PROVIDER END_PROVIDER