Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize fortran #141

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ project(
'c', 'cython', 'fortran',
version: '2.0.0',
license: 'BSD',
meson_version: '>= 1.1.0',
meson_version: '>= 1.2.0',
default_options : {
'optimization': '2',
# 'fortran_std': 'f2018'
}

)

# Seek the backend
Expand All @@ -26,10 +31,11 @@ if fc.get_id() == 'gcc'
# add_global_arguments('-fcheck=bounds', language : 'fortran')
add_global_arguments('-fno-range-check', language : 'fortran')
add_global_arguments('-w', language : 'fortran')
add_global_arguments('-O2', language : 'fortran')
endif




py = import('python').find_installation(pure: false)
py_dep = py.dependency()

Expand Down
27 changes: 14 additions & 13 deletions sources/DIFFaXsubs/DIFFaX.inc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
* ignored for the purposes of applying *
* instrumental broadening. *
************************************************************************
********************** integer*4 variables *********************
******************* integer(kind=4) variables ******************
************************************************************************
*d-> a_number(MAX_A,MAX_L) *
* - numeric label of atom in the layer. *
Expand Down Expand Up @@ -197,7 +197,7 @@
* 'data.sfc') *
* *
************************************************************************
*********************** real*8 variables ***********************
******************** real(kind=8) variables ********************
************************************************************************
* a0 - One of seven reciprocal lattice constants *
*d-> a_B(MAX_A,MAX_L) *
Expand Down Expand Up @@ -353,7 +353,7 @@
* a-direction. Wx and Wy in Angstroms. *
* *
************************************************************************
********************* complex*16 variables *********************
****************** complex(kind=8) variables *******************
************************************************************************
* l_phi(MAX_L,MAX_L) *
* - Phases of components of 'mat' *
Expand Down Expand Up @@ -384,33 +384,34 @@
| k_mirror, hk_mirror, check_sym, same_rz, any_sharp,
| same_layer, finite_width,debug
*
integer*4 l_seq(XP_MAX), pow(MAX_BIN), a_type(MAX_A,MAX_L),
integer(kind=4) l_seq(XP_MAX), pow(MAX_BIN), a_type(MAX_A,MAX_L),
| l_n_atoms(MAX_L), l_symmetry(MAX_L), l_actual(MAX_L),
| a_number(MAX_A,MAX_L), e_sf(MAX_TA)
integer*4 SymGrpNo, no_trials, h_bnd, k_bnd, cntrl, max_pow,
integer(kind=4) SymGrpNo, no_trials, h_bnd, k_bnd, cntrl, max_pow,
| l_cnt,full_brd, full_shrp, sadblock, loglin, bitdepth,
| rad_type, n_layers, n_actual, blurring, n_atoms, maxsad
integer*4 NONE, CENTRO, GAUSS, LORENZ, PS_VGT, PV_GSS, PV_LRN,
| X_RAY, NEUTRN, ELECTN
integer(kind=4) NONE, CENTRO, GAUSS, LORENZ, PS_VGT, PV_GSS,
| PV_LRN, X_RAY, NEUTRN, ELECTN
*
real*8 l_alpha(MAX_L,MAX_L), l_r(3,MAX_L,MAX_L), l_g(MAX_L),
real(kind=8) l_alpha(MAX_L,MAX_L), l_r(3,MAX_L,MAX_L), l_g(MAX_L),
| a_pos(3,MAX_A,MAX_L), a_B(MAX_A,MAX_L),
| a_occup(MAX_A,MAX_L), high_atom(MAX_L), low_atom(MAX_L),
| r_B11(MAX_L,MAX_L),r_B22(MAX_L,MAX_L),r_B33(MAX_L,MAX_L),
| r_B12(MAX_L,MAX_L),r_B23(MAX_L,MAX_L),r_B31(MAX_L,MAX_L),
| hx_ky(MAX_A,MAX_L), spec(MAX_SP), brd_spc(MAX_SP),
| detune(MAX_L,MAX_L), x_sf(9,MAX_TA)
real*8 a_B11,a_B22,a_B33,a_B12,a_B23,a_B31
real*8 tolerance, max_var, max_angle, l_bnd, l_rz,
real(kind=8) a_B11,a_B22,a_B33,a_B12,a_B23,a_B31
real(kind=8) tolerance, max_var, max_angle, l_bnd, l_rz,
| PI, PI2, RAD2DEG, DEG2RAD, scaleint, brightness, lambda,
| th2_min, th2_max, d_theta, h_start, k_start,h_end, k_end,
| cell_a, cell_b, cell_c, cell_gamma, pv_u, pv_v, pv_w,
| pv_gamma, FWHM, mltplcty, bnds_wt, theta1, theta2, a0, b0,
| c0, d0, ab0, bc0, ca0, tiny_inty, fatsWalla_hk
real*8 formfactor(FFACT_SIZE),ffact_scale,Wa,Wb,ffhkcnst,ffwdth
real*8 n_sf(MAX_TA)
real(kind=8) formfactor(FFACT_SIZE),ffact_scale,Wa,Wb,ffhkcnst,
| ffwdth
real(kind=8) n_sf(MAX_TA)
*
complex*16 mat(MAX_L,MAX_L), mat1(MAX_L,MAX_L),
complex(kind=8) mat(MAX_L,MAX_L), mat1(MAX_L,MAX_L),
| l_phi(MAX_L,MAX_L), wavefn
*
common /chars1/ a_name, atom_l
Expand Down
24 changes: 12 additions & 12 deletions sources/DIFFaXsubs/DIFFaX.par
Original file line number Diff line number Diff line change
Expand Up @@ -56,40 +56,40 @@
************************************************************************
*
implicit none
integer*4 MAX_L, MAX_A, MAX_TA, MAX_SP, SADSIZE
integer(kind=4) MAX_L, MAX_A, MAX_TA, MAX_SP, SADSIZE
parameter (MAX_L=20,MAX_A=200,MAX_TA=20,MAX_SP=20001,SADSIZE=256)
integer*4 XP_MAX, RCSV_MAX, MAX_NAM, MAX_BIN
integer(kind=4) XP_MAX, RCSV_MAX, MAX_NAM, MAX_BIN
parameter (XP_MAX=5000, RCSV_MAX=1022, MAX_NAM=31, MAX_BIN=10)
integer*4 FFACT_SIZE, N_SIGMAS
integer(kind=4) FFACT_SIZE, N_SIGMAS
parameter (FFACT_SIZE=201, N_SIGMAS=7)
real*8 inf_width
real(kind=8) inf_width
parameter (inf_width=1.0D4)
integer*4 ip, op, df, sf, dp, sy, sp, sk, sa
integer(kind=4) ip, op, df, sf, dp, sy, sp, sk, sa
parameter (ip=5,op=6,df=2,sf=4,dp=10,sy=11,sp=12,sk=13,sa=14)
integer*4 scrtch
integer(kind=4) scrtch
parameter (scrtch = 3)
integer*4 CLIP
integer(kind=4) CLIP
parameter (CLIP = 14)
integer*4 UNKNOWN
integer(kind=4) UNKNOWN
parameter (UNKNOWN = -1)
* define some useful numerical constants
complex*16 C_ZERO, C_ONE
complex(kind=8) C_ZERO, C_ONE
parameter (C_ZERO = (0.0D0,0.0D0), C_ONE = (1.0D0,0.0D0))
real*8 ZERO, QUARTER, HALF, ONE, TWO, THREE, FOUR, FIVE,
real(kind=8) ZERO, QUARTER, HALF, ONE, TWO, THREE, FOUR, FIVE,
| SIX, EIGHT, TEN, TWELVE, TWENTY, FIFTY, HUNDRED,
| ONE_EIGHTY
parameter (ZERO = 0.0D0, QUARTER = 0.25D0, HALF = 0.5D0,
| ONE = 1.0D0, TWO = 2.0D0, THREE = 3.0D0, FOUR = 4.0D0,
| FIVE = 5.0D0, SIX = 6.0D0, EIGHT = 8.0D0, TEN = 10.0D0,
| TWELVE = 12.0D0, TWENTY = 20.0D0, FIFTY = 50.0D0,
| HUNDRED = 100.0D0, ONE_EIGHTY = 180.0D0)
real*8 eps1, eps2, eps3, eps4, eps5, eps6, eps7, eps8, eps9,
real(kind=8) eps1, eps2, eps3, eps4, eps5, eps6, eps7, eps8, eps9,
| eps10, eps14
parameter (eps1 = 1.0D-1, eps2 = 1.0D-2, eps3 = 1.0D-3,
| eps4 = 1.0D-4, eps5 = 1.0D-5, eps6 = 1.0D-6,
| eps7 = 1.0D-7, eps8 = 1.0D-8, eps9 = 1.0D-9,
| eps10 = 1.0D-10, eps14 = 1.0D-14)
real*8 EIGHTBITS, FIFTEENBITS, SIXTEENBITS
real(kind=8) EIGHTBITS, FIFTEENBITS, SIXTEENBITS
parameter (EIGHTBITS = 256.0D0, FIFTEENBITS = 32768.0D0,
| SIXTEENBITS = 65536.0D0)
*
Loading
Loading