24小时热门版块排行榜    

查看: 1402  |  回复: 11
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

sci_papers

银虫 (正式写手)

[交流] 【求助】帮忙改写展宽程序已有3人参与

大家好,我想用高斯展宽程序,现在得到了一个,但是感觉不是很满意,再次贴出,麻烦大家帮我看看怎么修改,而且我也不太懂编程,所以大家修改后麻烦也全部贴上.谢谢,我现在的程序如下:

        program CONVOLUTE
        implicit none
        integer noofmodes,arbitrary
        parameter(arbitrary=3500)
        double precision wavenr(arbitrary),IRint(arbitrary)
        integer weigenv
!        wavenumber start and finish
        double precision wbegin,wend
        character*80 fname
        character*30 tc
       
!        Filename: inputfilename
        read(5,*) tc,fname
!        wbegin: 0.0
        read(5,*) tc,wbegin
!        wend: 3500.0
        read(5,*) tc,wend
!        print the data
        print *,'Filename: ',fname
        print *,'wbegin: ',wbegin
        print *,'wend: ',wend
       
        print *,'calling subroutine...'
        call readfreq(fname,wavenr,IRint,weigenv,wbegin)
       
        call convolution(wbegin,wend,wavenr,IRint,weigenv)
        stop
!        end program
        end
       
        subroutine readfreq(fname,wavenr,IRint,weigenv,wbegin)
!        print *,'beginning of subroutine...'
!        read in eigenfrequencies and IR intensities
        implicit none
        integer noofmodes,arbitrary
        parameter(arbitrary=3500)
        double precision wavenr(arbitrary),IRint(arbitrary)
        double precision energy(2,arbitrary),wbegin
        character*80 fname
!        print *,'opening the file'
        integer i,reason,weigenv
        double precision wavetmp, inttmp
        open (unit=3,file=fname,status='OLD')
        i=0
!        print *,'entering do statement'
        do
        read(3,*,IOSTAT=reason) wavetmp,inttmp
        if (reason>0) then
        print *,'reason>0, i.e. somethings wrong'
        else if (reason<0) then
        print *,'reason<0, reached the end of file'
        close(3)
        return
        else
        if(wavetmp.gt.wbegin) then
        i=i+1
!        print *,'eigenfreq: ',wavetmp,'IR intensity',inttmp
        wavenr(i)=wavetmp
        IRint(i)=inttmp
        print *,'eigenfreq: ',wavenr(i),' IR intensity: ',IRint(i),' i = ',i
        weigenv=i
        endif
        end if
        end do
        return
!        print *,'end of subroutine'
        end subroutine
       
       
        subroutine convolution(wbegin,wend,wavenr,IRint,weigenv)
        implicit none
        integer bignumber,arbitrary
        parameter(bignumber=10000000,arbitrary=3500)
        double precision wbegin,wend,wavenr(arbitrary),IRint(arbitrary)
        integer noofscanpoints,n,m,k,weigenv
        parameter(noofscanpoints=100000)
        double precision deltaw,w1(bignumber),conv(bignumber)
        double precision mygamma,wave2ev
        parameter(wave2ev=8065.46)
!        mygamma=4.0d-3*wave2ev
        mygamma=10.0
!        mygamma=4.0d-3 in eV unit, convert to wavenumber by multiple wave2ev
       
        deltaw=(wend-wbegin)/dfloat(noofscanpoints)
        do n=1,noofscanpoints
        w1(n)=wbegin+n*deltaw
        conv(n)=0.0
        enddo
        do m=1,weigenv
        do k=1,noofscanpoints
!        print *,'m=',m,'k=',k
        conv(k)=conv(k)+IRint(m)/((w1(k)-wavenr(m))**2+mygamma**2)
!        print *,'w1=',w1(k),' conv(k)=',conv(k)
        enddo
        enddo
       
        open(unit=1,file='IETSconv.dat',status='unknown')
        do k=1,noofscanpoints
        write(1,*) w1(k),conv(k)
        enddo
        close(1)
       
        return
        end subroutine


现在麻烦大家:
1. 麻烦检查下这个程序的高斯展宽是否正确. 自己没用过,真不知道.谢谢
2. 这个程序需要提供jobinput.txt文件,然后这个文件中含有相关数值:
inputfile anth.txt
wbegin 1000.0
wend 1800.0
这些数值也包括了需要展宽的波段数,比如:1000.0-1800.0。我觉得这个也挺好,因为有时候需要分析的波段不是全部波段, 然后这个展宽程序自动从anth.txt文件中自动读取这个范围的数据展宽.然后会输出一个展宽后的数据文件IETSconv.dat.当然我说这些对于编程的人来说就太啰嗦了,因为大家一看就知道什么意思.不好意思

3. 我现在想要的就是,自己输入需要读取的文件,也输出保存的文件名.这样比较方便.不想这样读取inputfile,因为如果处理数据多的话,每次都要修改inputfile文件,很麻烦.当然在这儿,如果我只输入一个文件,最后数据自动保存为同名的dat类型文件则更好.
比如./gauvib.exe < anth.txt > anth.dat
或者./gauvib.exe < anth.txt 然后得到anth.dat数据文件更好

4. 既然想不用inputfile文件,那这个文件中的波段要在程序中实现了.在程序中加入可以设置波段的语句.
比如:
wbegin=1000.0
wend=1800.0

5. 如果谁有这样的或者更好的高斯或者洛伦茨展宽程序可以帮忙给我,因为要用,自己又不会.
再次先感谢大家.深深的希望大家帮个忙.看怎么修改程序.
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

snoopyzhao

至尊木虫 (职业作家)

sci_papers(金币+2):谢谢,我马上贴出来 2010-05-15 20:06:34

snoopyzhao

至尊木虫 (职业作家)

★ ★
resonant(金币+2):新政策摸索中,感谢回帖交流。 2010-05-14 20:43:10
sci_papers(金币+2):谢谢,swizard,我也试过了,最后也是生成一个相同的文件,如果处理很多数据的话,也比较麻烦.所以就想得到,输入一个然后就输出一个相同文件名的文件.这样感觉在Linux下更好一点.所以还是想麻烦各位帮看看我的这个程序. 2010-05-14 22:46:06
sci_papers(金币+1):我不会编程哦,哎,惭愧.所以麻烦大家帮忙看看,要不看怎么在这个现有的程序上改. 2010-05-14 22:51:15

sci_papers

银虫 (正式写手)

sci_papers

银虫 (正式写手)

普通表情 高级回复(可上传附件)
信息提示
请填处理意见