adj_mat_from_conn Subroutine

public subroutine adj_mat_from_conn(i12, sparse)

Uses

  • proc~~adj_mat_from_conn~~UsesGraph proc~adj_mat_from_conn adj_mat_from_conn module~mod_utils mod_utils proc~adj_mat_from_conn->module~mod_utils module~mod_memory mod_memory proc~adj_mat_from_conn->module~mod_memory module~mod_utils->module~mod_memory module~mod_constants mod_constants module~mod_utils->module~mod_constants module~mod_memory->module~mod_constants iso_c_binding iso_c_binding module~mod_memory->iso_c_binding module~mod_io mod_io module~mod_memory->module~mod_io module~mod_constants->iso_c_binding module~mod_io->module~mod_constants

Create adjacency matrix from connectivity lists.
Array i12 and n12 contain the connectivity list in the following format: i12(0:n(j),j) contains the index of all the atoms connected to atom with index j.

Arguments

Type IntentOptional Attributes Name
integer(kind=ip), intent(inout) :: i12(:,:)

Indices of connected atoms for each atom in the molecule

type(yale_sparse), intent(out) :: sparse

Adjacency matrix in Yale format ()


Calls

proc~~adj_mat_from_conn~~CallsGraph proc~adj_mat_from_conn adj_mat_from_conn interface~mallocate mallocate proc~adj_mat_from_conn->interface~mallocate proc~compress_list compress_list proc~adj_mat_from_conn->proc~compress_list interface~mfree mfree proc~adj_mat_from_conn->interface~mfree proc~sort_ivec_inplace sort_ivec_inplace proc~adj_mat_from_conn->proc~sort_ivec_inplace 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~compress_list->interface~mallocate proc~compress_list->interface~mfree proc~i_free1 i_free1 interface~mfree->proc~i_free1 proc~l_free1 l_free1 interface~mfree->proc~l_free1 proc~r_free3 r_free3 interface~mfree->proc~r_free3 proc~r_free1 r_free1 interface~mfree->proc~r_free1 proc~i_free2 i_free2 interface~mfree->proc~i_free2 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~sort_ivec_inplace->interface~mfree proc~sort_ivec sort_ivec proc~sort_ivec_inplace->proc~sort_ivec proc~chk_free chk_free proc~i_free1->proc~chk_free proc~sort_ivec->interface~mallocate proc~sort_ivec->interface~mfree proc~l_free1->proc~chk_free proc~r_free3->proc~chk_free proc~chk_alloc chk_alloc proc~r_alloc1->proc~chk_alloc proc~memory_init memory_init proc~r_alloc1->proc~memory_init proc~r_alloc3->proc~chk_alloc proc~r_alloc3->proc~memory_init proc~i_alloc2->proc~chk_alloc proc~i_alloc2->proc~memory_init proc~i_alloc1->proc~chk_alloc proc~i_alloc1->proc~memory_init proc~r_alloc2->proc~chk_alloc proc~r_alloc2->proc~memory_init proc~i_alloc3->proc~chk_alloc proc~i_alloc3->proc~memory_init proc~l_alloc1->proc~chk_alloc proc~l_alloc1->proc~memory_init proc~l_alloc2->proc~chk_alloc proc~l_alloc2->proc~memory_init proc~r_free1->proc~chk_free proc~i_free2->proc~chk_free proc~r_free2->proc~chk_free proc~l_free2->proc~chk_free proc~i_free3->proc~chk_free proc~fatal_error fatal_error proc~chk_free->proc~fatal_error proc~chk_alloc->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~~adj_mat_from_conn~~CalledByGraph proc~adj_mat_from_conn adj_mat_from_conn proc~mmpol_init_from_mmp mmpol_init_from_mmp proc~mmpol_init_from_mmp->proc~adj_mat_from_conn proc~mmpol_init_from_xyz mmpol_init_from_xyz proc~mmpol_init_from_xyz->proc~adj_mat_from_conn proc~guess_connectivity guess_connectivity proc~guess_connectivity->proc~adj_mat_from_conn proc~ommp_init_mmp ommp_init_mmp proc~ommp_init_mmp->proc~mmpol_init_from_mmp proc~qm_helper_update_coord qm_helper_update_coord proc~qm_helper_update_coord->proc~guess_connectivity proc~qm_helper_init qm_helper_init proc~qm_helper_init->proc~guess_connectivity 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~ommp_update_link_atoms_position ommp_update_link_atoms_position proc~ommp_update_link_atoms_position->proc~qm_helper_update_coord proc~ommp_qm_helper_update_coord ommp_qm_helper_update_coord proc~ommp_qm_helper_update_coord->proc~qm_helper_update_coord proc~ommp_init_qm_helper ommp_init_qm_helper proc~ommp_init_qm_helper->proc~qm_helper_init proc~ommp_create_link_atom ommp_create_link_atom proc~ommp_create_link_atom->proc~qm_helper_update_coord proc~c_ommp_init_xyz C_ommp_init_xyz proc~c_ommp_init_xyz->proc~ommp_init_xyz proc~c_ommp_update_link_atoms_position C_ommp_update_link_atoms_position proc~c_ommp_update_link_atoms_position->proc~ommp_update_link_atoms_position proc~c_ommp_init_qm_helper C_ommp_init_qm_helper proc~c_ommp_init_qm_helper->proc~ommp_init_qm_helper proc~c_ommp_qm_helper_update_coord C_ommp_qm_helper_update_coord proc~c_ommp_qm_helper_update_coord->proc~ommp_qm_helper_update_coord proc~c_ommp_create_link_atom C_ommp_create_link_atom proc~c_ommp_create_link_atom->proc~ommp_create_link_atom

Contents

Source Code


Source Code

        subroutine adj_mat_from_conn(i12, sparse)
            !! Create adjacency matrix \(\mathbb C_1\) from connectivity lists.   
            !! Array i12 and n12 contain the connectivity list in the following
            !! format: i12(0:n(j),j) contains the index of all the atoms connected
            !! to atom with index j.

            use mod_utils, only: sort_ivec_inplace
            use mod_memory, only: mallocate, mfree
            implicit none

            integer(ip), intent(inout) :: i12(:,:)
            !! Indices of connected atoms for each atom in the molecule
            type(yale_sparse), intent(out) :: sparse
            !! Adjacency matrix in Yale format (\(\mathbb C_1\))

            integer(ip) :: i, j, n, m
            integer(ip), allocatable :: nnz(:)

            n = size(i12, 2)
            m = size(i12, 1)
            call mallocate('adj_mat_from_conn [nnz]', n, nnz)

            !$omp parallel do default(shared) &
            !$omp private(j,i)
            do i=1, n
                ! Count the number of non-zero elements and move them to the left
                nnz(i) = 0
                do j=1, m
                    if(i12(j,i) /= 0) then
                        nnz(i) = nnz(i) + 1
                        i12(nnz(i),i) = i12(j,i)
                    end if
                end do
                call sort_ivec_inplace(i12(1:nnz(i),i))
            end do

            call compress_list(n, i12, nnz, sparse)
            
            call mfree('adj_mat_from_conn [nnz]', nnz)

        end subroutine adj_mat_from_conn