NWChem 6.6 Compiling on Cray: FTN Recursive Include Error


Click here for full thread
Just Got Here
I'm trying to compile NWChem 6.6 on a Cray XE6/XK7 system, but I get a "Recursive use of INCLUDE file" error with the ftn compiler during the nwdft/xc portion of the compilation. I first encountered the error in setACmat.F, where ftn printed an the error for two lines that contained "#include setACmat.F" in setACmat.F. I noticed that this recursive use of include occurs in other .F files in the same directory.

This is the end of make.log:

 ftn  -c -s integer64 -Ktrap=fp -DCRAYFORTRAN -DUSE_POSIXF -O2 -O scalar3,thread0,vector2,ipa2  -I. -I../include -I/N/u/bnoffke/BigRed2/nwchem-6.6/src/include -I/N/u/bnoffke/BigRed2/nwchem-6.6/src/tools/install/include -DCRAYXT -DNOIO -DEXT_INT -DLINUX -DLINUX64 -DNOIO -DEAFHACK -DPARALLEL_DIAG   setACmat.F

#include "setACmat.F"
ftn-64 crayftn: ERROR TRANSFORM_CMAT, File = setACmat.F, Line = 296
Recursive use of INCLUDE file "setACmat.F".

#include "setACmat.F"
ftn-64 crayftn: ERROR TRANSFORM_CMAT, File = setACmat.F, Line = 303
Recursive use of INCLUDE file "setACmat.F".

make[3]: *** [/N/u/bnoffke/BigRed2/nwchem-6.6/lib/LINUX64/libnwdft.a(setACmat.o)] Error 1
make[3]: Leaving directory `/gpfs/home/b/n/bnoffke/BigRed2/nwchem-6.6/src/nwdft/xc'
make[2]: *** [optimized] Error 2
make[2]: Leaving directory `/gpfs/home/b/n/bnoffke/BigRed2/nwchem-6.6/src/nwdft/xc'
make[1]: *** [subdirs] Error 1
make[1]: Leaving directory `/gpfs/home/b/n/bnoffke/BigRed2/nwchem-6.6/src/nwdft'
make: *** [libraries] Error 1


Here's a snippet of the code in setACmat.F that contains the violating lines:

 #ifndef SECOND_DERIV
#define SECOND_DERIV
c
c Compile source again for the 2nd derivative case
c
#include "setACmat.F" <------------Problem line
#endif
#ifndef THIRD_DERIV
#define THIRD_DERIV
c
c Compile source again for the 3rd derivative case
c
#include "setACmat.F" <------------Problem line
#endif
C> @}

Any tips on resolving this issue? I would really appreciate it.

Thanks,
Ben