potential_M2E Subroutine

public subroutine potential_M2E(eel, cpt, V)

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) :: V(:)

Electric field (results will be added)


Calls

proc~~potential_m2e~~CallsGraph proc~potential_m2e potential_M2E proc~coulomb_kernel coulomb_kernel proc~potential_m2e->proc~coulomb_kernel proc~mu_elec_prop mu_elec_prop proc~potential_m2e->proc~mu_elec_prop proc~quad_elec_prop quad_elec_prop proc~potential_m2e->proc~quad_elec_prop proc~q_elec_prop q_elec_prop proc~potential_m2e->proc~q_elec_prop proc~fatal_error fatal_error proc~coulomb_kernel->proc~fatal_error proc~ommp_message ommp_message proc~fatal_error->proc~ommp_message proc~close_output close_output proc~fatal_error->proc~close_output proc~close_output->proc~ommp_message

Called by

proc~~potential_m2e~~CalledByGraph proc~potential_m2e potential_M2E proc~electrostatic_for_ene electrostatic_for_ene proc~electrostatic_for_ene->proc~potential_m2e proc~ommp_potential_mmpol2ext ommp_potential_mmpol2ext proc~ommp_potential_mmpol2ext->proc~potential_m2e proc~ommp_potential_mm2ext ommp_potential_mm2ext proc~ommp_potential_mm2ext->proc~potential_m2e proc~c_ommp_prepare_qm_ele_ene C_ommp_prepare_qm_ele_ene proc~c_ommp_prepare_qm_ele_ene->proc~electrostatic_for_ene proc~c_ommp_potential_mmpol2ext C_ommp_potential_mmpol2ext proc~c_ommp_potential_mmpol2ext->proc~ommp_potential_mmpol2ext proc~c_ommp_potential_mm2ext C_ommp_potential_mm2ext proc~c_ommp_potential_mm2ext->proc~ommp_potential_mm2ext

Contents

Source Code


Source Code

    subroutine potential_M2E(eel, cpt, V)
        !! 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) :: V(:)
        !! 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)

        n_cpt = size(cpt, 2)

        if(eel%amoeba) then
            !$omp parallel do default(shared) schedule(dynamic) collapse(2) &
            !$omp private(i,j,dr,kernel,tmpV,tmpE,tmpEgr,tmpHE) reduction(+:V)
            do i=1, eel%top%mm_atoms
                do j=1, n_cpt
                    dr = cpt(:,j) - eel%top%cmm(:,i)
                    call coulomb_kernel(dr, 2, kernel(1:3))
                    tmpV = 0.0_rp
                    
                    call q_elec_prop(eel%q(1,i), dr, kernel, .true., tmpV, &
                                     .false., tmpE, .false., tmpEgr, & 
                                     .false., tmpHE)
                    call mu_elec_prop(eel%q(2:4,i), dr, kernel, .true., tmpV, &
                                      .false., tmpE, .false., tmpEgr, & 
                                      .false., tmpHE)
                    call quad_elec_prop(eel%q(5:10,i), dr, kernel, .true., tmpV, &
                                        .false., tmpE, .false., tmpEgr, & 
                                        .false., tmpHE)

                    V(j) = V(j) + tmpV
                end do
            end do
        else
            !$omp parallel do default(shared) schedule(dynamic) collapse(2) &
            !$omp private(i,j,dr,kernel,tmpV,tmpE,tmpEgr,tmpHE) reduction(+:V)
            do i=1, eel%top%mm_atoms
                ! loop on sources
                do j=1, n_cpt
                    dr = cpt(:,j) - eel%top%cmm(:,i)
                    call coulomb_kernel(dr, 1, kernel(1:2))
                    tmpV = 0.0_rp
                    
                    call q_elec_prop(eel%q(1,i), dr, kernel, .true., tmpV, &
                                     .false., tmpE, .false., tmpEgr, & 
                                     .false., tmpHE)
                    
                    V(j) = V(j) + tmpV
                end do
            end do
        end if
    end subroutine potential_M2E