Perform matrix vector multiplication y = TMat*x, where TMat is polarization matrix (precomputed and stored in memory) and x and y are column vectors
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_electrostatics_type), | intent(in) | :: | eel |
The electostatic data structure |
||
real(kind=rp), | intent(in), | dimension(3*eel%pol_atoms) | :: | x |
Input vector |
|
real(kind=rp), | intent(out), | dimension(3*eel%pol_atoms) | :: | y |
Output vector |
|
logical, | intent(in) | :: | dodiag |
Logical flag (.true. = diagonal is computed, .false. = diagonal is skipped) |
subroutine TMatVec_otf(eel, x, y, dodiag)
!! Perform matrix vector multiplication y = TMat*x,
!! where TMat is polarization matrix (precomputed and stored in memory)
!! and x and y are column vectors
use mod_electrostatics, only: field_extD2D
implicit none
type(ommp_electrostatics_type), intent(in) :: eel
!! The electostatic data structure
real(rp), dimension(3*eel%pol_atoms), intent(in) :: x
!! Input vector
real(rp), dimension(3*eel%pol_atoms), intent(out) :: y
!! Output vector
logical, intent(in) :: dodiag
!! Logical flag (.true. = diagonal is computed, .false. = diagonal is
!! skipped)
y = 0.0_rp
call field_extD2D(eel, x, y)
y = -1.0_rp * y ! Why? TODO
if(dodiag) call TMatVec_diag(eel, x, y)
end subroutine TMatVec_otf