10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-22 20:34:58 +01:00

print_energy.irp.f

This commit is contained in:
Anthony Scemama 2020-02-26 15:58:14 +01:00
parent 547fea1d58
commit 3cf55e2676
2 changed files with 56 additions and 22 deletions

44
configure vendored
View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash
#
# Quantum Package configuration script
#
@ -45,7 +45,7 @@ Usage:
Options:
-c, --config=<file> Define a COMPILATION configuration file,
in "${QP_ROOT}/config/".
in "${QP_ROOT}/config/".
-h, --help Print the HELP message
-i, --install=<package> INSTALL <package>. Use at your OWN RISK:
no support will be provided for the installation of
@ -73,7 +73,7 @@ function execute () {
while read -r line; do
echo " " $line
_command+="${line} ;"
done
done
sleep 1
echo ""
printf "\e[0;94m"
@ -87,7 +87,7 @@ OCAML_PACKAGES="ocamlbuild cryptokit zmq sexplib ppx_sexp_conv ppx_deriving geto
while true ; do
case "$1" in
-c|--config)
-c|--config)
case "$2" in
"") help ; break;;
*) if [[ -f $2 ]] ; then
@ -96,15 +96,15 @@ while true ; do
error "error: configuration file $2 not found."
exit 1
fi
esac
esac
shift 2;;
-i|--install)
case "$2" in
"") help ; break;;
*) PACKAGES="${PACKAGE} $2"
esac
esac
shift 2;;
-h|-help|--help)
-h|-help|--help)
help
exit 0;;
--) shift ; break ;;
@ -183,7 +183,7 @@ EZFIO=$(find_dir "${QP_ROOT}"/external/ezfio)
if [[ ${EZFIO} = $(not_found) ]] ; then
execute << EOF
cd "\${QP_ROOT}"/external
tar --gunzip --extract --file ${EZFIO_TGZ}
tar --gunzip --extract --file ${EZFIO_TGZ}
rm -rf ezfio
mv EZFIO ezfio
EOF
@ -237,7 +237,7 @@ EOF
./configure --prefix=$QP_ROOT && make -j 8
make install
EOF
elif [[ ${PACKAGE} = libcap ]] ; then
download ${LIBCAP_URL} "${QP_ROOT}"/external/libcap.tar.gz
@ -272,7 +272,7 @@ EOF
cd irpf90-*
make
EOF
elif [[ ${PACKAGE} = zeromq ]] ; then
@ -303,7 +303,7 @@ EOF
cp f77_zmq_free.h "\${QP_ROOT}"/include
EOF
elif [[ ${PACKAGE} = ocaml ]] ; then
download ${OCAML_URL} "${QP_ROOT}"/external/opam_installer.sh
@ -316,7 +316,7 @@ EOF
rm -rf ${HOME}/.opam
fi
export OPAMROOT=${HOME}/.opam
cat << EOF | bash ${QP_ROOT}/external/opam_installer.sh --no-backup
cat << EOF | bash ${QP_ROOT}/external/opam_installer.sh --no-backup
${QP_ROOT}/bin
@ -336,13 +336,13 @@ EOF
# Conventional commands
execute << EOF
chmod +x "${QP_ROOT}"/external/opam_installer.sh
"${QP_ROOT}"/external/opam_installer.sh --no-backup
"${QP_ROOT}"/external/opam_installer.sh --no-backup
EOF
execute << EOF
rm --force ${QP_ROOT}/bin/opam
export OPAMROOT=${OPAMROOT:-${QP_ROOT}/external/opam}
echo ${QP_ROOT}/bin \
| sh ${QP_ROOT}/external/opam_installer.sh
| sh ${QP_ROOT}/external/opam_installer.sh
EOF
rm ${QP_ROOT}/external/opam_installer.sh
# source ${OPAMROOT}/opam-init/init.sh > /dev/null 2> /dev/null || true
@ -355,7 +355,7 @@ EOF
EOF
fi
elif [[ ${PACKAGE} = bse ]] ; then
download ${BSE_URL} "${QP_ROOT}"/external/bse.tar.gz
@ -376,13 +376,13 @@ EOF
make && make install
EOF
elif [[ ${PACKAGE} = docopt ]] ; then
download ${DOCOPT_URL} "${QP_ROOT}"/external/docopt.tar.gz
execute << EOF
cd "\${QP_ROOT}"/external
tar --gunzip --extract --file docopt.tar.gz
tar --gunzip --extract --file docopt.tar.gz
mv docopt-*/docopt.py "\${QP_ROOT}/external/Python"
rm --recursive --force -- docopt-*/ docopt.tar.gz
EOF
@ -393,7 +393,7 @@ EOF
download ${RESULTS_URL} "${QP_ROOT}"/external/resultsFile.tar.gz
execute << EOF
cd "\${QP_ROOT}"/external
tar --gunzip --extract --file resultsFile.tar.gz
tar --gunzip --extract --file resultsFile.tar.gz
mv resultsFile-*/resultsFile "\${QP_ROOT}/external/Python/"
rm --recursive --force resultsFile-* resultsFile.tar.gz
EOF
@ -403,7 +403,7 @@ EOF
download ${BATS_URL} "${QP_ROOT}"/external/bats.tar.gz
execute << EOF
cd "\${QP_ROOT}"/external
tar -zxf bats.tar.gz
tar -zxf bats.tar.gz
( cd bats-core-1.1.0/ ; ./install.sh \${QP_ROOT})
rm --recursive --force -- bats-core-1.1.0 \ "\${QP_ROOT}"/external/bats.tar.gz
EOF
@ -515,15 +515,15 @@ fi
if [[ -f ${QP_ROOT}/build.ninja ]] ; then
[[ -z ${TRAVIS} ]] && echo "You can now run ./bin/qpsh to enter in the QP shell mode :)"
else
else
echo ""
echo "${QP_ROOT}/build.ninja does not exist,"
echo "you need to specify the COMPILATION configuration file."
echo "See ./configure --help for more details."
echo "See ./configure --help for more details."
echo ""
fi
exit 0

View File

@ -0,0 +1,34 @@
program print_wf
implicit none
BEGIN_DOC
! Prints the energy of the wave function stored in the |EZFIO| directory.
END_DOC
! this has to be done in order to be sure that N_det, psi_det and
! psi_coef_sorted are the wave function stored in the |EZFIO| directory.
read_wf = .True.
touch read_wf
call run
end
subroutine run
implicit none
integer :: i
double precision :: i_H_psi_array(N_states)
double precision :: E(N_states)
double precision :: norm(N_states)
E(:) = nuclear_repulsion
norm(:) = 0.d0
do i=1,N_det
call i_H_psi(psi_det(1,1,i), psi_det, psi_coef, N_int, N_det, &
size(psi_coef,1), N_states, i_H_psi_array)
norm(:) += psi_coef(i,:)**2
E(:) += i_H_psi_array(:) * psi_coef(i,:)
enddo
print *, 'Energy:'
do i=1,N_states
print *, E(i)/norm(i)
enddo
end