From 14158742bf9e9ed706d8b7258fdb6a9f152a175e Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 19 Jun 2017 09:42:52 +0200 Subject: [PATCH] Review --- ocaml/qp_run.ml | 12 ++++---- plugins/Hartree_Fock/SCF.irp.f | 3 +- .../qp_convert_output_to_ezfio.py | 28 ++++++++++++------- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/ocaml/qp_run.ml b/ocaml/qp_run.ml index e8c8d05a..17d31cea 100644 --- a/ocaml/qp_run.ml +++ b/ocaml/qp_run.ml @@ -120,10 +120,11 @@ let run slave exe ezfio_file = | Some (_,x) -> x^" " | None -> assert false in - match (Sys.command (prefix^exe^ezfio_file)) with - | 0 -> () - | i -> Printf.printf "Program exited with code %d.\n%!" i; - ; + let exit_code = + match (Sys.command (prefix^exe^ezfio_file)) with + | 0 -> 0 + | i -> (Printf.printf "Program exited with code %d.\n%!" i; i) + in TaskServer.stop ~port:port_number; Thread.join task_thread; @@ -132,7 +133,8 @@ let run slave exe ezfio_file = let duration = Time.diff (Time.now()) time_start |> Core.Span.to_string in - Printf.printf "Wall time : %s\n\n" duration + Printf.printf "Wall time : %s\n\n" duration; + exit exit_code let spec = let open Command.Spec in diff --git a/plugins/Hartree_Fock/SCF.irp.f b/plugins/Hartree_Fock/SCF.irp.f index 853e34c9..64263e83 100644 --- a/plugins/Hartree_Fock/SCF.irp.f +++ b/plugins/Hartree_Fock/SCF.irp.f @@ -5,7 +5,6 @@ program scf ! output: hartree_fock.energy ! optional: mo_basis.mo_coef END_DOC -! call debug call create_guess call orthonormalize_mos call run @@ -56,7 +55,7 @@ subroutine run ! Choose SCF algorithm -! call damping_SCF +! call damping_SCF ! Deprecated routine call Roothaan_Hall_SCF end diff --git a/scripts/ezfio_interface/qp_convert_output_to_ezfio.py b/scripts/ezfio_interface/qp_convert_output_to_ezfio.py index 122ce1fe..2a9bc087 100755 --- a/scripts/ezfio_interface/qp_convert_output_to_ezfio.py +++ b/scripts/ezfio_interface/qp_convert_output_to_ezfio.py @@ -309,16 +309,16 @@ def write_ezfio(res, filename): array_l_max_block.append(l_max_block) array_z_remove.append(z_remove) - x = [[coef_n_zeta.split() for coef_n_zeta in l.split('\n')] \ + x = [[ filter(None,coef_n_zeta.split()) for coef_n_zeta in l.split('\n')] \ for l in array_party[1:] ] - x = [] - for l in array_party[1:]: - y = [] - for coef_n_zeta in l.split('\n'): - z = coef_n_zeta.split() - if z : y.append(z) - x.append(y) - matrix.append(x) +# x = [] +# for l in array_party[1:]: +# y = [] +# for coef_n_zeta in l.split('\n'): +# z = coef_n_zeta.split() +# if z : y.append(z) +# x.append(y) +# matrix.append(x) return (matrix, array_l_max_block, array_z_remove) def get_local_stuff(matrix): @@ -444,4 +444,12 @@ if __name__ == '__main__': print file_, 'recognized as', str(res_file).split('.')[-1].split()[0] write_ezfio(res_file, ezfio_file) - os.system("qp_run save_ortho_mos "+ezfio_file) + if os.system("qp_run save_ortho_mos "+ezfio_file) != 0: + print """Warning: You need to run + + qp_run save_ortho_mos """+ezfio_file+""" + +to be sure your MOs will be orthogonal, which is not the case when +the MOs are read from output files (not enough precision in output).""" + +