DFT-D3: clock print

This commit is contained in:
Ivan Carnimeo 2021-06-28 09:14:42 +02:00
parent 98901cc0d6
commit c67bcb5e52
3 changed files with 41 additions and 16 deletions

View File

@ -72,6 +72,11 @@ SUBROUTINE print_clock_pw()
CALL print_clock( 'vdW_ffts' )
CALL print_clock( 'vdW_v' )
CALL print_clock( 'vdW_kernel' )
CALL print_clock( 'dftd3' )
CALL print_clock( 'dftd3:edisp' )
CALL print_clock( 'dftd3:three' )
CALL print_clock( 'dftd3:ncoor' )
CALL print_clock( 'dftd3:gdisp' )
IF (lxdm) THEN
CALL print_clock('energy_xdm')

View File

@ -242,6 +242,8 @@ contains
real(wp) :: rtmp3(3)
integer :: rep_cn(3), rep_vdw(3)
Call start_clock('dftd3')
if (present(grads) .neqv. present(stress)) then
write(*,*) "!!! Error in dftd3_pbc_dispersion"
write(*,*) "Either both grads and stress must be present or none of them"
@ -268,20 +270,22 @@ contains
& this%rthr, rep_vdw, this%cn_thr, rep_cn)
disp = -e6 * this%s6 - e8 * this%s18 - e6abc
if (.not. present(grads)) then
return
end if
if (present(grads)) then
grads(:,:) = 0.0_wp
call pbcgdisp(max_elem, maxc, natom, coords, izp, this%c6ab, this%mxc, &
& r2r4, this%r0ab, rcov, s6, s18, rs6, rs8, rs10, alp6, alp8, alp10, &
& this%noabc, this%numgrad, this%version, grads, disp2, gnorm, &
& stress, latvecs, rep_vdw, rep_cn, this%rthr, .false., this%cn_thr)
! Note, the stress variable in pbcgdisp contains the *lattice derivatives*
! on return, so it needs to be converted to obtain the stress tensor.
stress(:,:) = -matmul(stress, transpose(latvecs))&
& / abs(determinant(latvecs))
grads(:,:) = 0.0_wp
call pbcgdisp(max_elem, maxc, natom, coords, izp, this%c6ab, this%mxc, &
& r2r4, this%r0ab, rcov, s6, s18, rs6, rs8, rs10, alp6, alp8, alp10, &
& this%noabc, this%numgrad, this%version, grads, disp2, gnorm, &
& stress, latvecs, rep_vdw, rep_cn, this%rthr, .false., this%cn_thr)
! Note, the stress variable in pbcgdisp contains the *lattice derivatives*
! on return, so it needs to be converted to obtain the stress tensor.
stress(:,:) = -matmul(stress, transpose(latvecs))&
& / abs(determinant(latvecs))
end if
Call stop_clock('dftd3')
end subroutine dftd3_pbc_dispersion

View File

@ -2455,6 +2455,8 @@ contains
real(wp) dx,dy,dz,r,damp,xn,rr,rco,tau(3)
real(wp), INTENT(IN) :: crit_cn
call start_clock('dftd3:ncoor')
do i=1,natoms
xn=0.0d0
do iat=1,natoms
@ -2485,6 +2487,8 @@ contains
cn(i)=xn
end do
call stop_clock('dftd3:ncoor')
end subroutine pbcncoord
@ -2520,6 +2524,7 @@ contains
real(wp) bj_dmp6,bj_dmp8
real(wp) tmp1,tmp2
call start_clock('dftd3:edisp')
e6 =0
e8 =0
@ -2806,12 +2811,15 @@ contains
end if
if (.not.noabc) then
if (noabc)return
! compute non-additive third-order energy using averaged C6
call pbcthreebody(max_elem,xyz,lat,n,iz,rep_cn,crit_cn,&
& cc6ab,r0ab,e63)
! compute non-additive third-order energy using averaged C6
call pbcthreebody(max_elem,xyz,lat,n,iz,rep_cn,crit_cn,&
& cc6ab,r0ab,e63)
end if
call stop_clock('dftd3:edisp')
end subroutine pbcedisp
@ -2841,6 +2849,8 @@ contains
INTEGER, DIMENSION(3) :: repmin,repmax
! REAL(WP) :: time1,time2
call start_clock('dftd3:three')
counter=0
eabc=0.0d0
abcthr=cnthr
@ -3141,6 +3151,8 @@ contains
end do
call stop_clock('dftd3:three')
end subroutine pbcthreebody
@ -3211,6 +3223,8 @@ contains
real(wp) abcthr,time1,time2,geomean2,r0av,dc9,dfdmp,dang,ang
integer,dimension(3) ::repv,repmin,repmax,repmin2,repmax2
call start_clock('dftd3:gdisp')
! R^2 cut-off
rthr=crit_vdw
abcthr=crit_cn
@ -4665,6 +4679,8 @@ contains
write(*,*)'|G(stress)|=',gnorm
end if
call stop_clock('dftd3:gdisp')
end subroutine pbcgdisp