10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-25 13:53:49 +01:00

Merge branch 'master' of github.com:scemama/quantum_package

This commit is contained in:
Anthony Scemama 2018-02-05 14:47:31 +01:00
commit eeaad3a3b5
20 changed files with 101 additions and 168 deletions

View File

@ -1,7 +1,9 @@
## IMPORTANT ## IMPORTANT
If you have problems upgrading to the current version, consider re-installing everything from scratch including the OCaml compiler. If you have problems upgrading to the current version, first try
To do this, you will have to remove the `quantum_package` directory **and** the `$HOME/.opam` directory as well. `qp_upgrade_ocaml.sh`. If it fails, then consider re-installing everything from
scratch including the OCaml compiler. To do this, you will have to remove the
`quantum_package` directory **and** the `$HOME/.opam` directory as well.

28
configure vendored
View File

@ -49,7 +49,7 @@ QP_ROOT_INSTALL = join(QP_ROOT, "install")
os.environ["PATH"] = os.environ["PATH"] + ":" + QP_ROOT_BIN os.environ["PATH"] = os.environ["PATH"] + ":" + QP_ROOT_BIN
d_dependency = { d_dependency = {
"ocaml": ["m4", "curl", "zlib", "patch", "gcc", "zeromq"], "ocaml": ["m4", "curl", "zlib", "patch", "gcc", "zeromq", "gmp"],
"m4": ["make"], "m4": ["make"],
"curl": ["make"], "curl": ["make"],
"zlib": ["gcc", "make"], "zlib": ["gcc", "make"],
@ -67,7 +67,8 @@ d_dependency = {
"ninja": ["g++", "python"], "ninja": ["g++", "python"],
"make": [], "make": [],
"p_graphviz": ["python"], "p_graphviz": ["python"],
"bats": [] "bats": [],
"gmp" : ["make", "g++"]
} }
from collections import namedtuple from collections import namedtuple
@ -136,6 +137,11 @@ zeromq = Info(
description=' ZeroMQ', description=' ZeroMQ',
default_path=join(QP_ROOT_LIB, "libzmq.a")) default_path=join(QP_ROOT_LIB, "libzmq.a"))
gmp= Info(
url='https://gmplib.org/download/gmp/gmp-6.1.2.tar.bz2',
description=' The GNU Multiple Precision Arithmetic Library',
default_path=join(QP_ROOT_LIB, "libgmp.a"))
f77zmq = Info( f77zmq = Info(
url='{head}/zeromq/f77_zmq/{tail}'.format(**path_github), url='{head}/zeromq/f77_zmq/{tail}'.format(**path_github),
description=' F77-ZeroMQ', description=' F77-ZeroMQ',
@ -155,7 +161,7 @@ d_info = dict()
for m in ["ocaml", "m4", "curl", "zlib", "patch", "irpf90", "docopt", for m in ["ocaml", "m4", "curl", "zlib", "patch", "irpf90", "docopt",
"resultsFile", "ninja", "emsl", "ezfio", "p_graphviz", "resultsFile", "ninja", "emsl", "ezfio", "p_graphviz",
"zeromq", "f77zmq", "bats"]: "zeromq", "f77zmq", "bats", "gmp"]:
exec ("d_info['{0}']={0}".format(m)) exec ("d_info['{0}']={0}".format(m))
@ -480,16 +486,16 @@ def create_ninja_and_rc(l_installed):
'export QP_PYTHON={0}'.format(":".join(l_python)), "", 'export QP_PYTHON={0}'.format(":".join(l_python)), "",
'export IRPF90={0}'.format(path_irpf90.replace(QP_ROOT,"${QP_ROOT}")), 'export IRPF90={0}'.format(path_irpf90.replace(QP_ROOT,"${QP_ROOT}")),
'export NINJA={0}'.format(path_ninja.replace(QP_ROOT,"${QP_ROOT}")), 'export NINJA={0}'.format(path_ninja.replace(QP_ROOT,"${QP_ROOT}")),
'function qp_append_export () {', 'function qp_prepend_export () {',
' #Append path $2:${!1}. Add the semicolon only if ${!1} is defined', ' #Prepend path $2:${!1}. Add the semicolon only if ${!1} is defined',
' eval "value_1=\"\${$1}\""', ' eval "value_1=\"\${$1}\""',
' echo ${2}${value_1:+:${value_1}}', ' echo ${value_1:+${value_1}:}${2}',
'}', '}',
'export PYTHONPATH=$(qp_append_export "PYTHONPATH" "${QP_EZFIO}/Python":"${QP_PYTHON}")', 'export PYTHONPATH=$(qp_prepend_export "PYTHONPATH" "${QP_EZFIO}/Python":"${QP_PYTHON}")',
'export PATH=$(qp_append_export "PATH" "${QP_PYTHON}":"${QP_ROOT}"/bin:"${QP_ROOT}"/ocaml)', 'export PATH=$(qp_prepend_export "PATH" "${QP_PYTHON}":"${QP_ROOT}"/bin:"${QP_ROOT}"/ocaml)',
'export LD_LIBRARY_PATH=$(qp_append_export "LD_LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)', 'export LD_LIBRARY_PATH=$(qp_prepend_export "LD_LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)',
'export LIBRARY_PATH=$(qp_append_export "LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)', 'export LIBRARY_PATH=$(qp_prepend_export "LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)',
'export C_INCLUDE_PATH=$(qp_append_export "C_INCLUDE_PATH" "${QP_ROOT}"/include)', 'export C_INCLUDE_PATH=$(qp_prepend_export "C_INCLUDE_PATH" "${QP_ROOT}"/include)',
'', '',
'if [[ $SHELL == "bash" ]] ; then', 'if [[ $SHELL == "bash" ]] ; then',
' source ${QP_ROOT}/install/EZFIO/Bash/ezfio.sh', ' source ${QP_ROOT}/install/EZFIO/Bash/ezfio.sh',

View File

@ -5,11 +5,12 @@ QP_ROOT=$PWD
cd - cd -
# Normal installation # Normal installation
PACKAGES="core.v0.9.1 cryptokit.1.10 ocamlfind sexplib.v0.9.1 ZMQ ppx_sexp_conv ppx_deriving" PACKAGES="core.v0.10.0 cryptokit ocamlfind sexplib.v0.10.0 ZMQ ppx_sexp_conv ppx_deriving"
# Needed for ZeroMQ # Needed for ZeroMQ
export C_INCLUDE_PATH="${QP_ROOT}"/include:"${C_INCLUDE_PATH}" export C_INCLUDE_PATH="${QP_ROOT}"/include:"${C_INCLUDE_PATH}"
export LIBRARY_PATH="${QP_ROOT}"/lib:"${LIBRARY_PATH}" export LIBRARY_PATH="${QP_ROOT}"/lib:"${LIBRARY_PATH}"
export LDFLAGS="-L$QP_ROOT/lib"
export LD_LIBRARY_PATH="${QP_ROOT}"/lib:"${LD_LIBRARY_PATH}" export LD_LIBRARY_PATH="${QP_ROOT}"/lib:"${LD_LIBRARY_PATH}"
# return 0 if program version is equal or greater than check version # return 0 if program version is equal or greater than check version
@ -64,7 +65,7 @@ fi
cd Downloads || exit 1 cd Downloads || exit 1
chmod +x ocaml.sh || exit 1 chmod +x ocaml.sh || exit 1
echo N | ./ocaml.sh ${QP_ROOT}/bin/ 4.04.2 || exit 1 echo N | ./ocaml.sh ${QP_ROOT}/bin/ 4.06.0 || exit 1
${QP_ROOT}/bin/opam config setup -a -q || exit 1 ${QP_ROOT}/bin/opam config setup -a -q || exit 1

View File

@ -1,6 +1,7 @@
open Core open Core
open Qptypes open Qptypes
module StringHashtbl = Hashtbl.Make(String)
type pub_state = type pub_state =
| Waiting | Waiting
@ -28,7 +29,7 @@ type t =
progress_bar : Progress_bar.t option ; progress_bar : Progress_bar.t option ;
running : bool; running : bool;
accepting_clients : bool; accepting_clients : bool;
data : (string, string) Hashtbl.t; data : string StringHashtbl.t;
} }
@ -208,7 +209,7 @@ let end_job msg program_state rep_socket pair_socket =
address_inproc = None; address_inproc = None;
running = true; running = true;
accepting_clients = false; accepting_clients = false;
data = Hashtbl.create ~hashable:String.hashable (); data = StringHashtbl.create ();
} }
and wait n = and wait n =
@ -592,7 +593,7 @@ let put_data msg rest_of_msg program_state rep_socket =
in in
let success () = let success () =
Hashtbl.set program_state.data ~key ~data:value ; StringHashtbl.set program_state.data ~key ~data:value ;
Message.PutDataReply (Message.PutDataReply_msg.create ()) Message.PutDataReply (Message.PutDataReply_msg.create ())
|> Message.to_string |> Message.to_string
|> ZMQ.Socket.send rep_socket; |> ZMQ.Socket.send rep_socket;
@ -622,7 +623,7 @@ let get_data msg program_state rep_socket =
let success () = let success () =
let value = let value =
match Hashtbl.find program_state.data key with match StringHashtbl.find program_state.data key with
| Some value -> value | Some value -> value
| None -> "" | None -> ""
in in
@ -776,7 +777,7 @@ let run ~port =
address_inproc = None; address_inproc = None;
progress_bar = None ; progress_bar = None ;
accepting_clients = false; accepting_clients = false;
data = Hashtbl.create ~hashable:String.hashable (); data = StringHashtbl.create ();
} }
in in

View File

@ -665,7 +665,7 @@ let run ?o b au c d m p cart xyz_file =
let command = let command =
Command.basic Command.basic_spec
~summary: "Quantum Package command" ~summary: "Quantum Package command"
~readme:(fun () -> " ~readme:(fun () -> "

View File

@ -128,7 +128,7 @@ let spec =
+> anon ("ezfio_file" %: string) +> anon ("ezfio_file" %: string)
let () = let () =
Command.basic Command.basic_spec
~summary: "Quantum Package command" ~summary: "Quantum Package command"
~readme:( fun () -> " ~readme:( fun () -> "
Creates an open-shell multiplet initial guess\n\n" ) Creates an open-shell multiplet initial guess\n\n" )

View File

@ -95,7 +95,7 @@ let spec =
let command = let command =
Command.basic Command.basic_spec
~summary: "Quantum Package command" ~summary: "Quantum Package command"
~readme:(fun () -> ~readme:(fun () ->
"Find all the pi molecular orbitals to create a pi space. "Find all the pi molecular orbitals to create a pi space.

View File

@ -141,7 +141,7 @@ let run_o ~action ezfio_filename =
;; ;;
let command = let command =
Command.basic Command.basic_spec
~summary: "Quantum Package command" ~summary: "Quantum Package command"
~readme:(fun () -> ~readme:(fun () ->
" "

View File

@ -150,7 +150,7 @@ let spec =
let () = let () =
Command.basic Command.basic_spec
~summary: "Quantum Package command" ~summary: "Quantum Package command"
~readme:( fun () -> " ~readme:( fun () -> "
Executes a Quantum Package binary file among these:\n\n" Executes a Quantum Package binary file among these:\n\n"

View File

@ -323,7 +323,7 @@ let spec =
let command = let command =
Command.basic Command.basic_spec
~summary: "Quantum Package command" ~summary: "Quantum Package command"
~readme:(fun () -> ~readme:(fun () ->
"Set the orbital classes in an EZFIO directory "Set the orbital classes in an EZFIO directory

View File

@ -1 +0,0 @@
Determinants

View File

@ -1,14 +0,0 @@
=====
GASPI
=====
Providers for GASPI programs (with the GPI2 library).
Needed Modules
==============
.. Do not edit this section It was auto-generated
.. by the `update_README.py` script.
Documentation
=============
.. Do not edit this section It was auto-generated
.. by the `update_README.py` script.

View File

@ -1,13 +0,0 @@
program test
double precision :: energy(N_states)
if (is_gaspi_master) then
energy = 1.d0
else
energy = 0.d0
endif
call broadcast_wf(energy)
print *, 'energy (1.d0) :', GASPI_rank, energy(1)
print *, 'coef :', GASPI_rank, psi_coef(1,1)
print *, 'det :', GASPI_rank, psi_det (1,1,1)
call gaspi_finalize
end

View File

@ -1,76 +0,0 @@
BEGIN_PROVIDER [ logical, GASPI_is_initialized ]
&BEGIN_PROVIDER [ logical, has_gaspi ]
implicit none
BEGIN_DOC
! This is true when GASPI_Init has been called
END_DOC
has_gaspi = .False.
IRP_IF GASPI
use GASPI
integer(gaspi_return_t) :: res
res = gaspi_proc_init(GASPI_BLOCK)
if (res /= GASPI_SUCCESS) then
print *, res
print *, 'GASPI failed to initialize'
stop -1
endif
has_gaspi = .True.
IRP_ENDIF
GASPI_is_initialized = .True.
END_PROVIDER
BEGIN_PROVIDER [ integer, GASPI_rank ]
&BEGIN_PROVIDER [ integer, GASPI_size ]
&BEGIN_PROVIDER [ logical, is_GASPI_master ]
implicit none
BEGIN_DOC
! Usual GASPI variables
END_DOC
PROVIDE GASPI_is_initialized
IRP_IF GASPI
use GASPI
integer(gaspi_return_t) :: res
integer(gaspi_rank_t) :: n
res = gaspi_proc_num(n)
GASPI_size = n
if (res /= GASPI_SUCCESS) then
print *, res
print *, 'Unable to get GASPI_size'
stop -1
endif
res = gaspi_proc_rank(n)
GASPI_rank = n
if (res /= GASPI_SUCCESS) then
print *, res
print *, 'Unable to get GASPI_rank'
stop -1
endif
is_GASPI_master = (GASPI_rank == 0)
IRP_ELSE
GASPI_rank = 0
GASPI_size = 1
is_GASPI_master = .True.
IRP_ENDIF
END_PROVIDER
subroutine gaspi_finalize()
implicit none
PROVIDE GASPI_is_initialized
IRP_IF GASPI
use GASPI
integer(gaspi_return_t) :: res
res = gaspi_proc_term(GASPI_BLOCK)
if (res /= GASPI_SUCCESS) then
print *, res
print *, 'Unable to finalize GASPI'
stop -1
endif
IRP_ENDIF
end subroutine

View File

@ -1 +1 @@
Integrals_Monoelec Integrals_Bielec Integrals_Monoelec Integrals_Bielec Hartree_Fock

View File

@ -44,14 +44,12 @@ program print_integrals
do l=1,mo_tot_num do l=1,mo_tot_num
do k=1,mo_tot_num do k=1,mo_tot_num
do j=l,mo_tot_num do j=l,mo_tot_num
do i=k,mo_tot_num do i=max(j,k),mo_tot_num
!if (i>=j) then double precision :: get_mo_bielec_integral
double precision :: get_mo_bielec_integral integral = get_mo_bielec_integral(i,j,k,l,mo_integrals_map)
integral = get_mo_bielec_integral(i,j,k,l,mo_integrals_map) if (dabs(integral) > mo_integrals_threshold) then
if (dabs(integral) > mo_integrals_threshold) then write (iunit,'(4(I6,X),E25.15)') i,j,k,l, integral
write (iunit,'(4(I6,X),F20.15)') i,j,k,l, integral endif
endif
!end if
enddo enddo
enddo enddo
enddo enddo

View File

@ -5,8 +5,44 @@ program read_integrals
! - nuclear_mo ! - nuclear_mo
! - bielec_mo ! - bielec_mo
END_DOC END_DOC
integer :: iunit
integer :: getunitandopen
integer :: i,j,n
PROVIDE ezfio_filename PROVIDE ezfio_filename
call ezfio_set_integrals_monoelec_disk_access_mo_one_integrals("None") call ezfio_set_integrals_monoelec_disk_access_mo_one_integrals("None")
logical :: has
call ezfio_has_mo_basis_mo_tot_num(has)
if (.not.has) then
iunit = getunitandopen('nuclear_mo','r')
n=0
do
read (iunit,*,end=12) i
n = max(n,i)
enddo
12 continue
close(iunit)
call ezfio_set_mo_basis_mo_tot_num(n)
call ezfio_has_ao_basis_ao_num(has)
mo_label = "None"
if (has) then
call huckel_guess
else
call ezfio_set_ao_basis_ao_num(n)
double precision, allocatable :: X(:,:)
allocate (X(n,n))
X = 0.d0
do i=1,n
X(i,i) = 1.d0
enddo
call ezfio_set_mo_basis_mo_coef(X)
call save_mos
endif
endif
call run call run
end end
@ -69,9 +105,10 @@ subroutine run
13 continue 13 continue
close(iunit) close(iunit)
call insert_into_mo_integrals_map(n_integrals,buffer_i,buffer_values,0.d0) call map_append(mo_integrals_map, buffer_i, buffer_values, n_integrals)
call map_sort(mo_integrals_map) call map_sort(mo_integrals_map)
call map_unique(mo_integrals_map)
call map_save_to_disk(trim(ezfio_filename)//'/work/mo_ints',mo_integrals_map) call map_save_to_disk(trim(ezfio_filename)//'/work/mo_ints',mo_integrals_map)
call ezfio_set_integrals_bielec_disk_access_mo_integrals("Read") call ezfio_set_integrals_bielec_disk_access_mo_integrals("Read")

View File

@ -256,7 +256,7 @@ let spec =
let command = let command =
Command.basic Command.basic_spec
~summary: "Quantum Package command" ~summary: "Quantum Package command"
~readme:(fun () -> ~readme:(fun () ->
" "

View File

@ -1,27 +0,0 @@
#!/bin/bash
# Convert a old ezfio file (with option.irp.f ezfio_default)
# into a new EZFIO.cfg type
# Hartree Fock
# Changin the case, don't know if is needed or not
mv $1/Hartree_Fock $1/hartree_fock 2> /dev/null
mv $1/hartree_Fock/thresh_SCF $1/hartree_fock/thresh_scf 2> /dev/null
# BiInts
mv $1/bi_integrals $1/bielect_integrals 2> /dev/null
if [ -f $1/bielect_integrals/read_ao_integrals ]; then
if [ `cat $1/bielect_integrals/read_ao_integrals` -eq "True" ]
then
echo "Read" > $1/bielect_integrals/disk_access_ao_integrals
elif [ `cat bielect_integrals/write_ao_integrals` -eq "True" ]
then
echo "Write" > $1/bielect_integrals/disk_access_ao_integrals
else
echo "None" > $1/bielect_integrals/disk_access_ao_integrals
fi
fi

19
scripts/qp_upgrade_ocaml.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
OCAML_VERSION="4.06.0"
PACKAGES="core.v0.10.0 cryptokit ocamlfind sexplib.v0.10.0 ZMQ ppx_sexp_conv ppx_deriving"
if [[ -z ${QP_ROOT} ]]
then
print "The QP_ROOT environment variable is not set."
print "Please reload the quantum_package.rc file."
exit -1
fi
cd $QP_ROOT/ocaml
opam update
opam switch ${OCAML_VERSION}
eval `opam config env`
opam install -y ${PACKAGES} || echo "Upgrade failed. You can try running
configure ; $0"