Skip to content

Commit

Permalink
task_list: Simplify matrix symmetry handling, two regtests updated
Browse files Browse the repository at this point in the history
  • Loading branch information
oschuett committed Jul 18, 2020
1 parent ff68bbe commit 460a82c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 36 deletions.
56 changes: 22 additions & 34 deletions src/qs_collocate_density.F
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,8 @@ SUBROUTINE calculate_rho_elec(matrix_p, matrix_p_kp, rho, rho_gspace, total_rho,
do_kp, my_compute_grad, &
my_compute_tau, my_soft, use_subpatch
REAL(KIND=dp) :: scale
REAL(KIND=dp), DIMENSION(3) :: ra, rab, rab_inv, rb
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :) :: p_block_set
REAL(KIND=dp), DIMENSION(3) :: ra, rab, rb
REAL(KIND=dp), DIMENSION(:, :), POINTER :: p_block, pab, sphi_a, sphi_b, work, &
zeta, zetb
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: pabt, workt
Expand Down Expand Up @@ -1657,9 +1658,9 @@ SUBROUTINE calculate_rho_elec(matrix_p, matrix_p_kp, rho, rho_gspace, total_rho,
!$OMP PRIVATE(img,img_old,iatom_old,jatom_old,iset_old,jset_old,ikind_old,jkind_old), &
!$OMP PRIVATE(qs_kind,orb_basis_set,first_sgfa,la_max,la_min), &
!$OMP PRIVATE(npgfa,nseta,nsgfa,sphi_a,zeta,first_sgfb,lb_max,lb_min,npgfb), &
!$OMP PRIVATE(nsetb,nsgfb,sphi_b,zetb,p_block), &
!$OMP PRIVATE(nsetb,nsgfb,sphi_b,zetb,p_block, p_block_set), &
!$OMP PRIVATE(atom_pair_changed,ncoa,sgfa,ncob,sgfb,rab,ra,rb), &
!$OMP PRIVATE(na1,na2,nb1,nb2,scale,use_subpatch,rab_inv,ithread,lb,ub,n,nw), &
!$OMP PRIVATE(na1,na2,nb1,nb2,scale,use_subpatch,ithread,lb,ub,n,nw), &
!$OMP PRIVATE(itask,nz,nxy,nzsize,nrlevel,nblock,lbw,lbr,nr,threadlocal_rsgrid)

ithread = 0
Expand Down Expand Up @@ -1752,17 +1753,17 @@ SUBROUTINE calculate_rho_elec(matrix_p, matrix_p_kp, rho, rho_gspace, total_rho,
ncob = npgfb(jset)*ncoset(lb_max(jset))
sgfb = first_sgfb(1, jset)
IF (ALLOCATED(p_block_set)) DEALLOCATE (p_block_set)
ALLOCATE (p_block_set(nsgfa(iset), nsgfb(jset)))
IF (iatom <= jatom) THEN
work(1:ncoa, 1:nsgfb(jset)) = MATMUL(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1), &
p_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1))
pab(1:ncoa, 1:ncob) = MATMUL(work(1:ncoa, 1:nsgfb(jset)), &
TRANSPOSE(sphi_b(1:ncob, sgfb:sgfb + nsgfb(jset) - 1)))
p_block_set(:, :) = p_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1)
ELSE
work(1:ncob, 1:nsgfa(iset)) = MATMUL(sphi_b(1:ncob, sgfb:sgfb + nsgfb(jset) - 1), &
p_block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1))
pab(1:ncob, 1:ncoa) = MATMUL(work(1:ncob, 1:nsgfa(iset)), &
TRANSPOSE(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1)))
END IF
p_block_set(:, :) = TRANSPOSE(p_block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1))
ENDIF
work(1:ncoa, 1:nsgfb(jset)) = MATMUL(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1), p_block_set)
pab(1:ncoa, 1:ncob) = MATMUL(work(1:ncoa, 1:nsgfb(jset)), &
TRANSPOSE(sphi_b(1:ncob, sgfb:sgfb + nsgfb(jset) - 1)))
iset_old = iset
jset_old = jset
Expand Down Expand Up @@ -1795,28 +1796,15 @@ SUBROUTINE calculate_rho_elec(matrix_p, matrix_p_kp, rho, rho_gspace, total_rho,
use_subpatch = .FALSE.
ENDIF

IF (iatom <= jatom) THEN
CALL collocate_pgf_product( &
la_max(iset), zeta(ipgf, iset), la_min(iset), &
lb_max(jset), zetb(jpgf, jset), lb_min(jset), &
ra, rab, scale, pab, na1 - 1, nb1 - 1, &
threadlocal_rsgrid, cell, cube_info(igrid_level), &
radius=tasks(itask)%radius, &
ga_gb_function=ga_gb_function, &
use_subpatch=use_subpatch, &
subpatch_pattern=tasks(itask)%subpatch_pattern)
ELSE
rab_inv = -rab
CALL collocate_pgf_product( &
lb_max(jset), zetb(jpgf, jset), lb_min(jset), &
la_max(iset), zeta(ipgf, iset), la_min(iset), &
rb, rab_inv, scale, pab, nb1 - 1, na1 - 1, &
threadlocal_rsgrid, cell, cube_info(igrid_level), &
radius=tasks(itask)%radius, &
ga_gb_function=ga_gb_function, &
use_subpatch=use_subpatch, &
subpatch_pattern=tasks(itask)%subpatch_pattern)
END IF
CALL collocate_pgf_product( &
la_max(iset), zeta(ipgf, iset), la_min(iset), &
lb_max(jset), zetb(jpgf, jset), lb_min(jset), &
ra, rab, scale, pab, na1 - 1, nb1 - 1, &
threadlocal_rsgrid, cell, cube_info(igrid_level), &
radius=tasks(itask)%radius, &
ga_gb_function=ga_gb_function, &
use_subpatch=use_subpatch, &
subpatch_pattern=tasks(itask)%subpatch_pattern)
END DO loop_tasks
END DO loop_pairs
!$OMP END DO
Expand Down
4 changes: 2 additions & 2 deletions tests/QS/regtest-kp-1/TEST_FILES
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ c_3.inp 1 2e-14
c_4.inp 1 3e-14 -45.66762356227670
c_5.inp 1 3e-14 -46.02680478900018
c_6.inp 1 3e-14 -45.65758013574263
c_gapw.inp 1 2e-14 -302.06260709151996
c_gapwxc.inp 1 2e-14 -45.66746891704994
c_gapw.inp 1 2e-14 -302.06260708586098
c_gapwxc.inp 1 2e-14 -45.66746891467081
cn_1.inp 1 6e-13 -49.27303752713806
c_dos.inp 1 1.0E-14 -45.65699752126638
#EOF

0 comments on commit 460a82c

Please sign in to comment.