cpinte / mcfost

MCFOST radiative transfer code
Other
23 stars 24 forks source link

fix bug reading SO molecular data file + fix compiler warnings with gfortran #113

Closed danieljprice closed 4 months ago

danieljprice commented 4 months ago

Type of PR: Bug fix

Description: In the so@lique.dat file the data has the format:

!LEVEL + ENERGIES(cm^-1) + WEIGHT  + N_J
   1       0.0000       1        1_0
   2       1.0007       3        0_1
   3       3.0999       5        1_2
...

but MCFOST was reading the last column as an integer. Since this is used for information only, we now read this as a string instead.

When compiling with gfortran/g++ there were also a bunch of legacy warnings, which I also fixed. Namely:

g++ -Wall -pedantic -m64 -O3 -funroll-loops -ffinite-math-only -fno-trapping-math -c voro++_wrapper.cpp -I/usr/local/include
voro++_wrapper.cpp:106:20: warning: unused variable 'cz' [-Wunused-variable]
    double cx, cy, cz, cutting_distance, delta_edge, f, d_to_star;
                   ^
voro++_wrapper.cpp:106:16: warning: unused variable 'cy' [-Wunused-variable]
    double cx, cy, cz, cutting_distance, delta_edge, f, d_to_star;
               ^
voro++_wrapper.cpp:106:12: warning: unused variable 'cx' [-Wunused-variable]
    double cx, cy, cz, cutting_distance, delta_edge, f, d_to_star;
           ^
voro++_wrapper.cpp:279:2: warning: no newline at end of file [-Wnewline-eof]
}
 ^
4 warnings generated.

and

gfortran -m64 -cpp -O3 -funroll-loops -ffinite-math-only -fno-trapping-math -ffree-line-length-132 -fbacktrace -fopenmp -c -DPOINTER_SIZE=8 gas/lte.f90 -o lte.o -I/usr/local/include
gas/lte.f90:544:85:

  544 |             write(*,'("max(rho)="(1ES20.7E3)" m^-3"," min(rho)="(1ES20.7E3)" m^-3")'), &
      |                                                                                     1
Warning: Legacy Extension: Comma before i/o item list at (1)
gas/lte.f90:546:93:

  546 |             write(*,'("Old max(nstar)="(1ES20.7E3)" m^-3"," min(nstar)="(1ES20.7E3)" m^-3")'), &
      |                                                                                             1
Warning: Legacy Extension: Comma before i/o item list at (1)
gas/lte.f90:548:93:

  548 |             write(*,'("New max(nstar)="(1ES20.7E3)" m^-3"," min(nstar)="(1ES20.7E3)" m^-3")'), &
      |                                                                                             1
Warning: Legacy Extension: Comma before i/o item list at (1)
gas/lte.f90:731:82:

  731 |          write(*,'("max(rho)="(1ES20.7E3)" m^-3"," min(rho)="(1ES20.7E3)" m^-3")'), &
      |                                                                                  1
Warning: Legacy Extension: Comma before i/o item list at (1)
gas/lte.f90:733:90:

  733 |          write(*,'("Old max(nstar)="(1ES20.7E3)" m^-3"," min(nstar)="(1ES20.7E3)" m^-3")'), &
      |                                                                                          1
Warning: Legacy Extension: Comma before i/o item list at (1)
gas/lte.f90:735:90:

  735 |          write(*,'("New max(nstar)="(1ES20.7E3)" m^-3"," min(nstar)="(1ES20.7E3)" m^-3")'), &
      |                                                                                          1
Warning: Legacy Extension: Comma before i/o item list at (1)

and

gas/io_atom.f90:986:78:

  986 |       write(*,'("  -- min(n)="(1ES20.7E3)" m^-3; max(n)="(1ES20.7E3)" m^-3")') , &
      |                                                                              1
Warning: Legacy Extension: Comma before i/o item list at (1)
gas/io_atom.f90:350:67:

  350 |                write(*,'(" -> lower edge cut at "(1F12.5)" nm !")'), atom%continua(kr)%lambdamin
      |                                                                   1
Warning: Legacy Extension: Comma before i/o item list at (1)
gfortran -m64 -cpp -O3 -funroll-loops -ffinite-math-only -fno-trapping-math -ffree-line-length-132 -fbacktrace -fopenmp -c -DPOINTER_SIZE=8 gas/electron_density.f90 -o electron_density.o -I/usr/local/include
gas/electron_density.f90:820:77:

  820 |    write(*,'("  -- min(ne)="(1ES20.7E3)" m^-3; max(ne)="(1ES20.7E3)" m^-3")') , minval(ne,mask=(ne>0)), maxval(ne)
      |                                                                             1
Warning: Legacy Extension: Comma before i/o item list at (1)
gfortran -m64 -cpp -O3 -funroll-loops -ffinite-math-only -fno-trapping-math -ffree-line-length-132 -fbacktrace -fopenmp -c -DPOINTER_SIZE=8 gas/see.f90 -o see.o -I/usr/local/include
gas/see.f90:1280:32:

 1280 |             f(ieq) = f(ieq) * -1.0_dp
      |                                1
Warning: Extension: Unary operator following arithmetic operator (use parentheses) at (1)

Testing: Successfully reads the SO data file

Did you run the check that the code and comments follow the code of conduct? no

Did you update relevant documentation in the docs directory? no