24小时热门版块排行榜    

查看: 871  |  回复: 0

rlafite

至尊木虫 (正式写手)

[求助] 这段F90代码如何用OpenMP并行运算?

这段代码如何用openmp并行运算?(附件是全模块) 并保证不溢出16gb内存
全套程序下载地址如下:
http://www.atomic-theory.uni-jen ... ange/ratip-2012.tgz

subroutine auger_calculate_amplitudes()
   !--------------------------------------------------------------------
   ! calculates for all transitions in turn the required continuum
   ! spinors and auger amplitudes.
   !
   ! calls: add_csf_to_basis(), anco_calculate_csf_matrix(),
   ! auger_channel_amplitude(), auger_pure_matrix(),
   ! auger_transition_properties() cowf_iterate_csp(),
   ! cowf_set_xk_coefficients(), cowf_set_yk_coefficients(),
   ! print_configuration_scheme()
   ! set_configuration_scheme().
   !--------------------------------------------------------------------
      !
      integer       :: i, j, n, nw, nocsf
      real(kind=dp) :: energy
      type(nkappa)  :: subshell
      integer, dimension(, allocatable :: ndx
      !
      n = asf_final%csf_set%nocsf + asf_initial%csf_set%nocsf
      !
      ! allocate for a "first time"; it is first dellocated before any usage
      allocate( auger_csp%p(1:n_grasp92), auger_csp%q(1:n_grasp92) )
      allocate( cowf_csp%p(1:10), cowf_csp%q(1:10) )
      allocate( ndx(1:n) )
      do  i = 1,number_of_transitions
         if (transition(i)%energy < zero) then
            transition(i)%probability = zero
            transition(i)%alpha_2     = zero
            transition(i)%alpha_4     = zero
            transition(i)%eta_2       = zero
            transition(i)%eta_4       = zero
            cycle
         end if
         !
         do  j = 1,transition(i)%number_of_channels
            energy = transition(i)%energy
            !!x print *, "auger_calculate_amplitudes - a"
            call set_configuration_scheme(asf_final%csf_set,asf_cont%csf_set,&
                     -1,transition(i)%channel(j)%kappa,                      &
                     transition(i)%totalj_f,transition(i)%parity_f,          &
                     transition(i)%totalj_i,transition(i)%parity_i,          &
                     append=.false.,index=ndx)
            !
            auger%no_f = asf_cont%csf_set%nocsf
            allocate( auger%ndx_f(auger%no_f) )
            auger%ndx_f(1:auger%no_f) = ndx(1:auger%no_f)
            !
            nw = asf_cont%csf_set%nwshells
            if (rabs_use_stop  .and. nw /= asf_final%csf_set%nwshells + 1) then
               stop "auger_calculate_amplitudes(): program stop a."
            end if
            ! calculate the mcp coefficients for the current coupling scheme
            ! as well as the d_rs,  y_k(ab), and x_k(abcd) coefficients
            nocsf = asf_cont%csf_set%nocsf
            call anco_calculate_csf_matrix(asf_cont%csf_set,1,nocsf,1,nocsf)
            call cowf_set_drs_coefficients(transition(i)%asff,             &
                                           asf_cont%csf_set,ndx)
            subshell = nkappa(-1,transition(i)%channel(j)%kappa)
            call cowf_set_yk_coefficients(subshell,asf_cont%csf_set)
            !!x print *, "auger_calculate_amplitudes - f"
            call cowf_set_xk_coefficients(subshell,asf_cont%csf_set)
            !!x print *, "auger_calculate_amplitudes - g"
            !
            ! now iterate the continuum spinors for this channel
            ! cowf_solve_homogeneous_eqn     = .true.
            cowf_start_homogeneous         = .true.
            cowf_phaseshift_wkb            = .true.
            cowf_phaseshift_zero_potential = .false.
            cowf_phaseshift_coulomb        = .false.
            !
            !! cowf_norm_nonrel               = .true.
            cowf_norm_wkb                  = .true.
            call cowf_iterate_csp(energy,subshell)
            !
            auger_csp = cowf_csp
            transition(i)%channel(j)%phase = auger_csp%phase
            !
            ! define the 'extended' configuration scheme for calculating
            ! the auger matrix and allocate memory
            call add_csf_to_basis(asf_initial%csf_set,asf_cont%csf_set,      &
                     transition(i)%totalj_i,transition(i)%parity_i,index=ndx)
            if (auger_print_csf_scheme) then
               call print_configuration_scheme(6,asf_cont%csf_set)
            end if
            !
            auger%no_i = asf_cont%csf_set%nocsf - auger%no_f
            allocate( auger%ndx_i(auger%no_i) )
            auger%ndx_i(1:auger%no_i) = ndx(1+auger%no_f:asf_cont%csf_set%nocsf)
            allocate( auger%matrix(1:auger%no_f,1:auger%no_i) )
            !
            ! calculate the 'pure' auger matrix in the given csf scheme
            ! (not including mixing coefficients)
            call auger_pure_matrix(asf_cont%csf_set,i)
            !
            call auger_channel_amplitude(i,j)
            !
            deallocate( auger%ndx_f, auger%ndx_i, auger%matrix  )
            call deallocate_csf_basis(asf_cont%csf_set)
         end do
         !
         ! calculates all selected properties for the selected transition
         call auger_transition_properties(transition(i))
      end do
      deallocate( ndx, auger_csp%p, auger_csp%q)
      !
   end subroutine auger_calculate_amplitudes
   !
   !
   subroutine auger_channel_amplitude(i,j)
   !--------------------------------------------------------------------
   ! calculates the auger amplitude of channel j of transition i
   ! by summing over the 'pure' auger matrix using the proper weights of
   ! transition i.
   !
   ! calls:
   !--------------------------------------------------------------------
      !
      integer, intent(in) :: i, j
      !
      integer       :: asfi, asff, l, r, rr, s, ss
      real(kind=dp) :: phase, value
      !
      if (auger_print_main_csf_me) then
         print *, " "
         print *, "main contribution from initial- and final-state csf "// &
                  "(abs(c_i*c_f) > 0.01)"
         print *, "----------------------------------------------------"// &
                  "---------------------"
         print *, " "
         print *, "   i-csf     f-csf   kappa    c_i     c_f       c_i*c_f"//&
                  "   c_i*c_f*a_if  "
         print *, "-------------------------------------------------------"//&
                  "-----------------"
      end if
      !
      asfi  = transition(i)%asfi;  asff = transition(i)%asff
      value = zero
      do  r = 1,auger%no_f
         rr = auger%ndx_f(r)
         do  s = 1,auger%no_i
            ss = auger%ndx_i(s)
            value = value + asf_final%asf(asff)%eigenvector(rr) * &
                    auger%matrix(r,s) * asf_initial%asf(asfi)%eigenvector(ss)
            !
            if (auger_print_main_csf_me) then
               if (abs(asf_final%asf(asff)%eigenvector(rr)*                   &
                       asf_initial%asf(asfi)%eigenvector(ss)) > 0.01_dp  .and.&
                   abs(asf_final%asf(asff)%eigenvector(rr) *                  &
                       auger%matrix(r,s) *                                    &
                   asf_initial%asf(asfi)%eigenvector(ss)) > 0.000001_dp)   then
                  !
                  ! determine first the radial integrals from the occupation
                  ! of the csf
                  write(*,1) ss,rr,                                         &
                     orbital_symmetry(transition(i)%channel(j)%kappa),      &
                             asf_initial%asf(asfi)%eigenvector(ss),         &
                             asf_final%asf(asff)%eigenvector(rr),           &
                             asf_final%asf(asff)%eigenvector(rr)*           &
                             asf_initial%asf(asfi)%eigenvector(ss),         &
                             asf_final%asf(asff)%eigenvector(rr)*           &
                             asf_initial%asf(asfi)%eigenvector(ss)*         &
                             auger%matrix(r,s)
                1 format(1x,i7,i10,6x,a2,3x,f6.3,2x,f6.3,5x,f8.5,4x,f9.6)
                end if
            end if
            !
         end do
      end do
      !
      if (auger_print_main_csf_me) then
         print *, "-------------------------------------------------------"//&
                  "-----------------"
      end if
      !
      l     = angular_momentum_l(transition(i)%channel(j)%kappa)
      phase = transition(i)%channel(j)%phase
      !
      transition(i)%channel(j)%amplitude_re = value
      transition(i)%channel(j)%amplitude    = cmplx(zero,one)**l *           &
                              exp( -cmplx(zero,one)*phase) * cmplx(value,zero)
      !
      print *, "i,j,transition(i)%channel(j)%amplitude = ",  &
                i,j,transition(i)%channel(j)%amplitude
      !
   end subroutine auger_channel_amplitude
   !
回复此楼

» 本帖附件资源列表

  • 欢迎监督和反馈:小木虫仅提供交流平台,不对该内容负责。
    本内容由用户自主发布,如果其内容涉及到知识产权问题,其责任在于用户本人,如对版权有异议,请联系邮箱:xiaomuchong@tal.com
  • 附件 1 : rabs_auger.f90
  • 2019-05-04 05:23:07, 86.51 K

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 rlafite 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 综述论文作为代表作会不会影响评审专家的印象分? +11 yufeiwaner 2026-08-09 13/650 2026-08-12 08:17 by yufeiwaner
[基金申请] 2019年青年基金涵评意见,大家看看几个A,几个B? +4 Tide man 2026-08-11 4/200 2026-08-12 00:39 by liuqidi
[基金申请] 奇怪,两个人的filecode固定段从头到尾一模一样 +7 布布和一二 2026-08-10 9/450 2026-08-11 22:12 by 医学老男孩
[基金申请] 是这周出结果还是下周出结果? +3 yuleib84 2026-08-11 3/150 2026-08-11 21:53 by jnhyjjm
[基金申请] 为什么网上很多人说本周 12号出结果 +6 瞬息宇宙 2026-08-10 7/350 2026-08-11 19:25 by Tide man
[论文投稿] 职称评审,求友友推荐见刊最快的期刊 +3 工厂打螺丝 2026-08-08 3/150 2026-08-11 13:42 by 会议编辑
[基金申请] 听说今天filecode变了 +26 布布和一二 2026-08-06 49/2450 2026-08-11 13:18 by WH3796
[基金申请] 关于代码变化问题,想知道的进来 +17 且听虎啸 2026-08-07 24/1200 2026-08-10 18:35 by zhangduo2008
[基金申请] 静等基金结果 +5 gjjjzhong 2026-08-10 16/800 2026-08-10 17:19 by Tide man
[基金申请] 关于Filecode分析方法 +3 majunge000 2026-08-10 3/150 2026-08-10 15:46 by lch2012
[基金申请] 国自然结果 +4 Vierhys 2026-08-10 8/400 2026-08-10 15:06 by Vierhys
[基金申请] 好奇怪的filecode +4 布布和一二 2026-08-08 5/250 2026-08-10 14:20 by 冰心玉壶晴
[基金申请] 面上项目filecode邪修 +5 西山十月 2026-08-09 7/350 2026-08-10 07:32 by 仁砚薪传
[基金申请] fileCode有新解读? +10 Tide man 2026-08-08 18/900 2026-08-09 12:55 by 仁砚薪传
[基金申请] 关于filecode,很负责任的告诉大家 +6 爱看书的可乐 2026-08-08 7/350 2026-08-08 22:13 by a_niu
[基金申请] 关于豆爷回答的JTJC与%2F数量 +5 yang182083 2026-08-06 7/350 2026-08-08 18:29 by zhanghaozhu
[基金申请] 国基金的申报应该改成非等额制,评价高的钱多评价低的钱少,但是增加资助率 +7 a089 2026-08-07 7/350 2026-08-08 18:05 by gltch
[基金申请] 化学口download_prp&amp;fileCode的固定段好像这几天一直没变,有变的大神么? +3 Tide man 2026-08-07 4/200 2026-08-07 22:39 by Tide man
[基金申请] filecode变化情况 +6 布布和一二 2026-08-07 22/1100 2026-08-07 14:45 by 且听虎啸
[基金申请] filecode +14 等待解的谜 2026-08-06 19/950 2026-08-07 12:20 by wlwhappy
信息提示
请填处理意见