10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-07-03 01:45:59 +02:00

Added CAS+S

This commit is contained in:
Anthony Scemama 2015-11-25 11:49:42 +01:00
parent aaa780358e
commit 8ca2815964
6 changed files with 264 additions and 10 deletions

30
configure vendored
View File

@ -63,6 +63,8 @@ d_dependency = {
"emsl": ["python"], "emsl": ["python"],
"gcc": [], "gcc": [],
"g++": [], "g++": [],
"zeromq" : [ "g++" ],
"f77zmq" : [ "zeromq", "python" ],
"python": [], "python": [],
"ninja": ["g++", "python"], "ninja": ["g++", "python"],
"make": [], "make": [],
@ -121,8 +123,7 @@ ninja = Info(
default_path=join(QP_ROOT_BIN, "ninja")) default_path=join(QP_ROOT_BIN, "ninja"))
emsl = Info( emsl = Info(
url='{head}/LCPQ/EMSL_Basis_Set_Exchange_Local/{tail}'.format(** url='{head}/LCPQ/EMSL_Basis_Set_Exchange_Local/{tail}'.format(**path_github),
path_github),
description=' EMSL basis set library', description=' EMSL basis set library',
default_path=join(QP_ROOT_INSTALL, "emsl")) default_path=join(QP_ROOT_INSTALL, "emsl"))
@ -131,6 +132,16 @@ ezfio = Info(
description=' EZFIO', description=' EZFIO',
default_path=join(QP_ROOT_INSTALL, "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( p_graphviz = Info(
url='https://github.com/xflr6/graphviz/archive/master.tar.gz', url='https://github.com/xflr6/graphviz/archive/master.tar.gz',
description=' Python library for graphviz', description=' Python library for graphviz',
@ -139,7 +150,8 @@ p_graphviz = Info(
d_info = dict() d_info = dict()
for m in ["ocaml", "m4", "curl", "zlib", "path", "irpf90", "docopt", 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)) exec ("d_info['{0}']={0}".format(m))
@ -190,8 +202,7 @@ def check_output(*popenargs, **kwargs):
def checking(d_dependency): def checking(d_dependency):
""" """
For each key in d_dependency check if it For each key in d_dependency check if it is avalabie
is avalabie or not
""" """
def check_python(): def check_python():
@ -261,7 +272,7 @@ def checking(d_dependency):
l_installed = dict() l_installed = dict()
l_needed = [] l_needed = []
# Check all the other # Check all the others
length = max(map(len, d_dependency)) length = max(map(len, d_dependency))
for i in d_dependency.keys(): for i in d_dependency.keys():
@ -276,7 +287,7 @@ def checking(d_dependency):
l_needed.append(i) l_needed.append(i)
print "" 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_install_descendant = get_list_descendant(d_dependency, l_installed,
l_needed) l_needed)
@ -329,7 +340,7 @@ _|_ | | _> |_ (_| | | (_| |_ | (_) | |
d_print = { d_print = {
"install_ninja": "Install ninja...", "install_ninja": "Install ninja...",
"build": "Creating build.ninja...", "build": "Creating build.ninja...",
"install": "Installing the dependencies with Ninja..." "install": "Installing the dependencies using Ninja..."
} }
length = max(map(len, d_print.values())) length = max(map(len, d_print.values()))
@ -373,7 +384,7 @@ _|_ | | _> |_ (_| | | (_| |_ | (_) | |
descr = d_info[need].description descr = d_info[need].description
default_path = d_info[need].default_path default_path = d_info[need].default_path
# Build to dowload # Build to download
l_build += ["build {0}: download".format(archive_path), l_build += ["build {0}: download".format(archive_path),
" url = {0}".format(url), " descr = {0}".format(descr), " url = {0}".format(url), " descr = {0}".format(descr),
""] ""]
@ -527,3 +538,4 @@ if __name__ == '__main__':
create_ninja_and_rc(l_installed) create_ninja_and_rc(l_installed)
recommendation() recommendation()

View File

@ -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

View File

@ -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

View File

@ -5,7 +5,6 @@ from generate_h_apply import *
s = H_apply("CAS_SD") s = H_apply("CAS_SD")
print s print s
s = H_apply("CAS_SD_selected_no_skip") s = H_apply("CAS_SD_selected_no_skip")
s.set_selection_pt2("epstein_nesbet_2x2") s.set_selection_pt2("epstein_nesbet_2x2")
s.unset_skip() s.unset_skip()
@ -19,5 +18,22 @@ s = H_apply("CAS_SD_PT2")
s.set_perturbation("epstein_nesbet_2x2") s.set_perturbation("epstein_nesbet_2x2")
print s 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 END_SHELL

View File

@ -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

View File

@ -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