@@ -1287,7 +1287,6 @@ subroutine precond_search_direction(cdodq, cdodq_r, cdodq_precond, cdodq_precond
12871287 integer , intent (in ) :: optimisation
12881288
12891289 ! local
1290- complex (kind= dp), external :: zdotc
12911290 complex (kind= dp) :: fac, rdotk
12921291 real (kind= dp) :: rvec_cart(3 )
12931292 real (kind= dp) :: alpha_precond
@@ -1408,8 +1407,8 @@ subroutine internal_search_direction(cdodq_precond_loc, cdqkeep_loc, iter, lprin
14081407 logical , intent (inout ) :: lrandom
14091408
14101409 ! local
1411- complex (kind= dp), external :: zdotc
14121410 integer :: m
1411+ complex (kind= dp) :: zres
14131412
14141413 m = count (dist_k == mpirank(comm))* num_wann* num_wann ! for dimensioning
14151414
@@ -1419,9 +1418,13 @@ subroutine internal_search_direction(cdodq_precond_loc, cdqkeep_loc, iter, lprin
14191418
14201419 ! gcnorm1 = Tr[gradient . gradient] -- NB gradient is anti-Hermitian
14211420 if (wann_control% precond) then
1422- gcnorm1 = real (zdotc(m, cdodq_precond_loc, 1 , cdodq_loc, 1 ), dp)
1421+ ! compute (zdotc) cdodq_precond_loc.cdodq_loc^c
1422+ call zgemv(' c' , m, 1 , cmplx_1, cdodq_precond_loc, m, cdodq_loc, 1 , cmplx_0, zres, 1 )
1423+ gcnorm1 = real (zres, dp)
14231424 else
1424- gcnorm1 = real (zdotc(m, cdodq_loc, 1 , cdodq_loc, 1 ), dp)
1425+ ! compute (zdotc) cdodq_loc.cdodq_loc^c
1426+ call zgemv(' c' , m, 1 , cmplx_1, cdodq_loc, m, cdodq_loc, 1 , cmplx_0, zres, 1 )
1427+ gcnorm1 = real (zres, dp)
14251428 endif
14261429 call comms_allreduce(gcnorm1, 1 , ' SUM' , error, comm)
14271430 if (allocated (error)) return
@@ -1468,7 +1471,9 @@ subroutine internal_search_direction(cdodq_precond_loc, cdqkeep_loc, iter, lprin
14681471
14691472 ! calculate gradient along search direction - Tr[gradient . search direction]
14701473 ! NB gradient is anti-hermitian
1471- doda0 = - real (zdotc(m, cdodq_loc, 1 , cdq_loc, 1 ), dp)
1474+ ! compute (zdotc) cdodq_loc.cdq_loc^c
1475+ call zgemv(' c' , m, 1 , cmplx_1, cdodq_loc, m, cdq_loc, 1 , cmplx_0, zres, 1 )
1476+ doda0 = - real (zres, dp)
14721477
14731478 call comms_allreduce(doda0, 1 , ' SUM' , error, comm)
14741479 if (allocated (error)) return
@@ -1489,7 +1494,9 @@ subroutine internal_search_direction(cdodq_precond_loc, cdqkeep_loc, iter, lprin
14891494 gcfac = 0.0_dp
14901495
14911496 ! re-calculate gradient along search direction
1492- doda0 = - real (zdotc(m, cdodq_loc, 1 , cdq_loc, 1 ), dp)
1497+ ! compute (zdotc) cdodq_loc.cdq_loc^c
1498+ call zgemv(' c' , m, 1 , cmplx_1, cdodq_loc, m, cdq_loc, 1 , cmplx_0, zres, 1 )
1499+ doda0 = - real (zres, dp)
14931500
14941501 call comms_allreduce(doda0, 1 , ' SUM' , error, comm)
14951502 if (allocated (error)) return
0 commit comments