10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-02 11:25:26 +02:00

Merge pull request #49 from scemama/master

merge
This commit is contained in:
Emmanuel Giner 2019-01-08 11:54:10 +01:00 committed by GitHub
commit b7ab24aea2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 297 additions and 91 deletions

View File

@ -58,11 +58,16 @@ def main(arguments):
print "Running tests for %s"%(bats_file)
print ""
if arguments["-v"]:
p1 = subprocess.Popen(["python2", "bats_to_sh.py", bats_file], \
stdout=subprocess.PIPE, env=os.environ)
p2 = subprocess.Popen(["bash"], stdin=p1.stdout, env=os.environ)
_, _ = os.waitpid(p2.pid,0)
_, _ = os.waitpid(p1.pid,0)
p = None
if arguments["TEST"]:
TEST="export TEST=%s\n"%arguments["TEST"]
else:
TEST=""
script = TEST+(subprocess.check_output(["python2", "bats_to_sh.py", bats_file]) )
try:
p = subprocess.check_call(script, shell=True, env=os.environ)
except:
if p: p.terminate()
else:
subprocess.check_call(["bats", bats_file], env=os.environ)

View File

@ -311,7 +311,7 @@ subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2, error, &
double precision, external :: omp_get_wtime
double precision :: v, x, x2, x3, avg, avg2, avg3, eqt, E0, v0, n0
double precision :: time, time0
double precision :: time, time1, time0
integer, allocatable :: f(:)
logical, allocatable :: d(:)
@ -363,7 +363,8 @@ subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2, error, &
v0 = 0.d0
n0 = 0.d0
more = 1
time0 = omp_get_wtime()
call wall_time(time0)
time1 = time0
do_exit = .false.
do while (n <= N_det_generators)
@ -421,7 +422,8 @@ subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2, error, &
eqt = dabs((S2(t) / c) - (S(t)/c)**2) ! dabs for numerical stability
eqt = sqrt(eqt / (dble(c) - 1.5d0))
error(pt2_stoch_istate) = eqt
if(mod(c,10)==0 .or. n==N_det_generators) then
if ((time - time1 > 1.d0) .or. (n==N_det_generators)) then
time1 = time
print '(G10.3, 2X, F16.10, 2X, G10.3, 2X, F14.10, 2X, F14.10, 2X, F10.4, A10)', c, avg+E, eqt, avg2, avg3, time-time0, ''
if(do_exit .and. (dabs(error(pt2_stoch_istate)) / (1.d-20 + dabs(pt2(pt2_stoch_istate)) ) <= relative_error)) then
if (zmq_abort(zmq_to_qp_run_socket) == -1) then
@ -433,7 +435,7 @@ subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2, error, &
endif
endif
endif
time = omp_get_wtime()
call wall_time(time)
end if
n += 1
else if(more == 0) then

View File

@ -29,20 +29,28 @@ subroutine get_mask_phase(det1, pm, Nint)
integer, intent(in) :: Nint
integer(bit_kind), intent(in) :: det1(Nint,2)
integer(bit_kind), intent(out) :: pm(Nint,2)
integer(bit_kind) :: tmp
integer :: ispin, i
do ispin=1,2
tmp = 0_8
integer(bit_kind) :: tmp1, tmp2
integer :: i
pm(1:Nint,1:2) = det1(1:Nint,1:2)
tmp1 = 0_8
tmp2 = 0_8
do i=1,Nint
pm(i,ispin) = ieor(det1(i,ispin), shiftl(det1(i,ispin), 1))
pm(i,ispin) = ieor(pm(i,ispin), shiftl(pm(i,ispin), 2))
pm(i,ispin) = ieor(pm(i,ispin), shiftl(pm(i,ispin), 4))
pm(i,ispin) = ieor(pm(i,ispin), shiftl(pm(i,ispin), 8))
pm(i,ispin) = ieor(pm(i,ispin), shiftl(pm(i,ispin), 16))
pm(i,ispin) = ieor(pm(i,ispin), shiftl(pm(i,ispin), 32))
pm(i,ispin) = ieor(pm(i,ispin), tmp)
if(iand(popcnt(det1(i,ispin)), 1) == 1) tmp = not(tmp)
end do
pm(i,1) = ieor(pm(i,1), shiftl(pm(i,1), 1))
pm(i,2) = ieor(pm(i,2), shiftl(pm(i,2), 1))
pm(i,1) = ieor(pm(i,1), shiftl(pm(i,1), 2))
pm(i,2) = ieor(pm(i,2), shiftl(pm(i,2), 2))
pm(i,1) = ieor(pm(i,1), shiftl(pm(i,1), 4))
pm(i,2) = ieor(pm(i,2), shiftl(pm(i,2), 4))
pm(i,1) = ieor(pm(i,1), shiftl(pm(i,1), 8))
pm(i,2) = ieor(pm(i,2), shiftl(pm(i,2), 8))
pm(i,1) = ieor(pm(i,1), shiftl(pm(i,1), 16))
pm(i,2) = ieor(pm(i,2), shiftl(pm(i,2), 16))
pm(i,1) = ieor(pm(i,1), shiftl(pm(i,1), 32))
pm(i,2) = ieor(pm(i,2), shiftl(pm(i,2), 32))
pm(i,1) = ieor(pm(i,1), tmp1)
pm(i,2) = ieor(pm(i,2), tmp2)
if(iand(popcnt(det1(i,1)), 1) == 1) tmp1 = not(tmp1)
if(iand(popcnt(det1(i,2)), 1) == 1) tmp2 = not(tmp2)
end do
end subroutine
@ -687,9 +695,6 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d
double precision :: e_pert, delta_E, val, Hii, sum_e_pert, tmp, alpha_h_psi, coef
double precision, external :: diag_H_mat_elem_fock
double precision :: E_shift
! double precision, allocatable :: mat_inv(:,:,:)
!
! allocate(mat_inv(N_states,mo_num,mo_num))
logical, external :: detEq
@ -735,7 +740,6 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d
endif
e_pert = 0.5d0 * (tmp - delta_E)
coef = e_pert / alpha_h_psi
! coef = e_pert * mat_inv(istate,p1,p2)
pt2(istate) = pt2(istate) + e_pert
variance(istate) = variance(istate) + alpha_h_psi * alpha_h_psi
norm(istate) = norm(istate) + coef * coef
@ -780,7 +784,7 @@ subroutine splash_pq(mask, sp, det, i_gen, N_sel, bannedOrb, banned, mat, intere
do i=1, N_sel ! interesting(0)
!i = interesting(ii)
if (interesting(i) < 0) then
stop 'prefetch interesting(i)'
stop 'prefetch interesting(i) and det(i)'
endif
@ -992,7 +996,6 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
double precision, intent(in) :: coefs(N_states)
double precision, intent(inout) :: mat(N_states, mo_num, mo_num)
integer, intent(in) :: h(0:2,2), p(0:4,2), sp
double precision :: hij, tmp_row(N_states, mo_num), tmp_row2(N_states, mo_num)
double precision, external :: get_phase_bi, mo_two_e_integral
logical :: ok
@ -1005,6 +1008,7 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
integer :: bant
double precision, allocatable :: hij_cache(:,:)
double precision :: hij, tmp_row(N_states, mo_num), tmp_row2(N_states, mo_num)
PROVIDE mo_integrals_map N_int
allocate (lbanned(mo_num, 2))
@ -1041,9 +1045,7 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
hij = hij_cache(putj,1) - hij_cache(putj,2)
if (hij /= 0.d0) then
hij = hij * get_phase_bi(phasemask, ma, ma, putj, p1, hfix, p2, N_int)
do k=1,N_states
tmp_row(k,putj) = tmp_row(k,putj) + hij * coefs(k)
enddo
tmp_row(1:N_states,putj) = tmp_row(1:N_states,putj) + hij * coefs(1:N_states)
endif
end do
do putj=hfix+1, mo_num
@ -1069,22 +1071,23 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
tmp_row2 = 0d0
call get_mo_two_e_integrals(hfix,pfix,p1,mo_num,hij_cache(1,1),mo_integrals_map)
call get_mo_two_e_integrals(hfix,pfix,p2,mo_num,hij_cache(1,2),mo_integrals_map)
putj = p1
do puti=1,mo_num
if(lbanned(puti,mi)) cycle
!p1 fixed
putj = p1
if(.not. banned(putj,puti,bant)) then
if(.not.(banned(putj,puti,bant).or.lbanned(puti,mi))) then
hij = hij_cache(puti,2)
if (hij /= 0.d0) then
hij = hij * get_phase_bi(phasemask, ma, mi, hfix, p2, puti, pfix, N_int)
do k=1,N_states
tmp_row(k,puti) = tmp_row(k,puti) + hij * coefs(k) ! HOTSPOT
tmp_row(k,puti) = tmp_row(k,puti) + hij * coefs(k)
enddo
endif
end if
enddo
putj = p2
if(.not. banned(putj,puti,bant)) then
putj = p2
do puti=1,mo_num
if(.not.(banned(putj,puti,bant)).or.(lbanned(puti,mi))) then
hij = hij_cache(puti,1)
if (hij /= 0.d0) then
hij = hij * get_phase_bi(phasemask, ma, mi, hfix, p1, puti, pfix, N_int)
@ -1115,8 +1118,8 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
call get_mo_two_e_integrals(hfix,p2,p1,mo_num,hij_cache(1,2),mo_integrals_map)
tmp_row = 0d0
do putj=1,hfix-1
if(lbanned(putj,ma)) cycle
if(banned(putj,puti,1)) cycle
if(lbanned(putj,ma)) cycle
hij = hij_cache(putj,1) - hij_cache(putj,2)
if (hij /= 0.d0) then
hij = hij * get_phase_bi(phasemask, ma, ma, putj, p1, hfix, p2, N_int)
@ -1124,8 +1127,8 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
endif
end do
do putj=hfix+1,mo_num
if(lbanned(putj,ma)) cycle
if(banned(putj,puti,1)) cycle
if(lbanned(putj,ma)) cycle
hij = hij_cache(putj,2) - hij_cache(putj,1)
if (hij /= 0.d0) then
hij = hij * get_phase_bi(phasemask, ma, ma, hfix, p1, putj, p2, N_int)
@ -1145,10 +1148,10 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
tmp_row2 = 0d0
call get_mo_two_e_integrals(hfix,p1,pfix,mo_num,hij_cache(1,1),mo_integrals_map)
call get_mo_two_e_integrals(hfix,p2,pfix,mo_num,hij_cache(1,2),mo_integrals_map)
putj = p2
do puti=1,mo_num
if(lbanned(puti,ma)) cycle
putj = p2
if(.not. banned(puti,putj,1)) then
if(lbanned(puti,ma)) cycle
hij = hij_cache(puti,1)
if (hij /= 0.d0) then
hij = hij * get_phase_bi(phasemask, mi, ma, hfix, pfix, puti, p1, N_int)
@ -1157,9 +1160,12 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
enddo
endif
end if
enddo
putj = p1
putj = p1
do puti=1,mo_num
if(.not. banned(puti,putj,1)) then
if(lbanned(puti,ma)) cycle
hij = hij_cache(puti,2)
if (hij /= 0.d0) then
hij = hij * get_phase_bi(phasemask, mi, ma, hfix, pfix, puti, p2, N_int)
@ -1188,8 +1194,8 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
do i1=1,p(0,s1)
ib = 1
if(s1 == s2) ib = i1+1
p1 = p(i1,s1)
if(s1 == s2) ib = i1+1
if(bannedOrb(p1, s1)) cycle
do i2=ib,p(0,s2)
p2 = p(i2,s2)
@ -1221,10 +1227,9 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
double precision, external :: get_phase_bi, mo_two_e_integral
logical :: ok
integer :: bant
integer, parameter :: bant=1
double precision, allocatable :: hij_cache1(:), hij_cache2(:)
allocate (hij_cache1(mo_num),hij_cache2(mo_num))
bant = 1
if(sp == 3) then ! AB

View File

@ -36,24 +36,39 @@
BEGIN_PROVIDER [double precision, potential_sr_x_alpha_ao_LDA,(ao_num,ao_num,N_states)]
&BEGIN_PROVIDER [double precision, potential_sr_x_beta_ao_LDA,(ao_num,ao_num,N_states)]
&BEGIN_PROVIDER [double precision, potential_sr_c_alpha_ao_LDA,(ao_num,ao_num,N_states)]
implicit none
BEGIN_DOC
! short range exchange alpha/beta potentials with LDA functional on the |AO| basis
END_DOC
! Second dimension is given as ao_num * N_states so that Lapack does the loop over N_states.
call dgemm('N','N',ao_num,ao_num*N_states,n_points_final_grid,1.d0, &
aos_in_r_array,size(aos_in_r_array,1), &
aos_sr_vx_alpha_LDA_w,size(aos_sr_vx_alpha_LDA_w,1),0.d0,&
potential_sr_x_alpha_ao_LDA,size(potential_sr_x_alpha_ao_LDA,1))
call dgemm('N','N',ao_num,ao_num*N_states,n_points_final_grid,1.d0, &
aos_in_r_array,size(aos_in_r_array,1), &
aos_sr_vx_beta_LDA_w,size(aos_sr_vx_beta_LDA_w,1),0.d0,&
potential_sr_x_beta_ao_LDA,size(potential_sr_x_beta_ao_LDA,1))
END_PROVIDER
BEGIN_PROVIDER [double precision, potential_sr_c_alpha_ao_LDA,(ao_num,ao_num,N_states)]
&BEGIN_PROVIDER [double precision, potential_sr_c_beta_ao_LDA,(ao_num,ao_num,N_states)]
implicit none
BEGIN_DOC
! short range exchange/correlation alpha/beta potentials with LDA functional on the AO basis
! short range correlation alpha/beta potentials with LDA functional on the |AO| basis
END_DOC
integer :: istate
double precision :: wall_1,wall_2
call wall_time(wall_1)
do istate = 1, N_states
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0,aos_in_r_array,ao_num,aos_sr_vc_alpha_LDA_w(1,1,istate),n_points_final_grid,0.d0,potential_sr_c_alpha_ao_LDA(1,1,istate),ao_num)
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0,aos_in_r_array,ao_num,aos_sr_vc_beta_LDA_w(1,1,istate) ,n_points_final_grid,0.d0,potential_sr_c_beta_ao_LDA(1,1,istate),ao_num)
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0,aos_in_r_array,ao_num,aos_sr_vx_alpha_LDA_w(1,1,istate),n_points_final_grid,0.d0,potential_sr_x_alpha_ao_LDA(1,1,istate),ao_num)
call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0,aos_in_r_array,ao_num,aos_sr_vx_beta_LDA_w(1,1,istate) ,n_points_final_grid,0.d0,potential_sr_x_beta_ao_LDA(1,1,istate),ao_num)
enddo
call wall_time(wall_2)
! Second dimension is given as ao_num * N_states so that Lapack does the loop over N_states.
call dgemm('N','N',ao_num,ao_num*N_states,n_points_final_grid,1.d0, &
aos_in_r_array,size(aos_in_r_array,1), &
aos_sr_vc_alpha_LDA_w,size(aos_sr_vc_alpha_LDA_w,1),0.d0,&
potential_sr_c_alpha_ao_LDA,size(potential_sr_c_alpha_ao_LDA,1))
call dgemm('N','N',ao_num,ao_num*N_states,n_points_final_grid,1.d0, &
aos_in_r_array,size(aos_in_r_array,1), &
aos_sr_vc_beta_LDA_w,size(aos_sr_vc_beta_LDA_w,1),0.d0,&
potential_sr_c_beta_ao_LDA,size(potential_sr_c_beta_ao_LDA,1))
END_PROVIDER
END_PROVIDER
BEGIN_PROVIDER[double precision, aos_sr_vc_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)] !(n_points_final_grid,ao_num,N_states)]
&BEGIN_PROVIDER[double precision, aos_sr_vc_beta_PBE_w , (ao_num,n_points_final_grid,N_states)]!(n_points_final_grid,ao_num,N_states)]
@ -69,20 +84,20 @@
&BEGIN_PROVIDER[double precision, grad_aos_dsr_vx_beta_PBE_w , (ao_num,n_points_final_grid,3,N_states)]
implicit none
BEGIN_DOC
! aos_vxc_alpha_PBE_w(j,i) = ao_i(r_j) * (v^x_alpha(r_j) + v^c_alpha(r_j)) * W(r_j)
! aos_vxc_alpha_PBE_w(j,i) = ao_i(r_j) * (v^x_alpha(r_j) + v^c_alpha(r_j)) * W(r_j)
END_DOC
integer :: istate,i,j,m
double precision :: r(3)
double precision :: mu,weight
double precision, allocatable :: ex(:), ec(:)
double precision, allocatable :: rho_a(:),rho_b(:),grad_rho_a(:,:),grad_rho_b(:,:),grad_rho_a_2(:),grad_rho_b_2(:),grad_rho_a_b(:)
double precision, allocatable :: contrib_grad_xa(:,:),contrib_grad_xb(:,:),contrib_grad_ca(:,:),contrib_grad_cb(:,:)
double precision, allocatable :: sr_vc_rho_a(:), sr_vc_rho_b(:), sr_vx_rho_a(:), sr_vx_rho_b(:)
double precision, allocatable :: sr_vx_grad_rho_a_2(:), sr_vx_grad_rho_b_2(:), sr_vx_grad_rho_a_b(:), sr_vc_grad_rho_a_2(:), sr_vc_grad_rho_b_2(:), sr_vc_grad_rho_a_b(:)
integer :: istate,i,j,m
double precision :: r(3)
double precision :: mu,weight
double precision, allocatable :: ex(:), ec(:)
double precision, allocatable :: rho_a(:),rho_b(:),grad_rho_a(:,:),grad_rho_b(:,:),grad_rho_a_2(:),grad_rho_b_2(:),grad_rho_a_b(:)
double precision, allocatable :: contrib_grad_xa(:,:),contrib_grad_xb(:,:),contrib_grad_ca(:,:),contrib_grad_cb(:,:)
double precision, allocatable :: sr_vc_rho_a(:), sr_vc_rho_b(:), sr_vx_rho_a(:), sr_vx_rho_b(:)
double precision, allocatable :: sr_vx_grad_rho_a_2(:), sr_vx_grad_rho_b_2(:), sr_vx_grad_rho_a_b(:), sr_vc_grad_rho_a_2(:), sr_vc_grad_rho_b_2(:), sr_vc_grad_rho_a_b(:)
allocate(sr_vc_rho_a(N_states), sr_vc_rho_b(N_states), sr_vx_rho_a(N_states), sr_vx_rho_b(N_states))
allocate(sr_vx_grad_rho_a_2(N_states), sr_vx_grad_rho_b_2(N_states), sr_vx_grad_rho_a_b(N_states), sr_vc_grad_rho_a_2(N_states), sr_vc_grad_rho_b_2(N_states), sr_vc_grad_rho_a_b(N_states))
allocate(rho_a(N_states), rho_b(N_states),grad_rho_a(3,N_states),grad_rho_b(3,N_states))
allocate(grad_rho_a_2(N_states),grad_rho_b_2(N_states),grad_rho_a_b(N_states), ex(N_states), ec(N_states))
allocate(contrib_grad_xa(3,N_states),contrib_grad_xb(3,N_states),contrib_grad_ca(3,N_states),contrib_grad_cb(3,N_states))
@ -152,36 +167,69 @@
END_DOC
integer :: istate, m
double precision :: wall_1,wall_2
call wall_time(wall_1)
potential_sr_c_alpha_ao_PBE = 0.d0
potential_sr_x_alpha_ao_PBE = 0.d0
potential_sr_c_beta_ao_PBE = 0.d0
potential_sr_x_beta_ao_PBE = 0.d0
do istate = 1, N_states
! correlation alpha
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,aos_sr_vc_alpha_PBE_w(1,1,istate),size(aos_sr_vc_alpha_PBE_w,1),aos_in_r_array,size(aos_in_r_array,1),1.d0,potential_sr_c_alpha_ao_PBE(1,1,istate),size(potential_sr_c_alpha_ao_PBE,1))
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
aos_sr_vc_alpha_PBE_w(1,1,istate),size(aos_sr_vc_alpha_PBE_w,1),&
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
potential_sr_c_alpha_ao_PBE(1,1,istate),size(potential_sr_c_alpha_ao_PBE,1))
! correlation beta
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,aos_sr_vc_beta_PBE_w(1,1,istate),size(aos_sr_vc_beta_PBE_w,1),aos_in_r_array,size(aos_in_r_array,1),1.d0,potential_sr_c_beta_ao_PBE(1,1,istate),size(potential_sr_c_beta_ao_PBE,1))
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
aos_sr_vc_beta_PBE_w(1,1,istate),size(aos_sr_vc_beta_PBE_w,1),&
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
potential_sr_c_beta_ao_PBE(1,1,istate),size(potential_sr_c_beta_ao_PBE,1))
! exchange alpha
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,aos_sr_vx_alpha_PBE_w(1,1,istate),size(aos_sr_vx_alpha_PBE_w,1),aos_in_r_array,size(aos_in_r_array,1),1.d0,potential_sr_x_alpha_ao_PBE(1,1,istate),size(potential_sr_x_alpha_ao_PBE,1))
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
aos_sr_vx_alpha_PBE_w(1,1,istate),size(aos_sr_vx_alpha_PBE_w,1),&
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
potential_sr_x_alpha_ao_PBE(1,1,istate),size(potential_sr_x_alpha_ao_PBE,1))
! exchange beta
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,aos_sr_vx_beta_PBE_w(1,1,istate),size(aos_sr_vx_beta_PBE_w,1), aos_in_r_array,size(aos_in_r_array,1),1.d0,potential_sr_x_beta_ao_PBE(1,1,istate), size(potential_sr_x_beta_ao_PBE,1))
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
aos_sr_vx_beta_PBE_w(1,1,istate),size(aos_sr_vx_beta_PBE_w,1),&
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
potential_sr_x_beta_ao_PBE(1,1,istate), size(potential_sr_x_beta_ao_PBE,1))
do m= 1,3
! correlation alpha
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,aos_dsr_vc_alpha_PBE_w(1,1,m,istate),size(aos_dsr_vc_alpha_PBE_w,1),aos_grad_in_r_array(1,1,m),size(aos_grad_in_r_array,1),1.d0,potential_sr_c_alpha_ao_PBE(1,1,istate),size(potential_sr_c_alpha_ao_PBE,1))
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,grad_aos_dsr_vc_alpha_PBE_w(1,1,m,istate),size(grad_aos_dsr_vc_alpha_PBE_w,1),aos_in_r_array,size(aos_in_r_array,1),1.d0,potential_sr_c_alpha_ao_PBE(1,1,istate),size(potential_sr_c_alpha_ao_PBE,1))
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
aos_dsr_vc_alpha_PBE_w(1,1,m,istate),size(aos_dsr_vc_alpha_PBE_w,1),&
aos_grad_in_r_array(1,1,m),size(aos_grad_in_r_array,1),1.d0, &
potential_sr_c_alpha_ao_PBE(1,1,istate),size(potential_sr_c_alpha_ao_PBE,1))
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
grad_aos_dsr_vc_alpha_PBE_w(1,1,m,istate),size(grad_aos_dsr_vc_alpha_PBE_w,1),&
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
potential_sr_c_alpha_ao_PBE(1,1,istate),size(potential_sr_c_alpha_ao_PBE,1))
! correlation beta
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,aos_dsr_vc_beta_PBE_w(1,1,m,istate),size(aos_dsr_vc_beta_PBE_w,1),aos_grad_in_r_array(1,1,m),size(aos_grad_in_r_array,1),1.d0,potential_sr_c_beta_ao_PBE(1,1,istate),size(potential_sr_c_beta_ao_PBE,1))
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,grad_aos_dsr_vc_beta_PBE_w(1,1,m,istate),size(grad_aos_dsr_vc_beta_PBE_w,1),aos_in_r_array,size(aos_in_r_array,1),1.d0,potential_sr_c_beta_ao_PBE(1,1,istate),size(potential_sr_c_beta_ao_PBE,1))
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
aos_dsr_vc_beta_PBE_w(1,1,m,istate),size(aos_dsr_vc_beta_PBE_w,1),&
aos_grad_in_r_array(1,1,m),size(aos_grad_in_r_array,1),1.d0, &
potential_sr_c_beta_ao_PBE(1,1,istate),size(potential_sr_c_beta_ao_PBE,1))
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
grad_aos_dsr_vc_beta_PBE_w(1,1,m,istate),size(grad_aos_dsr_vc_beta_PBE_w,1),&
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
potential_sr_c_beta_ao_PBE(1,1,istate),size(potential_sr_c_beta_ao_PBE,1))
! exchange alpha
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,aos_dsr_vx_alpha_PBE_w(1,1,m,istate),size(aos_dsr_vx_alpha_PBE_w,1),aos_grad_in_r_array(1,1,m),size(aos_grad_in_r_array,1),1.d0,potential_sr_x_alpha_ao_PBE(1,1,istate),size(potential_sr_x_alpha_ao_PBE,1))
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,grad_aos_dsr_vx_alpha_PBE_w(1,1,m,istate),size(grad_aos_dsr_vx_alpha_PBE_w,1),aos_in_r_array,size(aos_in_r_array,1),1.d0,potential_sr_x_alpha_ao_PBE(1,1,istate),size(potential_sr_x_alpha_ao_PBE,1))
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
aos_dsr_vx_alpha_PBE_w(1,1,m,istate),size(aos_dsr_vx_alpha_PBE_w,1),&
aos_grad_in_r_array(1,1,m),size(aos_grad_in_r_array,1),1.d0, &
potential_sr_x_alpha_ao_PBE(1,1,istate),size(potential_sr_x_alpha_ao_PBE,1))
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
grad_aos_dsr_vx_alpha_PBE_w(1,1,m,istate),size(grad_aos_dsr_vx_alpha_PBE_w,1),&
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
potential_sr_x_alpha_ao_PBE(1,1,istate),size(potential_sr_x_alpha_ao_PBE,1))
! exchange beta
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,aos_dsr_vx_beta_PBE_w(1,1,m,istate),size(aos_dsr_vx_beta_PBE_w,1),aos_grad_in_r_array(1,1,m),size(aos_grad_in_r_array,1),1.d0,potential_sr_x_beta_ao_PBE(1,1,istate),size(potential_sr_x_beta_ao_PBE,1))
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0,grad_aos_dsr_vx_beta_PBE_w(1,1,m,istate),size(grad_aos_dsr_vx_beta_PBE_w,1),aos_in_r_array,size(aos_in_r_array,1),1.d0,potential_sr_x_beta_ao_PBE(1,1,istate),size(potential_sr_x_beta_ao_PBE,1))
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
aos_dsr_vx_beta_PBE_w(1,1,m,istate),size(aos_dsr_vx_beta_PBE_w,1),&
aos_grad_in_r_array(1,1,m),size(aos_grad_in_r_array,1),1.d0, &
potential_sr_x_beta_ao_PBE(1,1,istate),size(potential_sr_x_beta_ao_PBE,1))
call dgemm('N','T',ao_num,ao_num,n_points_final_grid,1.d0, &
grad_aos_dsr_vx_beta_PBE_w(1,1,m,istate),size(grad_aos_dsr_vx_beta_PBE_w,1),&
aos_in_r_array,size(aos_in_r_array,1),1.d0, &
potential_sr_x_beta_ao_PBE(1,1,istate),size(potential_sr_x_beta_ao_PBE,1))
enddo
enddo
call wall_time(wall_2)
END_PROVIDER

140
src/fci/40.fci.bats Normal file
View File

@ -0,0 +1,140 @@
#!/usr/bin/env bats
source $QP_ROOT/tests/bats/common.bats.sh
function run() {
thresh=$3
test_exe fci || skip
qp_edit -c $1
ezfio set_file $1
ezfio set determinants n_det_max 8000
ezfio set determinants n_states 1
ezfio set davidson threshold_davidson 1.e-10
ezfio set davidson n_states_diag 8
qp_run fci $1
energy1="$(ezfio get fci energy_pt2 | tr '[]' ' ' | cut -d ',' -f 1)"
eq $energy1 $2 $thresh
}
@test "NH3" { # 10.6657s
qp_set_mo_class nh3.ezfio -core "[1-4]" -act "[5-72]"
run nh3.ezfio -56.2447484821590 1.e-8
}
@test "DHNO" { # 11.4721s
qp_set_mo_class dhno.ezfio -core "[1-7]" -act "[8-64]"
run dhno.ezfio -130.459030395165 1.e-8
}
@test "HCO" { # 12.2868s
run hco.ezfio -113.311549734862 1.444e-05
}
@test "H2O2" { # 12.9214s
qp_set_mo_class h2o2.ezfio -core "[1-2]" -act "[3-24]" -del "[25-38]"
run h2o2.ezfio -151.024844964871 0.00011948
}
@test "HBO" { # 13.3144s
run hbo.ezfio -100.221374036381 1.36e-05
}
@test "H2O" { # 11.3727s
run h2o.ezfio -76.2412334158826 1.988e-05
}
@test "ClO" { # 13.3755s
run clo.ezfio -534.572693465448 0.00019344
}
@test "SO" { # 13.4952s
run so.ezfio -26.0465405831268 0.00014494
}
@test "H2S" { # 13.6745s
[[ -n $TRAVIS ]] && skip
run h2s.ezfio -398.865096897874 8.46e-06
}
@test "OH" { # 13.865s
[[ -n $TRAVIS ]] && skip
run oh.ezfio -75.6188293682445 1.744e-05
}
@test "SiH2_3B1" { # 13.938ss
[[ -n $TRAVIS ]] && skip
run sih2_3b1.ezfio -290.017547995946 1.e-8
}
@test "H3COH" { # 14.7299s
[[ -n $TRAVIS ]] && skip
run h3coh.ezfio -115.223624478701 0.00018132
}
@test "SiH3" { # 15.99s
[[ -n $TRAVIS ]] && skip
run sih3.ezfio -5.57759237300615 1.116e-05
}
@test "CH4" { # 16.1612s
[[ -n $TRAVIS ]] && skip
qp_set_mo_class ch4.ezfio -core "[1]" -act "[2-30]" -del "[31-59]"
run ch4.ezfio -40.2418916955354 3.02e-06
}
@test "ClF" { # 16.8864s
[[ -n $TRAVIS ]] && skip
run clf.ezfio -559.19410640102 0.00021062
}
@test "SO2" { # 17.5645s
[[ -n $TRAVIS ]] && skip
qp_set_mo_class so2.ezfio -core "[1-8]" -act "[9-87]"
run so2.ezfio -41.5746738710646 1.e-8
}
@test "C2H2" { # 17.6827s
[[ -n $TRAVIS ]] && skip
qp_set_mo_class c2h2.ezfio -act "[1-30]" -del "[31-36]"
run c2h2.ezfio -12.3844530031717 9.402e-05
}
@test "N2" { # 18.0198s
[[ -n $TRAVIS ]] && skip
qp_set_mo_class n2.ezfio -core "[1,2]" -act "[3-40]" -del "[41-60]"
run n2.ezfio -109.312048711981 0.00010052
}
@test "N2H4" { # 18.5006s
[[ -n $TRAVIS ]] && skip
qp_set_mo_class n2h4.ezfio -core "[1-2]" -act "[3-24]" -del "[25-48]"
run n2h4.ezfio -111.382145310854 0.00010255
}
@test "CO2" { # 21.1748s
[[ -n $TRAVIS ]] && skip
qp_set_mo_class co2.ezfio -core "[1,2]" -act "[3-30]" -del "[31-42]"
run co2.ezfio -188.002445507874 0.00028902
}
@test "F2" { # 21.331s
[[ -n $TRAVIS ]] && skip
qp_set_mo_class f2.ezfio -core "[1,2]" -act "[3-30]" -del "[31-62]"
run f2.ezfio -199.084484583825 0.00014534
}
@test "[Cu(NH3)4]2+" { # 25.0417s
[[ -n $TRAVIS ]] && skip
qp_set_mo_class cu_nh3_4_2plus.ezfio -core "[1-24]" -act "[25-45]" -del "[46-87]"
run cu_nh3_4_2plus.ezfio -1862.98649500346 5.e-07
}
@test "HCN" { # 20.3273s
[[ -n $TRAVIS ]] && skip
qp_set_mo_class hcn.ezfio -core "[1,2]" -act "[3-40]" -del "[41-55]"
run hcn.ezfio -93.0959693071658 0.00016522
}

View File

@ -132,7 +132,6 @@ END_PROVIDER
nucl_dist_vec_y(ie1,ie2)*nucl_dist_vec_y(ie1,ie2) + &
nucl_dist_vec_z(ie1,ie2)*nucl_dist_vec_z(ie1,ie2)
nucl_dist(ie1,ie2) = sqrt(nucl_dist_2(ie1,ie2))
ASSERT (nucl_dist(ie1,ie2) > 0.d0)
enddo
enddo
END_PROVIDER

View File

@ -45,13 +45,18 @@ function test_exe() {
}
run_only_test() {
if [[ "$BATS_TEST_DESCRIPTION" != "$1" ]] && [[ "$BATS_TEST_NUMBER" -ne "$1" ]]; then
skip
if [[ "$BATS_TEST_DESCRIPTION" != "$1" ]] && [[ "$BATS_TEST_NUMBER" != "$1" ]]; then
if [[ -z $BATS_TEST_FILENAME ]] ; then
exit 0
else
skip
fi
fi
sleep 3
}
setup() {
if [[ -n $TEST ]] ; then
run_only_test $TEST
run_only_test $TEST || exit 0
fi
}

View File

@ -13,17 +13,19 @@ for i in raw_data:
if i == "@":
inside = True
elif i == "{" and inside and level == 0:
new_i = "\nsetup\n"
new_i = "\n( setup\n"
elif i == "}" and inside and level == 1:
inside = False
new_i = ""
new_i = ") || exit 1"
if i == "{":
level += 1
elif i == "}":
level -= 1
output.append(new_i)
print "".join(output).replace("@test","echo").replace("|| skip","|| return")
print "".join(output).replace("@test ",
"""[[ -z $BATS_TEST_NUMBER ]] && BATS_TEST_NUMBER=0 || ((++BATS_TEST_NUMBER)) ;
export BATS_TEST_DESCRIPTION=""").replace("skip","return")