From 9c6eca3de6601cedff8116719e990da5f9cc8264 Mon Sep 17 00:00:00 2001 From: Sylvester Joosten <sjoosten@anl.gov> Date: Wed, 12 Apr 2023 13:45:57 -0500 Subject: [PATCH] Update simc/nanocernlib for new compilers and add basic muon support --- cmake/compiler.cmake | 3 +++ nanocernlib | 2 +- simc/compiler.cmake | 3 ++- simc/constants.inc | 4 +++- simc/dbase.f | 8 +++++++- simc/simc.f | 2 ++ simc/simulate.inc | 7 ++++--- 7 files changed, 22 insertions(+), 7 deletions(-) diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index 193ceb5..875eb56 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -73,6 +73,9 @@ get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME) if (Fortran_COMPILER_NAME MATCHES "gfortran.*") set (gfortran_EXTRA_FLAGS "-fomit-frame-pointer -fno-automatic -fno-second-underscore -ffixed-line-length-none -fno-range-check") + if (${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER 10.0.0) + set (gfortran_EXTRA_FLAGS "${gfortran_EXTRA_FLAGS} -fallow-argument-mismatch -fallow-invalid-boz") + endif() set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${gfortran_EXTRA_FLAGS}") set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${gfortran_EXTRA_FLAGS}") set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${gfortran_EXTRA_FLAGS}") diff --git a/nanocernlib b/nanocernlib index 13987d3..cee0741 160000 --- a/nanocernlib +++ b/nanocernlib @@ -1 +1 @@ -Subproject commit 13987d3179c837fd1e8a1c3e40848b8b31085fe5 +Subproject commit cee0741e7008ac46bc4ce5ded570735894efa00a diff --git a/simc/compiler.cmake b/simc/compiler.cmake index 6560651..50d6bde 100644 --- a/simc/compiler.cmake +++ b/simc/compiler.cmake @@ -11,7 +11,8 @@ if (Fortran_COMPILER_NAME MATCHES "gfortran.*") set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${gfortran_EXTRA_FLAGS}") set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${gfortran_EXTRA_FLAGS}") set (CMAKE_Fortran_FLAGS_RELWITHDEBINFO "${CMAKE_Fortran_FLAGS_RELWITHDEBINFO} ${gfortran_EXTRA_FLAGS}") - +## gcc10 optimization + set (gfortran_EXTRA_FLAGS "${gfortran_EXTRA_FLAGS} -fallow-argument-mismatch -fallow-invalid-boz") ## g77 elseif (Fortran_COMPILER_NAME MATCHES "g77.*") diff --git a/simc/constants.inc b/simc/constants.inc index 4b358e2..bd48699 100644 --- a/simc/constants.inc +++ b/simc/constants.inc @@ -9,12 +9,14 @@ ! All roads lead to infinity ! ... some physical constants - real*8 Me, Me2, Mp, Mp2, Mn, Mn2, Mpi, Mpi2, Mpi0, Mpi02 + real*8 Me, Me2, Mmu, Mmu2, Mp, Mp2, Mn, Mn2, Mpi, Mpi2, Mpi0, Mpi02 real*8 Mk, Mk2, Mrho, Mrho2,Md, Md2 real*8 Mlambda, Msigma0, Msigma_minus real*8 amu, hbarc, pi, twopi, alpha, alpi, degrad, euler parameter (Me=0.51099906) parameter (Me2=Me**2) + parameter (Mmu=113.4289257) + parameter (Mmu2=Mmu**2) parameter (Mp=938.27231) parameter (Mp2=Mp**2) parameter (Mn=939.56563) diff --git a/simc/dbase.f b/simc/dbase.f index fd84112..b100a12 100644 --- a/simc/dbase.f +++ b/simc/dbase.f @@ -193,6 +193,9 @@ C DJG: else if (doing_positron) then Mh = Me doing_eep=.false. + else if (doing_muons) then + Mh = Mmu + doing_eep=.false. else !doing_eep if nothing else set. Mh=Mp doing_eep = .true. @@ -304,7 +307,7 @@ C DJG: sign_hadron=-1.0 endif - else if(doing_positron) then + else if(doing_positron.or.doing_muons) then targ%Mtar_struck = Mp targ%Mrec_struck = Mp @@ -776,6 +779,8 @@ C DJG: endif else if (doing_positron) then write(6,*) ' ****-------- Doing positron --------****' + else if (doing_muons) then + write(6,*) ' ****-------- Doing muon --------****' else if (doing_phsp) then write(6,*) ' ****-------- PHASE SPACE - NO physics, NO radiation --------****' else @@ -894,6 +899,7 @@ C DJG: ierr = regparmint('doing_2pi',doing_2pi,0) ierr = regparmint('doing_rho',doing_rho,0) ierr = regparmint('doing_positron',doing_positron,0) + ierr = regparmint('doing_muons',doing_muons,0) ierr = regparmint('doing_decay',doing_decay,0) ierr = regparmdouble('ctau',ctau,0) diff --git a/simc/simc.f b/simc/simc.f index 08dbbb3..371c81f 100644 --- a/simc/simc.f +++ b/simc/simc.f @@ -795,6 +795,8 @@ c write(7,*) 'BP thingie in/out ',shmsSTOP_BP_in,shmsSTOP_BP_out write(iun,*) ' ****--- PHASE SPACE - NO physics, NO radiation (may not work)---****' else if (doing_positron) then write(iun,*) ' ****--- doing positron****' + else if (doing_muons) then + write(iun,*) ' ****--- doing muons****' else stop 'I don''t have ANY idea what we''re doing!!!' endif diff --git a/simc/simulate.inc b/simc/simulate.inc index 8789400..169a0aa 100644 --- a/simc/simulate.inc +++ b/simc/simulate.inc @@ -68,8 +68,8 @@ logical doing_hyd_elast, doing_deuterium, doing_heavy logical doing_eep, doing_pion, doing_delta, doing_2pi, doing_kaon, doing_rho logical doing_semi, doing_semipi, doing_semika, doing_hplus - logical doing_positron - integer*4 which_kaon, which_pion + logical doing_positron, doing_muons + integer*4 padding, which_kaon, which_pion logical using_cit_generation, using_Coulomb, using_Eloss logical correct_Eloss, correct_raster,do_fermi logical using_tgt_field @@ -92,10 +92,11 @@ > extra_dbase_file,tgt_field_file,using_E_arm_montecarlo,using_P_arm_montecarlo, > doing_phsp, using_rad, hard_cuts, doing_hyd_elast, doing_deuterium, doing_heavy, > doing_eep, doing_pion, doing_delta, doing_2pi, doing_kaon, doing_rho, doing_semi,doing_positron, + > doing_muons, > doing_semipi, doing_semika, doing_hplus, which_kaon, > which_pion, using_cit_generation, using_Coulomb, using_Eloss, > correct_Eloss, correct_raster, do_fermi,using_tgt_field, - > electron_arm, hadron_arm, use_first_cer, + > electron_arm, hadron_arm, use_first_cer, padding, > transparency, use_benhar_sf, random_state_file, random_seed ! ........ note: make these first two parameters at least ONE BIGGER than the actual dimensions you want to read in -- GitLab