Skip to content
Merged
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
196 changes: 5 additions & 191 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,123 +6,6 @@ find_package( Python3 3.5 REQUIRED )
set( CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Supported configuration types" FORCE )

project( njoy LANGUAGES Fortran )
get_directory_property( is_subproject PARENT_DIRECTORY )
include( CMakeDependentOption REQUIRED )

set( njoy_GNU_minimum_version 5.1 )

if( njoy_${CMAKE_Fortran_COMPILER_ID}_minimum_version )
if( CMAKE_Fortran_COMPILER_VERSION AND
CMAKE_Fortran_COMPILER_VERSION VERSION_LESS
${njoy_${CMAKE_Fortran_COMPILER_ID}_minimum_version} )
message( FATAL_ERROR "${CMAKE_Fortran_COMPILER_ID} version must be greater than ${njoy_${CMAKE_Fortran_COMPILER_ID}_minimum_version}" )
endif()
endif()

# general properties
option( njoy_strict "Compile time warnings are converted to errors" OFF )

# binary instrumentation
option( coverage "Enable binary instrumentation to collect test coverage information in the DEBUG configuration" )
option( profile_generate "Enable binary instrumentation to generation execution profiles in the RELEASE configuration which may be used to guide later optimization" )

# additional optimizations
option( link_time_optimization "Enable link time optimization in the RELEASE configuration" )
option( profile_use "In the RELEASE configuration, leverage previously generated exeution profile to inform optimization decisions" )
option( nonportable_optimization "Enable optimizations which compromise portability of resulting binary in the RELEASE configuration" )

# libraries and linking
option( static "Statically link component and environment libraries" OFF )
if ( static AND ( "${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" ) )
message( FATAL_ERROR "Static binaries not supported on OSX" )
endif()

CMAKE_DEPENDENT_OPTION( static_libraries "Statically link component libraries" OFF "NOT static" ON )
CMAKE_DEPENDENT_OPTION( static_njoy "Statically link the njoy component library" OFF "NOT static;NOT static_libraries" ON )

if ( profile_generate AND profile_use )
message( FATAL_ERROR "Cannot both generate and use execution profile in the same configuration" )
endif()

if ( profile_generate )
file( MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/profiling" )
endif()

set( CMAKE_Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/fortran_modules" CACHE PATH "directory for fortran modules" )
file( MAKE_DIRECTORY "${CMAKE_Fortran_MODULE_DIRECTORY}" )

set( njoy_GNU_Linux_common_flags "-Wall" "-Wextra" )
set( njoy_GNU_Linux_DEBUG_flags "-O0" "-g" "-gdwarf-3" "-frounding-math" "-fsignaling-nans" "-fcheck=all" "-ffpe-trap=invalid,zero,overflow" )
set( njoy_GNU_Linux_RELEASE_flags "-O3" "-DNDEBUG" )
set( njoy_GNU_Linux_strict_flags "-Werror" )
set( njoy_GNU_Linux_coverage_flags "--coverage" )
set( njoy_GNU_Linux_subproject_flags "-Wno-maybe-uninitialized" "-Wno-conversion" "-Wno-unused-parameter" "-Wno-compare-reals" "-Wno-unused-variable" "-Wno-intrinsic-shadow" "-Wno-unused-dummy-argument" "-Wno-uninitialized" "-Wno-unused-function" "-Wno-unused-label" "-Wno-character-truncation" )
set( njoy_GNU_Linux_base_project_flags )
set( njoy_GNU_Linux_profile_generate_flags "-fprofile-generate='${CMAKE_BINARY_DIR}/profiling'" )
set( njoy_GNU_Linux_link_time_optimization_flags "-flto" )
set( njoy_GNU_Linux_profile_use_flags "-fprofile-use='${CMAKE_BINARY_DIR}/profiling'" )
set( njoy_GNU_Linux_nonportable_optimization_flags "-march=native" )
set( njoy_GNU_Linux_static_flags "-static" )
set( njoy_GNU_Windows_common_flags "-Wall" "-Wextra" )
set( njoy_GNU_Windows_DEBUG_flags "-O0" "-g" "-gdwarf-3" "-frounding-math" "-fsignaling-nans" "-fcheck=all" "-ffpe-trap=invalid,zero,overflow" )
set( njoy_GNU_Windows_RELEASE_flags "-O3" "-DNDEBUG" )
set( njoy_GNU_Windows_strict_flags "-Werror" )
set( njoy_GNU_Windows_coverage_flags "--coverage" )
set( njoy_GNU_Windows_subproject_flags "-Wno-maybe-uninitialized" "-Wno-conversion" "-Wno-unused-parameter" "-Wno-compare-reals" "-Wno-unused-variable" "-Wno-intrinsic-shadow" "-Wno-unused-dummy-argument" "-Wno-uninitialized" "-Wno-unused-function" "-Wno-unused-label" "-Wno-character-truncation" )
set( njoy_GNU_Windows_base_project_flags )
set( njoy_GNU_Windows_profile_generate_flags "-fprofile-generate='${CMAKE_BINARY_DIR}/profiling'" )
set( njoy_GNU_Windows_link_time_optimization_flags "-flto" )
set( njoy_GNU_Windows_profile_use_flags "-fprofile-use='${CMAKE_BINARY_DIR}/profiling'" )
set( njoy_GNU_Windows_nonportable_optimization_flags "-march=native" )
set( njoy_GNU_Windows_static_flags "-static" )
set( njoy_GNU_Darwin_common_flags "-Wall" "-Wextra" )
set( njoy_GNU_Darwin_DEBUG_flags "-O0" "-g" "-gdwarf-3" "-frounding-math" "-fsignaling-nans" "-fcheck=all" "-ffpe-trap=invalid,zero,overflow" )
set( njoy_GNU_Darwin_RELEASE_flags "-O3" "-DNDEBUG" )
set( njoy_GNU_Darwin_strict_flags "-Werror" )
set( njoy_GNU_Darwin_coverage_flags "--coverage" )
set( njoy_GNU_Darwin_subproject_flags "-Wno-maybe-uninitialized" "-Wno-conversion" "-Wno-unused-parameter" "-Wno-compare-reals" "-Wno-unused-variable" "-Wno-intrinsic-shadow" "-Wno-unused-dummy-argument" "-Wno-uninitialized" "-Wno-unused-function" "-Wno-unused-label" "-Wno-character-truncation" )
set( njoy_GNU_Darwin_base_project_flags )
set( njoy_GNU_Darwin_profile_generate_flags "-fprofile-generate='${CMAKE_BINARY_DIR}/profiling'" )
set( njoy_GNU_Darwin_link_time_optimization_flags "-flto" )
set( njoy_GNU_Darwin_profile_use_flags "-fprofile-use='${CMAKE_BINARY_DIR}/profiling'" )
set( njoy_GNU_Darwin_nonportable_optimization_flags "-march=native" )
set( njoy_GNU_Darwin_static_flags "-static" )

if ( static_njoy )
set( njoy_library_linkage STATIC )
else ()
set( njoy_library_linkage SHARED )
endif ()

set( CMAKE_SKIP_BUILD_RPATH FALSE )
set( CMAKE_BUILD_WITH_INSTALL_RPATH FALSE )
if ( CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
set( rpath_prefix "@loader_path" )
else()
set( rpath_prefix "\\$ORIGIN" )
endif()
list( INSERT 0 CMAKE_INSTALL_RPATH "${rpath_prefix}/../lib" )
set( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE )

if ( NOT GIT_EXECUTABLE )
find_package( Git )
if ( NOT GIT_FOUND )
message( FATAL_ERROR "git installation was not found." )
endif()
endif()

execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)

message( STATUS "" )
message( STATUS "-----------------------------------------------------------" )
Expand All @@ -133,7 +16,8 @@ message( STATUS "Git commit hash: ${GIT_HASH}" )
message( STATUS "" )
message( STATUS "-----------------------------------------------------------" )

add_library( njoy ${njoy_library_linkage}
add_executable( njoy_executable
"${CMAKE_CURRENT_SOURCE_DIR}/src/main.f90"
"${CMAKE_CURRENT_SOURCE_DIR}/src/acecm.f90"
"${CMAKE_CURRENT_SOURCE_DIR}/src/acedo.f90"
"${CMAKE_CURRENT_SOURCE_DIR}/src/acefc.f90"
Expand Down Expand Up @@ -173,77 +57,7 @@ add_library( njoy ${njoy_library_linkage}
"${CMAKE_CURRENT_SOURCE_DIR}/src/vers.f90"
"${CMAKE_CURRENT_SOURCE_DIR}/src/viewr.f90"
"${CMAKE_CURRENT_SOURCE_DIR}/src/wimsr.f90" )
set_target_properties( njoy_executable PROPERTIES OUTPUT_NAME njoy )

target_include_directories( njoy PUBLIC "${CMAKE_Fortran_MODULE_DIRECTORY}" )

set( PREFIX njoy_${CMAKE_Fortran_COMPILER_ID}_${CMAKE_SYSTEM_NAME} )

target_compile_options( njoy PRIVATE
${${PREFIX}_common_flags}
$<$<BOOL:${njoy_strict}>:${${PREFIX}_njoy_strict_flags}>
$<$<BOOL:${static}>:${${PREFIX}_static_flags}>
$<$<BOOL:${is_subproject}>:${${PREFIX}_subproject_flags}>
$<$<NOT:$<BOOL:${is_subproject}>>:${${PREFIX}_base_project_flags}>
$<$<CONFIG:DEBUG>:
${${PREFIX}_DEBUG_flags}
$<$<BOOL:${coverage}>:${${PREFIX}_coverage_flags}>>
$<$<CONFIG:RELEASE>:
${${PREFIX}_RELEASE_flags}
$<$<BOOL:${profile_generate}>:${${PREFIX}_profile_generate_flags}>
$<$<BOOL:${profile_use}>:${${PREFIX}_profile_use_flags}>
$<$<BOOL:${link_time_optimization}>:${${PREFIX}_link_time_optimization_flags}>
$<$<BOOL:${nonportable_optimization}>:${${PREFIX}_nonportable_optimization_flags}>>
${Fortran_appended_flags} ${njoy_appended_flags} )

target_link_libraries( njoy PUBLIC "$<$<AND:$<CONFIG:RELEASE>,$<BOOL:${link_time_optimization}>>:${${PREFIX}_RELEASE_flags};${${PREFIX}_link_time_optimization_flags}$<$<BOOL:${profile_generate}>:${${PREFIX}_profile_generate_flags};>$<$<BOOL:${profile_use}>:${${PREFIX}_profile_use_flags};>$<$<BOOL:${nonportable_optimization}>:${${PREFIX}_nonportable_optimization_flags};>>$<$<CONFIG:DEBUG>:$<$<BOOL:${coverage}>:${${PREFIX}_coverage_flags};>>$<$<BOOL:Fortran_appended_flags>:${Fortran_appended_flags};>$<$<BOOL:njoy_appended_flags>:${njoy_appended_flags};>" )

if ( NOT is_subproject )
add_executable( njoy_executable src/main.f90 )
set_target_properties( njoy_executable PROPERTIES OUTPUT_NAME njoy )
target_compile_options( njoy_executable PRIVATE
${${PREFIX}_common_flags}
$<$<BOOL:${njoy_strict}>:${${PREFIX}_njoy_strict_flags}>
$<$<BOOL:${static}>:${${PREFIX}_static_flags}>
$<$<BOOL:${is_subproject}>:${${PREFIX}_subproject_flags}>
$<$<NOT:$<BOOL:${is_subproject}>>:${${PREFIX}_base_project_flags}>
$<$<CONFIG:DEBUG>:
${${PREFIX}_DEBUG_flags}
$<$<BOOL:${coverage}>:${${PREFIX}_coverage_flags}>>
$<$<CONFIG:RELEASE>:
${${PREFIX}_RELEASE_flags}
$<$<BOOL:${profile_generate}>:${${PREFIX}_profile_generate_flags}>
$<$<BOOL:${profile_use}>:${${PREFIX}_profile_use_flags}>
$<$<BOOL:${link_time_optimization}>:${${PREFIX}_link_time_optimization_flags}>
$<$<BOOL:${nonportable_optimization}>:${${PREFIX}_nonportable_optimization_flags}>>
${Fortran_appended_flags} ${njoy_appended_flags} )
target_link_libraries( njoy_executable PUBLIC njoy )
endif()

if( NOT is_subproject )
enable_testing()
add_subdirectory( tests )
endif()

set( installation_targets njoy )
if ( NOT is_subproject )
list( APPEND installation_targets njoy_executable )
endif()

install( TARGETS ${installation_targets}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ
WORLD_EXECUTE WORLD_READ )

file( RELATIVE_PATH relative_fortran_module_files_path
"${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_Fortran_MODULE_DIRECTORY}" )
file( GLOB fortran_module_files
RELATIVE "${relative_fortran_module_files_path}"
*.mod )
install( FILES ${fortran_module_files}
DESTINATION include
PERMISSIONS OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ )
enable_testing()
add_subdirectory( tests )
3 changes: 3 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ This update fixes the following issues:
- GROUPR output now correctly distinguishes between level numbers and isomeric numbers when extracting nuclide production.
- LEAPR now sets the EMAX value in MF1 MT451 to be equal to the B(4) value in MF7 MT4.
- PURR now uses quicksort instead of bubble sort, which leads to a significant speedup in this module. This change should have no effect on the values of the probability table.
- ACER now correctly handles discrete primary gammas in File 6 for the ENDF/B-VIII.1 release, which uses a different format than JEFF and JENDL libraries.

In addition, this update added the following features and changes:
- Added optional card9a to GROUPR to support extracting MF=9 and MF=10 production channels with resulting level numbers greater than 9.
- Two group structures were added to GROUPR (the apollo 99-group structure and the ecco 1962-group structure). The shem epm 295-group structure and shem cea/epm 361-group structure were updated as well.

The cmake files were simplified to allow for the use of LLVM's flang compiler. A minor update was mode to GROUPR as well to allow for compilation with LLVM flang.

## [NJOY2016.78](https://github.com/njoy/NJOY2016/pull/361)
This update fixes the following issues:
- Tape numbers are now allowed to go up to 999 instead of 99 previously. This change was made to accommodate processing of the light water evaluation in ENDF/B-VIII.1 that has 94 temperatures. Test 84 was added to detect this issue in the future.
Expand Down
65 changes: 61 additions & 4 deletions src/acefc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ module acefc
integer::mt103,mt104,mt105,mt106,mt107
integer::mpmin,mpmax,mdmin,mdmax,mtmin,mtmax,m3min,m3max,m4min,m4max

!-- adding variables to hold the library and version
integer::nlib,lrel,nver

! record parameters for Type-2 binary files
integer::ner,nbw

Expand Down Expand Up @@ -152,6 +155,9 @@ subroutine acetop(nendf,npend,ngend,nace,ndir,iprint,itype,mcnpx,&
call repoz(nendf)
call tpidio(nendf,0,0,b,nb,nw)
call contio(nendf,0,0,b,nb,nw)
!-- get library
nlib = n1h

call contio(nendf,0,0,b,nb,nw)
if (n1h.ne.0) then
iverf=4
Expand All @@ -162,6 +168,11 @@ subroutine acetop(nendf,npend,ngend,nace,ndir,iprint,itype,mcnpx,&
endif
write(nsyso,'(/'' using endf-'',i1,'' format'')') iverf

!-- get library release
call contio(nendf,0,0,b,nb,nw)
lrel = l1h
nver=n2h

!--assign scratch files
mscr=10
mscr=iabs(mscr)
Expand Down Expand Up @@ -8669,6 +8680,25 @@ subroutine acelpp(next,matd,ngmt,nin)
'reset to 1.e-5 eV')
ep=1.e-5_kr
endif
!-- ENDF-8.1 formats primary gamma energy as the outgoing
!-- energy at each incident energy. JENDL (and JEFF) format
!-- them as the binding energy. NJOY expects the binding
!-- energy so this logic changes the value if the evaluation
!-- is from ENDF-8.1. This will hopefully be resolved before
!-- the next ENDF release.
if (law.eq.1.and.ep.lt.zero) then
if (nlib.eq.0.and.nver.eq.8.and.lrel.eq.1) then
!-- convert to the (negated) binding energy value
ep=ep+ei*awr/(awr+1)
call mess('acelpp',&
'Handling MF6 ENDF-8.1 discrete primary gamma ',&
'format by converting to JENDL format')
else
call mess('acelpp',&
'Handling MF6 discrete primary gammas by ',&
'assuming the JENDL-5.0 format.')
endif
endif
if (law.eq.2) ep=ep-awr*ei/(awr+1)
dise(ki)=ep
if (ki.gt.1) then
Expand All @@ -8691,6 +8721,18 @@ subroutine acelpp(next,matd,ngmt,nin)
'reset to 1.e-5 eV')
ep=1.e-5_kr
endif
!-- ENDF-8.1 formats primary gamma energy as the outgoing
!-- energy at each incident energy. JENDL (and JEFF) format
!-- them as the binding energy. NJOY expects the binding
!-- energy so this logic changes the value if the evaluation
!-- is from ENDF-8.1. This will hopefully be resolved before
!-- the next ENDF release
if (law.eq.1.and.ep.lt.zero) then
if (nlib.eq.0.and.nver.eq.8.and.lrel.eq.1) then
!-- convert to the (negated) binding energy value
ep=ep+ei*awr/(awr+1)
endif
endif
if (law.eq.2) ep=ep-awr*ei/(awr+1)
if (ki.gt.1.) then
if (ep.eq.scr(5+2*(ki-1)))&
Expand All @@ -8703,7 +8745,7 @@ subroutine acelpp(next,matd,ngmt,nin)
!--found a new discrete energy. insert it into
!--the existing dise array, making sure to
!--maintain a highest to lowest energy order.
if (abs(scr(5+2*ki)).gt.abs(dise(1))) then
if (abs(ep).gt.abs(dise(1))) then
do m=nd0,1,-1
dise(m+1)=dise(m)
enddo
Expand Down Expand Up @@ -8827,8 +8869,15 @@ subroutine acelpp(next,matd,ngmt,nin)
!--photon.
if (nd0.ne.0.and.nd.eq.nd0) then
do nn=1,nd
if (law.eq.1.and.scr(5+2*nn).lt.zero)&
scr(5+2*nn)=-scr(5+2*nn)+ei*awr/(awr+1)
if (law.eq.1.and.scr(5+2*nn).lt.zero) then
!-- if ENDF8.1, don't need to convert to gamma energy
!-- from binding energy - just negate
if (nlib.eq.0.and.nver.eq.8.and.lrel.eq.1) then
scr(5+2*nn)=-scr(5+2*nn)
else
scr(5+2*nn)=-scr(5+2*nn)+ei*awr/(awr+1)
endif
endif
enddo
elseif (nd0.ne.0.and.nd.ne.nd0) then
!--if nd=0 then must insert all discrete photons
Expand Down Expand Up @@ -8865,7 +8914,15 @@ subroutine acelpp(next,matd,ngmt,nin)
!--to account for the incident neutron energy.
do m=nd0,1,-1
ep=dise(m)
if (law.eq.1.and.ep.lt.zero)ep=-ep+ei*awr/(awr+1)
if (law.eq.1.and.ep.lt.zero) then
!-- if ENDF8.1, don't need to convert to gamma energy
!-- from binding energy - just negate
if (nlib.eq.0.and.nver.eq.8.and.lrel.eq.1) then
ep=-ep
else
ep=-ep+ei*awr/(awr+1)
endif
endif
if (law.eq.2)ep=ep+ei*awr/(awr+1)
scr(5+2*m)=ep
scr(6+2*m)=zero
Expand Down
2 changes: 1 addition & 1 deletion src/groupr.f90
Original file line number Diff line number Diff line change
Expand Up @@ -9074,7 +9074,7 @@ subroutine f6lab(ep,epnext,term,nl,law,int,lang,lep,clo,chi,e)
use mathm ! provides legndr
! externals
integer::nl,law,int,lang,lep
real(kr)::ep,epnext,term(nl),clo(*),chi(*),e
real(kr)::ep,epnext,term(*),clo(*),chi(*),e
! internals
integer::ilo,llo,mlo,nclo,ihi,lhi,mhi,nchi,intt,l,idone
integer::ndlo,ndhi,nplo,nphi,int2,na,i,j,jj,nll
Expand Down
12 changes: 12 additions & 0 deletions tests/87/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/input"
"${CMAKE_CURRENT_BINARY_DIR}/input" COPYONLY )

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/referenceTape41"
"${CMAKE_CURRENT_BINARY_DIR}/referenceTape41" COPYONLY )

configure_file("${RESOURCES}/n-078_Pt_190-ENDF8.1.endf"
"${CMAKE_CURRENT_BINARY_DIR}/tape20" COPYONLY )

add_test( NAME "Test87"
COMMAND ${Python3_EXECUTABLE} "../execute.py"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" )
Loading
Loading