10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-23 04:43:45 +01:00

Merge pull request #209 from QuantumPackage/dev

Dev
This commit is contained in:
Anthony Scemama 2022-09-29 14:35:01 +02:00 committed by GitHub
commit 2a99a0709a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 207 additions and 130 deletions

View File

@ -35,6 +35,12 @@ https://arxiv.org/abs/1902.08154
* [Download the latest release](http://github.com/QuantumPackage/qp2/releases)
* [Read the documentation](https://quantum-package.readthedocs.io)
# Discussion list
For any questions or announcements regarding QuantumPackage, you can join our discussion list by registering [here](https://groupes.renater.fr/sympa/subscribe/quantum_package) or by sending an email to `quantum_package-request@groupes.renater.fr` .
You can also look over its [archives](https://groupes.renater.fr/sympa/arc/quantum_package).
# Build status
* Master [![master build status](https://travis-ci.com/QuantumPackage/qp2.svg?branch=master)](https://travis-ci.org/QuantumPackage/qp2)

View File

@ -11,8 +11,8 @@ Usage:
Options:
-q --query Prints in the standard output the number of frozen MOs
-l --large Use a small core
-s --small Use a large core
-l --large Use a large core
-s --small Use a small core
-u --unset Unset frozen core

8
configure vendored
View File

@ -180,7 +180,7 @@ if [[ "${PACKAGES}.x" != ".x" ]] ; then
fi
if [[ ${PACKAGES} = all ]] ; then
PACKAGES="zlib ninja zeromq f77zmq gmp ocaml docopt resultsFile bats"
PACKAGES="zlib ninja zeromq f77zmq gmp ocaml docopt resultsFile bats bse"
fi
@ -354,12 +354,6 @@ echo " ||----w | "
echo " || || "
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo ""
echo "If you have PIP, you can install the Basis Set Exchange command-line tool:"
echo ""
echo " ./configure -i bse"
echo ""
echo "This will enable the usage of qp_basis to install extra basis sets."
echo ""
echo ""
printf "\e[m\n"

View File

@ -555,7 +555,7 @@ g 1 1.00
g 1 1.00
1 0.457496 1.000000
MAGNESIUM
MAGNESIUM
s 9 1.00
1 0.030975 0.165290
2 0.062959 0.506272

View File

@ -36,13 +36,13 @@ interface: ezfio, provider
type: double precision
doc: Primitive coefficients, read from input. Those should not be used directly, as the MOs are expressed on the basis of **normalized** AOs.
size: (ao_basis.ao_num,ao_basis.ao_prim_num_max)
interface: ezfio, provider
interface: ezfio
[ao_expo]
type: double precision
doc: Exponents for each primitive of each |AO|
size: (ao_basis.ao_num,ao_basis.ao_prim_num_max)
interface: ezfio, provider
interface: ezfio
[ao_md5]
type: character*(32)
@ -67,3 +67,4 @@ doc: Use normalized primitive functions
interface: ezfio, provider
default: true

View File

@ -1,11 +1,3 @@
BEGIN_PROVIDER [ integer, ao_prim_num_max ]
implicit none
BEGIN_DOC
! Max number of primitives.
END_DOC
ao_prim_num_max = maxval(ao_prim_num)
END_PROVIDER
BEGIN_PROVIDER [ integer, ao_shell, (ao_num) ]
implicit none
BEGIN_DOC
@ -23,6 +15,32 @@ BEGIN_PROVIDER [ integer, ao_shell, (ao_num) ]
END_PROVIDER
BEGIN_PROVIDER [ double precision, ao_coef , (ao_num,ao_prim_num_max) ]
&BEGIN_PROVIDER [ double precision, ao_expo , (ao_num,ao_prim_num_max) ]
implicit none
BEGIN_DOC
! Primitive coefficients and exponents for each atomic orbital. Copied from shell info.
END_DOC
integer :: i, l
do i=1,ao_num
l = ao_shell(i)
ao_coef(i,:) = shell_coef(l,:)
ao_expo(i,:) = shell_expo(l,:)
end do
END_PROVIDER
BEGIN_PROVIDER [ integer, ao_prim_num_max ]
implicit none
BEGIN_DOC
! Max number of primitives.
END_DOC
ao_prim_num_max = shell_prim_num_max
END_PROVIDER
BEGIN_PROVIDER [ integer, ao_first_of_shell, (shell_num) ]
implicit none
BEGIN_DOC
@ -44,20 +62,20 @@ END_PROVIDER
BEGIN_DOC
! Coefficients including the |AO| normalization
END_DOC
do i=1,ao_num
l = ao_shell(i)
ao_coef_normalized(i,:) = shell_coef(l,:) * shell_normalization_factor(l)
end do
double precision :: norm,overlap_x,overlap_y,overlap_z,C_A(3), c
integer :: l, powA(3), nz
integer :: i,j,k
nz=100
C_A(1) = 0.d0
C_A(2) = 0.d0
C_A(3) = 0.d0
ao_coef_normalized = 0.d0
C_A = 0.d0
do i=1,ao_num
! powA(1) = ao_power(i,1) + ao_power(i,2) + ao_power(i,3)
! powA(2) = 0
! powA(3) = 0
powA(1) = ao_power(i,1)
powA(2) = ao_power(i,2)
powA(3) = ao_power(i,3)
@ -67,18 +85,9 @@ END_PROVIDER
do j=1,ao_prim_num(i)
call overlap_gaussian_xyz(C_A,C_A,ao_expo(i,j),ao_expo(i,j), &
powA,powA,overlap_x,overlap_y,overlap_z,norm,nz)
ao_coef_normalized(i,j) = ao_coef(i,j)/dsqrt(norm)
enddo
else
do j=1,ao_prim_num(i)
ao_coef_normalized(i,j) = ao_coef(i,j)
ao_coef_normalized(i,j) = ao_coef_normalized(i,j)/dsqrt(norm)
enddo
endif
powA(1) = ao_power(i,1)
powA(2) = ao_power(i,2)
powA(3) = ao_power(i,3)
! Normalization of the contracted basis functions
if (ao_normalized) then
norm = 0.d0

View File

@ -72,4 +72,3 @@ doc: Exponents in the shell
size: (basis.prim_num)
interface: ezfio, provider

View File

@ -1,67 +1,11 @@
BEGIN_PROVIDER [ double precision, shell_normalization_factor , (shell_num) ]
implicit none
BEGIN_DOC
! Number of primitives per |AO|
END_DOC
logical :: has
PROVIDE ezfio_filename
if (mpi_master) then
if (size(shell_normalization_factor) == 0) return
call ezfio_has_basis_shell_normalization_factor(has)
if (has) then
write(6,'(A)') '.. >>>>> [ IO READ: shell_normalization_factor ] <<<<< ..'
call ezfio_get_basis_shell_normalization_factor(shell_normalization_factor)
else
double precision :: norm,overlap_x,overlap_y,overlap_z,C_A(3), c
integer :: l, powA(3), nz
integer :: i,j,k
nz=100
C_A(1) = 0.d0
C_A(2) = 0.d0
C_A(3) = 0.d0
do i=1,shell_num
powA(1) = shell_ang_mom(i)
powA(2) = 0
powA(3) = 0
norm = 0.d0
do k=1, prim_num
if (shell_index(k) /= i) cycle
do j=1, prim_num
if (shell_index(j) /= i) cycle
call overlap_gaussian_xyz(C_A,C_A,prim_expo(j),prim_expo(k), &
powA,powA,overlap_x,overlap_y,overlap_z,c,nz)
norm = norm+c*prim_coef(j)*prim_coef(k) * prim_normalization_factor(j) * prim_normalization_factor(k)
enddo
enddo
shell_normalization_factor(i) = 1.d0/dsqrt(norm)
enddo
endif
endif
IRP_IF MPI_DEBUG
print *, irp_here, mpi_rank
call MPI_BARRIER(MPI_COMM_WORLD, ierr)
IRP_ENDIF
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( shell_normalization_factor, (shell_num), MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read shell_normalization_factor with MPI'
endif
IRP_ENDIF
call write_time(6)
BEGIN_PROVIDER [ integer, shell_prim_num_max ]
implicit none
BEGIN_DOC
! Max number of primitives.
END_DOC
shell_prim_num_max = maxval(shell_prim_num)
END_PROVIDER
BEGIN_PROVIDER [ double precision, prim_normalization_factor , (prim_num) ]
implicit none
BEGIN_DOC
@ -120,3 +64,94 @@ BEGIN_PROVIDER [ double precision, prim_normalization_factor , (prim_num) ]
call write_time(6)
END_PROVIDER
BEGIN_PROVIDER [ double precision, shell_coef , (shell_num, shell_prim_num_max) ]
&BEGIN_PROVIDER [ double precision, shell_expo , (shell_num, shell_prim_num_max) ]
implicit none
BEGIN_DOC
! Primitive coefficients and exponents for each shell.
END_DOC
integer :: i, idx
integer :: count(shell_num)
count(:) = 0
do i=1, prim_num
idx = shell_index(i)
count(idx) += 1
shell_coef(idx, count(idx)) = prim_coef(i)
shell_expo(idx, count(idx)) = prim_expo(i)
end do
END_PROVIDER
BEGIN_PROVIDER [ double precision, shell_coef_normalized, (shell_num,shell_prim_num_max) ]
&BEGIN_PROVIDER [ double precision, shell_normalization_factor, (shell_num) ]
implicit none
BEGIN_DOC
! Coefficients including the |shell| normalization
END_DOC
logical :: has
PROVIDE ezfio_filename
shell_normalization_factor(:) = 1.d0
if (mpi_master) then
if (size(shell_normalization_factor) == 0) return
call ezfio_has_basis_shell_normalization_factor(has)
if (has) then
write(6,'(A)') '.. >>>>> [ IO READ: shell_normalization_factor ] <<<<< ..'
call ezfio_get_basis_shell_normalization_factor(shell_normalization_factor)
endif
endif
IRP_IF MPI_DEBUG
print *, irp_here, mpi_rank
call MPI_BARRIER(MPI_COMM_WORLD, ierr)
IRP_ENDIF
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( shell_normalization_factor, (shell_num), MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read shell_normalization_factor with MPI'
endif
IRP_ENDIF
call write_time(6)
double precision :: norm,overlap_x,overlap_y,overlap_z,C_A(3), c
integer :: l, powA(3), nz
integer :: i,j,k
nz=100
C_A = 0.d0
powA = 0
shell_coef_normalized = 0.d0
do i=1,shell_num
powA(1) = shell_ang_mom(i)
! Normalization of the primitives
if (primitives_normalized) then
do j=1,shell_prim_num(i)
call overlap_gaussian_xyz(C_A,C_A,shell_expo(i,j),shell_expo(i,j), &
powA,powA,overlap_x,overlap_y,overlap_z,norm,nz)
shell_coef_normalized(i,j) = shell_coef(i,j)/dsqrt(norm)
enddo
else
do j=1,shell_prim_num(i)
shell_coef_normalized(i,j) = shell_coef(i,j)
enddo
endif
! Normalization of the contracted basis functions
norm = 0.d0
do j=1,shell_prim_num(i)
do k=1,shell_prim_num(i)
call overlap_gaussian_xyz(C_A,C_A,shell_expo(i,j),shell_expo(i,k),powA,powA,overlap_x,overlap_y,overlap_z,c,nz)
norm = norm+c*shell_coef_normalized(i,j)*shell_coef_normalized(i,k)
enddo
enddo
shell_normalization_factor(i) *= 1.d0/dsqrt(norm)
enddo
END_PROVIDER

View File

@ -4,7 +4,7 @@ source $QP_ROOT/tests/bats/common.bats.sh
source $QP_ROOT/quantum_package.rc
function run() {
thresh=1.e-5
thresh=2.e-5
test_exe cisd || skip
qp edit --check
qp set determinants n_states 2

View File

@ -1,4 +1,5 @@
subroutine davidson_diag_h_csf(dets_in,u_in,dim_in,energies,sze,sze_csf,N_st,N_st_diag,Nint,dressing_state,converged)
subroutine davidson_diag_h_csf(dets_in, u_in, dim_in, energies, sze, sze_csf, &
N_st, N_st_diag, Nint, dressing_state,converged)
use bitmasks
implicit none
BEGIN_DOC

View File

@ -68,13 +68,21 @@ END_PROVIDER
do_csf = s2_eig .and. only_expected_s2 .and. csf_based
if (diag_algorithm == "Davidson") then
if (diag_algorithm == 'Davidson') then
if (do_csf) then
if (sigma_vector_algorithm == 'det') then
call davidson_diag_H_csf(psi_det,CI_eigenvectors, &
size(CI_eigenvectors,1),CI_electronic_energy, &
N_det,N_csf,min(N_det,N_states),min(N_det,N_states_diag),N_int,0,converged)
! if (sigma_vector_algorithm == 'det') then
call davidson_diag_H_csf (psi_det, &
CI_eigenvectors, &
size(CI_eigenvectors,1), &
CI_electronic_energy, &
N_det, &
N_csf, &
min(N_csf,N_states), &
min(N_csf,N_states_diag), &
N_int, &
0, &
converged)
! else if (sigma_vector_algorithm == 'cfg') then
! call davidson_diag_H_csf(psi_det,CI_eigenvectors, &
! size(CI_eigenvectors,1),CI_electronic_energy, &
@ -82,11 +90,19 @@ END_PROVIDER
! else
! print *, irp_here
! stop 'bug'
endif
! endif
else
call davidson_diag_HS2(psi_det,CI_eigenvectors, CI_s2, &
size(CI_eigenvectors,1),CI_electronic_energy, &
N_det,min(N_det,N_states),min(N_det,N_states_diag),N_int,0,converged)
call davidson_diag_HS2(psi_det, &
CI_eigenvectors, &
CI_s2, &
size(CI_eigenvectors,1), &
CI_electronic_energy, &
N_det, &
min(N_det,N_states), &
min(N_det,N_states_diag), &
N_int, &
0, &
converged)
endif
integer :: N_states_diag_save
@ -107,9 +123,17 @@ END_PROVIDER
CI_electronic_energy_tmp(1:N_states_diag_save) = CI_electronic_energy(1:N_states_diag_save)
CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save) = CI_eigenvectors(1:N_det,1:N_states_diag_save)
call davidson_diag_H_csf(psi_det,CI_eigenvectors_tmp, &
size(CI_eigenvectors_tmp,1),CI_electronic_energy_tmp, &
N_det,N_csf,min(N_det,N_states),min(N_det,N_states_diag),N_int,0,converged)
call davidson_diag_H_csf (psi_det, &
CI_eigenvectors_tmp, &
size(CI_eigenvectors_tmp,1), &
CI_electronic_energy_tmp, &
N_det, &
N_csf, &
min(N_csf,N_states), &
min(N_csf,N_states_diag), &
N_int, &
0, &
converged)
CI_electronic_energy(1:N_states_diag_save) = CI_electronic_energy_tmp(1:N_states_diag_save)
CI_eigenvectors(1:N_det,1:N_states_diag_save) = CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save)
@ -127,9 +151,17 @@ END_PROVIDER
CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save) = CI_eigenvectors(1:N_det,1:N_states_diag_save)
CI_s2_tmp(1:N_states_diag_save) = CI_s2(1:N_states_diag_save)
call davidson_diag_HS2(psi_det,CI_eigenvectors_tmp, CI_s2_tmp, &
size(CI_eigenvectors_tmp,1),CI_electronic_energy_tmp, &
N_det,min(N_det,N_states),min(N_det,N_states_diag),N_int,0,converged)
call davidson_diag_HS2(psi_det, &
CI_eigenvectors_tmp, &
CI_s2_tmp, &
size(CI_eigenvectors_tmp,1), &
CI_electronic_energy_tmp, &
N_det, &
min(N_det,N_states), &
min(N_det,N_states_diag), &
N_int, &
0, &
converged)
CI_electronic_energy(1:N_states_diag_save) = CI_electronic_energy_tmp(1:N_states_diag_save)
CI_eigenvectors(1:N_det,1:N_states_diag_save) = CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save)

View File

@ -537,6 +537,7 @@ subroutine save_wavefunction_general(ndet,nstates,psidet,dim_psicoef,psicoef)
double precision, intent(in) :: psicoef(dim_psicoef,nstates)
integer*8, allocatable :: psi_det_save(:,:,:)
double precision, allocatable :: psi_coef_save(:,:)
double precision, allocatable :: psi_coef_save2(:,:)
double precision :: accu_norm
integer :: i,j,k, ndet_qp_edit
@ -572,18 +573,17 @@ subroutine save_wavefunction_general(ndet,nstates,psidet,dim_psicoef,psicoef)
enddo
call ezfio_set_determinants_psi_coef(psi_coef_save)
deallocate (psi_coef_save)
allocate (psi_coef_save(ndet_qp_edit,nstates))
allocate (psi_coef_save2(ndet_qp_edit,nstates))
do k=1,nstates
do i=1,ndet_qp_edit
psi_coef_save(i,k) = psicoef(i,k)
psi_coef_save2(i,k) = psi_coef_save(i,k)
enddo
call normalize(psi_coef_save(1,k),ndet_qp_edit)
enddo
call ezfio_set_determinants_psi_coef_qp_edit(psi_coef_save)
call ezfio_set_determinants_psi_coef_qp_edit(psi_coef_save2)
deallocate (psi_coef_save)
deallocate (psi_coef_save2)
call write_int(6,ndet,'Saved determinants')
endif

View File

@ -40,7 +40,14 @@ function run_stoch() {
run_stoch -49.14097596 0.0001 10000
}
@test "NH3" { # 0:00:11
@test "F2" { # 4.07m
[[ -n $TRAVIS ]] && skip
qp set_file f2.ezfio
qp set_frozen_core
run_stoch -199.307512211742 0.002 100000
}
@test "NH3" { # 10.6657s
qp set_file nh3.ezfio
qp set_mo_class --core="[1-4]" --act="[5-72]"
run -56.24474908 1.e-5 10000
@ -179,10 +186,3 @@ function run_stoch() {
run_stoch -93.0980746734051 5.e-4 50000
}
@test "F2" { # 0:03:34
[[ -n $TRAVIS ]] && skip
qp set_file f2.ezfio
qp set_frozen_core
run_stoch -199.307512211742 0.002 100000
}