xraypy / feff85exafs

Feff8L: Open Source theoretical EXAFS fitting standards
Other
15 stars 7 forks source link

EXCH/mpse.f is broken #10

Open bruceravel opened 10 years ago

bruceravel commented 10 years ago

In file EXCH/mpse.f, mpse.f does not compile with rank mismatches at lines 37 and 57. Variable edens is defined as rank 2 and called as rank 1. To get it to compile, I added ,1 as the second dimension in each case. That just cannot be right.

I suspect that Josh will have to be consulted on this one.

newville commented 10 years ago

I'm confused. I see line 37 to be:

& SQRT(3.d0/((3 / (4_pi_edens(jIntrs+1,1))) \ third)**3)

and similar for line 57. I think that did already get changed from the original (I believe acceptable but non-recommended) edens(jintrs+1)

bruceravel commented 10 years ago

Let me explain this a bit more clearly.

As delivered, line 37 was

&        SQRT(3.d0/((3 / (4*pi*edens(jIntrs+1))) ** third)**3)

and line 57 was

  RsInt = (3 / (4*pi*edens(jIntrs+1))) ** third

When compiling with the that file in that state, this happens with gfortran:

gfortran -o mpse.o -c -O3 -ffree-line-length-none mpse.f mpse.f:37.41:

 &        SQRT(3.d0/((3 / (4*pi*edens(jIntrs+1))) ** third)**3)     
                                     1

Error: Rank mismatch in array reference at (1) (1/2) mpse.f:57.30:

  RsInt = (3 / (4*pi*edens(jIntrs+1))) ** third                     
                          1

Error: Rank mismatch in array reference at (1) (1/2) scons: *\ [mpse.o] Error 1 scons: building terminated because of errors.

To get the file to compile, I modified those two lines to include the second index.

With the modification, the damn thing :poop: at least compiles. I think my modification should be transparent, but I don't really understand this bit of code. I don't seem to have access to the issue labels, or I would have used both of your neat, new ones.

newville commented 10 years ago

But this change to edens(jIntrs+1, 1) IS in the master branch.

I think accessing an array declared ARRAY(i, j) as ARRAY(i) used to be valid Fortran -- perhaps it's now deprecated? -- meaning ARRAY(i, 1). I'm a little surprised gfortran calls that invalid. It's definitely bad form, and should be made explicit.

bruceravel commented 10 years ago

I am not certain what you are saying. edens(jIntrs+1, 1) IS in the master branch because I made that change in order to get the compilation to run to completion. I opened this issue because I wanted to document the change in a way that was up-front and obvious. You can close this issue if you would like.

newville commented 10 years ago

OK. I guess I was confused by an issue on something that was already changed.

I think that the addition of the ', 1' is right, but then again maybe it should be edens(1, jintrs+1).....

I'm willing to leave the issue open until the code gets run. Then again, I'm not entirely that this code is actually called.