10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-07-03 18:05:59 +02: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
If you have problems upgrading to the current version, 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.
If you have problems upgrading to the current version, first try
`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
d_dependency = {
"ocaml": ["m4", "curl", "zlib", "patch", "gcc", "zeromq"],
"ocaml": ["m4", "curl", "zlib", "patch", "gcc", "zeromq", "gmp"],
"m4": ["make"],
"curl": ["make"],
"zlib": ["gcc", "make"],
@ -67,7 +67,8 @@ d_dependency = {
"ninja": ["g++", "python"],
"make": [],
"p_graphviz": ["python"],
"bats": []
"bats": [],
"gmp" : ["make", "g++"]
}
from collections import namedtuple
@ -136,6 +137,11 @@ zeromq = Info(
description=' ZeroMQ',
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(
url='{head}/zeromq/f77_zmq/{tail}'.format(**path_github),
description=' F77-ZeroMQ',
@ -155,7 +161,7 @@ d_info = dict()
for m in ["ocaml", "m4", "curl", "zlib", "patch", "irpf90", "docopt",
"resultsFile", "ninja", "emsl", "ezfio", "p_graphviz",
"zeromq", "f77zmq", "bats"]:
"zeromq", "f77zmq", "bats", "gmp"]:
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 IRPF90={0}'.format(path_irpf90.replace(QP_ROOT,"${QP_ROOT}")),
'export NINJA={0}'.format(path_ninja.replace(QP_ROOT,"${QP_ROOT}")),
'function qp_append_export () {',
' #Append path $2:${!1}. Add the semicolon only if ${!1} is defined',
'function qp_prepend_export () {',
' #Prepend path $2:${!1}. Add the semicolon only if ${!1} is defined',
' 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 PATH=$(qp_append_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 LIBRARY_PATH=$(qp_append_export "LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)',
'export C_INCLUDE_PATH=$(qp_append_export "C_INCLUDE_PATH" "${QP_ROOT}"/include)',
'export PYTHONPATH=$(qp_prepend_export "PYTHONPATH" "${QP_EZFIO}/Python":"${QP_PYTHON}")',
'export PATH=$(qp_prepend_export "PATH" "${QP_PYTHON}":"${QP_ROOT}"/bin:"${QP_ROOT}"/ocaml)',
'export LD_LIBRARY_PATH=$(qp_prepend_export "LD_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_prepend_export "C_INCLUDE_PATH" "${QP_ROOT}"/include)',
'',
'if [[ $SHELL == "bash" ]] ; then',
' source ${QP_ROOT}/install/EZFIO/Bash/ezfio.sh',

View File

@ -5,11 +5,12 @@ QP_ROOT=$PWD
cd -
# 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
export C_INCLUDE_PATH="${QP_ROOT}"/include:"${C_INCLUDE_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}"
# return 0 if program version is equal or greater than check version
@ -64,7 +65,7 @@ fi
cd Downloads || 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

View File

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

View File

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

View File

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

View File

@ -95,7 +95,7 @@ let spec =
let command =
Command.basic
Command.basic_spec
~summary: "Quantum Package command"
~readme:(fun () ->
"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 =
Command.basic
Command.basic_spec
~summary: "Quantum Package command"
~readme:(fun () ->
"

View File

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

View File

@ -323,7 +323,7 @@ let spec =
let command =
Command.basic
Command.basic_spec
~summary: "Quantum Package command"
~readme:(fun () ->
"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 k=1,mo_tot_num
do j=l,mo_tot_num
do i=k,mo_tot_num
!if (i>=j) then
double precision :: get_mo_bielec_integral
integral = get_mo_bielec_integral(i,j,k,l,mo_integrals_map)
if (dabs(integral) > mo_integrals_threshold) then
write (iunit,'(4(I6,X),F20.15)') i,j,k,l, integral
endif
!end if
do i=max(j,k),mo_tot_num
double precision :: get_mo_bielec_integral
integral = get_mo_bielec_integral(i,j,k,l,mo_integrals_map)
if (dabs(integral) > mo_integrals_threshold) then
write (iunit,'(4(I6,X),E25.15)') i,j,k,l, integral
endif
enddo
enddo
enddo

View File

@ -5,8 +5,44 @@ program read_integrals
! - nuclear_mo
! - bielec_mo
END_DOC
integer :: iunit
integer :: getunitandopen
integer :: i,j,n
PROVIDE ezfio_filename
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
end
@ -69,9 +105,10 @@ subroutine run
13 continue
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_unique(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")

View File

@ -256,7 +256,7 @@ let spec =
let command =
Command.basic
Command.basic_spec
~summary: "Quantum Package command"
~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"