diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 19bb45bb38..8eb1d2d42b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -67,7 +67,7 @@ simulation_stack: .spack_nmodl: variables: SPACK_PACKAGE: nmodl - SPACK_PACKAGE_SPEC: ~legacy-unit+python + SPACK_PACKAGE_SPEC: +python spack_setup: extends: .spack_setup_ccache diff --git a/CMakeLists.txt b/CMakeLists.txt index 20573097ad..9a98839831 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,11 +18,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) # Build options for NMODL # ============================================================================= option(NMODL_ENABLE_PYTHON_BINDINGS "Enable pybind11 based python bindings" ON) -option(NMODL_ENABLE_LEGACY_UNITS "Use original faraday, R, etc. instead of 2019 nist constants" OFF) option(NMODL_ENABLE_TESTS "Enable build of tests" ON) -if(NMODL_ENABLE_LEGACY_UNITS) - add_definitions(-DUSE_LEGACY_UNITS) -endif() set(NMODL_EXTRA_CXX_FLAGS "" CACHE STRING "Add extra compile flags for NMODL sources") @@ -220,21 +216,10 @@ include(${PROJECT_SOURCE_DIR}/src/language/code_generator.cmake) add_subdirectory(src) -# ============================================================================= -# Prepare units database file from nrnunits.lib.in -# ============================================================================= -if(NMODL_ENABLE_LEGACY_UNITS) - set(LegacyY "") - set(LegacyN "/") -else() - set(LegacyY "/") - set(LegacyN "") -endif() -configure_file(share/nrnunits.lib.in ${CMAKE_CURRENT_BINARY_DIR}/share/nmodl/nrnunits.lib @ONLY) - # ============================================================================= # Install unit database to share # ============================================================================= +configure_file(share/nrnunits.lib ${CMAKE_CURRENT_BINARY_DIR}/share/nmodl/nrnunits.lib COPYONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/nmodl/nrnunits.lib DESTINATION ${NMODL_INSTALL_DIR_SUFFIX}share/nmodl) @@ -268,7 +253,6 @@ message(STATUS "--------------------+------------------------------------------- message(STATUS "CXX COMPILER | ${CMAKE_CXX_COMPILER}") message(STATUS "COMPILE FLAGS | ${COMPILER_FLAGS}") message(STATUS "Build Type | ${CMAKE_BUILD_TYPE}") -message(STATUS "Legacy Units | ${NMODL_ENABLE_LEGACY_UNITS}") message(STATUS "Python Bindings | ${NMODL_ENABLE_PYTHON_BINDINGS}") message(STATUS "Flex | ${FLEX_EXECUTABLE}") message(STATUS "Bison | ${BISON_EXECUTABLE}") diff --git a/share/nrnunits.lib.in b/share/nrnunits.lib similarity index 95% rename from share/nrnunits.lib.in rename to share/nrnunits.lib index 8af235ee58..8fb81e7f56 100755 --- a/share/nrnunits.lib.in +++ b/share/nrnunits.lib @@ -68,15 +68,13 @@ pi 3.14159265358979323846 c 2.99792458+8 m/sec fuzz g 9.80665 m/sec2 au 1.49597871+11 m fuzz -@LegacyY@mole 6.022169+23 fuzz -@LegacyN@mole 6.02214076+23 fuzz +mole 6.02214076+23 fuzz mol 1 / mol is explicitly defined as a constant / with value 1 to avoid "undefined unit" / error with mod files that don't define / it themselves -@LegacyY@e 1.6021917-19 coul fuzz -@LegacyN@e 1.602176634-19 coul fuzz +e 1.602176634-19 coul fuzz energy c2 force g mercury 1.33322+5 kg/m2-sec2 @@ -399,8 +397,7 @@ ev e-volt / faraday 9.652000+04 coul / faraday from host: physics.nist.gov / path: /PhysRefData/fundconst/html/keywords.html -@LegacyY@faraday 9.6485309+4 coul -@LegacyN@faraday e-mole +faraday e-mole fathom 6 ft fermi 1-15 m fifth 4|5 qt @@ -436,8 +433,7 @@ hyl gm force sec2/m hz /sec imaginarycubicfoot 1.4 ft3 jeroboam 4|5 gal -@LegacyY@boltzmann 1.38064852-23 joule/K -@LegacyN@boltzmann 1.380649-23 joule/K +boltzmann 1.380649-23 joule/K k boltzmann karat 1|24 kcal kilocal @@ -506,8 +502,7 @@ quarter 9 in quartersection 1|4 mi2 quintal 100 kg quire 25 -@LegacyY@gasconstant 8.3144598 joule/K -@LegacyN@gasconstant k-mole +gasconstant k-mole R gasconstant rad 100 erg/gm ream 500 @@ -581,10 +576,8 @@ tex .001 gram / m englishell 45 inch scottishell 37.2 inch flemishell 27 inch -@LegacyY@planck 6.626-34 joule-sec -@LegacyN@planck 6.62607015-34 joule-sec -@LegacyY@hbar 1.055-34 joule-sec -@LegacyN@hbar planck/two-pi +planck 6.62607015-34 joule-sec +hbar planck/two-pi electronmass 9.1095-31 kg protonmass 1.6726-27 kg neutronmass 1.6606-27 kg diff --git a/src/visitors/units_visitor.cpp b/src/visitors/units_visitor.cpp index 0da2a1c6cc..2ad612d0ea 100644 --- a/src/visitors/units_visitor.cpp +++ b/src/visitors/units_visitor.cpp @@ -128,13 +128,7 @@ void UnitsVisitor::visit_factor_def(ast::FactorDef& node) { auto node_unit_name = node.get_node_name(); auto unit1_factor = units_driver.table->get_unit(node_unit_name + "_unit1")->get_factor(); auto unit2_factor = units_driver.table->get_unit(node_unit_name + "_unit2")->get_factor(); - -#ifdef USE_LEGACY_UNITS - auto unit_factor = stringutils::to_string(unit1_factor / unit2_factor, "{:g}"); -#else auto unit_factor = stringutils::to_string(unit1_factor / unit2_factor, "{:a}"); -#endif - auto double_value_ptr = std::make_shared(ast::Double(unit_factor)); node.set_value(std::move(double_value_ptr)); }