Explicitly construct polarization tensor in memory. This routine is only used to accumulate results from dipole_T and shape it in the correct way.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_electrostatics_type), | intent(inout) | :: | eel |
The electostatic data structure for which the interaction tensor should be computed |
subroutine create_tmat(eel)
!! Explicitly construct polarization tensor in memory. This routine
!! is only used to accumulate results from [[dipole_T]] and shape it in
!! the correct way.
use mod_io, only: print_matrix
use mod_constants, only: OMMP_VERBOSE_HIGH
implicit none
type(ommp_electrostatics_type), intent(inout) :: eel
!! The electostatic data structure for which the
!! interaction tensor should be computed
real(rp), dimension(3, 3) :: tensor
!! Temporary interaction tensor between two sites
integer(ip) :: i, j, ii, jj
call ommp_message("Explicitly computing interaction matrix to solve &
&the polarization system", OMMP_VERBOSE_HIGH)
! Initialize the tensor with zeros
eel%tmat = 0.0_rp
!$omp parallel do default(shared) schedule(dynamic) &
!$omp private(i,j,tensor,ii,jj)
do i = 1, eel%pol_atoms
do j = 1, i
call dipole_T(eel, i, j, tensor)
do ii=1, 3
do jj=1, 3
eel%tmat((j-1)*3+jj, (i-1)*3+ii) = tensor(jj, ii)
eel%tmat((i-1)*3+ii, (j-1)*3+jj) = tensor(jj, ii)
end do
end do
enddo
enddo
! Print the matrix if verbose output is requested
! if(verbose == OMMP_VERBOSE_DEBUG) then
! call print_matrix(.true., 'Polarization tensor:', &
! 3*pol_atoms, 3*pol_atoms, &
! 3*pol_atoms, 3*pol_atoms, TMat)
! end if
end subroutine create_TMat