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

Transform +/- -> 10

This commit is contained in:
TApplencourt 2016-03-01 15:41:41 +01:00
parent d562bc83cb
commit 6171d5c204
7 changed files with 100 additions and 56 deletions

View File

@ -24,7 +24,6 @@ python:
script: script:
- ./configure --production ./config/gfortran.cfg - ./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 ; qp_module.py install Full_CI Hartree_Fock CAS_SD MRCC_CASSD
- source ./quantum_package.rc ; ninja - source ./quantum_package.rc ; ninja
- source ./quantum_package.rc ; cd ocaml ; make ; cd - - source ./quantum_package.rc ; cd ocaml ; make ; cd -

View File

@ -18,9 +18,9 @@ type keyword =
| Mo_basis | Mo_basis
| Nuclei | Nuclei
| Determinants | Determinants
| Integrals_bielec
| Pseudo
| Perturbation | Perturbation
| Pseudo
| Integrals_bielec
| Properties | Properties
| Hartree_fock | Hartree_fock
;; ;;
@ -33,9 +33,9 @@ let keyword_to_string = function
| Mo_basis -> "MO basis" | Mo_basis -> "MO basis"
| Nuclei -> "Molecule" | Nuclei -> "Molecule"
| Determinants -> "Determinants" | Determinants -> "Determinants"
| Integrals_bielec -> "Integrals_bielec"
| Pseudo -> "Pseudo"
| Perturbation -> "Perturbation" | Perturbation -> "Perturbation"
| Pseudo -> "Pseudo"
| Integrals_bielec -> "Integrals_bielec"
| Properties -> "Properties" | Properties -> "Properties"
| Hartree_fock -> "Hartree_fock" | Hartree_fock -> "Hartree_fock"
;; ;;
@ -88,12 +88,12 @@ let get s =
f Determinants_by_hand.(read, to_rst) f Determinants_by_hand.(read, to_rst)
| Determinants -> | Determinants ->
f Determinants.(read, to_rst) f Determinants.(read, to_rst)
| Integrals_bielec ->
f Integrals_bielec.(read, to_rst)
| Pseudo ->
f Pseudo.(read, to_rst)
| Perturbation -> | Perturbation ->
f Perturbation.(read, to_rst) f Perturbation.(read, to_rst)
| Pseudo ->
f Pseudo.(read, to_rst)
| Integrals_bielec ->
f Integrals_bielec.(read, to_rst)
| Properties -> | Properties ->
f Properties.(read, to_rst) f Properties.(read, to_rst)
| Hartree_fock -> | Hartree_fock ->
@ -136,9 +136,9 @@ let set str s =
let open Input in let open Input in
match s with match s with
| Determinants -> write Determinants.(of_rst, write) s | 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 | 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 | Properties -> write Properties.(of_rst, write) s
| Hartree_fock -> write Hartree_fock.(of_rst, write) s | Hartree_fock -> write Hartree_fock.(of_rst, write) s
| Electrons -> write Electrons.(of_rst, write) s | Electrons -> write Electrons.(of_rst, write) s
@ -189,9 +189,9 @@ let run check_only ezfio_filename =
Ao_basis; Ao_basis;
Electrons ; Electrons ;
Determinants ; Determinants ;
Integrals_bielec ;
Pseudo ;
Perturbation ; Perturbation ;
Pseudo ;
Integrals_bielec ;
Properties ; Properties ;
Hartree_fock ; Hartree_fock ;
Mo_basis; Mo_basis;

View File

@ -35,7 +35,26 @@ let mo () =
|> print_endline |> 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 () = let () =
basis (); basis ();
mo () mo ();
psi_det ();

View File

@ -17,7 +17,7 @@ ezfio.set_file(ezfio_path)
do_pseudo = ezfio.get_pseudo_do_pseudo() do_pseudo = ezfio.get_pseudo_do_pseudo()
if do_pseudo: if do_pseudo:
print "do_pseudo True" 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: else:
print "do_pseudo False" print "do_pseudo False"
@ -68,11 +68,7 @@ print "nucl_num", len(l_label)
print "Atomic coord in Bohr" print "Atomic coord in Bohr"
for i, t in enumerate(zip(l_label, l_charge, l_coord_str)): for i, t in enumerate(zip(l_label, l_charge, l_coord_str)):
try: print list_to_string(t)
l = (t[0], t[1] + zcore[i], t[2])
except NameError:
l = t
print list_to_string(l)
# #
# Call externet process to get the sysmetry # Call externet process to get the sysmetry
@ -83,7 +79,8 @@ process = subprocess.Popen(
stdout=subprocess.PIPE) stdout=subprocess.PIPE)
out, err = process.communicate() 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 _ (_ _ _|_ # |_) _. _ o _ (_ _ _|_
@ -175,6 +172,9 @@ def get_nb_permutation(str_):
def order_l_l_sym(l_l_sym): def order_l_l_sym(l_l_sym):
l_order_mo = [i for i,_ in enumerate(l_l_sym)]
n = 1 n = 1
for i in range(len(l_l_sym)): for i in range(len(l_l_sym)):
if n != 1: if n != 1:
@ -184,11 +184,11 @@ def order_l_l_sym(l_l_sym):
l = l_l_sym[i] l = l_l_sym[i]
n = get_nb_permutation(l[2]) n = get_nb_permutation(l[2])
l_l_sym[i:i + n] = sorted(l_l_sym[i:i + n], 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[2], key=lambda x: x[0][2],
cmp=compare_gamess_style) 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_sym_without_header = sym_raw.split("\n")[3:-2]
l_l_sym_raw = [i.split() for i in l_sym_without_header] 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_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 #MO COEF
@ -305,8 +310,8 @@ if do_pseudo:
if l_dump: if l_dump:
l_str.append(l_dump) l_str.append(l_dump)
str_ = "PARAMETERS FOR {0} ON ATOM {1} WITH ZCORE {2} AND LMAX {3} ARE" str_ = "PARAMETERS FOR {0} ON ATOM {1} WITH ZCORE -1 AND LMAX {2} ARE"
print str_.format(a, i + 1, int(zcore[i]), int(len(l_str) - 1)) print str_.format(a, i + 1, int(len(l_str) - 1))
for i, l in enumerate(l_str): for i, l in enumerate(l_str):
str_ = "FOR L= {0} COEFF N ZETA" str_ = "FOR L= {0} COEFF N ZETA"
@ -314,8 +319,7 @@ if do_pseudo:
for ii, ll in enumerate(l): for ii, ll in enumerate(l):
print " ", ii + 1, ll print " ", ii + 1, ll
str_ = "THE ECP RUN REMOVES {0} CORE ELECTRONS, AND THE SAME NUMBER OF PROTONS." str_ = "THE ECP RUN REMOVES -1 CORE ELECTRONS, AND THE SAME NUMBER OF PROTONS."
print str_.format(sum(zcore))
print "END_PSEUDO" print "END_PSEUDO"
# _ # _
@ -329,31 +333,29 @@ print "mo_num", mo_num
print "det_num", n_det print "det_num", n_det
print "" 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 = "" token = "Determinants ::"
for i,int_det in enumerate(l_det_bit_alpha): pos = det_raw.rfind(token) + len(token)
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 d_rep={"+":"1","-":"0"}
bin_det = "" det_without_header = det_raw[pos+2::]
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 for line_raw in det_without_header.split("\n"):
print "" 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" print "END_DET"

View File

@ -38,6 +38,7 @@ from qp_path import QP_ROOT, QP_SRC, QP_EZFIO
LIB = "" # join(QP_ROOT, "lib", "rdtsc.o") LIB = "" # join(QP_ROOT, "lib", "rdtsc.o")
EZFIO_LIB = join(QP_ROOT, "lib", "libezfio_irp.a") 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" 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") ROOT_BUILD_NINJA = join(QP_ROOT, "config", "build.ninja")
header = r"""# header = r"""#
@ -96,7 +97,8 @@ def ninja_create_env_variable(pwd_config_file):
l_string.append(str_) l_string.append(str_)
lib_lapack = get_compilation_option(pwd_config_file, "LAPACK_LIB") 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("") l_string.append("")
@ -387,6 +389,8 @@ def get_l_file_for_module(path_module):
l_src.append(f) l_src.append(f)
obj = '{0}.o'.format(os.path.splitext(f)[0]) obj = '{0}.o'.format(os.path.splitext(f)[0])
l_obj.append(obj) l_obj.append(obj)
elif f.lower().endswith(".o"):
l_obj.append(join(path_module.abs, f))
elif f == "EZFIO.cfg": elif f == "EZFIO.cfg":
l_depend.append(join(path_module.abs, "ezfio_interface.irp.f")) l_depend.append(join(path_module.abs, "ezfio_interface.irp.f"))

View File

@ -54,6 +54,13 @@ END_PROVIDER
ao_coef_normalized(i,j) = ao_coef_normalized(i,j) * ao_coef_normalization_factor(i) ao_coef_normalized(i,j) = ao_coef_normalized(i,j) * ao_coef_normalization_factor(i)
enddo enddo
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 END_PROVIDER
BEGIN_PROVIDER [ double precision, ao_coef_normalized_ordered, (ao_num_align,ao_prim_num_max) ] 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,1) = ao_expo(i,j)
d(j,2) = ao_coef_normalized(i,j) d(j,2) = ao_coef_normalized(i,j)
enddo enddo
call dsort(d(1,1),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)) ! call dset_order(d(1,2),iorder,ao_prim_num(i))
do j=1,ao_prim_num(i) do j=1,ao_prim_num(i)
ao_expo_ordered(i,j) = d(j,1) ao_expo_ordered(i,j) = d(j,1)
ao_coef_normalized_ordered(i,j) = d(j,2) ao_coef_normalized_ordered(i,j) = d(j,2)

View File

@ -4,6 +4,12 @@ double precision function ao_bielec_integral(i,j,k,l)
! integral of the AO basis <ik|jl> or (ij|kl) ! integral of the AO basis <ik|jl> or (ij|kl)
! i(r1) j(r1) 1/r12 k(r2) l(r2) ! i(r1) j(r1) 1/r12 k(r2) l(r2)
END_DOC 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,intent(in) :: i,j,k,l
integer :: p,q,r,s integer :: p,q,r,s
double precision :: I_center(3),J_center(3),K_center(3),L_center(3) 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) subroutine compute_ao_bielec_integrals(j,k,l,sze,buffer_value)
implicit none implicit none
use map_module use map_module
use libint_module
BEGIN_DOC BEGIN_DOC
! Compute AO 1/r12 integrals for all i and fixed j,k,l ! Compute AO 1/r12 integrals for all i and fixed j,k,l
END_DOC 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' include 'Utils/constants.include.F'
integer, intent(in) :: j,k,l,sze integer, intent(in) :: j,k,l,sze
real(integral_kind), intent(out) :: buffer_value(sze) real(integral_kind), intent(out) :: buffer_value(sze)