mmpol_prepare Subroutine

public subroutine mmpol_prepare(sys_obj)

Uses

  • proc~~mmpol_prepare~~UsesGraph proc~mmpol_prepare mmpol_prepare module~mod_profiling mod_profiling proc~mmpol_prepare->module~mod_profiling module~mod_constants mod_constants proc~mmpol_prepare->module~mod_constants module~mod_electrostatics mod_electrostatics proc~mmpol_prepare->module~mod_electrostatics module~mod_adjacency_mat mod_adjacency_mat proc~mmpol_prepare->module~mod_adjacency_mat module~mod_io mod_io proc~mmpol_prepare->module~mod_io module~mod_profiling->module~mod_constants module~mod_profiling->module~mod_io module~mod_memory mod_memory module~mod_profiling->module~mod_memory iso_c_binding iso_c_binding module~mod_constants->iso_c_binding module~mod_electrostatics->module~mod_profiling module~mod_electrostatics->module~mod_constants module~mod_electrostatics->module~mod_adjacency_mat module~mod_electrostatics->module~mod_io module~mod_electrostatics->module~mod_memory module~fmmlib_interface fmmlib_interface module~mod_electrostatics->module~fmmlib_interface module~mod_topology mod_topology module~mod_electrostatics->module~mod_topology module~mod_adjacency_mat->module~mod_memory module~mod_io->module~mod_constants module~mod_memory->module~mod_constants module~mod_memory->module~mod_io module~mod_memory->iso_c_binding module~fmmlib_interface->module~mod_constants module~mod_tree mod_tree module~fmmlib_interface->module~mod_tree module~mod_ribtree mod_ribtree module~fmmlib_interface->module~mod_ribtree module~mod_harmonics mod_harmonics module~fmmlib_interface->module~mod_harmonics module~mod_fmm_utils mod_fmm_utils module~fmmlib_interface->module~mod_fmm_utils module~mod_fmm mod_fmm module~fmmlib_interface->module~mod_fmm module~mod_octatree mod_octatree module~fmmlib_interface->module~mod_octatree module~mod_topology->module~mod_adjacency_mat module~mod_topology->module~mod_memory module~mod_tree->module~mod_constants module~mod_tree->module~mod_adjacency_mat module~mod_tree->module~mod_fmm_utils module~mod_ribtree->module~mod_profiling module~mod_ribtree->module~mod_constants module~mod_ribtree->module~mod_tree module~mod_ribtree->module~mod_fmm_utils module~mod_harmonics->module~mod_constants module~mod_harmonics->module~mod_fmm_utils module~mod_fmm_utils->module~mod_constants module~mod_fmm->module~mod_constants module~mod_fmm->module~mod_tree module~mod_fmm->module~mod_harmonics module~mod_fmm->module~mod_fmm_utils module~mod_octatree->module~mod_profiling module~mod_octatree->module~mod_constants module~mod_octatree->module~mod_tree module~mod_octatree->module~mod_fmm_utils

Compute some derived quantities from the input that are used during the calculation. The upstream code have to provide cmm, q, pol, adjacency matrix and in the case of AMOEBA also multipoles rotation information, and polarization group information.
This routine
* compute connectivity lists from connected atoms
* invert polar_mm list creating mm_polar
* populate cpol list of coordinates
* compute factors for thole damping
* scales by 1/3 AMOEBA quadrupoles (?)
* Build list for polarization groups, compute groups connectivity
* performs multipoles rotation

Arguments

Type IntentOptional Attributes Name
type(ommp_system), intent(inout) :: sys_obj

The system object to bi initialized


Calls

proc~~mmpol_prepare~~CallsGraph proc~mmpol_prepare mmpol_prepare proc~rotate_multipoles rotate_multipoles proc~mmpol_prepare->proc~rotate_multipoles proc~make_screening_lists make_screening_lists proc~mmpol_prepare->proc~make_screening_lists proc~ommp_message ommp_message proc~mmpol_prepare->proc~ommp_message proc~remove_null_pol remove_null_pol proc~mmpol_prepare->proc~remove_null_pol proc~time_pull time_pull proc~mmpol_prepare->proc~time_pull proc~time_push time_push proc~mmpol_prepare->proc~time_push proc~copy_yale_sparse copy_yale_sparse proc~mmpol_prepare->proc~copy_yale_sparse proc~build_conn_upto_n build_conn_upto_n proc~mmpol_prepare->proc~build_conn_upto_n proc~thole_init thole_init proc~mmpol_prepare->proc~thole_init proc~reverse_grp_tab reverse_grp_tab proc~mmpol_prepare->proc~reverse_grp_tab proc~build_pg_adjacency_matrix build_pg_adjacency_matrix proc~mmpol_prepare->proc~build_pg_adjacency_matrix proc~fmm_coordinates_update fmm_coordinates_update proc~mmpol_prepare->proc~fmm_coordinates_update proc~rotation_matrix rotation_matrix proc~rotate_multipoles->proc~rotation_matrix interface~mallocate mallocate proc~make_screening_lists->interface~mallocate proc~fmm_make_neigh_list fmm_make_neigh_list proc~make_screening_lists->proc~fmm_make_neigh_list proc~compress_list compress_list proc~make_screening_lists->proc~compress_list proc~fmm_list_are_near fmm_list_are_near proc~make_screening_lists->proc~fmm_list_are_near interface~mfree mfree proc~make_screening_lists->interface~mfree proc~screening_rules screening_rules proc~make_screening_lists->proc~screening_rules proc~compress_data compress_data proc~make_screening_lists->proc~compress_data proc~free_yale_sparse free_yale_sparse proc~make_screening_lists->proc~free_yale_sparse proc~remove_null_pol->proc~ommp_message proc~remove_null_pol->interface~mallocate proc~remove_null_pol->interface~mfree proc~time_pull->proc~ommp_message proc~fatal_error fatal_error proc~time_pull->proc~fatal_error proc~mem_stat mem_stat proc~time_pull->proc~mem_stat proc~time_push->proc~fatal_error proc~time_push->proc~mem_stat proc~build_conn_upto_n->proc~copy_yale_sparse proc~sparse_identity sparse_identity proc~build_conn_upto_n->proc~sparse_identity proc~mat_andnot mat_andnot proc~build_conn_upto_n->proc~mat_andnot proc~build_conn_upto_n->proc~free_yale_sparse proc~mat_mult mat_mult proc~build_conn_upto_n->proc~mat_mult proc~thole_init->proc~ommp_message proc~thole_init->proc~fatal_error proc~reverse_grp_tab->interface~mallocate proc~reverse_grp_tab->proc~compress_list proc~reverse_grp_tab->interface~mfree proc~reallocate_mat reallocate_mat proc~build_pg_adjacency_matrix->proc~reallocate_mat proc~fmm_coordinates_update->proc~ommp_message proc~fmm_coordinates_update->proc~time_pull proc~fmm_coordinates_update->proc~time_push proc~init_as_octatree init_as_octatree proc~fmm_coordinates_update->proc~init_as_octatree proc~fmm_init fmm_init proc~fmm_coordinates_update->proc~fmm_init proc~fmm_coordinates_update->proc~fmm_make_neigh_list proc~free_fmm free_fmm proc~fmm_coordinates_update->proc~free_fmm proc~free_tree free_tree proc~fmm_coordinates_update->proc~free_tree proc~fmm_error fmm_error proc~init_as_octatree->proc~fmm_error proc~populate_level_list populate_level_list proc~init_as_octatree->proc~populate_level_list proc~tree_populate_farnear_lists tree_populate_farnear_lists proc~init_as_octatree->proc~tree_populate_farnear_lists proc~allocate_tree allocate_tree proc~init_as_octatree->proc~allocate_tree proc~populate_leaf_list populate_leaf_list proc~init_as_octatree->proc~populate_leaf_list proc~ntot_sph_harm ntot_sph_harm proc~fmm_init->proc~ntot_sph_harm proc~prepare_fmmm_constants prepare_fmmm_constants proc~fmm_init->proc~prepare_fmmm_constants proc~i_alloc1 i_alloc1 interface~mallocate->proc~i_alloc1 proc~l_alloc2 l_alloc2 interface~mallocate->proc~l_alloc2 proc~i_alloc3 i_alloc3 interface~mallocate->proc~i_alloc3 proc~r_alloc2 r_alloc2 interface~mallocate->proc~r_alloc2 proc~r_alloc1 r_alloc1 interface~mallocate->proc~r_alloc1 proc~i_alloc2 i_alloc2 interface~mallocate->proc~i_alloc2 proc~r_alloc3 r_alloc3 interface~mallocate->proc~r_alloc3 proc~l_alloc1 l_alloc1 interface~mallocate->proc~l_alloc1 proc~fmm_make_neigh_list->interface~mallocate proc~fmm_make_neigh_list->proc~compress_list proc~fmm_make_neigh_list->interface~mfree proc~compress_list->interface~mallocate proc~compress_list->interface~mfree proc~l_free1 l_free1 interface~mfree->proc~l_free1 proc~i_free2 i_free2 interface~mfree->proc~i_free2 proc~r_free3 r_free3 interface~mfree->proc~r_free3 proc~r_free2 r_free2 interface~mfree->proc~r_free2 proc~l_free2 l_free2 interface~mfree->proc~l_free2 proc~i_free3 i_free3 interface~mfree->proc~i_free3 proc~i_free1 i_free1 interface~mfree->proc~i_free1 proc~r_free1 r_free1 interface~mfree->proc~r_free1 proc~fatal_error->proc~ommp_message proc~close_output close_output proc~fatal_error->proc~close_output proc~mat_andnot->proc~reallocate_mat proc~free_tree->proc~free_yale_sparse proc~rotation_matrix->proc~fatal_error proc~screening_rules->proc~fatal_error proc~compress_data->interface~mallocate proc~memory_init memory_init proc~mem_stat->proc~memory_init proc~mat_mult->proc~reallocate_mat proc~chk_free chk_free proc~l_free1->proc~chk_free proc~i_alloc1->proc~memory_init proc~chk_alloc chk_alloc proc~i_alloc1->proc~chk_alloc proc~l_alloc2->proc~memory_init proc~l_alloc2->proc~chk_alloc proc~i_alloc3->proc~memory_init proc~i_alloc3->proc~chk_alloc proc~i_free2->proc~chk_free proc~r_free3->proc~chk_free proc~populate_level_list->proc~compress_list proc~tree_populate_farnear_lists->proc~compress_list proc~aggregative_pass aggregative_pass proc~tree_populate_farnear_lists->proc~aggregative_pass proc~allocate_tree->proc~fmm_error proc~allocate_yale_sparse allocate_yale_sparse proc~allocate_tree->proc~allocate_yale_sparse proc~r_free2->proc~chk_free proc~l_free2->proc~chk_free proc~close_output->proc~ommp_message proc~i_free3->proc~chk_free proc~i_free1->proc~chk_free proc~r_free1->proc~chk_free proc~r_alloc2->proc~memory_init proc~r_alloc2->proc~chk_alloc proc~make_vscales make_vscales proc~prepare_fmmm_constants->proc~make_vscales proc~make_vcnk make_vcnk proc~prepare_fmmm_constants->proc~make_vcnk proc~make_m2l_ztranslate_coef make_m2l_ztranslate_coef proc~prepare_fmmm_constants->proc~make_m2l_ztranslate_coef proc~r_alloc1->proc~memory_init proc~r_alloc1->proc~chk_alloc proc~i_alloc2->proc~memory_init proc~i_alloc2->proc~chk_alloc proc~r_alloc3->proc~memory_init proc~r_alloc3->proc~chk_alloc proc~l_alloc1->proc~memory_init proc~l_alloc1->proc~chk_alloc proc~chk_free->proc~fatal_error proc~chk_alloc->proc~fatal_error proc~make_m2l_ztranslate_coef->proc~make_vcnk

Called by

proc~~mmpol_prepare~~CalledByGraph proc~mmpol_prepare mmpol_prepare proc~mmpol_init_from_mmp mmpol_init_from_mmp proc~mmpol_init_from_mmp->proc~mmpol_prepare proc~mmpol_init_from_xyz mmpol_init_from_xyz proc~mmpol_init_from_xyz->proc~mmpol_prepare proc~ommp_system_from_qm_helper ommp_system_from_qm_helper proc~ommp_system_from_qm_helper->proc~mmpol_prepare proc~ommp_init_mmp ommp_init_mmp proc~ommp_init_mmp->proc~mmpol_init_from_mmp proc~c_ommp_system_from_qm_helper C_ommp_system_from_qm_helper proc~c_ommp_system_from_qm_helper->proc~ommp_system_from_qm_helper proc~ommp_init_xyz ommp_init_xyz proc~ommp_init_xyz->proc~mmpol_init_from_xyz proc~c_ommp_init_mmp C_ommp_init_mmp proc~c_ommp_init_mmp->proc~ommp_init_mmp proc~c_ommp_init_xyz C_ommp_init_xyz proc~c_ommp_init_xyz->proc~ommp_init_xyz

Contents

Source Code


Source Code

    subroutine mmpol_prepare(sys_obj)
        !! Compute some derived quantities from the input that 
        !! are used during the calculation. The upstream code have
        !! to provide cmm, q, pol, adjacency matrix and in
        !! the case of AMOEBA also multipoles rotation information, and 
        !! polarization group information.   
        !! This routine    
        !!   * compute connectivity lists from connected atoms    
        !!   * invert polar_mm list creating mm_polar   
        !!   * populate cpol list of coordinates   
        !!   * compute factors for thole damping    
        !!   * scales by 1/3 AMOEBA quadrupoles (?)    
        !!   * Build list for polarization groups, compute groups connectivity   
        !!   * performs multipoles rotation   

        use mod_adjacency_mat, only: build_conn_upto_n, copy_yale_sparse, reverse_grp_tab
        use mod_io, only: ommp_message
        use mod_profiling, only: time_push, time_pull
        use mod_constants, only: OMMP_VERBOSE_DEBUG
        use mod_electrostatics, only: thole_init, remove_null_pol, &
                                      make_screening_lists, fmm_coordinates_update

        implicit none
        
        type(ommp_system), intent(inout) :: sys_obj
        !! The system object to bi initialized

        integer(ip) :: i
        
        type(yale_sparse) :: adj, pg_adj

        call time_push()
        call ommp_message("Building connectivity lists", OMMP_VERBOSE_DEBUG)
        
        ! compute connectivity lists from connected atoms
        if(size(sys_obj%top%conn) < 4) then
            call copy_yale_sparse(sys_obj%top%conn(1), adj)
            deallocate(sys_obj%top%conn)
            call build_conn_upto_n(adj, 4, sys_obj%top%conn, .false.)
        end if

        call remove_null_pol(sys_obj%eel)
       
        ! invert mm_polar list creating mm_polar
        sys_obj%eel%mm_polar(:) = 0
        if(sys_obj%eel%pol_atoms > 0) then
            call ommp_message("Creating MM->polar and polar->MM lists", &
                              OMMP_VERBOSE_DEBUG)
            !$omp parallel do default(shared) private(i)
            do i = 1, sys_obj%eel%pol_atoms
                sys_obj%eel%mm_polar(sys_obj%eel%polar_mm(i)) = i
            end do

            call ommp_message("Populating coordinates of polarizable atoms", &
                              OMMP_VERBOSE_DEBUG)
            ! populate cpol list of coordinates
            !$omp parallel do default(shared) private(i)
            do i = 1, sys_obj%eel%pol_atoms
                sys_obj%eel%cpol(:,i) = sys_obj%top%cmm(:, sys_obj%eel%polar_mm(i))
            end do

            call ommp_message("Setting Thole factors", OMMP_VERBOSE_DEBUG)
            ! compute factors for thole damping
            call thole_init(sys_obj%eel)
        else
            sys_obj%eel%thole = 0.0
        end if

        if(sys_obj%amoeba) then
            ! Copy multipoles from q to q0
            sys_obj%eel%q0 = sys_obj%eel%q

            ! scales by 1/3 AMOEBA quadrupoles (?)
            ! Mysterious division of multipoles by three
            ! FL told me that it was done like that in
            ! Tinker
            sys_obj%eel%q0(5:10,:) = sys_obj%eel%q0(5:10,:) / 3.0_rp

            ! polarization groups connectivity list
            call reverse_grp_tab(sys_obj%eel%mmat_polgrp, &
                                 sys_obj%eel%polgrp_mmat)
            call build_pg_adjacency_matrix(sys_obj%eel, pg_adj)
            call build_conn_upto_n(pg_adj, 3, sys_obj%eel%pg_conn, .true.)

            ! performs multipoles rotation
            call rotate_multipoles(sys_obj%eel)
        end if

        if(sys_obj%eel%use_fmm) then
            call ommp_message("Building FMM near lists", OMMP_VERBOSE_DEBUG)
            call fmm_coordinates_update(sys_obj%eel)
        end if
        call ommp_message("Building screening lists", OMMP_VERBOSE_DEBUG)
        call time_push()
        call make_screening_lists(sys_obj%eel)
        call time_pull("Preparing screening lists")
        call ommp_message("MMPol initialization (mmpol_prepare) completed.", OMMP_VERBOSE_DEBUG)
        call time_pull('MMPol object initialization (mmpol_prepare)')
    end subroutine mmpol_prepare