field_D2E Subroutine

public subroutine field_D2E(eel, cpt, E)

This subroutine computes the potential generated by the static multipoles to a set of arbitrary coordinates, without applying any screening rules.

Arguments

Type IntentOptional Attributes Name
type(ommp_electrostatics_type), intent(in) :: eel

Electrostatics data structure

real(kind=rp), intent(in) :: cpt(:,:)

Coordinates at which the electric field is requested

real(kind=rp), intent(inout) :: E(:,:)

Electric field (results will be added)


Calls

proc~~field_d2e~~CallsGraph proc~field_d2e field_D2E proc~fatal_error fatal_error proc~field_d2e->proc~fatal_error proc~mu_elec_prop mu_elec_prop proc~field_d2e->proc~mu_elec_prop proc~coulomb_kernel coulomb_kernel proc~field_d2e->proc~coulomb_kernel proc~ommp_message ommp_message proc~fatal_error->proc~ommp_message proc~close_output close_output proc~fatal_error->proc~close_output proc~coulomb_kernel->proc~fatal_error proc~close_output->proc~ommp_message

Called by

proc~~field_d2e~~CalledByGraph proc~field_d2e field_D2E proc~electrostatic_for_grad electrostatic_for_grad proc~electrostatic_for_grad->proc~field_d2e proc~c_ommp_field_pol2ext C_ommp_field_pol2ext proc~c_ommp_field_pol2ext->proc~field_d2e proc~ommp_field_mmpol2ext ommp_field_mmpol2ext proc~ommp_field_mmpol2ext->proc~field_d2e proc~ommp_field_pol2ext ommp_field_pol2ext proc~ommp_field_pol2ext->proc~field_d2e proc~c_ommp_prepare_qm_ele_grd C_ommp_prepare_qm_ele_grd proc~c_ommp_prepare_qm_ele_grd->proc~electrostatic_for_grad proc~c_ommp_field_mmpol2ext C_ommp_field_mmpol2ext proc~c_ommp_field_mmpol2ext->proc~ommp_field_mmpol2ext

Contents

Source Code


Source Code

    subroutine field_D2E(eel, cpt, E)
        !! This subroutine computes the potential generated by the static
        !! multipoles to a set of arbitrary coordinates, without applying
        !! any screening rules.
        
        implicit none

        type(ommp_electrostatics_type), intent(in) :: eel
        !! Electrostatics data structure
        real(rp), intent(inout) :: E(:,:)
        !! Electric field (results will be added)
        real(rp), intent(in) :: cpt(:,:)
        !! Coordinates at which the electric field is requested

        integer(ip) :: i, j, n_cpt
        real(rp) :: kernel(5), dr(3), tmpV, tmpE(3), tmpEgr(6), tmpHE(10)

        if(eel%pol_atoms < 1) return

        if(.not. eel%ipd_done) call fatal_error("IPD should be computed before&
                                                & computing D2E field.")
        n_cpt = size(cpt, 2)

        if(eel%amoeba) then
            !$omp parallel do default(shared) schedule(dynamic) &
            !$omp private(i,j,dr,kernel,tmpV,tmpE,tmpEgr,tmpHE) reduction(+:E)
            do i=1, eel%pol_atoms
                do j=1, n_cpt
                    dr = cpt(:,j) - eel%cpol(:,i)
                    call coulomb_kernel(dr, 3, kernel)
                    tmpE = 0.0_rp
                    !TODO
                    call mu_elec_prop(0.5*(eel%ipd(:,i, _amoeba_P_) + eel%ipd(:,i, _amoeba_D_)), dr, kernel, .false., tmpV, &
                                      .true., tmpE, .false., tmpEgr, & 
                                      .false., tmpHE)

                    E(:,j) = E(:,j) + tmpE 
                end do
            end do
        else
            !$omp parallel do default(shared) schedule(dynamic) &
            !$omp private(i,j,dr,kernel,tmpV,tmpE,tmpEgr,tmpHE) reduction(+:E)
            do i=1, eel%pol_atoms
                ! loop on sources
                do j=1, n_cpt
                    dr = cpt(:,j) - eel%cpol(:,i)
                    call coulomb_kernel(dr, 3, kernel)
                    tmpE = 0.0_rp
                    
                    call mu_elec_prop(eel%ipd(:,i,1), dr, kernel, .false., tmpV, &
                                     .true., tmpE, .false., tmpEgr, & 
                                     .false., tmpHE)
                    
                    E(:,j) = E(:,j) + tmpE
                end do
            end do
        end if
    end subroutine field_D2E