Prev: XLF V13.1 release for AIX -- fully compliant Fortran 2003 standard
Next: GCC/gfortran 4.5.0 release
From: rudra on 14 Apr 2010 05:31 Friends, I wrote the code: module mprintinit use extras contains subroutine printinit(cz,sptyp,reltyp,xctyp,confA,confB,alloy_rad,& ityp,nsp,numprocs) use parameters implicit none integer::bit,bit2,opfl,ityp,nsp,numprocs character(8) :: date character(10) :: time character(5) :: zone integer,dimension(8) :: values character(2),dimension(2)::cz character(10)::alloy_rad real(8),dimension(2)::rz character(32) :: sys character(15) :: nis character(8)::confA,confB character(80)::sptyp,reltyp,xctyp,ermsg,brief character(2)::sps character(1),dimension(4)::orbnm integer,dimension(2)::atz orbnm(1)='s' orbnm(2)='p' orbnm(3)='d' orbnm(4)='f' open(19,file="err.log")!,status='replace') write(19,*)"!=============ERROR FILE FOR ASR RUN=============!" open(9,file="asrrun.log",status='replace') write(9,*)"!=============OUTPUT FILE FOR ASR RUN=============!" bit = operating_system(sys) bit2 = operating_sys(nis) call date_and_time(date,time,zone,values) rz(1)=z_a;rz(2)=z_b call atomname(rz,cz,atz) call alloy_spec(sptyp,reltyp,xctyp,confA,confB) do opfl=6,9,3 write(opfl,*)"" write(opfl, & '(("Job submitted on:",i2,".",i2,".",i4,2x,"at ",i2,":",i2))') & & values(3),values(2),values(1),values(5),values(6) write(opfl,*) Trim(fil) write(opfl, '("Running on system",2x,a32,"in machine",a15,"on" & & ,i2," node")') trim(sys),trim(nis),numprocs write(opfl,'("Alloy system:: ",2(a2,"{",f4.2,"}"))') & & cz(1),x,cz(2),y write(opfl,'("Underlying alloy ::",a3)') lattice write(opfl,'("Alloy Radius:: ",a10)')alloy_rad write(opfl,*) "The Electronic Configuration" write(opfl,"(1x,a2,'::',a2,'s',a2,1x,a2,'p',a2,1x,a2,'d',& & a2,1x,a2,a1,a2)") cz(1),trim(confA(1:1)),trim(confA(5:5)),& & trim(confA(2:2)),trim(confA(6:6)),trim(confA(3:3)), & & trim(confA(7:7)),trim(confA(4:4)),orbnm(4),trim(confA(8:8)) write(opfl,"(1x,a2,'::',a2,'s',a2,1x,a2,'p',a2,1x,a2,'d',& & a2,1x,a2,'f',a2)") cz(2),trim(confB(1:1)),trim(confB(5:5)),& trim(confB(2:2)),trim(confB(6:6)),trim(confB(3:3)), & trim(confB(7:7)),trim(confB(4:4)),trim(confB(8:8)) write(opfl,*) trim(reltyp) write(opfl,*) trim(xctyp) if(spn==1)then write(opfl,*)"Running spin-independent calculation" else if (spn==2)then write(opfl,*)"Running spin-dependent calculation" else write(opfl,*) "Not allowed spintype!!IDIOT!!EXITING!" STOP endif !Printing The input parameters write(opfl,*)"The Input parameters:-" ! write(opfl,'("Number of orbital calc. :",t36,i1)') norb write(opfl,'("Nearest neighbour in real space:",t36,i2)') nrsite write(opfl,'("Number of site in AS Map:",t36,i6)') nasite write(opfl,'("Number of atom type: ",t36,i2)') ntype write(opfl,'("Dimension of AS Map: ",t36,i2)') ntsite write(opfl,'("Total number of n.n. in AS Map: ",t36,i6)') nsite write(opfl,'("Number of recursion step: ",t36,i2)')maxrec write(opfl,'("Number of orbital(s+3p+5d+7f): ", t36,i2)') lorbit write(opfl,'("Number of seeds for fitting: ",t36,i2)') ienum write(opfl,'("Number of points extrapolated: ",t36,i2)') nkp write(opfl,'("SCF loop: ", t36,i3)') nscf write(opfl,'("Atomic number of atom A: ",t36,i2)') z_a write(opfl,'("Atomic number of atom B: ", t36,i2)') z_b write(opfl,'("Core electron atom A: ", t36,i2)') c_a write(opfl,'("Core electron atom B: ", t36,i2)') c_b write(opfl,'("Valence electron atom A: ",t36,i2)') e_a write(opfl,'("Valence electron atom B: ",t36,i2)') e_b write(opfl,'("Energy Range: ", t36,2(f5.3,1x))') emin,emax write(opfl,'("POTPAR for orb. S: ",t36,es9.2)') ALPS write(opfl,'("POTPAR for orb. P: ", t36,es9.2)')ALPP write(opfl,'("POTPAR for orb. D: ",t36,es9.2)') ALPD write(opfl,'("POTPAR for orb. F: ",t36,es9.2)') ALPF write(opfl,'("Medulang: ",t36,es9.2)') ruban write(opfl,'("Mixing scheme parameter: ", t36,es9.2)') amix end do end subroutine subroutine prspn(nsp) if (nsp==1)then sps="UP" else sps='DW' endif do opfl=6,9,3 write(opfl,'("WORKING FOR SPIN",1x,a2)') sps end do end subroutine subroutine pratm(ityp) do opfl=6,9,3 write(opfl,'("WORKING FOR ATOM",1x,i1)') ityp end do end subroutine end module which when compiled by gfortran, gives error: $ make FC=gfortran gfortran -c -O3 -fopenmp prinit.f90 prinit.f90:52.47: & ,i2," node")') trim(sys),trim(nis),numprocs 1 Warning: Extension: Tab character in format at (1) prinit.f90:125.7: write(opfl,'("WORKING FOR ATOM",1x,i1)') ityp 1 Error: UNIT specification at (1) must be an INTEGER expression or a CHARACTER variable prinit.f90:124.11: do opfl=6,9,3 1 Warning: Deleted feature: Loop variable at (1) must be integer prinit.f90:114.11: sps="UP" 1 Error: Can't convert CHARACTER(1) to REAL(4) at (1) prinit.f90:116.11: sps='DW' 1 Error: Can't convert CHARACTER(1) to REAL(4) at (1) prinit.f90:119.14: write(opfl,'("WORKING FOR SPIN",1x,a2)') sps 1 Error: UNIT specification at (1) must be an INTEGER expression or a CHARACTER variable prinit.f90:118.11: do opfl=6,9,3 1 Warning: Deleted feature: Loop variable at (1) must be integer make: *** [prinit.o] Error 1 though opfl is clearly stated as integer. what is the reason? I cant say this is a bug as same behavior is noticed with sun95(sun95 does not complain about "Error: Can't convert CHARACTER(1) to REAL(4) at (1)") I am using gfortran version 4.4
From: glen herrmannsfeldt on 14 Apr 2010 06:15 rudra <bnrj.rudra(a)gmail.com> wrote: > Friends, I wrote the code: > module mprintinit > use extras > contains > subroutine printinit(cz,sptyp,reltyp,xctyp,confA,confB,alloy_rad,& > ityp,nsp,numprocs) > use parameters > implicit none > integer::bit,bit2,opfl,ityp,nsp,numprocs > character(8) :: date > character(10) :: time > character(5) :: zone > integer,dimension(8) :: values > character(2),dimension(2)::cz (big snip) > end subroutine Note all those declarations at the beginning of subroutine printinit. Note no declarations at all in subroutine prspn. In prspn, sps and opf1 are REAL variables. > subroutine prspn(nsp) > if (nsp==1)then > sps="UP" > else > sps='DW' > endif > do opfl=6,9,3 > write(opfl,'("WORKING FOR SPIN",1x,a2)') sps > end do > end subroutine (snip of the rest) -- glen
From: Richard Maine on 14 Apr 2010 15:48 m_b_metcalf <michaelmetcalf(a)compuserve.com> wrote: > You could try an 'implicit none' statement to help with this! Actually, he has one, but it didn't help for the same reason that the declaration of opfl didn't help - it was in the wrong subroutine. I recommend putting implicit none in the top level scoping unit - that is in the module scope in this case. That way it applies to all the inner scopes as well (unless overridden). Then it would have helped... Well maybe it would have helped. The subroutines with the problem were awfully short anyway. I'm not sure that a message saying that opfl was not declared would have been any more obvious than the messages saying that it needed to be integer. There is only so much that error messages can plausibly do for you. Otherwise good error messages aren't likely to be able to teach Fortran in you are missing the basics. I swear it almost looks like the OP thought that the declarations in one subroutine applied to every subroutine in the module. But in cases where the problem subroutines are larger and where you don't otherwise get an error message at all, having the implicit none at the top level can help. -- Richard Maine | Good judgment comes from experience; email: last name at domain . net | experience comes from bad judgment. domain: summertriangle | -- Mark Twain
From: robin on 14 Apr 2010 21:53 "rudra" <bnrj.rudra(a)gmail.com> wrote in message news:3c462607-fc1b-429a-80ca-db9d94c872d4(a)z6g2000yqz.googlegroups.com... | Friends, I wrote the code: | module mprintinit | use extras | contains | | subroutine printinit(cz,sptyp,reltyp,xctyp,confA,confB,alloy_rad,& | which when compiled by gfortran, gives error: Believe the compiler. Like the others have said, put in IMPLICIYT NONE in EVERY subroutine, not just the first. As well as that, it's a good idea to include the subroutine name in each END statement.
From: rudra on 15 Apr 2010 12:45 Friends, Thanks for your help and it is solved.
|
Pages: 1 Prev: XLF V13.1 release for AIX -- fully compliant Fortran 2003 standard Next: GCC/gfortran 4.5.0 release |