24小时热门版块排行榜    

查看: 401  |  回复: 0

buddy006

铜虫 (初入文坛)

[求助] 费米能级电荷密度文件读取报错,求助

大家好,想计算一下费米能级附件的电荷分布,通过设置INCAR中的 LPARD值,已经达到了PARCHG文件,想通过下面的脚本,读取电荷文件,然后分别输出spin-down 和spin-up电荷密度,但运行后总是提示,
line1: program: comand not found
command not foundy-1.f:line 2 :
line3: ccccc: command not found
line4:ccccc: command not found
conmand not foundy-1.f:line 5:
line6:syntax error near unexpected token '('
line6:'     implicit double precision ( a-h, o-z )
下面是我用的脚本,哪位帮忙看一下,什么地方有问题,多谢了。
**************************************************
program plot_chargedensity

ccccc This program read the vasp charge density file and write them in a matrix.
ccccc This matrix has a dimension of nx*ny*nz.

       implicit double precision (a-h,o-z)

       character*20 file1

       character*20 filename

c       real*8, allocatable, dimension (:,:, :: dens_up
c       real*8, allocatable, dimension (:,:, :: dens_down
c       real*8, allocatable, dimension( :: dens_tmp

       real*8 dens_up(108,108,180)
       real*8 dens_down(108,108,180)
       real*8 dens_tmp(108*108*180)
       write(6,*)  "input the charge density file name"
       read(5,*)  filename
      
c       write(6,*) "input the values of nx, ny, nz:"
c       read(5,*) nx,ny,nz
       nx = 108
       ny = 108
       nz = 180
       m1=nx*my*nz
       m2=m1/10
c       allocate(dens_up(nx,ny,nz))
c       allocate(dens_up(nx,ny,nz))
c       allocate(dens_tmp(m1))
      
       open(12,file=filename)
      
c      The first lines you don not want      
       do i=1,42
       read(12,*)  
       end do
c      begin to read the spin up-charge density
       do i=1,m2
       m3=(i-1)*5
       read(12,*)dens_tmp(m3+1),dens_tmp(m3+2),dens_tmp(m3+3),
     * dens_tmp(m3+4),dens_tmp(m3+5),dens_tmp(m3+6),dens_tmp(m3+7),
     * dens_tmp(m3+8),dens_tmp(m3+9),dens_tmp(m3+10)
       end do
       do m=1,m1
       k=(m-1)/(nx*ny)+1
       i=(m-1-(k-1)*nx*ny)/ny+1
       j=m-(k-1)*nx*ny-(i-1)*ny
       dens_up(i,j,k)=dens_tmp(m)
       end do
      
      
      
c      The some lines between up and down you don not want      
       do i=1,2
       read(12,*)  
       end do
         
         
c      begin to read the spin up-charge density
       do i=1,m2
       m3=(i-1)*10
       read(12,*)dens_tmp(m3+1),dens_tmp(m3+2),dens_tmp(m3+3),
     * dens_tmp(m3+4),dens_tmp(m3+5),dens_tmp(m3+6),dens_tmp(m3+7),
     * dens_tmp(m3+8),dens_tmp(m3+9),dens_tmp(m3+10)
       end do
       do m=1,m1
       k=(m-1)/(nx*ny)+1
       i=(m-1-(k-1)*nx*ny)/ny+1
       j=m-(k-1)*nx*ny-(i-1)*ny
       dens_up(i,j,k)=dens_tmp(m)
       end do

      
      
       open(13,file="charge-up.out"
       rewind(13)
       do i=1,nx
       write(13,101) ((dens_up(i,j,45)+dens_down(i,j,45))/2.0,j=1,ny)
       end do
      
      
       open(14,file="charge-down.out"
       rewind(14)
       do i=1,nx
       write(14,101) ((dens_up(i,j,45)-dens_down(i,j,45))/2.0,j=1,ny)
       end do
      
      
  101  format(300(F12.8,2X))
  
  
       close(12)
       close(13)
       close(14)
       end
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 buddy006 的主题更新
信息提示
请填处理意见