From 590b0d6edbc380d74c31e20b98d07930e0b0dc96 Mon Sep 17 00:00:00 2001 From: TApplencourt Date: Mon, 29 Feb 2016 11:26:33 +0100 Subject: [PATCH] Fix qmcpack convert --- ocaml/qp_print_basis.ml | 21 +++++++++- .../qmcpack/qp_convert_qmcpack_to_ezfio.py | 38 ++++--------------- 2 files changed, 27 insertions(+), 32 deletions(-) diff --git a/ocaml/qp_print_basis.ml b/ocaml/qp_print_basis.ml index 3a481c21..16a2f721 100644 --- a/ocaml/qp_print_basis.ml +++ b/ocaml/qp_print_basis.ml @@ -35,7 +35,26 @@ let mo () = |> print_endline +let psi_det () = + let ezfio_filename = + Sys.argv.(1) + in + if (not (Sys.file_exists_exn ezfio_filename)) then + failwith "Error reading EZFIO file"; + Ezfio.set_file ezfio_filename; + let psi_det = + match Input.Determinants_by_hand.read () with + | Some psi_det -> psi_det + | _ -> failwith "Error reading the mo set" + in + Input.Determinants_by_hand.to_rst psi_det + |> Rst_string.to_string + |> print_endline + + + let () = basis (); - mo () + mo (); + psi_det (); diff --git a/plugins/qmcpack/qp_convert_qmcpack_to_ezfio.py b/plugins/qmcpack/qp_convert_qmcpack_to_ezfio.py index 4b345d84..f0bfe174 100755 --- a/plugins/qmcpack/qp_convert_qmcpack_to_ezfio.py +++ b/plugins/qmcpack/qp_convert_qmcpack_to_ezfio.py @@ -79,7 +79,8 @@ process = subprocess.Popen( stdout=subprocess.PIPE) out, err = process.communicate() -basis_raw, sym_raw, _= out.split("\n\n\n") +print len(out.split("\n\n\n")) +basis_raw, sym_raw, _ , det_raw, _ = out.split("\n\n\n") # _ __ # |_) _. _ o _ (_ _ _|_ @@ -324,39 +325,14 @@ print "mo_num", mo_num print "det_num", n_det print "" -psi_det = ezfio.get_determinants_psi_det() -psi_coef = ezfio.get_determinants_psi_coef()[0] -for c, (l_det_bit_alpha, l_det_bit_beta) in zip(psi_coef, psi_det): - print c - bin_det = "" - int_det = l_det_bit_alpha[0] - bin_det_raw = "{0:b}".format(int_det)[::-1] - bin_det += bin_det_raw + "0" * (mo_num - len(bin_det_raw)) - -# for i,int_det in enumerate(l_det_bit_alpha): -# bin_det_raw = "{0:b}".format(int_det)[::-1] -# if mo_num - 64*(i+1) > 0: -# bin_det += bin_det_raw + "0" * (64*(i+1) - len(bin_det_raw)) -# else: -# bin_det += bin_det_raw + "0" * (mo_num-64*i - len(bin_det_raw)) +token = "Determinants ::" +pos = det_raw.rfind(token) + len(token) - print bin_det +det_without_header = det_raw[pos+2::] - bin_det = "" - int_det = l_det_bit_beta[0] - bin_det_raw = "{0:b}".format(int_det)[::-1] - bin_det += bin_det_raw + "0" * (mo_num - len(bin_det_raw)) - -# for i,int_det in enumerate(l_det_bit_beta): -# bin_det_raw = "{0:b}".format(int_det)[::-1] -# if mo_num - 64*(i+1) > 0: -# bin_det += bin_det_raw + "0" * (64*(i+1) - len(bin_det_raw)) -# else: -# bin_det += bin_det_raw + "0" * (mo_num-64*i - len(bin_det_raw)) - - print bin_det - print "" +print det_without_header print "END_DET" +