create_tmat Subroutine

private subroutine create_tmat(eel)

Uses

  • proc~~create_tmat~~UsesGraph proc~create_tmat create_tmat module~mod_io mod_io proc~create_tmat->module~mod_io module~mod_constants mod_constants proc~create_tmat->module~mod_constants module~mod_io->module~mod_constants iso_c_binding iso_c_binding module~mod_constants->iso_c_binding

Explicitly construct polarization tensor in memory. This routine is only used to accumulate results from dipole_T and shape it in the correct way.

Arguments

Type IntentOptional Attributes Name
type(ommp_electrostatics_type), intent(inout) :: eel

The electostatic data structure for which the interaction tensor should be computed


Calls

proc~~create_tmat~~CallsGraph proc~create_tmat create_tmat proc~ommp_message ommp_message proc~create_tmat->proc~ommp_message proc~dipole_t dipole_T proc~create_tmat->proc~dipole_t proc~screening_rules screening_rules proc~dipole_t->proc~screening_rules proc~damped_coulomb_kernel damped_coulomb_kernel proc~dipole_t->proc~damped_coulomb_kernel proc~fatal_error fatal_error proc~screening_rules->proc~fatal_error proc~damped_coulomb_kernel->proc~fatal_error proc~coulomb_kernel coulomb_kernel proc~damped_coulomb_kernel->proc~coulomb_kernel proc~fatal_error->proc~ommp_message proc~close_output close_output proc~fatal_error->proc~close_output proc~coulomb_kernel->proc~fatal_error proc~close_output->proc~ommp_message

Called by

proc~~create_tmat~~CalledByGraph proc~create_tmat create_tmat proc~polarization polarization proc~polarization->proc~create_tmat proc~ommp_get_polelec_energy ommp_get_polelec_energy proc~ommp_get_polelec_energy->proc~polarization proc~ommp_set_external_field ommp_set_external_field proc~ommp_set_external_field->proc~polarization proc~polelec_geomgrad polelec_geomgrad proc~polelec_geomgrad->proc~polarization proc~ommp_get_full_ele_energy ommp_get_full_ele_energy proc~ommp_get_full_ele_energy->proc~ommp_get_polelec_energy program~test_si_potential test_SI_potential program~test_si_potential->proc~ommp_get_polelec_energy program~test_si_potential->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_set_external_field_nomm ommp_set_external_field_nomm proc~ommp_set_external_field_nomm->proc~ommp_set_external_field proc~c_ommp_get_polelec_energy C_ommp_get_polelec_energy proc~c_ommp_get_polelec_energy->proc~ommp_get_polelec_energy 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~ommp_full_geomgrad ommp_full_geomgrad proc~ommp_full_geomgrad->proc~polelec_geomgrad 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~ommptest_fakeqm_internal_geomgrad ommptest_fakeqm_internal_geomgrad proc~ommptest_fakeqm_internal_geomgrad->proc~ommp_full_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~ommptest_totalqmmm_geomgrad ommptest_totalqmmm_geomgrad proc~ommptest_totalqmmm_geomgrad->proc~ommp_full_geomgrad proc~ommptest_fakeqm_linkatom_geomgrad ommptest_fakeqm_linkatom_geomgrad proc~ommptest_fakeqm_linkatom_geomgrad->proc~ommp_full_geomgrad 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 create_tmat(eel)
        !! Explicitly construct polarization tensor in memory. This routine
        !! is only used to accumulate results from [[dipole_T]] and shape it in
        !! the correct way.

        use mod_io, only: print_matrix
        use mod_constants, only: OMMP_VERBOSE_HIGH

        implicit none
        
        type(ommp_electrostatics_type), intent(inout) :: eel
        !! The electostatic data structure  for which the 
        !! interaction tensor should be computed
        real(rp), dimension(3, 3) :: tensor
        !! Temporary interaction tensor between two sites

        integer(ip) :: i, j, ii, jj
        
        call ommp_message("Explicitly computing interaction matrix to solve &
                           &the polarization system", OMMP_VERBOSE_HIGH)

        ! Initialize the tensor with zeros
        eel%tmat = 0.0_rp
        
        !$omp parallel do default(shared) schedule(dynamic) &
        !$omp private(i,j,tensor,ii,jj) 
        do i = 1, eel%pol_atoms
            do j = 1, i
                call dipole_T(eel, i, j, tensor)
                
                do ii=1, 3
                    do jj=1, 3
                        eel%tmat((j-1)*3+jj, (i-1)*3+ii) = tensor(jj, ii)
                        eel%tmat((i-1)*3+ii, (j-1)*3+jj) = tensor(jj, ii)
                    end do
                end do
            enddo
        enddo
        
        ! Print the matrix if verbose output is requested
        ! if(verbose == OMMP_VERBOSE_DEBUG) then
        !     call print_matrix(.true., 'Polarization tensor:', &
        !                       3*pol_atoms, 3*pol_atoms, &
        !                       3*pol_atoms, 3*pol_atoms, TMat)
        ! end if
        
    end subroutine create_TMat