prepare_fixedelec Subroutine

public subroutine prepare_fixedelec(eel, arg_dogg)

Uses

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

This function allocate and populate array of electrostatic properties of static multipoles at static multipoles sites. It should be called blindly before any calculation that requires V_M2M etc.

TODO Improve logic

Arguments

Type IntentOptional Attributes Name
type(ommp_electrostatics_type), intent(inout) :: eel
logical, intent(in), optional :: arg_dogg

Calls

proc~~prepare_fixedelec~~CallsGraph proc~prepare_fixedelec prepare_fixedelec interface~mallocate mallocate proc~prepare_fixedelec->interface~mallocate proc~elec_prop_m2m elec_prop_M2M proc~prepare_fixedelec->proc~elec_prop_m2m proc~time_push time_push proc~prepare_fixedelec->proc~time_push proc~time_pull time_pull proc~prepare_fixedelec->proc~time_pull proc~r_alloc1 r_alloc1 interface~mallocate->proc~r_alloc1 proc~r_alloc3 r_alloc3 interface~mallocate->proc~r_alloc3 proc~i_alloc2 i_alloc2 interface~mallocate->proc~i_alloc2 proc~i_alloc1 i_alloc1 interface~mallocate->proc~i_alloc1 proc~r_alloc2 r_alloc2 interface~mallocate->proc~r_alloc2 proc~i_alloc3 i_alloc3 interface~mallocate->proc~i_alloc3 proc~l_alloc1 l_alloc1 interface~mallocate->proc~l_alloc1 proc~l_alloc2 l_alloc2 interface~mallocate->proc~l_alloc2 proc~coulomb_kernel coulomb_kernel proc~elec_prop_m2m->proc~coulomb_kernel proc~preapare_fmm_static preapare_fmm_static proc~elec_prop_m2m->proc~preapare_fmm_static proc~cart_propfar_at_ipart cart_propfar_at_ipart proc~elec_prop_m2m->proc~cart_propfar_at_ipart proc~quad_elec_prop quad_elec_prop proc~elec_prop_m2m->proc~quad_elec_prop proc~q_elec_prop q_elec_prop proc~elec_prop_m2m->proc~q_elec_prop proc~mu_elec_prop mu_elec_prop proc~elec_prop_m2m->proc~mu_elec_prop proc~mem_stat mem_stat proc~time_push->proc~mem_stat proc~fatal_error fatal_error proc~time_push->proc~fatal_error proc~ommp_message ommp_message proc~time_pull->proc~ommp_message proc~time_pull->proc~mem_stat proc~time_pull->proc~fatal_error proc~memory_init memory_init proc~mem_stat->proc~memory_init proc~coulomb_kernel->proc~fatal_error proc~fatal_error->proc~ommp_message proc~close_output close_output proc~fatal_error->proc~close_output proc~r_alloc1->proc~memory_init proc~chk_alloc chk_alloc proc~r_alloc1->proc~chk_alloc proc~r_alloc3->proc~memory_init proc~r_alloc3->proc~chk_alloc proc~i_alloc2->proc~memory_init proc~i_alloc2->proc~chk_alloc proc~i_alloc1->proc~memory_init proc~i_alloc1->proc~chk_alloc proc~r_alloc2->proc~memory_init proc~r_alloc2->proc~chk_alloc proc~i_alloc3->proc~memory_init proc~i_alloc3->proc~chk_alloc proc~l_alloc1->proc~memory_init proc~l_alloc1->proc~chk_alloc proc~l_alloc2->proc~memory_init proc~l_alloc2->proc~chk_alloc proc~preapare_fmm_static->interface~mallocate interface~mfree mfree proc~preapare_fmm_static->interface~mfree proc~fmm_solve_for_multipoles fmm_solve_for_multipoles proc~preapare_fmm_static->proc~fmm_solve_for_multipoles proc~ntot_sph_harm ntot_sph_harm proc~cart_propfar_at_ipart->proc~ntot_sph_harm proc~fmm_l2l fmm_l2l proc~cart_propfar_at_ipart->proc~fmm_l2l proc~chk_alloc->proc~fatal_error proc~r_free1 r_free1 interface~mfree->proc~r_free1 proc~i_free2 i_free2 interface~mfree->proc~i_free2 proc~i_free1 i_free1 interface~mfree->proc~i_free1 proc~r_free2 r_free2 interface~mfree->proc~r_free2 proc~r_free3 r_free3 interface~mfree->proc~r_free3 proc~i_free3 i_free3 interface~mfree->proc~i_free3 proc~l_free1 l_free1 interface~mfree->proc~l_free1 proc~l_free2 l_free2 interface~mfree->proc~l_free2 proc~fmm_solve_for_multipoles->proc~time_push proc~fmm_solve_for_multipoles->proc~time_pull proc~fmm_solve_for_multipoles->proc~fatal_error proc~tree_l2l tree_l2l proc~fmm_solve_for_multipoles->proc~tree_l2l proc~tree_m2m tree_m2m proc~fmm_solve_for_multipoles->proc~tree_m2m proc~tree_m2l tree_m2l proc~fmm_solve_for_multipoles->proc~tree_m2l proc~tree_p2m tree_p2m proc~fmm_solve_for_multipoles->proc~tree_p2m proc~close_output->proc~ommp_message proc~fmm_l2l_rotation_work fmm_l2l_rotation_work proc~fmm_l2l->proc~fmm_l2l_rotation_work proc~make_vfact make_vfact proc~fmm_l2l->proc~make_vfact proc~carttosph carttosph proc~fmm_l2l_rotation_work->proc~carttosph proc~fmm_l2l_ztranslate_work fmm_l2l_ztranslate_work proc~fmm_l2l_rotation_work->proc~fmm_l2l_ztranslate_work proc~trgev trgev proc~fmm_l2l_rotation_work->proc~trgev proc~fmm_sph_rotate_oxz_work fmm_sph_rotate_oxz_work proc~fmm_l2l_rotation_work->proc~fmm_sph_rotate_oxz_work proc~fmm_sph_rotate_oz_adj_work fmm_sph_rotate_oz_adj_work proc~fmm_l2l_rotation_work->proc~fmm_sph_rotate_oz_adj_work proc~fmm_sph_rotate_oz_work fmm_sph_rotate_oz_work proc~fmm_l2l_rotation_work->proc~fmm_sph_rotate_oz_work proc~tree_l2l->proc~ntot_sph_harm proc~tree_l2l->proc~fmm_l2l proc~chk_free chk_free proc~r_free1->proc~chk_free proc~i_free2->proc~chk_free proc~i_free1->proc~chk_free proc~r_free2->proc~chk_free proc~r_free3->proc~chk_free proc~i_free3->proc~chk_free proc~l_free1->proc~chk_free proc~l_free2->proc~chk_free proc~tree_m2m->proc~ntot_sph_harm proc~fmm_m2m fmm_m2m proc~tree_m2m->proc~fmm_m2m proc~tree_m2l->proc~ntot_sph_harm proc~fmm_m2l fmm_m2l proc~tree_m2l->proc~fmm_m2l proc~tree_p2m->proc~ntot_sph_harm proc~tree_p2m->proc~fmm_m2m proc~fmm_error fmm_error proc~tree_p2m->proc~fmm_error proc~chk_free->proc~fatal_error proc~fmm_m2m_rotation_work fmm_m2m_rotation_work proc~fmm_m2m->proc~fmm_m2m_rotation_work proc~fmm_m2l_rotation_work fmm_m2l_rotation_work proc~fmm_m2l->proc~fmm_m2l_rotation_work proc~fmm_m2m_rotation_work->proc~carttosph proc~fmm_m2m_rotation_work->proc~trgev proc~fmm_m2m_rotation_work->proc~fmm_sph_rotate_oxz_work proc~fmm_m2m_rotation_work->proc~fmm_sph_rotate_oz_adj_work proc~fmm_m2m_rotation_work->proc~fmm_sph_rotate_oz_work proc~fmm_m2m_ztranslate_work fmm_m2m_ztranslate_work proc~fmm_m2m_rotation_work->proc~fmm_m2m_ztranslate_work proc~fmm_m2l_rotation_work->proc~carttosph proc~fmm_m2l_rotation_work->proc~trgev proc~fmm_m2l_rotation_work->proc~fmm_sph_rotate_oxz_work proc~fmm_m2l_rotation_work->proc~fmm_sph_rotate_oz_adj_work proc~fmm_m2l_rotation_work->proc~fmm_sph_rotate_oz_work proc~fmm_m2l_ztranslate_work fmm_m2l_ztranslate_work proc~fmm_m2l_rotation_work->proc~fmm_m2l_ztranslate_work

Called by

proc~~prepare_fixedelec~~CalledByGraph proc~prepare_fixedelec prepare_fixedelec 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~ommp_fixedelec_geomgrad ommp_fixedelec_geomgrad proc~ommp_fixedelec_geomgrad->proc~fixedelec_geomgrad proc~ommp_get_fixedelec_energy ommp_get_fixedelec_energy proc~ommp_get_fixedelec_energy->proc~energy_mm_mm proc~ommp_full_geomgrad ommp_full_geomgrad proc~ommp_full_geomgrad->proc~fixedelec_geomgrad proc~c_ommp_fixedelec_geomgrad C_ommp_fixedelec_geomgrad proc~c_ommp_fixedelec_geomgrad->proc~ommp_fixedelec_geomgrad proc~ommp_get_full_ele_energy ommp_get_full_ele_energy proc~ommp_get_full_ele_energy->proc~ommp_get_fixedelec_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_full_geomgrad C_ommp_full_geomgrad proc~c_ommp_full_geomgrad->proc~ommp_full_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_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 prepare_fixedelec(eel, arg_dogg) 
        !! This function allocate and populate array of electrostatic 
        !! properties of static multipoles at static multipoles sites.
        !! It should be called blindly before any calculation that requires
        !! V_M2M etc.
   
        use mod_memory, only: mallocate

        implicit none

        type(ommp_electrostatics_type), intent(inout) :: eel
        logical, optional, intent(in) :: arg_dogg

        integer(ip) :: mm_atoms
        logical :: do_gg

        mm_atoms = eel%top%mm_atoms

        !! TODO Improve logic
        do_gg = .false.
        if(present(arg_dogg)) then
            if(arg_dogg) do_gg = .true.
        end if

        if(.not. do_gg .and. eel%M2M_done) return
        if(do_gg .and. eel%M2M_done .and. eel%M2Mgg_done) return

        if(eel%amoeba) then
            if(.not. allocated(eel%V_M2M)) then
                call mallocate('prepare_fixedelec [V_M2M]', mm_atoms, eel%V_M2M)
            end if

            if(.not. allocated(eel%E_M2M)) then
                call mallocate('prepare_fixedelec [E_M2M]', 3_ip, mm_atoms, eel%E_M2M)
            end if

            if(.not. allocated(eel%Egrd_M2M)) then
                call mallocate('prepare_fixedelec [Egrd_M2M]', 6_ip, mm_atoms, eel%Egrd_M2M)
            end if
            
            if(do_gg .and. .not. allocated(eel%EHes_M2M)) then
                call mallocate('prepare_fixedelec [EHes_M2M]', 10_ip, mm_atoms, eel%EHes_M2M)
            end if
            
            eel%V_M2M = 0.0_rp
            eel%E_M2M = 0.0_rp
            eel%Egrd_M2M = 0.0_rp
            if(do_gg) eel%EHes_M2M = 0.0_rp
            
            if(do_gg) then
                call time_push
                call elec_prop_M2M(eel, .true., .true., .true., .true.)
                call time_pull('elec prop M2M')
            else
                call elec_prop_M2M(eel, .true., .true., .true., .false.)
            end if
        else
            if(.not. allocated(eel%V_M2M)) then
                call mallocate('prepare_fixedelec [V_M2M]', mm_atoms, eel%V_M2M)
            end if

            if(do_gg .and. .not. allocated(eel%E_M2M)) then
                call mallocate('prepare_fixedelec [E_M2M]', 3_ip, mm_atoms, eel%E_M2M)
            end if

            eel%V_M2M = 0.0_rp
            if(do_gg) eel%E_M2M = 0.0_rp

            if(do_gg) then
                call elec_prop_M2M(eel, .true., .true., .false., .false.)
            else
                call elec_prop_M2M(eel, .true., .false., .false., .false.)
            end if
        end if
        
        eel%M2M_done = .true.
        if(do_gg) eel%M2Mgg_done = .true.

    end subroutine prepare_fixedelec