9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-07 05:53:37 +01:00

Merge branch 'dev-lcpq' of github.com:QuantumPackage/qp2 into dev-lcpq

This commit is contained in:
Anthony Scemama 2019-04-01 18:03:12 +02:00
commit 1db465d0f9
10 changed files with 271 additions and 54 deletions

View File

@ -3,7 +3,7 @@
"""
Usage:
qp_plugins list [-iuq]
qp_plugins download <url>
qp_plugins download <url> [-n <name>]
qp_plugins install <name>...
qp_plugins uninstall <name>
qp_plugins create -n <name> [-r <repo>] [<needed_modules>...]
@ -186,7 +186,10 @@ def main(arguments):
url.endswith(".zip"))
os.chdir(QP_PLUGINS)
if is_repo:
subprocess.check_call(["git", "clone", url])
git_cmd=["git", "clone", url]
if arguments["--name"]:
git_cmd.append(arguments["--name"])
subprocess.check_call(git_cmd)
else:
filename = url.split('/')[-1]

2
configure vendored
View File

@ -60,7 +60,7 @@ function execute () {
}
PACKAGES=""
OCAML_PACKAGES="ocamlbuild cryptokit zmq sexplib ppx_sexp_conv ppx_deriving getopt"
OCAML_PACKAGES="ocamlbuild cryptokit zmq sexplib.v0.11.0 ppx_sexp_conv ppx_deriving getopt"
while true ; do
case "$1" in

View File

@ -19,21 +19,23 @@ Programs}},
url = {https://arxiv.org/abs/1812.06902}
}
@article{Loos2019Jan,
%%%% PUBLISHED PAPERS
@article{Loos2019Mar,
author = {Loos, Pierre-Fran\c{c}ois and Boggio-Pasqua, Martial and Scemama, Anthony and Caffarel, Michel and Jacquemin, Denis},
title = {{Reference Energies for Double Excitations}},
journal = {J. Chem. Theory Comput.},
volume = {15},
number = {3},
pages = {1939--1956},
year = {2019},
month = {Jan},
month = {Mar},
issn = {1549-9618},
publisher = {American Chemical Society},
doi = {10.1021/acs.jctc.8b01205}
}
%%%% PUBLISHED PAPERS
@article{PinedaFlores2019Feb,
author = {Pineda Flores, Sergio and Neuscamman, Eric},
title = {{Excited State Specific Multi-Slater Jastrow Wave Functions}},

38
ocaml/.gitignore vendored
View File

@ -1,38 +0,0 @@
_build
element_create_db
element_create_db.byte
ezfio.ml
.gitignore
Git.ml
Input_ao_one_e_ints.ml
Input_ao_two_e_erf_ints.ml
Input_ao_two_e_ints.ml
Input_auto_generated.ml
Input_becke_numerical_grid.ml
Input_champ.ml
Input_davidson.ml
Input_density_for_dft.ml
Input_determinants.ml
Input_dft_keywords.ml
Input_dressing.ml
Input_mo_one_e_ints.ml
Input_mo_two_e_erf_ints.ml
Input_mo_two_e_ints.ml
Input_nuclei.ml
Input_perturbation.ml
Input_pseudo.ml
Input_scf_utils.ml
Input_variance.ml
qp_create_ezfio
qp_create_ezfio.native
qp_edit
qp_edit.ml
qp_edit.native
qp_print_basis
qp_print_basis.native
qp_run
qp_run.native
qp_set_mo_class
qp_set_mo_class.native
qptypes_generator.byte
Qptypes.ml

View File

@ -195,6 +195,20 @@ BEGIN_PROVIDER [double precision, weight_at_r, (n_points_integration_angular,n_p
enddo
accu = 1.d0/accu
weight_at_r(l,k,j) = tmp_array(j) * accu
if(isnan(weight_at_r(l,k,j)))then
print*,'isnan(weight_at_r(l,k,j))'
print*,l,k,j
accu = 0.d0
do i = 1, nucl_num
! function defined for each atom "i" by equation (13) and (21) with k == 3
tmp_array(i) = cell_function_becke(r,i) ! P_n(r)
print*,i,tmp_array(i)
! Then you compute the summ the P_n(r) function for each of the "r" points
accu += tmp_array(i)
enddo
write(*,'(100(F16.10,X))')tmp_array(j) , accu
stop
endif
enddo
enddo
enddo
@ -221,6 +235,12 @@ BEGIN_PROVIDER [double precision, final_weight_at_r, (n_points_integration_angul
contrib_integration = derivative_knowles_function(alpha_knowles(int(nucl_charge(j))),m_knowles,x)&
*knowles_function(alpha_knowles(int(nucl_charge(j))),m_knowles,x)**2
final_weight_at_r(k,i,j) = weights_angular_points(k) * weight_at_r(k,i,j) * contrib_integration * dr_radial_integral
if(isnan(final_weight_at_r(k,i,j)))then
print*,'isnan(final_weight_at_r(k,i,j))'
print*,k,i,j
write(*,'(100(F16.10,X))')weights_angular_points(k) , weight_at_r(k,i,j) , contrib_integration , dr_radial_integral
stop
endif
enddo
enddo
enddo

View File

@ -31,6 +31,10 @@ double precision function cell_function_becke(r,atom_number)
double precision :: mu_ij,nu_ij
double precision :: distance_i,distance_j,step_function_becke
integer :: j
if(int(nucl_charge(atom_number))==0)then
cell_function_becke = 0.d0
return
endif
distance_i = (r(1) - nucl_coord_transp(1,atom_number) ) * (r(1) - nucl_coord_transp(1,atom_number))
distance_i += (r(2) - nucl_coord_transp(2,atom_number) ) * (r(2) - nucl_coord_transp(2,atom_number))
distance_i += (r(3) - nucl_coord_transp(3,atom_number) ) * (r(3) - nucl_coord_transp(3,atom_number))
@ -38,6 +42,7 @@ double precision function cell_function_becke(r,atom_number)
cell_function_becke = 1.d0
do j = 1, nucl_num
if(j==atom_number)cycle
if(int(nucl_charge(j))==0)cycle
distance_j = (r(1) - nucl_coord_transp(1,j) ) * (r(1) - nucl_coord_transp(1,j))
distance_j+= (r(2) - nucl_coord_transp(2,j) ) * (r(2) - nucl_coord_transp(2,j))
distance_j+= (r(3) - nucl_coord_transp(3,j) ) * (r(3) - nucl_coord_transp(3,j))

View File

@ -16,3 +16,10 @@ doc: Type of density
doc: if [no_core_dm] then all elements of the density matrix involving at least one orbital set as core are set to zero
interface: ezfio, provider, ocaml
default: full_density
[normalize_dm]
type: logical
doc: Type of density
doc: if .True., then you normalize the no_core_dm to elec_alpha_num - n_core_orb and elec_beta_num - n_core_orb
interface: ezfio, provider, ocaml
default: True

View File

@ -21,13 +21,28 @@ BEGIN_PROVIDER [double precision, one_e_dm_mo_alpha_for_dft, (mo_num,mo_num, N_s
endif
if(no_core_density .EQ. "no_core_dm")then
integer :: i,j
do i = 1, n_core_orb
integer :: ii,i,j
do ii = 1, n_core_orb
i = list_core(ii)
do j = 1, mo_num
one_e_dm_mo_alpha_for_dft(j,i,:) = 0.d0
one_e_dm_mo_alpha_for_dft(i,j,:) = 0.d0
enddo
enddo
if(normalize_dm)then
double precision :: elec_alpha_frozen_num, elec_alpha_valence(N_states)
elec_alpha_frozen_num = elec_alpha_num - n_core_orb
elec_alpha_valence = 0.d0
integer :: istate
do istate = 1, N_states
do i = 1, mo_num
elec_alpha_valence(istate) += one_e_dm_mo_alpha_for_dft(i,i,istate)
enddo
elec_alpha_valence(istate) = elec_alpha_frozen_num/elec_alpha_valence(istate)
one_e_dm_mo_alpha_for_dft(:,:,istate) = one_e_dm_mo_alpha_for_dft(:,:,istate) * elec_alpha_valence(istate)
enddo
endif
endif
END_PROVIDER
@ -55,13 +70,27 @@ BEGIN_PROVIDER [double precision, one_e_dm_mo_beta_for_dft, (mo_num,mo_num, N_st
endif
if(no_core_density .EQ. "no_core_dm")then
integer :: i,j
do i = 1, n_core_orb
integer :: ii,i,j
do ii = 1, n_core_orb
i = list_core(ii)
do j = 1, mo_num
one_e_dm_mo_beta_for_dft(j,i,:) = 0.d0
one_e_dm_mo_beta_for_dft(i,j,:) = 0.d0
enddo
enddo
if(normalize_dm)then
double precision :: elec_beta_valence(N_states),elec_beta_frozen_num
elec_beta_frozen_num = elec_beta_num - n_core_orb
elec_beta_valence = 0.d0
integer :: istate
do istate = 1, N_states
do i = 1, mo_num
elec_beta_valence(istate) += one_e_dm_mo_beta_for_dft(i,i,istate)
enddo
elec_beta_valence(istate) = elec_beta_frozen_num/elec_beta_valence(istate)
one_e_dm_mo_beta_for_dft(:,:,istate) = one_e_dm_mo_beta_for_dft(:,:,istate) * elec_beta_valence(istate)
enddo
endif
endif
END_PROVIDER
@ -119,3 +148,65 @@ END_PROVIDER
one_body_dm_mo_beta_one_det(i,i, 1:N_states) = 1.d0
enddo
END_PROVIDER
BEGIN_PROVIDER [double precision, one_e_dm_mo_alpha_for_dft_no_core, (mo_num,mo_num, N_states)]
implicit none
BEGIN_DOC
! density matrix for alpha electrons in the MO basis without the core orbitals
END_DOC
one_e_dm_mo_alpha_for_dft_no_core = one_e_dm_mo_alpha_for_dft
integer :: ii,i,j
do ii = 1, n_core_orb
i = list_core(ii)
do j = 1, mo_num
one_e_dm_mo_alpha_for_dft_no_core(j,i,:) = 0.d0
one_e_dm_mo_alpha_for_dft_no_core(i,j,:) = 0.d0
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [double precision, one_e_dm_mo_beta_for_dft_no_core, (mo_num,mo_num, N_states)]
implicit none
BEGIN_DOC
! density matrix for beta electrons in the MO basis without the core orbitals
END_DOC
one_e_dm_mo_beta_for_dft_no_core = one_e_dm_mo_beta_for_dft
integer :: ii,i,j
do ii = 1, n_core_orb
i = list_core(ii)
do j = 1, mo_num
one_e_dm_mo_beta_for_dft_no_core(j,i,:) = 0.d0
one_e_dm_mo_beta_for_dft_no_core(i,j,:) = 0.d0
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [ double precision, one_e_dm_alpha_ao_for_dft_no_core, (ao_num,ao_num,N_states) ]
&BEGIN_PROVIDER [ double precision, one_e_dm_beta_ao_for_dft_no_core, (ao_num,ao_num,N_states) ]
BEGIN_DOC
! one body density matrix on the AO basis based on one_e_dm_mo_alpha_for_dft_no_core
END_DOC
implicit none
integer :: istate
double precision :: mo_alpha,mo_beta
one_e_dm_alpha_ao_for_dft_no_core = 0.d0
one_e_dm_beta_ao_for_dft_no_core = 0.d0
do istate = 1, N_states
call mo_to_ao_no_overlap( one_e_dm_mo_alpha_for_dft_no_core(1,1,istate), &
size(one_e_dm_mo_alpha_for_dft_no_core,1), &
one_e_dm_alpha_ao_for_dft_no_core(1,1,istate), &
size(one_e_dm_alpha_ao_for_dft_no_core,1) )
call mo_to_ao_no_overlap( one_e_dm_mo_beta_for_dft_no_core(1,1,istate), &
size(one_e_dm_mo_beta_for_dft_no_core,1), &
one_e_dm_beta_ao_for_dft_no_core(1,1,istate), &
size(one_e_dm_beta_ao_for_dft_no_core,1) )
enddo
END_PROVIDER

View File

@ -109,6 +109,90 @@ end
grad_dm_b *= 2.d0
end
subroutine dm_dft_alpha_beta_no_core_at_r(r,dm_a,dm_b)
implicit none
BEGIN_DOC
! input: r(1) ==> r(1) = x, r(2) = y, r(3) = z
! output : dm_a = alpha density evaluated at r(3) without the core orbitals
! output : dm_b = beta density evaluated at r(3) without the core orbitals
END_DOC
double precision, intent(in) :: r(3)
double precision, intent(out) :: dm_a(N_states),dm_b(N_states)
integer :: istate
double precision :: aos_array(ao_num),aos_array_bis(ao_num),u_dot_v
call give_all_aos_at_r(r,aos_array)
do istate = 1, N_states
aos_array_bis = aos_array
! alpha density
call dgemv('N',ao_num,ao_num,1.d0,one_e_dm_alpha_ao_for_dft_no_core(1,1,istate),ao_num,aos_array,1,0.d0,aos_array_bis,1)
dm_a(istate) = u_dot_v(aos_array,aos_array_bis,ao_num)
! beta density
aos_array_bis = aos_array
call dgemv('N',ao_num,ao_num,1.d0,one_e_dm_beta_ao_for_dft_no_core(1,1,istate),ao_num,aos_array,1,0.d0,aos_array_bis,1)
dm_b(istate) = u_dot_v(aos_array,aos_array_bis,ao_num)
enddo
end
subroutine dens_grad_a_b_no_core_and_aos_grad_aos_at_r(r,dm_a,dm_b, grad_dm_a, grad_dm_b, aos_array, grad_aos_array)
implicit none
BEGIN_DOC
! input:
!
! * r(1) ==> r(1) = x, r(2) = y, r(3) = z
!
! output:
!
! * dm_a = alpha density evaluated at r without the core orbitals
! * dm_b = beta density evaluated at r without the core orbitals
! * aos_array(i) = ao(i) evaluated at r without the core orbitals
! * grad_dm_a(1) = X gradient of the alpha density evaluated in r without the core orbitals
! * grad_dm_a(1) = X gradient of the beta density evaluated in r without the core orbitals
! * grad_aos_array(1) = X gradient of the aos(i) evaluated at r
!
END_DOC
double precision, intent(in) :: r(3)
double precision, intent(out) :: dm_a(N_states),dm_b(N_states)
double precision, intent(out) :: grad_dm_a(3,N_states),grad_dm_b(3,N_states)
double precision, intent(out) :: grad_aos_array(3,ao_num)
integer :: i,j,istate
double precision :: aos_array(ao_num),aos_array_bis(ao_num),u_dot_v
double precision :: aos_grad_array(ao_num,3), aos_grad_array_bis(ao_num,3)
call give_all_aos_and_grad_at_r(r,aos_array,grad_aos_array)
do i = 1, ao_num
do j = 1, 3
aos_grad_array(i,j) = grad_aos_array(j,i)
enddo
enddo
do istate = 1, N_states
! alpha density
! aos_array_bis = \rho_ao * aos_array
call dsymv('U',ao_num,1.d0,one_e_dm_alpha_ao_for_dft_no_core(1,1,istate),size(one_e_dm_alpha_ao_for_dft_no_core,1),aos_array,1,0.d0,aos_array_bis,1)
dm_a(istate) = u_dot_v(aos_array,aos_array_bis,ao_num)
! grad_dm(1) = \sum_i aos_grad_array(i,1) * aos_array_bis(i)
grad_dm_a(1,istate) = u_dot_v(aos_grad_array(1,1),aos_array_bis,ao_num)
grad_dm_a(2,istate) = u_dot_v(aos_grad_array(1,2),aos_array_bis,ao_num)
grad_dm_a(3,istate) = u_dot_v(aos_grad_array(1,3),aos_array_bis,ao_num)
! aos_grad_array_bis = \rho_ao * aos_grad_array
! beta density
call dsymv('U',ao_num,1.d0,one_e_dm_beta_ao_for_dft_no_core(1,1,istate),size(one_e_dm_beta_ao_for_dft_no_core,1),aos_array,1,0.d0,aos_array_bis,1)
dm_b(istate) = u_dot_v(aos_array,aos_array_bis,ao_num)
! grad_dm(1) = \sum_i aos_grad_array(i,1) * aos_array_bis(i)
grad_dm_b(1,istate) = u_dot_v(aos_grad_array(1,1),aos_array_bis,ao_num)
grad_dm_b(2,istate) = u_dot_v(aos_grad_array(1,2),aos_array_bis,ao_num)
grad_dm_b(3,istate) = u_dot_v(aos_grad_array(1,3),aos_array_bis,ao_num)
! aos_grad_array_bis = \rho_ao * aos_grad_array
enddo
grad_dm_a *= 2.d0
grad_dm_b *= 2.d0
end
BEGIN_PROVIDER [double precision, one_e_dm_alpha_in_r, (n_points_integration_angular,n_points_radial_grid,nucl_num,N_states) ]
&BEGIN_PROVIDER [double precision, one_e_dm_beta_in_r, (n_points_integration_angular,n_points_radial_grid,nucl_num,N_states) ]
implicit none
@ -143,6 +227,8 @@ END_PROVIDER
BEGIN_PROVIDER [double precision, one_e_dm_alpha_at_r, (n_points_final_grid,N_states) ]
&BEGIN_PROVIDER [double precision, one_e_dm_beta_at_r, (n_points_final_grid,N_states) ]
&BEGIN_PROVIDER [double precision, elec_beta_num_grid_becke , (N_states) ]
&BEGIN_PROVIDER [double precision, elec_alpha_num_grid_becke , (N_states) ]
implicit none
BEGIN_DOC
! one_e_dm_alpha_at_r(i,istate) = n_alpha(r_i,istate)
@ -209,3 +295,44 @@ END_PROVIDER
enddo
END_PROVIDER
BEGIN_PROVIDER [double precision, one_e_dm_no_core_and_grad_alpha_in_r, (4,n_points_final_grid,N_states) ]
&BEGIN_PROVIDER [double precision, one_e_dm_no_core_and_grad_beta_in_r, (4,n_points_final_grid,N_states) ]
BEGIN_DOC
! one_e_dm_no_core_and_grad_alpha_in_r(1,i,i_state) = d\dx n_alpha(r_i,istate) without core orbitals
! one_e_dm_no_core_and_grad_alpha_in_r(2,i,i_state) = d\dy n_alpha(r_i,istate) without core orbitals
! one_e_dm_no_core_and_grad_alpha_in_r(3,i,i_state) = d\dz n_alpha(r_i,istate) without core orbitals
! one_e_dm_no_core_and_grad_alpha_in_r(4,i,i_state) = n_alpha(r_i,istate) without core orbitals
! where r_i is the ith point of the grid and istate is the state number
END_DOC
implicit none
integer :: i,j,k,l,m,istate
double precision :: contrib
double precision :: r(3)
double precision, allocatable :: aos_array(:),grad_aos_array(:,:)
double precision, allocatable :: dm_a(:),dm_b(:), dm_a_grad(:,:), dm_b_grad(:,:)
allocate(dm_a(N_states),dm_b(N_states), dm_a_grad(3,N_states), dm_b_grad(3,N_states))
allocate(aos_array(ao_num),grad_aos_array(3,ao_num))
do istate = 1, N_states
do i = 1, n_points_final_grid
r(1) = final_grid_points(1,i)
r(2) = final_grid_points(2,i)
r(3) = final_grid_points(3,i)
!!!! Works also with the ao basis
call dens_grad_a_b_no_core_and_aos_grad_aos_at_r(r,dm_a,dm_b, dm_a_grad, dm_b_grad, aos_array, grad_aos_array)
one_e_dm_no_core_and_grad_alpha_in_r(1,i,istate) = dm_a_grad(1,istate)
one_e_dm_no_core_and_grad_alpha_in_r(2,i,istate) = dm_a_grad(2,istate)
one_e_dm_no_core_and_grad_alpha_in_r(3,i,istate) = dm_a_grad(3,istate)
one_e_dm_no_core_and_grad_alpha_in_r(4,i,istate) = dm_a(istate)
one_e_dm_no_core_and_grad_beta_in_r(1,i,istate) = dm_b_grad(1,istate)
one_e_dm_no_core_and_grad_beta_in_r(2,i,istate) = dm_b_grad(2,istate)
one_e_dm_no_core_and_grad_beta_in_r(3,i,istate) = dm_b_grad(3,istate)
one_e_dm_no_core_and_grad_beta_in_r(4,i,istate) = dm_b(istate)
enddo
enddo
END_PROVIDER

View File

@ -1,4 +1,4 @@
BEGIN_PROVIDER [ double precision, slater_bragg_radii, (100)]
BEGIN_PROVIDER [ double precision, slater_bragg_radii, (0:100)]
implicit none
BEGIN_DOC
! atomic radii in Angstrom defined in table I of JCP 41, 3199 (1964) Slater
@ -54,10 +54,10 @@ BEGIN_PROVIDER [ double precision, slater_bragg_radii, (100)]
END_PROVIDER
BEGIN_PROVIDER [double precision, slater_bragg_radii_ua, (100)]
BEGIN_PROVIDER [double precision, slater_bragg_radii_ua, (0:100)]
implicit none
integer :: i
do i = 1, 100
do i = 0, 100
slater_bragg_radii_ua(i) = slater_bragg_radii(i) * 1.889725989d0
enddo
END_PROVIDER