coulomb_kernel Subroutine

public subroutine coulomb_kernel(dr, maxder, res)

Uses

  • proc~~coulomb_kernel~~UsesGraph proc~coulomb_kernel coulomb_kernel module~mod_io mod_io proc~coulomb_kernel->module~mod_io module~mod_constants mod_constants proc~coulomb_kernel->module~mod_constants module~mod_memory mod_memory proc~coulomb_kernel->module~mod_memory module~mod_io->module~mod_constants iso_c_binding iso_c_binding module~mod_constants->iso_c_binding module~mod_memory->module~mod_io module~mod_memory->module~mod_constants module~mod_memory->iso_c_binding

This function compute the coulomb kernel for the distance vector dr and its derivative up to the value required by maxder.

Arguments

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

Distance vector from atom i to atom j

integer(kind=ip), intent(in) :: maxder

Maximum derivative to be computed

real(kind=rp), intent(out), dimension(maxder+1) :: res

Results vector


Calls

proc~~coulomb_kernel~~CallsGraph proc~coulomb_kernel coulomb_kernel 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~~coulomb_kernel~~CalledByGraph proc~coulomb_kernel coulomb_kernel proc~damped_coulomb_kernel damped_coulomb_kernel proc~damped_coulomb_kernel->proc~coulomb_kernel proc~potential_d2e potential_D2E proc~potential_d2e->proc~coulomb_kernel proc~field_m2e field_M2E proc~field_m2e->proc~coulomb_kernel proc~potential_m2e potential_M2E proc~potential_m2e->proc~coulomb_kernel proc~elec_prop_m2m elec_prop_M2M proc~elec_prop_m2m->proc~coulomb_kernel proc~field_d2e field_D2E proc~field_d2e->proc~coulomb_kernel proc~electrostatic_for_ene electrostatic_for_ene proc~electrostatic_for_ene->proc~coulomb_kernel proc~electrostatic_for_ene->proc~potential_d2e proc~electrostatic_for_ene->proc~potential_m2e proc~electrostatic_for_grad electrostatic_for_grad proc~electrostatic_for_grad->proc~coulomb_kernel proc~electrostatic_for_grad->proc~field_m2e proc~electrostatic_for_grad->proc~field_d2e 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~c_ommp_prepare_qm_ele_grd C_ommp_prepare_qm_ele_grd proc~c_ommp_prepare_qm_ele_grd->proc~electrostatic_for_grad proc~dipole_t dipole_T proc~dipole_t->proc~damped_coulomb_kernel proc~elec_prop_d2m elec_prop_D2M proc~elec_prop_d2m->proc~damped_coulomb_kernel proc~field_extd2d field_extD2D proc~field_extd2d->proc~damped_coulomb_kernel proc~elec_prop_m2d elec_prop_M2D proc~elec_prop_m2d->proc~damped_coulomb_kernel proc~elec_prop_d2d elec_prop_D2D proc~elec_prop_d2d->proc~damped_coulomb_kernel proc~ommp_potential_mmpol2ext ommp_potential_mmpol2ext proc~ommp_potential_mmpol2ext->proc~potential_d2e proc~ommp_potential_mmpol2ext->proc~potential_m2e 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~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~ommp_potential_mm2ext ommp_potential_mm2ext proc~ommp_potential_mm2ext->proc~potential_m2e proc~prepare_fixedelec prepare_fixedelec proc~prepare_fixedelec->proc~elec_prop_m2m 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~create_tmat create_tmat proc~create_tmat->proc~dipole_t 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~c_ommp_potential_pol2ext C_ommp_potential_pol2ext proc~c_ommp_potential_pol2ext->proc~ommp_potential_pol2ext proc~c_ommp_potential_mmpol2ext C_ommp_potential_mmpol2ext proc~c_ommp_potential_mmpol2ext->proc~ommp_potential_mmpol2ext proc~tmatvec_otf TMatVec_otf proc~tmatvec_otf->proc~field_extd2d proc~c_ommp_field_mmpol2ext C_ommp_field_mmpol2ext proc~c_ommp_field_mmpol2ext->proc~ommp_field_mmpol2ext proc~c_ommp_potential_mm2ext C_ommp_potential_mm2ext proc~c_ommp_potential_mm2ext->proc~ommp_potential_mm2ext proc~fixedelec_geomgrad fixedelec_geomgrad proc~fixedelec_geomgrad->proc~prepare_fixedelec proc~energy_mm_mm energy_MM_MM proc~energy_mm_mm->proc~prepare_fixedelec proc~polarization polarization proc~polarization->proc~create_tmat proc~ommp_get_polelec_energy ommp_get_polelec_energy proc~ommp_get_polelec_energy->proc~prepare_polelec proc~ommp_get_polelec_energy->proc~polarization 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~ommp_set_external_field->proc~polarization proc~polelec_geomgrad polelec_geomgrad proc~polelec_geomgrad->proc~prepare_polelec proc~polelec_geomgrad->proc~polarization proc~energy_mm_pol->proc~prepare_polelec proc~ommp_fixedelec_geomgrad ommp_fixedelec_geomgrad proc~ommp_fixedelec_geomgrad->proc~fixedelec_geomgrad proc~ommp_full_geomgrad ommp_full_geomgrad proc~ommp_full_geomgrad->proc~fixedelec_geomgrad proc~ommp_full_geomgrad->proc~polelec_geomgrad proc~ommp_get_fixedelec_energy ommp_get_fixedelec_energy proc~ommp_get_fixedelec_energy->proc~energy_mm_mm 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_full_ele_energy->proc~ommp_get_fixedelec_energy proc~c_ommp_get_polelec_energy C_ommp_get_polelec_energy proc~c_ommp_get_polelec_energy->proc~ommp_get_polelec_energy proc~ommp_set_external_field_nomm ommp_set_external_field_nomm proc~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~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~ommp_polelec_geomgrad ommp_polelec_geomgrad proc~ommp_polelec_geomgrad->proc~polelec_geomgrad proc~c_ommp_fixedelec_geomgrad C_ommp_fixedelec_geomgrad proc~c_ommp_fixedelec_geomgrad->proc~ommp_fixedelec_geomgrad proc~c_ommp_full_geomgrad C_ommp_full_geomgrad proc~c_ommp_full_geomgrad->proc~ommp_full_geomgrad proc~c_ommp_get_fixedelec_energy C_ommp_get_fixedelec_energy proc~c_ommp_get_fixedelec_energy->proc~ommp_get_fixedelec_energy proc~ommp_get_full_energy ommp_get_full_energy proc~ommp_get_full_energy->proc~ommp_get_full_ele_energy proc~c_ommp_polelec_geomgrad C_ommp_polelec_geomgrad proc~c_ommp_polelec_geomgrad->proc~ommp_polelec_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_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 coulomb_kernel(dr, maxder, res)
        !! This function compute the coulomb kernel for the distance vector dr and 
        !! its derivative up to the value required by maxder.
        use mod_memory, only: ip, rp
        use mod_io, only: fatal_error
        use mod_constants, only: eps_rp

        implicit none

        real(rp), intent(in) :: dr(3)
        !! Distance vector from atom i to atom j
        integer(ip), intent(in) :: maxder
        !! Maximum derivative to be computed
        real(rp), intent(out), dimension(maxder+1) :: res
        !! Results vector
        
        integer(ip) :: ii
        real(rp) :: norm2_r, inv_norm_sq 

        if(maxder < 0) then
            ! Strange request, maybe a warning should be printed
            return 
        end if
        
        norm2_r = sqrt(dr(1)*dr(1) + dr(2)*dr(2) + dr(3)*dr(3))
        if(norm2_r < eps_rp) then
            call fatal_error("Requesting Coulomb kernel for two atoms &
                             &placed in the same point, this could be &
                             &an internal bug or a problem in your input &
                             &file, please check.")
        end if
        res(1) = 1.0_rp / norm2_r
        inv_norm_sq = res(1) * res(1)

        do ii = 1, maxder
            res(ii+1) = res(ii) * inv_norm_sq
        end do
        
    end subroutine coulomb_kernel