diff --git a/configure b/configure index 29c99d24..8376940d 100755 --- a/configure +++ b/configure @@ -63,6 +63,8 @@ d_dependency = { "emsl": ["python"], "gcc": [], "g++": [], + "zeromq" : [ "g++" ], + "f77zmq" : [ "zeromq", "python" ], "python": [], "ninja": ["g++", "python"], "make": [], @@ -121,8 +123,7 @@ ninja = Info( default_path=join(QP_ROOT_BIN, "ninja")) emsl = Info( - url='{head}/LCPQ/EMSL_Basis_Set_Exchange_Local/{tail}'.format(** - path_github), + url='{head}/LCPQ/EMSL_Basis_Set_Exchange_Local/{tail}'.format(**path_github), description=' EMSL basis set library', default_path=join(QP_ROOT_INSTALL, "emsl")) @@ -131,6 +132,16 @@ ezfio = Info( description=' EZFIO', default_path=join(QP_ROOT_INSTALL, "EZFIO")) +zeromq = Info( + url='http://download.zeromq.org/zeromq-4.1.3.tar.gz', + description=' ZeroMQ', + default_path=join(QP_ROOT_INSTALL, "zeromq")) + +f77zmq = Info( + url='{head}/zeromq/f77zmq/{tail}'.format(**path_github), + description=' F77-ZeroMQ', + default_path=join(QP_ROOT_INSTALL, "f77zmq")) + p_graphviz = Info( url='https://github.com/xflr6/graphviz/archive/master.tar.gz', description=' Python library for graphviz', @@ -139,7 +150,8 @@ p_graphviz = Info( d_info = dict() for m in ["ocaml", "m4", "curl", "zlib", "path", "irpf90", "docopt", - "resultsFile", "ninja", "emsl", "ezfio", "p_graphviz"]: + "resultsFile", "ninja", "emsl", "ezfio", "p_graphviz", + "zeromq", "f77zmq" ]: exec ("d_info['{0}']={0}".format(m)) @@ -190,8 +202,7 @@ def check_output(*popenargs, **kwargs): def checking(d_dependency): """ - For each key in d_dependency check if it - is avalabie or not + For each key in d_dependency check if it is avalabie """ def check_python(): @@ -261,7 +272,7 @@ def checking(d_dependency): l_installed = dict() l_needed = [] - # Check all the other + # Check all the others length = max(map(len, d_dependency)) for i in d_dependency.keys(): @@ -276,7 +287,7 @@ def checking(d_dependency): l_needed.append(i) print "" - # Expend the need_stuff for all the genealogy + # Expand the needed stuff for all the genealogy l_install_descendant = get_list_descendant(d_dependency, l_installed, l_needed) @@ -329,7 +340,7 @@ _|_ | | _> |_ (_| | | (_| |_ | (_) | | d_print = { "install_ninja": "Install ninja...", "build": "Creating build.ninja...", - "install": "Installing the dependencies with Ninja..." + "install": "Installing the dependencies using Ninja..." } length = max(map(len, d_print.values())) @@ -373,7 +384,7 @@ _|_ | | _> |_ (_| | | (_| |_ | (_) | | descr = d_info[need].description default_path = d_info[need].default_path - # Build to dowload + # Build to download l_build += ["build {0}: download".format(archive_path), " url = {0}".format(url), " descr = {0}".format(descr), ""] @@ -527,3 +538,4 @@ if __name__ == '__main__': create_ninja_and_rc(l_installed) recommendation() + diff --git a/install/scripts/install_f77zmq.sh b/install/scripts/install_f77zmq.sh new file mode 100755 index 00000000..afbd03ca --- /dev/null +++ b/install/scripts/install_f77zmq.sh @@ -0,0 +1,19 @@ +#!/bin/bash -x + +TARGET=f77zmq + +function _install() +{ + set -e + set -u + export C_INCLUDE_PATH="${C_INCLUDE_PATH}":"${QP_ROOT}"/lib + export ZMQ_H=$PWD/zmq.h + cd "${BUILD}" + make -j 8 + mv libf77zmq.a "${QP_ROOT}"/lib + mv libf77zmq.so "${QP_ROOT}"/lib + cd - + return 0 +} + +source scripts/build.sh diff --git a/install/scripts/install_zeromq.sh b/install/scripts/install_zeromq.sh new file mode 100755 index 00000000..0e36d46c --- /dev/null +++ b/install/scripts/install_zeromq.sh @@ -0,0 +1,23 @@ +#!/bin/bash -x + +TARGET=zeromq + +function _install() +{ + export C_INCLUDE_PATH="${C_INCLUDE_PATH}":./ + set -e + set -u + cd "${BUILD}" + ./configure --without-libsodium || exit 1 + make -j 8 || exit 1 + rm -f -- ../lib/libzmq.a ../lib/libzmq.so ../lib/libzmq.so.5 + cp .libs/libzmq.a "${QP_ROOT}"/lib + cp .libs/libzmq.so "${QP_ROOT}"/lib/libzmq.so.5 + cp include/{zmq.h,zmq_utils.h} "${QP_ROOT}"/lib + cd "${QP_ROOT}"/lib + ln -s libzmq.so.5 libzmq.so + cd - + return 0 +} + +source scripts/build.sh diff --git a/plugins/CAS_SD/H_apply.irp.f b/plugins/CAS_SD/H_apply.irp.f index e2f939fe..35c45fb6 100644 --- a/plugins/CAS_SD/H_apply.irp.f +++ b/plugins/CAS_SD/H_apply.irp.f @@ -5,7 +5,6 @@ from generate_h_apply import * s = H_apply("CAS_SD") print s - s = H_apply("CAS_SD_selected_no_skip") s.set_selection_pt2("epstein_nesbet_2x2") s.unset_skip() @@ -19,5 +18,22 @@ s = H_apply("CAS_SD_PT2") s.set_perturbation("epstein_nesbet_2x2") print s + +s = H_apply("CAS_S",do_double_exc=False) +print s + +s = H_apply("CAS_S_selected_no_skip",do_double_exc=False) +s.set_selection_pt2("epstein_nesbet_2x2") +s.unset_skip() +print s + +s = H_apply("CAS_S_selected",do_double_exc=False) +s.set_selection_pt2("epstein_nesbet_2x2") +print s + +s = H_apply("CAS_S_PT2",do_double_exc=False) +s.set_perturbation("epstein_nesbet_2x2") +print s + END_SHELL diff --git a/plugins/CAS_SD/cas_s.irp.f b/plugins/CAS_SD/cas_s.irp.f new file mode 100644 index 00000000..e0c4a663 --- /dev/null +++ b/plugins/CAS_SD/cas_s.irp.f @@ -0,0 +1,95 @@ +program full_ci + implicit none + integer :: i,k + integer :: N_det_old + + + double precision, allocatable :: pt2(:), norm_pert(:), H_pert_diag(:) + integer :: N_st, degree + N_st = N_states + allocate (pt2(N_st), norm_pert(N_st),H_pert_diag(N_st)) + character*(64) :: perturbation + PROVIDE N_det_cas + + N_det_old = 0 + pt2 = 1.d0 + diag_algorithm = "Lapack" + if (N_det > N_det_max) then + call diagonalize_CI + call save_wavefunction + psi_det = psi_det_sorted + psi_coef = psi_coef_sorted + N_det = N_det_max + soft_touch N_det psi_det psi_coef + call diagonalize_CI + call save_wavefunction + print *, 'N_det = ', N_det + print *, 'N_states = ', N_states + print *, 'PT2 = ', pt2 + print *, 'E = ', CI_energy + print *, 'E+PT2 = ', CI_energy+pt2 + print *, '-----' + endif + + do while (N_det < N_det_max.and.maxval(abs(pt2(1:N_st))) > pt2_max) + N_det_old = N_det + call H_apply_CAS_S(pt2, norm_pert, H_pert_diag, N_st) + + PROVIDE psi_coef + PROVIDE psi_det + PROVIDE psi_det_sorted + + if (N_det > N_det_max) then + psi_det = psi_det_sorted + psi_coef = psi_coef_sorted + N_det = N_det_max + soft_touch N_det psi_det psi_coef + endif + call diagonalize_CI + call save_wavefunction + print *, 'N_det = ', N_det + print *, 'N_states = ', N_states + print *, 'PT2 = ', pt2 + print *, 'E = ', CI_energy + print *, 'E+PT2 = ', CI_energy+pt2 + print *, '-----' + call ezfio_set_cas_sd_energy(CI_energy(1)) + if (abort_all) then + exit + endif + if (N_det == N_det_old) then + exit + endif + enddo + call diagonalize_CI + + if(do_pt2_end)then + print*,'Last iteration only to compute the PT2' + threshold_selectors = 1.d0 + threshold_generators = 0.999d0 + call H_apply_CAS_S_PT2(pt2, norm_pert, H_pert_diag, N_st) + + print *, 'Final step' + print *, 'N_det = ', N_det + print *, 'N_states = ', N_states + print *, 'PT2 = ', pt2 + print *, 'E = ', CI_energy + print *, 'E+PT2 = ', CI_energy+pt2 + print *, '-----' + call ezfio_set_cas_sd_energy_pt2(CI_energy(1)+pt2(1)) + endif + + + integer :: exc_max, degree_min + exc_max = 0 + print *, 'CAS determinants : ', N_det_cas + do i=1,min(N_det_cas,10) + do k=i,N_det_cas + call get_excitation_degree(psi_cas(1,1,k),psi_cas(1,1,i),degree,N_int) + exc_max = max(exc_max,degree) + enddo + call debug_det(psi_cas(1,1,i),N_int) + print *, '' + enddo + print *, 'Max excitation degree in the CAS :', exc_max +end diff --git a/plugins/CAS_SD/cas_s_selected.irp.f b/plugins/CAS_SD/cas_s_selected.irp.f new file mode 100644 index 00000000..7a72a243 --- /dev/null +++ b/plugins/CAS_SD/cas_s_selected.irp.f @@ -0,0 +1,89 @@ +program full_ci + implicit none + integer :: i,k + + + double precision, allocatable :: pt2(:), norm_pert(:), H_pert_diag(:) + integer :: N_st, degree + N_st = N_states + allocate (pt2(N_st), norm_pert(N_st),H_pert_diag(N_st)) + character*(64) :: perturbation + PROVIDE N_det_cas + + pt2 = 1.d0 + diag_algorithm = "Lapack" + if (N_det > N_det_max) then + call diagonalize_CI + call save_wavefunction + psi_det = psi_det_sorted + psi_coef = psi_coef_sorted + N_det = N_det_max + soft_touch N_det psi_det psi_coef + call diagonalize_CI + call save_wavefunction + print *, 'N_det = ', N_det + print *, 'N_states = ', N_states + print *, 'PT2 = ', pt2 + print *, 'E = ', CI_energy + print *, 'E+PT2 = ', CI_energy+pt2 + print *, '-----' + endif + + do while (N_det < N_det_max.and.maxval(abs(pt2(1:N_st))) > pt2_max) + call H_apply_CAS_S_selected(pt2, norm_pert, H_pert_diag, N_st) + + PROVIDE psi_coef + PROVIDE psi_det + PROVIDE psi_det_sorted + + if (N_det > N_det_max) then + psi_det = psi_det_sorted + psi_coef = psi_coef_sorted + N_det = N_det_max + soft_touch N_det psi_det psi_coef + endif + call diagonalize_CI + call save_wavefunction + print *, 'N_det = ', N_det + print *, 'N_states = ', N_states + print *, 'PT2 = ', pt2 + print *, 'E = ', CI_energy + print *, 'E+PT2 = ', CI_energy+pt2 + print *, '-----' + call ezfio_set_cas_sd_energy(CI_energy(1)) + if (abort_all) then + exit + endif + enddo + call diagonalize_CI + + if(do_pt2_end)then + print*,'Last iteration only to compute the PT2' + threshold_selectors = 1.d0 + threshold_generators = 0.999d0 + call H_apply_CAS_S_PT2(pt2, norm_pert, H_pert_diag, N_st) + + print *, 'Final step' + print *, 'N_det = ', N_det + print *, 'N_states = ', N_states + print *, 'PT2 = ', pt2 + print *, 'E = ', CI_energy + print *, 'E+PT2 = ', CI_energy+pt2 + print *, '-----' + call ezfio_set_cas_sd_energy_pt2(CI_energy(1)+pt2(1)) + endif + + + integer :: exc_max, degree_min + exc_max = 0 + print *, 'CAS determinants : ', N_det_cas + do i=1,min(N_det_cas,10) + do k=i,N_det_cas + call get_excitation_degree(psi_cas(1,1,k),psi_cas(1,1,i),degree,N_int) + exc_max = max(exc_max,degree) + enddo + call debug_det(psi_cas(1,1,i),N_int) + print *, '' + enddo + print *, 'Max excitation degree in the CAS :', exc_max +end