get_states_overlap Subroutine

public subroutine get_states_overlap(infos)

Uses

  • proc~~get_states_overlap~~UsesGraph proc~get_states_overlap get_states_overlap module~atomic_structure_m atomic_structure_m proc~get_states_overlap->module~atomic_structure_m module~basis_tools basis_tools proc~get_states_overlap->module~basis_tools module~io_constants io_constants proc~get_states_overlap->module~io_constants module~messages messages proc~get_states_overlap->module~messages module~oqp_tagarray_driver oqp_tagarray_driver proc~get_states_overlap->module~oqp_tagarray_driver module~precision precision proc~get_states_overlap->module~precision module~strings strings proc~get_states_overlap->module~strings module~tdhf_mrsf_lib tdhf_mrsf_lib proc~get_states_overlap->module~tdhf_mrsf_lib module~types types proc~get_states_overlap->module~types module~util util proc~get_states_overlap->module~util iso_c_binding iso_c_binding module~atomic_structure_m->iso_c_binding module~basis_tools->module~atomic_structure_m module~basis_tools->module~io_constants module~basis_tools->module~precision iso_fortran_env iso_fortran_env module~basis_tools->iso_fortran_env module~constants constants module~basis_tools->module~constants module~parallel parallel module~basis_tools->module~parallel module~messages->module~io_constants module~messages->module~precision comm_IOFILE comm_IOFILE module~messages->comm_IOFILE comm_PAR comm_PAR module~messages->comm_PAR module~oqp_tagarray_driver->iso_c_binding tagarray tagarray module~oqp_tagarray_driver->tagarray module~precision->iso_fortran_env module~strings->iso_c_binding module~tdhf_mrsf_lib->module~basis_tools module~tdhf_mrsf_lib->module~precision module~int2_compute int2_compute module~tdhf_mrsf_lib->module~int2_compute module~oqp_linalg oqp_linalg module~tdhf_mrsf_lib->module~oqp_linalg module~types->module~atomic_structure_m module~types->module~basis_tools module~types->module~precision module~types->iso_c_binding module~functionals functionals module~types->module~functionals module~types->module~parallel module~types->tagarray module~util->module~precision module~constants->module~precision module~functionals->module~precision module~functionals->iso_c_binding xc_f03_lib_m xc_f03_lib_m module~functionals->xc_f03_lib_m module~int2_compute->module~atomic_structure_m module~int2_compute->module~basis_tools module~int2_compute->module~messages module~int2_compute->module~precision module~int2_compute->module~parallel module~int2_pairs int2_pairs module~int2_compute->module~int2_pairs module~int2e_libint int2e_libint module~int2_compute->module~int2e_libint module~int2e_rys int2e_rys module~int2_compute->module~int2e_rys module~blas_wrap blas_wrap module~oqp_linalg->module~blas_wrap module~lapack_wrap lapack_wrap module~oqp_linalg->module~lapack_wrap module~parallel->module~precision module~parallel->iso_c_binding module~parallel->iso_fortran_env mpi mpi module~parallel->mpi module~blas_wrap->module~messages module~blas_wrap->module~precision module~mathlib_types mathlib_types module~blas_wrap->module~mathlib_types module~int2_pairs->module~precision module~int2e_libint->module~precision module~int2e_libint->iso_c_binding module~int2e_libint->module~constants module~int2e_libint->module~int2_pairs module~libint_f libint_f module~int2e_libint->module~libint_f module~int2e_rys->module~basis_tools module~int2e_rys->module~precision module~int2e_rys->module~constants module~lapack_wrap->module~messages module~lapack_wrap->module~precision module~lapack_wrap->module~mathlib_types module~libint_f->iso_c_binding

@brief Main subroutine for calculating state overlaps and derivative coupling matrix elements

@param[in,out] infos Information class containing molecule parameters

Arguments

Type IntentOptional Attributes Name
type(information), intent(inout), target :: infos

Calls

proc~~get_states_overlap~~CallsGraph proc~get_states_overlap get_states_overlap interface~data_has_tags data_has_tags proc~get_states_overlap->interface~data_has_tags interface~show_message show_message proc~get_states_overlap->interface~show_message interface~tagarray_get_data tagarray_get_data proc~get_states_overlap->interface~tagarray_get_data proc~check_states_phase check_states_phase proc~get_states_overlap->proc~check_states_phase proc~compute_states_overlap compute_states_overlap proc~get_states_overlap->proc~compute_states_overlap proc~get_dcv get_dcv proc~get_states_overlap->proc~get_dcv proc~measure_time measure_time proc~get_states_overlap->proc~measure_time proc~mrsfxvec mrsfxvec proc~get_states_overlap->proc~mrsfxvec remove_records remove_records proc~get_states_overlap->remove_records reserve_data reserve_data proc~get_states_overlap->reserve_data proc~mrsf_tlf mrsf_tlf proc~compute_states_overlap->proc~mrsf_tlf proc~mrsfxvec->interface~show_message proc~ov_exact ov_exact proc~mrsf_tlf->proc~ov_exact proc~tlf_exp tlf_exp proc~mrsf_tlf->proc~tlf_exp proc~comp_det comp_det proc~ov_exact->proc~comp_det

Called by

proc~~get_states_overlap~~CalledByGraph proc~get_states_overlap get_states_overlap proc~get_state_overlap_c get_state_overlap_C proc~get_state_overlap_c->proc~get_states_overlap

Source Code

  subroutine get_states_overlap(infos)

    use precision, only: dp
    use io_constants, only: iw
    use oqp_tagarray_driver
    use types, only: information
    use strings, only: Cstring, fstring
    use basis_tools, only: basis_set
    use atomic_structure_m, only: atomic_structure
    use messages, only: show_message, with_abort
    use tdhf_mrsf_lib, only: mrsfxvec
    use util, only: measure_time

    implicit none

    character(len=*), parameter :: subroutine_name = "get_states_overlap"

    type(information), target, intent(inout) :: infos
    type(basis_set), pointer :: basis

    integer :: nstates, mrst, xvec_dim, nbf, ok, j
    integer :: noca, nocb, ndtlf

    real(kind=dp), allocatable, target :: bvec(:,:), bvec_old(:,:)

    ! Tagarray
    character(len=*), parameter :: tags_general(*) = (/ character(len=80) :: &
        OQP_td_bvec_mo_old, OQP_td_bvec_mo, OQP_overlap_mo /)
    character(len=*), parameter :: tags_alloc(*) = (/ character(len=80) :: &
        OQP_nac /)
    real(kind=dp), contiguous, pointer :: bvec_mo(:,:), bvec_mo_old(:,:), &
          nac_out(:,:), overlap_mo(:,:), td_states_phase(:), td_states_overlap(:,:)

    ! Files open
    open (unit=IW, file=infos%log_filename, position="append")

    ! Load basis set
    basis => infos%basis
    basis%atoms => infos%atoms
    nstates = infos%tddft%nstate
    mrst = infos%tddft%mult
    nbf = basis%nbf
    xvec_dim = infos%mol_prop%nelec_a*(nbf-infos%mol_prop%nelec_b)

!   ndtlf = 0          less accurate
!   ndtlf = 1 : tlf(1)
!   ndtlf = 2 : tlf(2) most accurate
    ndtlf = infos%tddft%tlf

    ! Allocate data for outputing in python level
    call infos%dat%remove_records(tags_alloc)
    call infos%dat%reserve_data(OQP_td_states_phase, ta_type_real64, &
          nstates, (/ nstates /), comment=OQP_td_states_phase_comment)
    call infos%dat%reserve_data(OQP_td_states_overlap, ta_type_real64, &
          nstates*nstates, (/ nstates, nstates /), comment=OQP_td_states_overlap_comment)
    call infos%dat%reserve_data(OQP_nac, ta_type_real64, &
          nstates*nstates, (/ nstates, nstates /), comment=OQP_nac_comment)

    ! Load data from python level
    call data_has_tags(infos%dat, tags_general, module_name, subroutine_name, with_abort)
    call tagarray_get_data(infos%dat, OQP_td_bvec_mo, bvec_mo)
    call tagarray_get_data(infos%dat, OQP_overlap_mo, overlap_mo)
    call tagarray_get_data(infos%dat, OQP_td_bvec_mo_old, bvec_mo_old)

    call data_has_tags(infos%dat, tags_alloc, module_name, subroutine_name, with_abort)
    call tagarray_get_data(infos%dat, OQP_td_states_phase, td_states_phase)
    call tagarray_get_data(infos%dat, OQP_td_states_overlap, td_states_overlap)
    call tagarray_get_data(infos%dat, OQP_nac, nac_out)

    allocate(bvec(xvec_dim,nstates), &
             bvec_old(xvec_dim,nstates), &
             source=0.0_dp, stat=ok)
    if( ok/=0 ) call show_message('Cannot allocate memory',with_abort)

    noca = infos%mol_prop%nelec_a
    nocb = infos%mol_prop%nelec_b

    do j = 1, nstates
      call mrsfxvec(infos, bvec_mo_old(:,j), bvec_old(:,j))
      call mrsfxvec(infos, bvec_mo(:,j), bvec(:,j))
    end do

    call check_states_phase(bvec, bvec_old, td_states_phase)

    call compute_states_overlap( &
          infos, overlap_mo, td_states_overlap, bvec, &
          bvec_old, nbf,noca, nocb, nstates, ndtlf)

    call get_dcv(nac_out, td_states_overlap, nstates)

!   call print_nac(infos, td_states_overlap, nac_out)

!   Print timings
    call measure_time(print_total=1, log_unit=iw)
    call flush(iw)

    close(iw)

  end subroutine get_states_overlap