gfortran - Fortran Error: Unexpected STATEMENT FUNCTION statement at (1) -



gfortran - Fortran Error: Unexpected STATEMENT FUNCTION statement at (1) -

i'm doing fortran code find radial distribution function (rdf) hard spheres in cell model. it's not finished yet, , have error. i'm implementing histogram. code.

implicit double precision (a-h,o-z) parameter(npart=3000) dimension x(0:npart),y(0:npart),z(0:npart) c n=number of particules c rcel=radius of cell c rpart=radius of particules pi=3.1415927 write(*,*)'n,rcel,rpart,dr?' read(*,*)n,rcel,rpart,dr write(*,*)'nstep,dp' read(*,*)nstep,dp rpart2=(2*rpart) nfatmax=rcel/dr ! number of bins vtotal=(4/3)*pi*rcel*rcel*rcel dentotal=n/vtotal write(*,*)'density of particles, volume , bins = ' write(*,*)dentotal,vtotal,nfatmax x(0)=0 y(0)=0 z(0)=0 write(*,'(a,/)')'generating start configurations' counter1=0 counter2=0 counter3=0 k=0 i=1,n 21 xx=rcel*(ran()-0.5)*2 yy=rcel*(ran()-0.5)*2 zz=rcel*(ran()-0.5)*2 rr=xx**2+yy**2+zz**2 dist=sqrt(rr) if(dist.gt.(rcel-rpart2))then !avoid particles outside cell counter1=counter1+1 go 21 end if if(dist.lt.rpart2)then ! avoid overlap central particle counter2=counter2+1 go 21 end if if(i.ge.1)then j=1,i-1,1 sep2=(x(i)-x(j))**2+(y(i)-y(j))**2+(z(i)-z(j))**2 sep=sqrt(sep2) if(sep.lt.rpart2)then counter3=counter3+1 go 21 end if end end if k=k+1 x(k)=xx y(k)=yy z(k)=zz end write(*,*)'starting config' write(*,'(3f8.3)')(x(i),y(i),z(i),i=1,n) countera=counter1+counter2+counter3 write(*,*)'rejection = ' write(*,*)countera c monte carlo loop counter4=0 counter5=0 counter6=0 = 1,nfatmax h(i) = 0 !!!! error here!!!!!! end nobs = 0 naccept = 0 i=1,nstep j=1,n nobs = nobs + 1 xil=x(j)+dp*(ran()-0.5) yil=y(j)+dp*(ran()-0.5) zil=z(j)+dp*(ran()-0.5) r2=(xil**2)+(yil**2)+(zil**2) r=sqrt(r2) if(r.gt.(rcel-rpart2))then counter4=counter4+1 go 444 ! avoid particles outside cell end if if(r.lt.rpart2)then counter5=counter5+1 go 444 ! avoid overlap central particle end if ii=1,j-1 dist2=(x(ii)-xil)**2+(y(ii)-yil)**2+(z(ii)-zil)**2 dist=sqrt(dist2) if(dist.lt.rpart2)then counter6=counter6+1 go 444 ! avoid overlap wit particles end if end c accepted configuration x(j)=xil y(j)=yil z(j)=zil naccept = naccept + 1 c rejected configuration 444 go on jj=1,n dist2=(x(jj))**2+(y(jj))**2+(z(jj))**2 dist=sqrt(dist2) k=(dist/dr)+1 h(k) = h(k)+1 !!!!!!!! error here!!!!!!!!! end enddo end write(*,*)'final config' write(*,'(3f8.3)')(x(j),y(j),z(j),j=1,n) counterb=counter4+counter5+counter6 write(*,*)'rejection =' write(*,*)counterb stop end

in code, h not declared...

from

= 1,nfatmax h(i) = 0 end

i assume should array of length nfatmax:

dimension h(nfatmax)

as stated in high performance mark's comment, have found error using implicit none...

fortran gfortran

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -