- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
dear friends,
In my code, in a namelist i have declared:
and then allocate arrays as:
But now in a subroutine:
In my code, in a namelist i have declared:
[cpp]&alloy_spec fil= "Relativistic calculation for JaTa" z_a=25.0 z_b=29.0 x=.10 y=.90 c_a=18.0 c_b=18.0 spn=2
nscf=100 /[/cpp]
and then allocate arrays as:
[cpp]allocate(A_MOM(0:8,spn),B_MOM(0:8,spn),ECG_A(3,spn),ECG_B(3,spn), & sorb(ntype,nfn+1,spn),porb(ntype,nfn+1,spn), & dorb(ntype,nfn+1,spn),dos1(ntype,nfn+1,spn)) [/cpp]in the main program.
But now in a subroutine:
[cpp]module mdos CONTAINS subroutine tdos(spec,ipdos,nsp,dos, & sorb,porb,dorb,osd1,osd2) use parameters implicit double precision(a-h,o-z) integer::osd1,osd2 dimension spec(nkp,nfn+1),dos(nfn+1) real(8),dimension(ntype,nfn+1,spn)::sorb,porb,dorb ! write(*,*)ipdos,'from dos.f' do i=1,nfn+1 dos(i)=0.0d0 enddo sum=0.0d0 do i=1,nfn+1 sum=sum+spec(1,i)+3.0d0*spec(3,i)+ & 3.0d0*spec(5,i)+2.0d0*spec(7,i) dos(i)=sum sum=0.0d0 write(*,*) shape(sorb), shape(spec),shape(dos) sorb(ipdos,i,nsp)=spec(1,i) porb(ipdos,i,nsp)=3.0d0*spec(3,i) dorb(ipdos,i,nsp)=3.0d0*spec(5,i)+2.0d0*spec(7,i) enddo end subroutine tdos end module mdos [/cpp]its giving error as segmentation fault. But if I use spn as a parameter and keep every other things unchanged, its going good. Anything you can notice?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
aah...it seems working if I use assumed shape arrays in the tdos subroutine!!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page