From 3aad57369921cc00f6d3989fb9e666b31551a042 Mon Sep 17 00:00:00 2001 From: Tammo van der Heide Date: Fri, 26 Apr 2024 16:28:03 +0200 Subject: [PATCH] Perform various infrastructure related trivial updates --- CONTRIBUTING.rst | 18 +++---- cmake/Modules/FindCustomBlas.cmake | 2 +- cmake/Modules/FindCustomLapack.cmake | 2 +- cmake/SkProgsUtils.cmake | 2 +- common/include/LICENSE | 2 +- common/include/common.fypp | 50 +++++++++++--------- common/include/error.fypp | 55 +++++----------------- doc/devel/code_structure.txt | 3 +- doc/devel/general_notes.txt | 6 +-- doc/input.txt | 2 +- sys/generic.cmake | 2 +- sys/intel.cmake | 9 +++- tools/utils/srccheck/pylint/pylintrc-2.ini | 26 ---------- tools/utils/srccheck/pylint/pylintrc-3.ini | 30 ------------ utils/srccheck/pylint/pylintrc-2.ini | 26 ---------- utils/srccheck/pylint/pylintrc-3.ini | 30 ------------ 16 files changed, 66 insertions(+), 199 deletions(-) delete mode 100644 tools/utils/srccheck/pylint/pylintrc-2.ini delete mode 100644 tools/utils/srccheck/pylint/pylintrc-3.ini delete mode 100644 utils/srccheck/pylint/pylintrc-2.ini delete mode 100644 utils/srccheck/pylint/pylintrc-3.ini diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 93f75b4e..9e445389 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -35,24 +35,24 @@ When you contribute to the project, your contribution must align with the Developer Certificate of Origin Version 1.1 - + Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 1 Letterman Drive Suite D4700 San Francisco, CA, 94129 - + Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - - + + Developer's Certificate of Origin 1.1 - + By making a contribution to this project, I certify that: - + (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or - + (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that @@ -60,11 +60,11 @@ When you contribute to the project, your contribution must align with the by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or - + (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. - + (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is diff --git a/cmake/Modules/FindCustomBlas.cmake b/cmake/Modules/FindCustomBlas.cmake index 6ec8e9c2..bc195426 100644 --- a/cmake/Modules/FindCustomBlas.cmake +++ b/cmake/Modules/FindCustomBlas.cmake @@ -1,6 +1,6 @@ # Distributed under the OSI-approved BSD 2-Clause License. # -# Copyright (C) 2021 DFTB+ developers group +# Copyright (C) 2024 DFTB+ developers group # #[=======================================================================[.rst: diff --git a/cmake/Modules/FindCustomLapack.cmake b/cmake/Modules/FindCustomLapack.cmake index 7486c0a6..365d683f 100644 --- a/cmake/Modules/FindCustomLapack.cmake +++ b/cmake/Modules/FindCustomLapack.cmake @@ -1,6 +1,6 @@ # Distributed under the OSI-approved BSD 2-Clause License. # -# Copyright (C) 2021 DFTB+ developers group +# Copyright (C) 2024 DFTB+ developers group # #[=======================================================================[.rst: diff --git a/cmake/SkProgsUtils.cmake b/cmake/SkProgsUtils.cmake index dd57ebbc..d5f85909 100644 --- a/cmake/SkProgsUtils.cmake +++ b/cmake/SkProgsUtils.cmake @@ -137,7 +137,7 @@ function(skprogs_guess_toolchain toolchain) if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") set(_toolchain "gnu") - elseif("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "Intel") + elseif("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel|IntelLLVM") set(_toolchain "intel") elseif("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "NAG") set(_toolchain "nag") diff --git a/common/include/LICENSE b/common/include/LICENSE index 39a18bb4..10fb1e3e 100644 --- a/common/include/LICENSE +++ b/common/include/LICENSE @@ -1,5 +1,5 @@ DFTB+: general package for performing fast atomistic simulations -Copyright (C) 2006 - 2021 DFTB+ developers group +Copyright (C) 2006 - 2024 DFTB+ developers group This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free diff --git a/common/include/common.fypp b/common/include/common.fypp index 917f43d9..759424c9 100644 --- a/common/include/common.fypp +++ b/common/include/common.fypp @@ -1,6 +1,6 @@ #!-------------------------------------------------------------------------------------------------! #! DFTB+: general package for performing fast atomistic simulations ! -#! Copyright (C) 2006 - 2020 DFTB+ developers group ! +#! Copyright (C) 2006 - 2024 DFTB+ developers group ! #! ! #! See the LICENSE file for terms of usage and distribution. ! #!-------------------------------------------------------------------------------------------------! @@ -12,27 +12,15 @@ #! Default values for all preprocessor variables #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -#:if not defined('DEBUG') - #:set DEBUG = 0 -#:endif - +#:set DEBUG = getvar('DEBUG', 0) #:set WITH_ASSERT = defined('WITH_ASSERT') or DEBUG > 0 #:set WITH_MPI = defined('WITH_MPI') + #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -#! ASSERT and DEBUG related macros +#! DEBUG related macros #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -#! Check a condition if WITH_ASSERT is True and call assertError if condition is False. -#:def ASSERT(cond) - #:if WITH_ASSERT - if (.not. (${cond}$)) then - call assertError("${_FILE_}$", ${_LINE_}$) - end if - #:endif -#:enddef ASSERT - - #! Insert code if DEBUG level is greater than zero. #:def DEBUG_CODE(code) #:if DEBUG > 0 @@ -58,11 +46,31 @@ #:enddef -#! Macro for automated deallocations -#:def SAFE_DEALLOC(*args) - #:for arg in args - if (allocated(${arg}$)) deallocate(${arg}$) - #:endfor +#! Creates a class instance by allocating, initializing and move_allocing a specific type +#! +#! Args: +#! cls (str): Name of the LHS variable (must be a class) +#! dyntype (str): Dynamic type of the actual instance to be initialized +#! init (str): Initialization routine to call (with allocated instance as first arg) +#! initargs (str): Further arguments to pass to the init routine. +#:def CREATE_CLASS(cls, dyntype, init, *initargs) +block + type(${dyntype}$), allocatable :: inst + allocate(inst) + call ${init}$(inst, ${", ".join(initargs)}$) + call move_alloc(inst, ${cls}$) +end block #:enddef + +#! Simple macro printing out the position of a line +#:def PRINT_POSITION() +block + use iso_fortran_env, only : output_unit + write(output_unit, "(a)") "Reached line ${_LINE_}$ in ${_FILE_}$" + flush(output_unit) +end block +#:enddef + +#:endif #:endmute diff --git a/common/include/error.fypp b/common/include/error.fypp index b63680a8..cbd9d419 100644 --- a/common/include/error.fypp +++ b/common/include/error.fypp @@ -1,55 +1,18 @@ #!-------------------------------------------------------------------------------------------------! #! DFTB+: general package for performing fast atomistic simulations ! -#! Copyright (C) 2006 - 2020 DFTB+ developers group ! +#! Copyright (C) 2006 - 2024 DFTB+ developers group ! #! ! #! See the LICENSE file for terms of usage and distribution. ! #!-------------------------------------------------------------------------------------------------! -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -#! Error string handling wrappers for returns from routinese -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - -#! Macro to return an error flag if return variable available or throw -#! an error and shut down otherwise -#:def ERROR_HANDLING(errVar, errNumber, msg) - block - use dftbp_accuracy, only : lc - use dftbp_message - !> Error handling string - character(lc) :: stringTmp - - write(stringTmp,"(A)")${msg}$ - if (present(${errVar}$)) then - ${errVar}$ = ${errNumber}$ - call warning(stringTmp) - return - else - call error(stringTmp) - end if - end block -#:enddef ERROR_HANDLING - +#:mute +#:if not defined("_ERROR_FYPP_") +#:set _ERROR_FYPP_ -#! Macro to return an error flag if return variable available or throw -#! an error and shut down otherwise -#:def FORMATTED_ERROR_HANDLING(errVar, errNumber, formating, *variables) - block - use dftbp_accuracy, only : lc - use dftbp_message - !> Error handling string - character(lc) :: stringTmp - write(stringTmp,${formating}$) ${ ",".join(variables) }$ - if (present(${errVar}$)) then - ${errVar}$ = ${errNumber}$ - call warning(stringTmp) - return - else - call error(stringTmp) - end if - end block -#:enddef FORMATTED_ERROR_HANDLING +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#! Error string handling wrappers for returns from routines +#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #! Propagation of error handling, for now it just returns when in error @@ -60,3 +23,7 @@ end if end if #:enddef + + +#:endif +#:endmute diff --git a/doc/devel/code_structure.txt b/doc/devel/code_structure.txt index e65dea68..5232dd7f 100644 --- a/doc/devel/code_structure.txt +++ b/doc/devel/code_structure.txt @@ -4,7 +4,7 @@ OVERVIEW main.f90: main program globals.f90: Variables of the main program, except the mixer all - other subroutines/functions use intent(in)/intent(out) to protect + other subroutines/functions use intent(in)/intent(out) to protect these variables, so in some sence this is not global The variables are also allocated here. IMPORTANT: This also gives a short comment what the variable is ! @@ -49,4 +49,3 @@ utilities.f90: misc stuff (factorial etc.) zora_routines.f90: ZORA routines, contains even the routines for the naive implementation, see NAIVE_ZORA for their use - diff --git a/doc/devel/general_notes.txt b/doc/devel/general_notes.txt index bddb7bfc..7d4d12dc 100644 --- a/doc/devel/general_notes.txt +++ b/doc/devel/general_notes.txt @@ -41,7 +41,7 @@ alpha with a known issue: Although I am confident I got the prefactor right I cannot reproduce literature results. Not sure why. For the ZORA stuff see vlenthe.pdf in references. Here, I basically use -the implementation for ADF Band (Chapter 6.2) which explicitely assumes a +the implementation for ADF Band (Chapter 6.2) which explicitely assumes a sphericallysymmetric potential with one more step (which has to be checked): Impementing 6.13-6.15 directly leads to an matrix element containg the second derivative of the basis function. IMHO one can @@ -60,7 +60,7 @@ ZORA as currently implemented. The confining potential matrix elements are also evaluated analytically. The confinig potential does not enter in the ZORA kinetic energy -operator, since the kinetic energy would then vanish for r->infty which is -clearly wrong. Having the confining potential only in the SCF potential but +operator, since the kinetic energy would then vanish for r->infty which is +clearly wrong. Having the confining potential only in the SCF potential but not in the ZORA kinetic energy seems to work reasonanbly judging from the expectation values. diff --git a/doc/input.txt b/doc/input.txt index f18dbbbe..f4b64d51 100644 --- a/doc/input.txt +++ b/doc/input.txt @@ -13,7 +13,7 @@ Line 2: xc_functional integer :: xc_functional, 0=HF, 1=X-Alpha, 2=PW-LDA, 3=PBE - NOTE: HF only correct for 1S states, X-Aalpha is untested alpha=0.7 + NOTE: HF only correct for 1S states, X-Alpha is untested alpha=0.7 Line 3: r_0 power diff --git a/sys/generic.cmake b/sys/generic.cmake index c6fde8ce..3102fac0 100644 --- a/sys/generic.cmake +++ b/sys/generic.cmake @@ -28,7 +28,7 @@ set(Fortran_FLAGS "${CMAKE_Fortran_FLAGS}" set(Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" CACHE STRING "Fortran compiler flags for Release build") -set(Fortran_FLAGS_RELWITHDEBINFO "${Fortran_FLAGS_RELWITHDEBINFO}" +set(Fortran_FLAGS_RELWITHDEBINFO "${CMAKE_Fortran_FLAGS_RELWITHDEBINFO}" CACHE STRING "Fortran compiler flags for Release build") set(Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" diff --git a/sys/intel.cmake b/sys/intel.cmake index 98c32ddc..e4c1fa02 100644 --- a/sys/intel.cmake +++ b/sys/intel.cmake @@ -18,8 +18,13 @@ # # Fortran compiler settings # -set(Fortran_FLAGS_RELEASE "-O2 -ip" - CACHE STRING "Fortran compiler flags for Release build") +if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "IntelLLVM") + set(Fortran_FLAGS_RELEASE "-O2" + CACHE STRING "Fortran compiler flags for Release build") +else() + set(Fortran_FLAGS_RELEASE "-O2 -ip" + CACHE STRING "Fortran compiler flags for Release build") +endif() set(Fortran_FLAGS_RELWITHDEBINFO "-g ${Fortran_FLAGS_RELEASE}" CACHE STRING "Fortran compiler flags for Release build") diff --git a/tools/utils/srccheck/pylint/pylintrc-2.ini b/tools/utils/srccheck/pylint/pylintrc-2.ini deleted file mode 100644 index 4c909ac7..00000000 --- a/tools/utils/srccheck/pylint/pylintrc-2.ini +++ /dev/null @@ -1,26 +0,0 @@ -[TYPECHECK] - -ignored-modules = numpy, numpy.linalg -ignored-classes = numpy, numpy.linalg - -[BASIC] - -variable-rgx = [a-z_][a-z0-9_]{1,30}$ -good-names = _ - -[FORMAT] - -max-line-length = 80 - -[DESIGN] - -min-public-methods = 0 -max-locals = 20 -max-attributes = 20 -max-args = 10 -max-returns = 10 -max-statements = 100 -max-branches = 20 - -[MESSAGES CONTROL] -disable = old-style-class,star-args diff --git a/tools/utils/srccheck/pylint/pylintrc-3.ini b/tools/utils/srccheck/pylint/pylintrc-3.ini deleted file mode 100644 index 5d85cf14..00000000 --- a/tools/utils/srccheck/pylint/pylintrc-3.ini +++ /dev/null @@ -1,30 +0,0 @@ -[TYPECHECK] - -ignored-modules = numpy, numpy.linalg -ignored-classes = numpy, numpy.linalg - -[BASIC] - -variable-rgx = [a-z_][a-z0-9_]{1,30}$ -good-names = _ - -[FORMAT] - -max-line-length = 80 - -[DESIGN] - -min-public-methods = 0 -max-locals = 20 -max-attributes = 20 -max-args = 10 -max-returns = 10 -max-statements = 100 -max-branches = 20 - -[MESSAGES CONTROL] -disable = star-args - -[IMPORTS] -# remove optparse from deprecated modules -deprecated-modules = diff --git a/utils/srccheck/pylint/pylintrc-2.ini b/utils/srccheck/pylint/pylintrc-2.ini deleted file mode 100644 index 4c909ac7..00000000 --- a/utils/srccheck/pylint/pylintrc-2.ini +++ /dev/null @@ -1,26 +0,0 @@ -[TYPECHECK] - -ignored-modules = numpy, numpy.linalg -ignored-classes = numpy, numpy.linalg - -[BASIC] - -variable-rgx = [a-z_][a-z0-9_]{1,30}$ -good-names = _ - -[FORMAT] - -max-line-length = 80 - -[DESIGN] - -min-public-methods = 0 -max-locals = 20 -max-attributes = 20 -max-args = 10 -max-returns = 10 -max-statements = 100 -max-branches = 20 - -[MESSAGES CONTROL] -disable = old-style-class,star-args diff --git a/utils/srccheck/pylint/pylintrc-3.ini b/utils/srccheck/pylint/pylintrc-3.ini deleted file mode 100644 index 5d85cf14..00000000 --- a/utils/srccheck/pylint/pylintrc-3.ini +++ /dev/null @@ -1,30 +0,0 @@ -[TYPECHECK] - -ignored-modules = numpy, numpy.linalg -ignored-classes = numpy, numpy.linalg - -[BASIC] - -variable-rgx = [a-z_][a-z0-9_]{1,30}$ -good-names = _ - -[FORMAT] - -max-line-length = 80 - -[DESIGN] - -min-public-methods = 0 -max-locals = 20 -max-attributes = 20 -max-args = 10 -max-returns = 10 -max-statements = 100 -max-branches = 20 - -[MESSAGES CONTROL] -disable = star-args - -[IMPORTS] -# remove optparse from deprecated modules -deprecated-modules =