mu_elec_prop Subroutine

private subroutine mu_elec_prop(mu, dr, kernel, do_V, V, do_E, E, do_grdE, grdE, do_HE, HE)

Arguments

Type IntentOptional Attributes Name
real(kind=rp), intent(in) :: mu(3)

point dipole

real(kind=rp), intent(in) :: dr(3)

Distance vector

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

Array of coulomb kernel (either damped or undamped)

logical, intent(in) :: do_V

Flags to enable/disable calculation of different electrostatic properties

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

Electric potential

logical, intent(in) :: do_E

Flags to enable/disable calculation of different electrostatic properties

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

Electric potential

logical, intent(in) :: do_grdE

Flags to enable/disable calculation of different electrostatic properties

real(kind=rp), intent(inout) :: grdE(6)

Electric potential

logical, intent(in) :: do_HE

Flags to enable/disable calculation of different electrostatic properties

real(kind=rp), intent(inout) :: HE(10)

Electric potential


Called by

proc~~mu_elec_prop~~CalledByGraph proc~mu_elec_prop mu_elec_prop proc~field_extd2d field_extD2D proc~field_extd2d->proc~mu_elec_prop proc~elec_prop_d2m elec_prop_D2M proc~elec_prop_d2m->proc~mu_elec_prop proc~elec_prop_m2m elec_prop_M2M proc~elec_prop_m2m->proc~mu_elec_prop proc~elec_prop_m2d elec_prop_M2D proc~elec_prop_m2d->proc~mu_elec_prop proc~elec_prop_d2d elec_prop_D2D proc~elec_prop_d2d->proc~mu_elec_prop proc~potential_m2e potential_M2E proc~potential_m2e->proc~mu_elec_prop proc~potential_d2e potential_D2E proc~potential_d2e->proc~mu_elec_prop proc~field_m2e field_M2E proc~field_m2e->proc~mu_elec_prop proc~field_d2e field_D2E proc~field_d2e->proc~mu_elec_prop proc~ommp_field_pol2ext ommp_field_pol2ext proc~ommp_field_pol2ext->proc~field_d2e proc~c_ommp_field_pol2ext C_ommp_field_pol2ext proc~c_ommp_field_pol2ext->proc~field_d2e proc~tmatvec_otf TMatVec_otf proc~tmatvec_otf->proc~field_extd2d proc~prepare_polelec prepare_polelec proc~prepare_polelec->proc~elec_prop_d2m proc~prepare_polelec->proc~elec_prop_m2d proc~prepare_polelec->proc~elec_prop_d2d proc~prepare_fixedelec prepare_fixedelec proc~prepare_fixedelec->proc~elec_prop_m2m proc~ommp_potential_mmpol2ext ommp_potential_mmpol2ext proc~ommp_potential_mmpol2ext->proc~potential_m2e proc~ommp_potential_mmpol2ext->proc~potential_d2e proc~ommp_potential_mm2ext ommp_potential_mm2ext proc~ommp_potential_mm2ext->proc~potential_m2e proc~electrostatic_for_ene electrostatic_for_ene proc~electrostatic_for_ene->proc~potential_m2e proc~electrostatic_for_ene->proc~potential_d2e proc~ommp_potential_pol2ext ommp_potential_pol2ext proc~ommp_potential_pol2ext->proc~potential_d2e proc~ommp_field_mmpol2ext ommp_field_mmpol2ext proc~ommp_field_mmpol2ext->proc~field_m2e proc~ommp_field_mmpol2ext->proc~field_d2e proc~electrostatic_for_grad electrostatic_for_grad proc~electrostatic_for_grad->proc~field_m2e proc~electrostatic_for_grad->proc~field_d2e proc~c_ommp_field_mm2ext C_ommp_field_mm2ext proc~c_ommp_field_mm2ext->proc~field_m2e proc~ommp_field_mm2ext ommp_field_mm2ext proc~ommp_field_mm2ext->proc~field_m2e proc~polelec_geomgrad polelec_geomgrad proc~polelec_geomgrad->proc~prepare_polelec proc~ommp_get_polelec_energy ommp_get_polelec_energy proc~ommp_get_polelec_energy->proc~prepare_polelec proc~energy_mm_pol energy_MM_pol proc~ommp_get_polelec_energy->proc~energy_mm_pol proc~ommp_set_external_field ommp_set_external_field proc~ommp_set_external_field->proc~prepare_polelec proc~fixedelec_geomgrad fixedelec_geomgrad proc~fixedelec_geomgrad->proc~prepare_fixedelec proc~energy_mm_pol->proc~prepare_polelec proc~energy_mm_mm energy_MM_MM proc~energy_mm_mm->proc~prepare_fixedelec 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 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_pol2ext C_ommp_potential_pol2ext proc~c_ommp_potential_pol2ext->proc~ommp_potential_pol2ext proc~c_ommp_field_mmpol2ext C_ommp_field_mmpol2ext proc~c_ommp_field_mmpol2ext->proc~ommp_field_mmpol2ext 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~ommp_polelec_geomgrad ommp_polelec_geomgrad proc~ommp_polelec_geomgrad->proc~polelec_geomgrad proc~c_ommp_get_polelec_energy C_ommp_get_polelec_energy proc~c_ommp_get_polelec_energy->proc~ommp_get_polelec_energy proc~ommp_get_full_ele_energy ommp_get_full_ele_energy proc~ommp_get_full_ele_energy->proc~ommp_get_polelec_energy proc~ommp_get_fixedelec_energy ommp_get_fixedelec_energy proc~ommp_get_full_ele_energy->proc~ommp_get_fixedelec_energy proc~ommp_set_external_field_nomm ommp_set_external_field_nomm proc~ommp_set_external_field_nomm->proc~ommp_set_external_field proc~ommp_full_geomgrad ommp_full_geomgrad proc~ommp_full_geomgrad->proc~polelec_geomgrad proc~ommp_full_geomgrad->proc~fixedelec_geomgrad proc~c_ommp_set_external_field_nomm C_ommp_set_external_field_nomm proc~c_ommp_set_external_field_nomm->proc~ommp_set_external_field proc~c_ommp_set_external_field C_ommp_set_external_field proc~c_ommp_set_external_field->proc~ommp_set_external_field proc~ommp_fixedelec_geomgrad ommp_fixedelec_geomgrad proc~ommp_fixedelec_geomgrad->proc~fixedelec_geomgrad proc~ommp_get_fixedelec_energy->proc~energy_mm_mm proc~c_ommp_polelec_geomgrad C_ommp_polelec_geomgrad proc~c_ommp_polelec_geomgrad->proc~ommp_polelec_geomgrad proc~c_ommp_full_geomgrad C_ommp_full_geomgrad proc~c_ommp_full_geomgrad->proc~ommp_full_geomgrad proc~c_ommp_get_full_ele_energy C_ommp_get_full_ele_energy proc~c_ommp_get_full_ele_energy->proc~ommp_get_full_ele_energy proc~c_ommp_fixedelec_geomgrad C_ommp_fixedelec_geomgrad proc~c_ommp_fixedelec_geomgrad->proc~ommp_fixedelec_geomgrad proc~ommp_get_full_energy ommp_get_full_energy proc~ommp_get_full_energy->proc~ommp_get_full_ele_energy proc~c_ommp_get_fixedelec_energy C_ommp_get_fixedelec_energy proc~c_ommp_get_fixedelec_energy->proc~ommp_get_fixedelec_energy proc~c_ommp_get_full_energy C_ommp_get_full_energy proc~c_ommp_get_full_energy->proc~ommp_get_full_energy

Contents

Source Code


Source Code

    subroutine mu_elec_prop(mu, dr, kernel, &
                            do_V, V, do_E, E, do_grdE, grdE, do_HE, HE)
        
        implicit none

        real(rp), intent(in) :: mu(3)
        !! point dipole
        real(rp), intent(in) :: dr(3)
        !! Distance vector
        real(rp), intent(in) :: kernel(:)
        !! Array of coulomb kernel (either damped or undamped)
        logical, intent(in) :: do_V, do_E, do_grdE, do_HE
        !! Flags to enable/disable calculation of different electrostatic 
        !! properties
        real(rp), intent(inout) :: V, E(3), grdE(6), HE(10)
        !! Electric potential
        
        real(rp) :: mu_dot_dr
        
        mu_dot_dr = dot_product(mu, dr)

        if(do_V) then
            V = V + mu_dot_dr * kernel(2)
        end if
        
        if(do_E) then
            E = E + 3.0_rp * mu_dot_dr * dr * kernel(3) - mu * kernel(2)
        end if

        if(do_grdE) then
            ! xx
            grdE(1) = grdE(1) + mu_dot_dr * kernel(4) * 15.0 * dr(1) * dr(1) - &
                              (mu_dot_dr + 2.0 * mu(1) * dr(1)) * 3.0 * kernel(3)
            ! xy
            grdE(2) = grdE(2) + mu_dot_dr * kernel(4) * 15.0 * dr(1) * dr(2) - &
                              (mu(1)*dr(2) + mu(2)*dr(1)) * 3.0 * kernel(3)
            ! yy
            grdE(3) = grdE(3) + mu_dot_dr * kernel(4) * 15.0 * dr(2) * dr(2) - &
                              (mu_dot_dr + 2.0 * mu(2) * dr(2)) * 3.0 * kernel(3)
            ! xz
            grdE(4) = grdE(4) + mu_dot_dr * kernel(4) * 15.0 * dr(1) * dr(3) - &
                              (mu(1)*dr(3) + mu(3)*dr(1)) * 3.0 * kernel(3)
            ! yz
            grdE(5) = grdE(5) + mu_dot_dr * kernel(4) * 15.0 * dr(2) * dr(3) - &
                              (mu(2)*dr(3) + mu(3)*dr(2)) * 3.0 * kernel(3)
            ! zz
            grdE(6) = grdE(6) + mu_dot_dr * kernel(4) * 15.0 * dr(3) * dr(3) - &
                              (mu_dot_dr + 2.0 * mu(3) * dr(3)) * 3.0 * kernel(3)
        end if

        if(do_HE) then
            ! xxx
            HE(1) = HE(1) + 105.0_rp * mu_dot_dr * kernel(5) * dr(1)*dr(1)*dr(1) &
                          - 45.0_rp * kernel(4) * dr(1) * (mu(1)*dr(1) + mu_dot_dr) &
                          + 9.0_rp * kernel(3) * mu(1)
            ! xxy
            HE(2) = HE(2) + 105.0_rp * kernel(5) * mu_dot_dr * dr(1)*dr(1)*dr(2) &
                          - 15.0_rp * kernel(4) * (mu(2)*dr(1)*dr(1) + &
                                                   2.0_rp *mu(1)*dr(1)*dr(2) + &
                                                   mu_dot_dr*dr(2)) &
                          + 3.0_rp * kernel(3) * mu(2)

            ! xxz
            HE(3) = HE(3) + 105.0_rp * kernel(5) * mu_dot_dr * dr(1)*dr(1)*dr(3) &
                          - 15.0_rp * kernel(4) * (mu(3)*dr(1)*dr(1) + &
                                                   2.0_rp *mu(1)*dr(1)*dr(3) + &
                                                   mu_dot_dr*dr(3)) &
                          + 3.0_rp * kernel(3) * mu(3)
            ! xyy
            HE(4) = HE(4) + 105.0_rp * kernel(5) * mu_dot_dr * dr(2)*dr(2)*dr(1) &
                          - 15.0_rp * kernel(4) * (mu(1)*dr(2)*dr(2) + &
                                                   2.0_rp *mu(2)*dr(2)*dr(1) + &
                                                   mu_dot_dr*dr(1)) &
                          + 3.0_rp * kernel(3) * mu(1)
            ! xyz
            HE(5) = HE(5) + 105.0_rp * mu_dot_dr * kernel(5) * dr(1)*dr(2)*dr(3) &
                          - 15.0_rp * kernel(4) * (mu(1)*dr(2)*dr(3) + &
                                                   dr(1)*mu(2)*dr(3) + &
                                                   dr(1)*dr(2)*mu(3))
            ! xzz
            HE(6) = HE(6) + 105.0_rp * kernel(5) * mu_dot_dr * dr(3)*dr(3)*dr(1) &
                          - 15.0_rp * kernel(4) * (mu(1)*dr(3)*dr(3) + &
                                                   2.0_rp *mu(3)*dr(3)*dr(1) + &
                                                   mu_dot_dr*dr(1)) &
                          + 3.0_rp * kernel(3) * mu(1)
            ! yyy
            HE(7) = HE(7) + 105.0_rp * mu_dot_dr * kernel(5) * dr(2)*dr(2)*dr(2) &
                          - 45.0_rp * kernel(4) * dr(2) * (mu(2)*dr(2) + mu_dot_dr) &
                          + 9.0_rp * kernel(3) * mu(2)
            ! yyz
            HE(8) = HE(8) + 105.0_rp * kernel(5) * mu_dot_dr * dr(2)*dr(2)*dr(3) &
                          - 15.0_rp * kernel(4) * (mu(3)*dr(2)*dr(2) + &
                                                   2.0_rp *mu(2)*dr(2)*dr(3) + &
                                                   mu_dot_dr*dr(3)) &
                          + 3.0_rp * kernel(3) * mu(3)
            ! yzz
            HE(9) = HE(9) + 105.0_rp * kernel(5) * mu_dot_dr * dr(3)*dr(3)*dr(2) &
                          - 15.0_rp * kernel(4) * (mu(2)*dr(3)*dr(3) + &
                                                   2.0_rp *mu(3)*dr(3)*dr(2) + &
                                                   mu_dot_dr*dr(2)) &
                          + 3.0_rp * kernel(3) * mu(2)
            ! zzz
            HE(10) = HE(10) + 105.0_rp * mu_dot_dr * kernel(5) * dr(3)*dr(3)*dr(3) &
                            - 45.0_rp * kernel(4) * dr(3) * (mu(3)*dr(3) + mu_dot_dr) &
                            + 9.0_rp * kernel(3) * mu(3)
        end if
    end subroutine mu_elec_prop