Fortran Coder

标题: 求助!!!请问为什么 在外面 rou(-2,-2) rwa(-2,-2 ) 的实部 [打印本页]

作者: 王二小    时间: 2018-11-15 16:47
标题: 求助!!!请问为什么 在外面 rou(-2,-2) rwa(-2,-2 ) 的实部
本帖最后由 王二小 于 2018-11-17 21:08 编辑

在 106 行外 定义初始值 rou(-2,-2) rwa(-2,-2) 的实部都是1 ,
但是进入循环 , rou(-2,-2) 的实部就从0 开始了

! Initial Values for the Expnasion Coefficients
do a = -5, 1
  do b = -5, total_num
    if ((a==b).and.(a==-2))then
      rwa(a,b) = 1.0d0             ! In case of a=-2, b=-2: r(a,b)=r(g,g)
      rou(a,b) = 1.0d0    !!!!!!!!!!!!!!!! rou(-2,-2)的初始值是1!!!!!!!!!!!!!!!!
    else
      rwa(a,b) = 0.0d0
      rou(a,b) = 0.0d0
    end if
  end do
end do

! Initial Values
pop_g = 1.0d0
pop_1e = 0.0d0
pop_2e = 0.0d0
pop_mnp = 0.0d0
pop_sem = 0.0d0

write (*,*) " time "," pop_g "," pop_1e "," pop_2e "," pop_mnp "," pop_sem "
write (*,*) "out" ,rou(-2,-2), rwa(-2,-2)
write(11,*) time, pop_g  
write(12,*) time, pop_1e
write(13,*) time, pop_2e
write(14,*) time, pop_mnp
write(15,*) time, pop_sem
!!!!!!!!
!!!!!!!!从这里开始进入循环,rou(-2,-2) 的实部就变成从0 开始了,请问为什么?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
do
  call rk4 (fin,time,delta_time,nearatom,nearatom2,ncenter,cor_cen,omega_telta,J_1eI,J_2eI,J_1e2e,dipole_mnp,fout)
  call multi_to_single (rwa,fin)
  call single_to_multi (fout,rwa)
  time = time + delta_time
  t = t + 1
  if (mod(t, 50)==0) then
    ss=ss+1

write (*,*)  "in", rwa(-2,-2), rou(-2,-2)

  do a = -5, 0
    do b = -5, total_num
      if ((a/=b).and.(b==-2)) then                  
        rou(a,b) = rwa(a,b)*exp(-ii*omega_0*time)                   ! 蟻=r*e^(-i*蠅0*t):
        ! rou(-5~-3,-2):蟻(I,g), rou(-1,-2):蟻(1e,g), rou(0,-2):蟻(2e,g)
      else if ((a==-2).and.(b==-2)) then
        rou(a,b) = rwa(a,b)
      else
        rou(a,b) = rwa(a,b)
      end if
    end do
  end do

  do b = 1, total_num
! rou(-2,b): 蟻(g,m)
    rou(-2,b) = rwa(-2,b)*exp(ii*omega_0*time)
! rou(1,b): 蟻(n,m)
    rou(1,b) = rwa(1,b)*conjg(rwa(1,b))
  end do

  pop_g   = rou(-2,-2)
  pop_1e  = rou(-1,-1)
  pop_2e  = rou(0,0)
  pop_mnp = 0.0d0
  pop_sem = 0.0d0

  do  a = -5, -3
    pop_mnp = pop_mnp + rou(a,a)
  end do   
  do a = 1, total_num
    pop_sem = pop_sem + real(rwa(1,a)*conjg(rwa(1,a)))
  end do

write (*,*)  "in ", rwa(-2,-2), rou(-2,-2)
write (*,*)  time, pop_g, pop_1e, pop_2e, pop_mnp, pop_sem
write (11,*) time, pop_g
write (12,*) time, pop_1e
write (13,*) time, pop_2e
write (14,*) time, pop_mnp
write (15,*) time, pop_sem

全部代码附件上传了,因为有字节的限制




mytype.f90

111 Bytes, 下载次数: 1

params.f90

3.54 KB, 下载次数: 1

improve - chuan.f90

20.07 KB, 下载次数: 1


作者: 王二小    时间: 2018-11-15 16:48
焦急等待,,,
作者: 王二小    时间: 2018-11-15 16:48
焦急等待,,,
作者: 王二小    时间: 2018-11-15 16:48
焦急等待,,,
作者: 再见大麋鹿    时间: 2018-11-15 17:12
这个问题确实很棘手 顶一记




欢迎光临 Fortran Coder (http://bbs.fcode.cn/) Powered by Discuz! X3.2