From 6171d5c204796b15a1bab1f8f672962b66a485b7 Mon Sep 17 00:00:00 2001 From: TApplencourt Date: Tue, 1 Mar 2016 15:41:41 +0100 Subject: [PATCH] Transform +/- -> 10 --- .travis.yml | 1 - ocaml/qp_edit.ml | 24 +++--- ocaml/qp_print_basis.ml | 21 ++++- .../qmcpack/qp_convert_qmcpack_to_ezfio.py | 76 ++++++++++--------- scripts/compilation/qp_create_ninja.py | 6 +- src/AO_Basis/aos.irp.f | 11 ++- src/Integrals_Bielec/ao_bi_integrals.irp.f | 17 ++++- 7 files changed, 100 insertions(+), 56 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5793478c..f451f1d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,6 @@ python: script: - ./configure --production ./config/gfortran.cfg - - source ./quantum_package.rc ; cd tests ; bats bats/qp.bats - source ./quantum_package.rc ; qp_module.py install Full_CI Hartree_Fock CAS_SD MRCC_CASSD - source ./quantum_package.rc ; ninja - source ./quantum_package.rc ; cd ocaml ; make ; cd - diff --git a/ocaml/qp_edit.ml b/ocaml/qp_edit.ml index a693aa2f..5b5ff95b 100644 --- a/ocaml/qp_edit.ml +++ b/ocaml/qp_edit.ml @@ -18,9 +18,9 @@ type keyword = | Mo_basis | Nuclei | Determinants -| Integrals_bielec -| Pseudo | Perturbation +| Pseudo +| Integrals_bielec | Properties | Hartree_fock ;; @@ -33,9 +33,9 @@ let keyword_to_string = function | Mo_basis -> "MO basis" | Nuclei -> "Molecule" | Determinants -> "Determinants" -| Integrals_bielec -> "Integrals_bielec" -| Pseudo -> "Pseudo" | Perturbation -> "Perturbation" +| Pseudo -> "Pseudo" +| Integrals_bielec -> "Integrals_bielec" | Properties -> "Properties" | Hartree_fock -> "Hartree_fock" ;; @@ -88,12 +88,12 @@ let get s = f Determinants_by_hand.(read, to_rst) | Determinants -> f Determinants.(read, to_rst) - | Integrals_bielec -> - f Integrals_bielec.(read, to_rst) - | Pseudo -> - f Pseudo.(read, to_rst) | Perturbation -> f Perturbation.(read, to_rst) + | Pseudo -> + f Pseudo.(read, to_rst) + | Integrals_bielec -> + f Integrals_bielec.(read, to_rst) | Properties -> f Properties.(read, to_rst) | Hartree_fock -> @@ -136,9 +136,9 @@ let set str s = let open Input in match s with | Determinants -> write Determinants.(of_rst, write) s - | Integrals_bielec -> write Integrals_bielec.(of_rst, write) s - | Pseudo -> write Pseudo.(of_rst, write) s | Perturbation -> write Perturbation.(of_rst, write) s + | Pseudo -> write Pseudo.(of_rst, write) s + | Integrals_bielec -> write Integrals_bielec.(of_rst, write) s | Properties -> write Properties.(of_rst, write) s | Hartree_fock -> write Hartree_fock.(of_rst, write) s | Electrons -> write Electrons.(of_rst, write) s @@ -189,9 +189,9 @@ let run check_only ezfio_filename = Ao_basis; Electrons ; Determinants ; - Integrals_bielec ; - Pseudo ; Perturbation ; + Pseudo ; + Integrals_bielec ; Properties ; Hartree_fock ; Mo_basis; 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 9349b9e2..35e00ce1 100755 --- a/plugins/qmcpack/qp_convert_qmcpack_to_ezfio.py +++ b/plugins/qmcpack/qp_convert_qmcpack_to_ezfio.py @@ -17,7 +17,7 @@ ezfio.set_file(ezfio_path) do_pseudo = ezfio.get_pseudo_do_pseudo() if do_pseudo: print "do_pseudo True" - zcore = ezfio.get_pseudo_nucl_charge_remove() + print "The charge of nucl will be decreasced for taking into acount the pseudo potentiel" else: print "do_pseudo False" @@ -68,11 +68,7 @@ print "nucl_num", len(l_label) print "Atomic coord in Bohr" for i, t in enumerate(zip(l_label, l_charge, l_coord_str)): - try: - l = (t[0], t[1] + zcore[i], t[2]) - except NameError: - l = t - print list_to_string(l) + print list_to_string(t) # # Call externet process to get the sysmetry @@ -83,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 _ (_ _ _|_ @@ -175,6 +172,9 @@ def get_nb_permutation(str_): def order_l_l_sym(l_l_sym): + + l_order_mo = [i for i,_ in enumerate(l_l_sym)] + n = 1 for i in range(len(l_l_sym)): if n != 1: @@ -184,11 +184,11 @@ def order_l_l_sym(l_l_sym): l = l_l_sym[i] n = get_nb_permutation(l[2]) - l_l_sym[i:i + n] = sorted(l_l_sym[i:i + n], - key=lambda x: x[2], - cmp=compare_gamess_style) + l_l_sym[i:i + n], l_order_mo[i:i+n] = zip(*sorted(zip(l_l_sym[i:i + n],l_order_mo[i:i+n]), + key=lambda x: x[0][2], + cmp=compare_gamess_style)) - return l_l_sym + return l_l_sym, l_order_mo #========================== @@ -197,8 +197,13 @@ def order_l_l_sym(l_l_sym): l_sym_without_header = sym_raw.split("\n")[3:-2] l_l_sym_raw = [i.split() for i in l_sym_without_header] +print len(l_l_sym_raw) + l_l_sym_expend_sym = expend_sym_l(l_l_sym_raw) -l_l_sym_ordered = order_l_l_sym(l_l_sym_expend_sym) +print len(l_l_sym_expend_sym) + +l_l_sym_ordered, l_order_mo = order_l_l_sym(l_l_sym_expend_sym) + #======== #MO COEF @@ -305,8 +310,8 @@ if do_pseudo: if l_dump: l_str.append(l_dump) - str_ = "PARAMETERS FOR {0} ON ATOM {1} WITH ZCORE {2} AND LMAX {3} ARE" - print str_.format(a, i + 1, int(zcore[i]), int(len(l_str) - 1)) + str_ = "PARAMETERS FOR {0} ON ATOM {1} WITH ZCORE -1 AND LMAX {2} ARE" + print str_.format(a, i + 1, int(len(l_str) - 1)) for i, l in enumerate(l_str): str_ = "FOR L= {0} COEFF N ZETA" @@ -314,8 +319,7 @@ if do_pseudo: for ii, ll in enumerate(l): print " ", ii + 1, ll - str_ = "THE ECP RUN REMOVES {0} CORE ELECTRONS, AND THE SAME NUMBER OF PROTONS." - print str_.format(sum(zcore)) + str_ = "THE ECP RUN REMOVES -1 CORE ELECTRONS, AND THE SAME NUMBER OF PROTONS." print "END_PSEUDO" # _ @@ -329,31 +333,29 @@ 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 = "" - 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 +d_rep={"+":"1","-":"0"} - bin_det = "" - 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)) +det_without_header = det_raw[pos+2::] - print bin_det - print "" +for line_raw in det_without_header.split("\n"): + line = line_raw + + if line_raw: + try: + float(line) + except ValueError: + print line_raw.strip(), len(line_raw.strip()) + print l_order_mo, len(l_order_mo) + + line_order = [line_raw[i] for i in l_order_mo] + line= "".join([d_rep[x] if x in d_rep else x for x in line_order]) + + print line print "END_DET" + diff --git a/scripts/compilation/qp_create_ninja.py b/scripts/compilation/qp_create_ninja.py index d089e76b..a742f7da 100755 --- a/scripts/compilation/qp_create_ninja.py +++ b/scripts/compilation/qp_create_ninja.py @@ -38,6 +38,7 @@ from qp_path import QP_ROOT, QP_SRC, QP_EZFIO LIB = "" # join(QP_ROOT, "lib", "rdtsc.o") EZFIO_LIB = join(QP_ROOT, "lib", "libezfio_irp.a") ZMQ_LIB = join(QP_ROOT, "lib", "libf77zmq.a") + " " + join(QP_ROOT, "lib", "libzmq.a") + " -lstdc++ -lrt" +INT_LIB = "/home/razoa/libint/libint-2.1.0-beta2/lib/.libs/libint2.a" ROOT_BUILD_NINJA = join(QP_ROOT, "config", "build.ninja") header = r"""# @@ -96,7 +97,8 @@ def ninja_create_env_variable(pwd_config_file): l_string.append(str_) lib_lapack = get_compilation_option(pwd_config_file, "LAPACK_LIB") - l_string.append("LIB = {0} {1} {2} {3}".format(LIB, lib_lapack, EZFIO_LIB, ZMQ_LIB)) + str_lib = " ".join([LIB, lib_lapack, EZFIO_LIB, ZMQ_LIB, INT_LIB]) + l_string.append("LIB = {0} ".format(str_lib)) l_string.append("") @@ -387,6 +389,8 @@ def get_l_file_for_module(path_module): l_src.append(f) obj = '{0}.o'.format(os.path.splitext(f)[0]) l_obj.append(obj) + elif f.lower().endswith(".o"): + l_obj.append(join(path_module.abs, f)) elif f == "EZFIO.cfg": l_depend.append(join(path_module.abs, "ezfio_interface.irp.f")) diff --git a/src/AO_Basis/aos.irp.f b/src/AO_Basis/aos.irp.f index 341d1453..04c90ca7 100644 --- a/src/AO_Basis/aos.irp.f +++ b/src/AO_Basis/aos.irp.f @@ -54,6 +54,13 @@ END_PROVIDER ao_coef_normalized(i,j) = ao_coef_normalized(i,j) * ao_coef_normalization_factor(i) enddo enddo + +! do i=1,ao_num +! do j=1,ao_prim_num(i) +! ao_coef_normalized(i,j) = ao_coef(i,j) +! enddo +! enddo + END_PROVIDER BEGIN_PROVIDER [ double precision, ao_coef_normalized_ordered, (ao_num_align,ao_prim_num_max) ] @@ -72,8 +79,8 @@ END_PROVIDER d(j,1) = ao_expo(i,j) d(j,2) = ao_coef_normalized(i,j) enddo - call dsort(d(1,1),iorder,ao_prim_num(i)) - call dset_order(d(1,2),iorder,ao_prim_num(i)) +! call dsort(d(1,1),iorder,ao_prim_num(i)) +! call dset_order(d(1,2),iorder,ao_prim_num(i)) do j=1,ao_prim_num(i) ao_expo_ordered(i,j) = d(j,1) ao_coef_normalized_ordered(i,j) = d(j,2) diff --git a/src/Integrals_Bielec/ao_bi_integrals.irp.f b/src/Integrals_Bielec/ao_bi_integrals.irp.f index 07416e61..7586c8fd 100644 --- a/src/Integrals_Bielec/ao_bi_integrals.irp.f +++ b/src/Integrals_Bielec/ao_bi_integrals.irp.f @@ -4,6 +4,12 @@ double precision function ao_bielec_integral(i,j,k,l) ! integral of the AO basis or (ij|kl) ! i(r1) j(r1) 1/r12 k(r2) l(r2) END_DOC + + ! use libint_module + ! call init_libint(trim(ezfio_filename)//char(0)) + ! ao_bielec_integral = ao_bielec_integral_libint(i,j,k,l) + ! return + integer,intent(in) :: i,j,k,l integer :: p,q,r,s double precision :: I_center(3),J_center(3),K_center(3),L_center(3) @@ -288,11 +294,18 @@ end subroutine compute_ao_bielec_integrals(j,k,l,sze,buffer_value) implicit none use map_module - + use libint_module + BEGIN_DOC ! Compute AO 1/r12 integrals for all i and fixed j,k,l END_DOC - + +! include 'Utils/constants.include.F' +! integer, intent(in) :: j,k,l,sze +! real(integral_kind), intent(out) :: buffer_value(sze) +! +! call compute_ao_bielec_integrals_libint(j,k,l,sze,buffer_value) + include 'Utils/constants.include.F' integer, intent(in) :: j,k,l,sze real(integral_kind), intent(out) :: buffer_value(sze)