I am trying to compile a fortran file, timedel.f, file
This file creates the module gettimedel
module gettimedel
parameter (maxpnt=10000)
double precision :: q(maxpnt),qen(maxpnt)
integer :: nrestofit
end module gettimedel
Which defines the two arrays, q, qen and the integer nrestofit.
Later in this fortran file, timedel.f, I have a subroutine which uses this module to get these arrays and integer
subroutine fitlors(nresdum,npt,dum1,dum2,approx,reson,backgr,
1 error,ifail)
use gettimedel
intent(in) nresdum,npt,dum1,dum2,approx
intent(out) reson,backgr,error,ifail
integer :: liw,ifail,i,lw,nresdum,npt
parameter (liw=2000)
double precision :: error,backgr,fvec(npt),
1 work(14*(nresdum+1)+4*(nresdum+1)**2 +4*npt*(nresdum+1)
2 + 3*npt + (nresdum+1)*(2*(nresdum+1)-1))
double precision :: dum1(npt),dum2(npt),reson(nresdum*2)
double precision :: x(nresdum*2+1),tol
integer :: approx(nresdum),info,iw(liw)
external fcn,lmdf1
work=0.0D0
x=0.0D0
nrestofit=nresdum
q(1:npt)=dum1
qen(1:npt)=dum2
do i=1,nrestofit
x(2*i-1)=qen(approx(i))
x(2*i)=q(approx(i))
enddo
tol=1.0D-03
call lmdif1 (fcn,npt,nrestofit*2+1,x,fvec,tol,info,iw,
* work,lw)
reson=x(1:nrestofit*2)
backgr=x((nrestofit*2)+1)
print *,'Fitlors done.INFO=',info
return
end
This subroutine uses this module gettimedel to define the integer nrestofit and the arrays q() and qen() which are used in the module.
However when I compile this fortran file I see the error message
timedel.f(1): error #7001: Error in creating the compiled module file. [GETTIMEDEL]
module gettimedel
-------------^
timedel.f(388): error #7002: Error in opening the compiled module file. Check INCLUDE paths. [GETTIMEDEL]
use gettimedel
----------^
timedel.f(407): error #6404: This name does not have a type, and must have an explicit type. [NRESTOFIT]
nrestofit=nresdum
------^
timedel.f(415): error #6404: This name does not have a type, and must have an explicit type. [Q]
q(1:npt)=dum1
------^
timedel.f(415): error #6514: A substring must be of type CHARACTER. [Q]
q(1:npt)=dum1
------^
timedel.f(415): error #6054: A CHARACTER data type is required in this context. [DUM1]
q(1:npt)=dum1
---------------^
timedel.f(415): error #6366: The shapes of the array expressions do not conform. [Q]
q(1:npt)=dum1
------^
timedel.f(416): error #6404: This name does not have a type, and must have an explicit type. [QEN]
qen(1:npt)=dum2
------^
timedel.f(416): error #6514: A substring must be of type CHARACTER. [QEN]
qen(1:npt)=dum2
------^
timedel.f(416): error #6054: A CHARACTER data type is required in this context. [DUM2]
qen(1:npt)=dum2
-----------------^
timedel.f(416): error #6366: The shapes of the array expressions do not conform. [QEN]
qen(1:npt)=dum2
------^
compilation aborted for timedel.f (code 1)
make: *** [timedel.o] Error 1
I can fix this issue but defining the type of q, qen and nrestofit within the subroutine fitlors however I would like to fix it so that these types are defined correctly by the module gettimedel. (which I think my code should be doing).
I do not think this is an issue with INCLUDE paths as the module gettimedel is created in the same file as the subroutine.
I am using the compiler ifort.
Any help would be appreciated, please let me know if further information is required.
Thank you very much
James
(Where the function lmdif1 is called from minpack)