diff --git a/.gitmodules b/.gitmodules index 3f29618d0..871a9607b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,9 +7,12 @@ [submodule "external/wannier90"] path = external/wannier90 url = https://github.com/wannier-developers/wannier90.git -[submodule "external/devxlib"] - path = external/devxlib - url = https://gitlab.com/max-centre/components/devicexlib.git [submodule "external/mbd"] path = external/mbd url = https://github.com/jhrmnn/libmbd.git +[submodule "external/eigensolver_gpu"] + path = external/eigensolver_gpu + url = https://github.com/NVIDIA/Eigensolver_gpu.git +[submodule "external/devxlib"] + path = external/devxlib + url = https://gitlab.com/max-centre/components/devicexlib.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 905fa276c..293e49daf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,12 +10,12 @@ cmake_minimum_required(VERSION 3.14 FATAL_ERROR) set(CMAKE_POLICY_DEFAULT_CMP0048 NEW) project(qe - VERSION 6.6.0 + VERSION 6.7.1 DESCRIPTION "ESPRESSO: opEn-Source Package for Research in Electronic Structure, Simulation, and Optimization" LANGUAGES Fortran C) if(${qe_BINARY_DIR} STREQUAL ${qe_SOURCE_DIR}) - message(FATAL_ERROR "QE source folder cannot be safely used as a build folder!") + message(FATAL_ERROR "QE source folder cannot be safely used as a build folder!") endif() # CMake < v3.18 cannot discover the ARM Performance Library @@ -25,14 +25,17 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*|arm64.*|ARM64.*)") endif() endif() -###################################################################### +########################################################## # Define the paths for static libraries and executables -###################################################################### -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${qe_BINARY_DIR}/lib CACHE PATH "Single output directory for building all libraries.") -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${qe_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.") +########################################################## +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${qe_BINARY_DIR}/lib + CACHE + PATH "Single output directory for building all libraries.") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${qe_BINARY_DIR}/bin + CACHE + PATH "Single output directory for building all executables.") set(QE_TESTS_DIR ${qe_BINARY_DIR}/tests/bin) - ########################################################### # Build helpers ########################################################### @@ -59,12 +62,22 @@ include(GNUInstallDirs) ########################################################### # Build Options ########################################################### -option(QE_ENABLE_TEST - "enable unit tests" ON) +option(QE_ENABLE_CUDA + "enable CUDA acceleration on NVIDIA GPUs" OFF) +if(QE_ENABLE_CUDA) + option(QE_ENABLE_LAXLIB_CUSOLVER + "enable CUDA solver acceleration for LAXLib on NVIDIA GPUs" ON) + # OpenMP enable by default if CUDA is enable + option(QE_ENABLE_OPENMP + "enable distributed execution support via OpenMP" ON) +else() + option(QE_ENABLE_OPENMP + "enable distributed execution support via OpenMP" OFF) +endif() option(QE_ENABLE_MPI "enable distributed execution support via MPI" ON) -option(QE_ENABLE_OPENMP - "enable distributed execution support via OpenMP" OFF) +option(QE_ENABLE_TEST + "enable unit tests" OFF) option(QE_ENABLE_TRACE "enable execution tracing output" OFF) option(QE_ENABLE_MPI_INPLACE @@ -81,8 +94,6 @@ option(QE_ENABLE_ELPA "enable ELPA execution units" OFF) option(QE_ENABLE_HDF5 "enable HDF5 data collection" OFF) -option(QE_ENABLE_CUDA - "enable CUDA acceleration on NVIDIA GPUs" OFF) option(QE_ENABLE_DOC "enable documentation building" OFF) set(QE_FFTW_VENDOR "AUTO" CACHE @@ -99,6 +110,12 @@ set(QE_FFTW_VENDOR "AUTO" CACHE # by configure (see /include/) qe_add_global_compile_definitions(QE_NO_CONFIG_H) +if(QE_ENABLE_CUDA) + include(CheckLanguage) + check_language(CUDA) + enable_language(CUDA) + qe_add_global_compile_definitions(__CUDA) +endif() if(QE_ENABLE_TRACE) qe_add_global_compile_definitions(__TRACE) endif() @@ -135,6 +152,12 @@ endif() if(QE_ENABLE_SCALAPACK AND NOT QE_ENABLE_MPI) message(FATAL_ERROR "SCALAPACK requires MPI support, enable it with '-DQE_ENABLE_MPI=ON' or disable SCALAPACK with '-DQE_ENABLE_SCALAPACK=OFF'") endif() +if(QE_ENABLE_CUDA AND NOT CMAKE_Fortran_COMPILER_ID MATCHES "PGI") + message(FATAL_ERROR "PGI compiler is mandatory when CUDA is enable due QE is based on CUDA Fortran language") +endif() +if(QE_ENABLE_LAXLIB_CUSOLVER AND (NOT QE_ENABLE_CUDA)) + message(FATAL_ERROR "CUDA Solver for LAXLib requires CUDA support, enable it with '-DQE_ENABLE_CUDA=ON' or disable CUDA Solver for LAXLib with '-DQE_ENABLE_LAXLIB_CUSOLVER=OFF'") +endif() # if(QE_ENABLE_HDF5 AND NOT QE_ENABLE_MPI) # message(FATAL_ERROR "HDF5 requires MPI support, enable it with '-DQE_ENABLE_MPI=ON' or disable HDF5 with '-DQE_ENABLE_HDF5=OFF'") # endif() @@ -145,9 +168,9 @@ endif() ########################################################### # TODO need to require all compilers using the same one if(CMAKE_C_COMPILER_ID MATCHES "PGI") - set(CMAKE_C_STANDARD 11) - set(CMAKE_C_STANDARD_REQUIRED ON) - set(CMAKE_C_EXTENSIONS OFF) + set(CMAKE_C_STANDARD 11) + set(CMAKE_C_STANDARD_REQUIRED ON) + set(CMAKE_C_EXTENSIONS OFF) endif() ############################################################ @@ -161,13 +184,18 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "XL") include(${PROJECT_CMAKE}/IBMFortranCompiler.cmake) endif() +########################################################### +# CUDA +########################################################### +if(QE_ENABLE_CUDA) + find_package(CUDAToolkit REQUIRED) +endif(QE_ENABLE_CUDA) + ########################################################### # OpenMP # The following targets will be defined: add_library(qe_openmp_fortran INTERFACE) -add_library(QE::OpenMP_Fortran ALIAS qe_openmp_fortran) add_library(qe_openmp_c INTERFACE) -add_library(QE::OpenMP_C ALIAS qe_openmp_c) qe_install_targets(qe_openmp_fortran qe_openmp_c) ########################################################### if(QE_ENABLE_OPENMP) @@ -182,7 +210,6 @@ endif(QE_ENABLE_OPENMP) # MPI # The following targets will be defined: add_library(qe_mpi_fortran INTERFACE) -add_library(QE::MPI_Fortran ALIAS qe_mpi_fortran) qe_install_targets(qe_mpi_fortran) ########################################################### if(QE_ENABLE_MPI) @@ -195,9 +222,8 @@ endif(QE_ENABLE_MPI) # Lapack # The following targets will be defined: add_library(qe_lapack INTERFACE) -add_library(QE::LAPACK ALIAS qe_lapack) qe_install_targets(qe_lapack) -####################################################################### +########################################################### if(NOT QE_LAPACK_INTERNAL) if(NOT BLA_VENDOR) if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64.*") @@ -251,7 +277,7 @@ else() "due to the conflict in flags for free vs fixed format. " "Please use an optimized LAPACK or build internal reference LAPACK separately.") endif() - message(STATUS "Installing QE::LAPACK via submodule") + message(STATUS "Installing LAPACK via submodule") qe_git_submodule_update(external/lapack) add_subdirectory(external/lapack EXCLUDE_FROM_ALL) target_link_libraries(qe_lapack INTERFACE lapack) @@ -263,7 +289,6 @@ endif() # SCALAPACK # The following targets will be defined: add_library(qe_scalapack INTERFACE) -add_library(QE::SCALAPACK ALIAS qe_scalapack) qe_install_targets(qe_scalapack) ########################################################### if(QE_ENABLE_SCALAPACK) @@ -279,7 +304,6 @@ endif(QE_ENABLE_SCALAPACK) # ELPA # The following targets will be defined: add_library(qe_elpa INTERFACE) -add_library(QE::ELPA ALIAS qe_elpa) qe_install_targets(qe_elpa) ########################################################### if(QE_ENABLE_ELPA) @@ -324,9 +348,7 @@ endif(QE_ENABLE_ELPA) # HDF5 # The following targets will be defined: add_library(qe_hdf5_fortran INTERFACE) -add_library(QE::HDF5_Fortran ALIAS qe_hdf5_fortran) add_library(qe_hdf5_c INTERFACE) -add_library(QE::HDF5_C ALIAS qe_hdf5_c) qe_install_targets(qe_hdf5_fortran qe_hdf5_c) ########################################################### if(QE_ENABLE_HDF5) @@ -368,14 +390,6 @@ if(QE_ENABLE_HDF5) ${HDF5_C_DEFINITIONS}) endif(QE_ENABLE_HDF5) -########################################################### -# CUDA -# FIXME just a place holder for the moment -########################################################### -if(QE_ENABLE_CUDA) - qe_add_global_compile_definitions(__CUDA) -endif(QE_ENABLE_CUDA) - ########################################################### # Tests # Any executable target marked as test runner via @@ -433,7 +447,6 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/quantum_espresso.pc ########################################################### install(EXPORT qeTargets FILE qeTargets.cmake - NAMESPACE qe:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/qe) include(CMakePackageConfigHelpers) @@ -621,4 +634,4 @@ add_custom_target(epw DEPENDS qe_epw_exe COMMENT - "electron-Phonon Coupling with wannier functions") \ No newline at end of file + "electron-Phonon Coupling with wannier functions") diff --git a/COUPLE/CMakeLists.txt b/COUPLE/CMakeLists.txt index 17d3a18e7..3c3ad1338 100644 --- a/COUPLE/CMakeLists.txt +++ b/COUPLE/CMakeLists.txt @@ -1,18 +1,17 @@ -set(sources +set(src_couple src/libpwscf.f90 src/libcpv.f90 src/libqemod.f90) +qe_enable_cuda_fortran("${src_couple}") -qe_add_library(qe_couple ${sources}) -add_library(QE::COUPLE ALIAS qe_couple) +qe_add_library(qe_couple ${src_couple}) target_link_libraries(qe_couple PRIVATE - QE::Modules - QE::LAX - QE::FFTX - QE::UTILX - QE::CPV) + qe_modules + qe_lax + qe_fftx + qe_cpv) ########################################################### -qe_install_targets(qe_couple) +qe_install_targets(qe_couple) \ No newline at end of file diff --git a/CPV/CMakeLists.txt b/CPV/CMakeLists.txt index 4c2565833..501aade99 100644 --- a/CPV/CMakeLists.txt +++ b/CPV/CMakeLists.txt @@ -1,4 +1,4 @@ -set(sources +set(src_cpv src/berryion.f90 src/bforceion.f90 src/cell_nose.f90 @@ -104,75 +104,88 @@ set(sources src/wf.f90 src/makov_payne.f90 src/entropy.f90) +qe_enable_cuda_fortran("${src_cpv}") -qe_add_library(qe_cpv ${sources}) -add_library(QE::CPV ALIAS qe_cpv) +qe_add_library(qe_cpv ${src_cpv}) target_link_libraries(qe_cpv PRIVATE - QE::LAX - QE::UTILX - QE::Modules - QE::XClib - QE::FOX - QE::FFTX - QE::UPF - QE::OpenMP_Fortran - QE::MPI_Fortran) + qe_lax + qe_modules + qe_fftx + qe_upflib + qe_openmp_fortran + qe_mpi_fortran + qe_xclib) +if(QE_ENABLE_CUDA) + target_link_libraries(qe_cpv + PRIVATE + qe_devxlib) +endif() ########################################################### # cp.x ########################################################### -set(sources src/cprstart.f90) -qe_add_executable(qe_cpv_exe ${sources}) -set_target_properties(qe_cpv_exe PROPERTIES OUTPUT_NAME cp.x) +set(src_cp_x src/cprstart.f90) +qe_enable_cuda_fortran("${src_cp_x}") +qe_add_executable(qe_cpv_exe ${src_cp_x}) +set_target_properties(qe_cpv_exe + PROPERTIES + OUTPUT_NAME cp.x) target_link_libraries(qe_cpv_exe PRIVATE - QE::Modules - QE::XClib - QE::LAX - QE::CPV - QE::UTILX) + qe_modules + qe_lax + qe_cpv + qe_lapack + qe_xclib) ########################################################### # manycp.x ########################################################### -set(sources src/manycp.f90) -qe_add_executable(qe_cpv_manycp_exe ${sources}) -set_target_properties(qe_cpv_manycp_exe PROPERTIES OUTPUT_NAME manycp.x) +set(src_manycp_x src/manycp.f90) +qe_enable_cuda_fortran("${src_manycp_x}") +qe_add_executable(qe_cpv_manycp_exe ${src_manycp_x}) +set_target_properties(qe_cpv_manycp_exe + PROPERTIES + OUTPUT_NAME manycp.x) target_link_libraries(qe_cpv_manycp_exe PRIVATE - QE::LAX - QE::Modules - QE::XClib - QE::UTILX - QE::CPV) + qe_lax + qe_modules + qe_cpv + qe_lapack + qe_xclib) ########################################################### # cppp.x ########################################################### -set(sources src/cppp.f90) -qe_add_executable(qe_cpv_cppp_exe ${sources}) -set_target_properties(qe_cpv_cppp_exe PROPERTIES OUTPUT_NAME cppp.x) +set(src_cppp_x src/cppp.f90) +qe_add_executable(qe_cpv_cppp_exe ${src_cppp_x}) +set_target_properties(qe_cpv_cppp_exe + PROPERTIES + OUTPUT_NAME cppp.x) target_link_libraries(qe_cpv_cppp_exe PRIVATE - QE::Modules - QE::XClib - QE::CPV - QE::CLIB - QE::UTILX) + qe_modules + qe_cpv + qe_clib + qe_lapack + qe_xclib) ########################################################### # wfdd.x ########################################################### -set(sources src/wfdd.f90) -qe_add_executable(qe_cpv_wfdd_exe ${sources}) -set_target_properties(qe_cpv_wfdd_exe PROPERTIES OUTPUT_NAME wfdd.x) +set(src_wfdd_x src/wfdd.f90) +qe_add_executable(qe_cpv_wfdd_exe ${src_wfdd_x}) +set_target_properties(qe_cpv_wfdd_exe + PROPERTIES + OUTPUT_NAME wfdd.x) target_link_libraries(qe_cpv_wfdd_exe PRIVATE - QE::LAPACK - QE::XClib - QE::Modules - QE::CPV) + qe_lapack + qe_modules + qe_cpv + qe_xclib) ########################################################### diff --git a/CPV/examples/README b/CPV/examples/README index d4c426122..d5feafe96 100644 --- a/CPV/examples/README +++ b/CPV/examples/README @@ -1,69 +1,6 @@ -These are instructions on how to run the examples for CP package. -These examples try to exercise all the programs and features -of the CP package. -If you find that any relevant feature isn't being tested, -please contact us (or even better, write and send us a new example). - -To run the examples, you should follow this procedure: - -1) Edit the "environment_variables" file from the main - ESPRESSO directory, setting the following variables as needed: - - BIN_DIR = directory where ESPRESSO executables reside - PSEUDO_DIR = directory where pseudopotential files reside - TMP_DIR = directory to be used as temporary storage area - - If you have downloaded the full ESPRESSO distribution, you may set - BIN_DIR=$TOPDIR/bin and PSEUDO_DIR=$TOPDIR/pseudo, where $TOPDIR is - the root of the ESPRESSO source tree. - - TMP_DIR must be a directory you have read and write access to, with - enough available space to host the temporary files produced by the - example runs, and possibly offering high I/O performance (i.e., - don't use an NFS-mounted directory). - -2) If you want to test the parallel version of ESPRESSO, you will - usually have to specify a driver program (such as "poe" or "mpirun") - and the number of processors. This can be done by editing PARA_PREFIX - and PARA_POSTFIX variables (in the "environment_variables" file). - Parallel executables will be run by a command like this: - - $PARA_PREFIX cp.x $PARA_POSTFIX < file.in > file.out - - For example, if the command line is like this (as for an IBM SP): - - poe cp.x -procs 4 < file.in > file.out - - you should set PARA_PREFIX="poe", PARA_POSTFIX="-procs 4". - - See section "Running on parallel machines" of the user guide for details. - Furthermore, if your machine does not support interactive use, you - must run the commands specified below through the batch queueing - system installed on that machine. Ask your system administrator - for instructions. - -3) To run a single example, go to the corresponding directory (for - instance, "example/example01") and execute: - - ./run_example - - (except for example 04, see below) - This will create a subdirectory "results", containing the input and - output files generated by the calculation. - - Some examples take only a few seconds to run, while others may - require several minutes depending on your system. - -4) In each example's directory, the "reference" subdirectory contains - verified output files, that you can check your results against. - - The reference results were generated on a Linux PC with Intel compiler. - On different architectures the precise numbers could be slightly - different, in particular if different FFT dimensions are - automatically selected. For this reason, a plain "diff" of your - results against the reference data doesn't work, or at least, it - requires human inspection of the results. - +These examples cover most programs and features of the CP package. +See comments in file "environment_variables" in the top QE directory +for instructions on how to run these examples. ----------------------------------------------------------------------- LIST AND CONTENT OF THE EXAMPLES diff --git a/Doc/user_guide.tex b/Doc/user_guide.tex index 1dcf48ea1..b81d4df71 100644 --- a/Doc/user_guide.tex +++ b/Doc/user_guide.tex @@ -809,7 +809,7 @@ Then \qe\ can be compiled as usual. If the version of \libxc\ is older than 5.0. \begin{itemize} \item set \texttt{LD\_LIBS=-L/path/to/libxc/lib/ -lxcf03 -lxc} \end{itemize} -\paragraph{Note for version 5.0.0:} the \texttt{f03} interfaces are no longer available in \libxc\ 5.0.0. They have been reintroduced in the current develop version. Version 5.0.0 is still usable, but, before compiling \qe, a string replacement is necessary, namely `\texttt{xc\_f03}' must be repalced with `\texttt{xc\_f90}' everywhere in the following files: \texttt{funct.f90}, \texttt{xc\_lda\_lsda\_drivers.f90}, \texttt{xc\_gga\_drivers.f90}, \texttt{xc\_mgga\_drivers.f90}, \texttt{dmxc\_drivers.f90} and \texttt{dgcxc\_drivers.f90} in \texttt{Modules} folder and \texttt{xctest\_qe\_libxc.f90} in \texttt{PP/src} folder. +\paragraph{Note for version 5.0.0:} the \texttt{f03} interfaces are no longer available in \libxc\ 5.0.0. They have been reintroduced in the current develop version. Version 5.0.0 is still usable, but, before compiling \qe, a string replacement is necessary, namely `\texttt{xc\_f03}' must be repalced with `\texttt{xc\_f90}' everywhere in the \texttt{XClib} folder. \subsubsection{Usage} In order to use \libxc\ functionals, you must enforce them from input by including the \texttt{input\_dft} string in the \texttt{system} namelist. For example, to use the \libxc\ version of the PBE functionals (both exchange and correlation): @@ -826,24 +826,24 @@ Combinations of \qe\ and \libxc\ functionals are allowed in \texttt{PW}, but som \begin{verbatim} input_dft = `sla pbe gga_c_pbe' \end{verbatim} -Note that when using GGA functionals of \qe\ you must always specify the LDA term too, while it is not the case for the \libxc\ ones. \\ -Outside \texttt{PW} (\texttt{PHonon}, \texttt{PP}, etc.), \libxc\ functionals are still usable, but in these cases it is highly recommended to avoid combinations of QE and \libxc\ functionals together, since, at present, they may lead to some issues in the dft detection. +Note that when using GGA functionals of \qe\ you must always specify the LDA term too, while it is not the case for the \libxc\ ones. % \subsubsection{Differences between Libxc and internal functionals} There are some differences between \qe\ functionals and \libxc\ ones. In \qe\ the LDA and the GGA terms are separated and must be specified independently. In \libxc\ the GGA functionals already include the LDA part (Slater exchange and Perdew\&Wang correlation in most of the cases with the exception, for example, of Lee Yang Parr functionals).\\ The \libxc\ metaGGA functionals may or may not need the LDA and GGA terms, depending on the cases, therefore a good check of the chosen functionals is recommended before doing expensive runs.\\ -Some functionals in \libxc\ incorporate the exchange part and the correlation one into one term only (e.g. the ones that include the `\texttt{\_xc}' label in their name). In these cases the whole functional is formally treated as `exchange only' by \qe. This does not imply any loss of information. +Some functionals in \libxc\ incorporate the exchange part and the correlation one into one term only (e.g. the ones that include the `\texttt{\_xc}' kind label in their name). In these cases the whole functional is formally treated as `exchange only' by \qe. This does not imply any loss of information. % \subsubsection{Special cases} A number of \libxc\ functional routines need extra information on input and/or provide only partial information on output (e.g. the energy or the potential only). In these cases the use of such functionals may not be straightforward and, depending on the cases, may require some work on the \qe\ source code. % \paragraph{External parameters.} -Several functionals in \libxc\ depend on one or more external parameters. Some of these can be recovered inside \qe, some others are not directly available. In all these cases a direct intervention on the \qe\ source code could be necessary in order to be able to properly use such functionals. However two routines have been defined in the XC library of \qe\ that ease the task of setting and recovering the external parameters in \libxc. +Several functionals in \libxc\ depend on one or more external parameters. Some of these can be recovered inside \qe, some others are not directly available. In all these cases a direct intervention on the \qe\ source code might be necessary in order to be able to properly use such functionals. However two routines have been defined in the XC library of \qe\ that ease the task of setting and recovering the external parameters in \libxc: \begin{itemize} - \item \texttt{get\_libxc\_ext\_param}: this function receives as input the ID of the \libxc\ functional and the index of the chosen parameter and returns its value. If the parameter has not been set before it returns the default value. - \item \texttt{set\_libxc\_ext\_param}: routine that receives as input the index of the functional family-type (from 1 to 6: lda-exch, lda-corr, gga-exch, etc.), the index of the chosen \libxc\ parameter and the value to set to. + \item \texttt{get\_libxc\_ext\_param}: this function receives as input the ID of the \libxc\ functional and the index of the chosen parameter and returns its value. If the parameter has not been set before it returns its default value. + \item \texttt{set\_libxc\_ext\_param}: this routine receives as input the index of the functional family-type (from 1 to 6: lda-exch, lda-corr, gga-exch, ...), the index of the chosen \libxc\ parameter and the value to set it to. \end{itemize} -In order to see the available parameters for a given \libxc\ functional and the corresponding indexes, the \texttt{dft\_info} test is available as an option of the \texttt{xclib\_test.x} program in \texttt{XClib} folder. For more details see Sec. \ref{SubSec:XCtest}.\\ +In order to see the available parameters for a given \libxc\ functional and their corresponding indexes, the \texttt{dft\_info} test is available as an option of the \texttt{xclib\_test.x} program in \texttt{XClib} folder. For more details see Sec. \ref{SubSec:XCtest}.\\ +The two routines can be called almost anywhere in \qe, however, as any other \texttt{XClib} setting routine, they must be declared through the \texttt{xc\_lib} module.\\ Without setting the external parameters inside the code, their default value will be assumed. This could lead to results different from the expectations.\\ In any case, when external parameters are needed by the chosen functionals, a warning message will appear in the output of \qe. % @@ -856,13 +856,13 @@ A few \libxc\ functional routines provides the energy and some others the potent % \subsubsection{XC test} \label{SubSec:XCtest} -A testing program, \texttt{xclib\_test.x}, for the \texttt{XClib} library of \qe\ is available. Three options available: +A testing program, \texttt{xclib\_test.x}, for the \texttt{XClib} library of \qe\ is available. Three options: \begin{itemize} - \item \texttt{dft-info}: infos on the input dft are provided. If the functionals are from \libxc\ the external parameters, when present, are listed with a brief description and their default value. - \item \texttt{xc-benchmark}: the program gets a data file generated previously as input (by running the same program with the \texttt{gen-benchmark} option) and compares the output data, namely energy and potential on a selected number of grid points. It also compares total energy and potential summed up on a large grid in order to better span the input domain. This option shoud be used to test modifications in the \texttt{XClib} library or to check the output matching among different parallelization schemes. - \item \texttt{dft-comparison}: comparison between two different dfts on a large grid of points. Max, min and average percentage difference between the two dft outputs (energy and potential) are provided and the points of the grid where the two output differ are shown. This option can be used, for example, to find differences between internal \qe\ functional and the \libxc\ ones. + \item \texttt{dft-info}: infos on the input dft are provided. If the functionals are from \libxc\ the external parameters, when present, are listed with a brief description and their default value. + \item \texttt{exe-benchmark} (\texttt{gen-benchmark}): the program gets a data file generated previously as input (by running the same program with the \texttt{gen-benchmark} option) and compares the output data, namely energy and potential on a selected number of grid points. It also compares total energy and potential summed up on a large grid in order to better span the input domain. This option shoud be used to test modifications in the \texttt{XClib} library or to check the output matching among different parallelization schemes. + \item \texttt{dft-comparison}: comparison between two different dfts on a large grid of points. Max, min and average percentage difference between the two dft outputs (energy and potential) are provided and the points of the grid where the two output differ are shown. This option can be used, for example, to find differences between internal \qe\ functionals and the \libxc\ ones. \end{itemize} -The testing program is available for LDA, GGA and MGGA functionals. It also tests the XC-derivative part (mainly used in \texttt{PHonon}). +The testing program is available for LDA, GGA and MGGA functionals. It also tests the potential derivatives for LDA (\texttt{dmxc}) and GGA (\texttt{dgcxc}). \subsection{Compilation} \label{SubSec:Compilation} diff --git a/EPW/CMakeLists.txt b/EPW/CMakeLists.txt index bebbbe454..e8318e970 100644 --- a/EPW/CMakeLists.txt +++ b/EPW/CMakeLists.txt @@ -54,19 +54,17 @@ set(sources src/test_tools.f90) qe_add_library(qe_epw ${sources}) -add_library(QE::EPW ALIAS qe_epw) target_link_libraries(qe_epw PRIVATE - QE::WANNIER90 - QE::Modules - QE::XClib - QE::LR_Modules - QE::PHonon::PH - QE::PW - QE::MPI_Fortran - QE::UTILX - QE::UPF - QE::FFTX) + qe_wannier90 + qe_modules + qe_lr_modules + qe_phonon_ph + qe_pw + qe_mpi_fortran + qe_upflib + qe_fftx + qe_xclib) ########################################################### # epw.x @@ -76,12 +74,12 @@ qe_add_executable(qe_epw_exe ${sources}) set_target_properties(qe_epw_exe PROPERTIES OUTPUT_NAME epw.x) target_link_libraries(qe_epw_exe PRIVATE - QE::Modules - QE::PP - QE::PW - QE::FFTX - QE::UTILX - QE::EPW) + qe_modules + qe_pp + qe_pw + qe_fftx + qe_epw + qe_upflib) ########################################################### diff --git a/FFTXlib/CMakeLists.txt b/FFTXlib/CMakeLists.txt index c85804df9..a3dff11ac 100644 --- a/FFTXlib/CMakeLists.txt +++ b/FFTXlib/CMakeLists.txt @@ -2,7 +2,6 @@ # FFT # The following targets will be defined: add_library(qe_fft INTERFACE) -add_library(QE::FFT ALIAS qe_fft) qe_install_targets(qe_fft) ########################################################### SET(BLA_VENDOR_SAVED ${BLA_VENDOR}) @@ -124,7 +123,7 @@ else() endif() SET(BLA_VENDOR ${BLA_VENDOR_SAVED}) -set(f_sources +set(f_src_fftx fft_scatter.f90 fft_scatter_2d.f90 scatter_mod.f90 @@ -145,29 +144,39 @@ set(f_sources tg_gather.f90 fft_helper_subroutines.f90 fft_param.f90) - if(QE_ENABLE_CUDA) - set(f_sources ${f_sources} - fft_scatter_gpu.f90 - fft_scatter_2d_gpu.f90 - fft_buffers.f90 - fft_scalar.cuFFT.f90) + set(f_src_fftx + ${f_src_fftx} + fft_scalar.cuFFT.f90 + fft_buffers.f90 + fft_scatter_gpu.f90 + fft_scatter_2d_gpu.f90) endif() +qe_enable_cuda_fortran("${f_src_fftx}") -set(c_sources +set(c_src_fftx fft_stick.c fftw.c fftw_sp.c fftw_dp.c) -qe_add_library(qe_fftx ${f_sources} ${c_sources} ${qe_fft_wrappers}) -add_library(QE::FFTX ALIAS qe_fftx) +qe_add_library(qe_fftx + ${f_src_fftx} + ${c_src_fftx} + ${qe_fft_wrappers}) + target_link_libraries(qe_fftx PRIVATE - QE::FFT - QE::OpenMP_Fortran - QE::MPI_Fortran - QE::LAPACK) + qe_fft + qe_openmp_fortran + qe_mpi_fortran + qe_utilx) +if(QE_ENABLE_CUDA) + target_link_libraries(qe_fftx + PRIVATE + CUDA::cufft) +endif() + qe_install_targets(qe_fftx) ########################################################### @@ -175,14 +184,17 @@ qe_install_targets(qe_fftx) # TODO move all tests to a proper location ########################################################### if(QE_ENABLE_TEST) - set(sources fft_test.f90) - qe_add_executable(qe_fftx_test ${sources}) - set_target_properties(qe_fftx_test PROPERTIES OUTPUT_NAME qe_fftx_test.x RUNTIME_OUTPUT_DIRECTORY ${QE_TESTS_DIR}) + set(src_fftx_test fft_test.f90) + qe_add_executable(qe_fftx_test ${src_fftx_test}) + set_target_properties(qe_fftx_test + PROPERTIES + OUTPUT_NAME qe_fftx_test.x + RUNTIME_OUTPUT_DIRECTORY ${QE_TESTS_DIR}) target_link_libraries(qe_fftx_test PRIVATE - QE::OpenMP_Fortran - QE::MPI_Fortran - QE::LAPACK - QE::FFTX) - add_test(NAME test_qe_fftx COMMAND ${QE_TESTS_DIR}/qe_fftx_test.x) + qe_openmp_fortran + qe_mpi_fortran + qe_fftx) + add_test(NAME test_qe_fftx + COMMAND ${QE_TESTS_DIR}/qe_fftx_test.x) endif() diff --git a/GWW/CMakeLists.txt b/GWW/CMakeLists.txt index 9ab331b89..8f8085b9b 100644 --- a/GWW/CMakeLists.txt +++ b/GWW/CMakeLists.txt @@ -1,4 +1,4 @@ -set(sources_gww +set(src_gww gww/basic_structures.f90 gww/compact_product.f90 gww/contour.f90 @@ -33,7 +33,7 @@ set(sources_gww gww/times_gw.f90 gww/vcprim.f90) -set(sources_pw4gww +set(src_pw4gww pw4gww/allocate_wannier.f90 pw4gww/produce_wannier_gamma.f90 pw4gww/start_pw4gww.f90 @@ -70,9 +70,11 @@ set(sources_pw4gww pw4gww/wannier_bse.f90 pw4gww/hpsi_pw4gww.f90 pw4gww/cgsolve_all_gamma.f90 - pw4gww/realus.f90) + pw4gww/realus.f90 + pw4gww/operator_1_vp.f90) +qe_enable_cuda_fortran("${src_pw4gww}") -set(sources_bse +set(src_bse bse/openfil_bse.f90 bse/start_bse.f90 bse/bse_wannier.f90 @@ -108,7 +110,7 @@ set(sources_bse bse/qpe_exc.f90 bse/qpcorrections.f90) -set(sources_head +set(src_head head/bcast_ph_input.f90 head/close_phq.f90 head/lanczos_k.f90 @@ -116,7 +118,7 @@ set(sources_head head/phq_readin.f90 head/solve_head.f90) -set(sources_minpack +set(src_minpack minpack/dpmpar.f90 minpack/fdjac2.f90 minpack/lmder1.f90 @@ -131,7 +133,7 @@ set(sources_minpack minpack/mlegzo.f90 minpack/qrsolv.f90) -set(sources_simple +set(src_simple simple/stop_pp.f90 simple/read_export.f90 simple/openfile_simple.f90 @@ -145,7 +147,7 @@ set(sources_simple simple/init_us_2_max.f90 simple/commutator.f90) -set(sources_simple_bse +set(src_simple_bse simple_bse/simple_object.f90 simple_bse/start_end.f90 simple_bse/input_simple_exc.f90 @@ -158,7 +160,7 @@ set(sources_simple_bse simple_bse/lanczos.f90 simple_bse/build_eemat.f90) -set(sources_simple_ip +set(src_simple_ip simple_ip/simple_ip_objects.f90 simple_ip/start_end.f90 simple_ip/input_simple_ip.f90 @@ -167,170 +169,200 @@ set(sources_simple_ip simple_ip/diagonalization.f90 simple_ip/dielectric.f90) -qe_add_library(qe_gww ${sources_gww}) -add_library(QE::GWW ALIAS qe_gww) +qe_add_library(qe_gww ${src_gww}) target_link_libraries(qe_gww PRIVATE - QE::FFTX - PUBLIC - QE::UTILX - QE::Modules) + qe_fftx + qe_modules) -qe_add_library(qe_gww_pw4gww ${sources_pw4gww}) -add_library(QE::GWW::pw4gww ALIAS qe_gww_pw4gww) +qe_add_library(qe_gww_pw4gww ${src_pw4gww}) target_link_libraries(qe_gww_pw4gww PRIVATE - QE::SCALAPACK - QE::PW - QE::XClib - QE::GWW - QE::FFTX - QE::UPF - QE::LAX) + qe_scalapack + qe_pw + qe_modules + qe_gww + qe_utilx + qe_fftx + qe_upflib + qe_lax + qe_gww_minpack + qe_xclib) -qe_add_library(qe_gww_bse ${sources_bse}) -add_library(QE::GWW::bse ALIAS qe_gww_bse) +qe_add_library(qe_gww_bse ${src_bse}) target_link_libraries(qe_gww_bse - PUBLIC - QE::GWW - QE::PW - QE::GWW::pw4gww - QE::UPF) + PRIVATE + qe_pw + qe_modules + qe_gww + qe_gww_pw4gww + qe_upflib + qe_fftx + qe_xclib) -qe_add_library(qe_gww_head ${sources_head}) -add_library(QE::GWW::head ALIAS qe_gww_head) +qe_add_library(qe_gww_head ${src_head}) target_link_libraries(qe_gww_head PRIVATE - QE::PW - QE::LR_Modules - QE::XClib - QE::Modules - QE::PHonon::PH - QE::UTILX - QE::UPF - QE::FFTX) + qe_pw + qe_lr_modules + qe_modules + qe_phonon_ph + qe_upflib + qe_fftx + qe_xclib) -qe_add_library(qe_gww_minpack ${sources_minpack}) -add_library(QE::GWW::minpack ALIAS qe_gww_minpack) +qe_add_library(qe_gww_minpack ${src_minpack}) target_link_libraries(qe_gww_minpack PRIVATE - QE::Modules) + qe_modules) -qe_add_library(qe_gww_simple ${sources_simple}) -add_library(QE::GWW::simple ALIAS qe_gww_simple) +qe_add_library(qe_gww_simple ${src_simple}) target_link_libraries(qe_gww_simple PRIVATE - QE::PW - QE::GWW - QE::UPF - QE::FFTX) + qe_pw + qe_gww + qe_modules + qe_upflib + qe_fftx + qe_xclib) -qe_add_library(qe_gww_simplebse ${sources_simple_bse}) -add_library(QE::GWW::simple_bse ALIAS qe_gww_simplebse) +qe_add_library(qe_gww_simplebse ${src_simple_bse}) target_link_libraries(qe_gww_simplebse PRIVATE - QE::UTILX - QE::Modules) + qe_modules) -qe_add_library(qe_gww_simpleip ${sources_simple_ip}) -add_library(QE::GWW::simple_ip ALIAS qe_gww_simpleip) +qe_add_library(qe_gww_simpleip ${src_simple_ip}) target_link_libraries(qe_gww_simpleip PRIVATE - QE::UTILX - QE::Modules - QE::PW -) + qe_modules + qe_pw) ########################################################### # graph.x ########################################################### -set(sources util/graph.f90) -qe_add_executable(qe_gww_util_grap_exe ${sources}) -set_target_properties(qe_gww_util_grap_exe PROPERTIES OUTPUT_NAME graph.x) +set(src_graph_x util/graph.f90) +qe_add_executable(qe_gww_util_grap_exe ${src_graph_x}) +set_target_properties(qe_gww_util_grap_exe + PROPERTIES + OUTPUT_NAME graph.x) +set_target_properties(qe_gww_util_grap_exe + PROPERTIES + OUTPUT_NAME graph.x) ########################################################### # abcoeff_to_eps.x ########################################################### -set(sources util/abcoeff_to_eps.f90) -qe_add_executable(qe_gww_util_abcoefftoeps_exe ${sources}) -set_target_properties(qe_gww_util_abcoefftoeps_exe PROPERTIES OUTPUT_NAME abcoeff_to_eps.x) +set(src_abcoeff_to_eps_x util/abcoeff_to_eps.f90) +qe_add_executable(qe_gww_util_abcoefftoeps_exe ${src_abcoeff_to_eps_x}) +set_target_properties(qe_gww_util_abcoefftoeps_exe + PROPERTIES + OUTPUT_NAME abcoeff_to_eps.x) +set_target_properties(qe_gww_util_abcoefftoeps_exe + PROPERTIES + OUTPUT_NAME abcoeff_to_eps.x) ########################################################### # memory_pw4gww.x ########################################################### -set(sources util/memory_pw4gww.f90) -qe_add_executable(qe_gww_util_memorypw4gww_exe ${sources}) -set_target_properties(qe_gww_util_memorypw4gww_exe PROPERTIES OUTPUT_NAME memory_pw4gww.x) +set(src_memory_pw4gww_x util/memory_pw4gww.f90) +qe_add_executable(qe_gww_util_memorypw4gww_exe ${src_memory_pw4gww_x}) +set_target_properties(qe_gww_util_memorypw4gww_exe + PROPERTIES + OUTPUT_NAME memory_pw4gww.x) +set_target_properties(qe_gww_util_memorypw4gww_exe + PROPERTIES + OUTPUT_NAME memory_pw4gww.x) ############################################################# -#bse_main.x +# bse_main.x ############################################################ -set(sources bse/bse_main.f90) -qe_add_executable(qe_gww_bse_bse_main_exe ${sources}) -set_target_properties(qe_gww_bse_bse_main_exe PROPERTIES OUTPUT_NAME bse_main.x) +set(src_bse_main_x bse/bse_main.f90) +qe_add_executable(qe_gww_bse_bse_main_exe ${src_bse_main_x}) +set_target_properties(qe_gww_bse_bse_main_exe + PROPERTIES + OUTPUT_NAME bse_main.x) target_link_libraries(qe_gww_bse_bse_main_exe PRIVATE - QE::GWW::bse ) + qe_gww_bse + qe_gww_pw4gww + qe_gww_minpack + qe_modules + qe_pw + qe_upflib + qe_fftx + qe_xclib) + ################################################################ -#gww.x +# gww.x ################################################################ -set (sources gww/gww.f90) -qe_add_executable(qe_gww_gww_exe ${sources}) -set_target_properties(qe_gww_gww_exe PROPERTIES OUTPUT_NAME gww.x) +set(src_gww_x gww/gww.f90) +qe_add_executable(qe_gww_gww_exe ${src_gww_x}) +set_target_properties(qe_gww_gww_exe + PROPERTIES + OUTPUT_NAME gww.x) target_link_libraries(qe_gww_gww_exe - PRIVATE - QE::GWW - QE::GWW::minpack - QE::PW - ) + PRIVATE + qe_gww + qe_gww_minpack + qe_pw + qe_modules) ################################################################ -#gww_fit.x +# gww_fit.x ################################################################ -set (sources gww/gww_fit.f90) -qe_add_executable(qe_gww_gww_fit_exe ${sources}) -set_target_properties(qe_gww_gww_fit_exe PROPERTIES OUTPUT_NAME gww.x) +set(src_gww_fit_x gww/gww_fit.f90) +qe_add_executable(qe_gww_gww_fit_exe ${src_gww_fit_x}) +set_target_properties(qe_gww_gww_fit_exe + PROPERTIES + OUTPUT_NAME gww.x) target_link_libraries(qe_gww_gww_fit_exe - PRIVATE - QE::GWW - QE::GWW::minpack - ) + PRIVATE + qe_gww + qe_gww_minpack + qe_modules) ################################################################ -#head.x +# head.x ################################################################ -set (sources head/head.f90) -qe_add_executable(qe_gww_head_exe ${sources}) -set_target_properties(qe_gww_head_exe PROPERTIES OUTPUT_NAME head.x) +set(src_head_x head/head.f90) +qe_add_executable(qe_gww_head_exe ${src_head_x}) +set_target_properties(qe_gww_head_exe + PROPERTIES + OUTPUT_NAME head.x) target_link_libraries(qe_gww_head_exe - PRIVATE - QE::GWW::head - QE::GWW::minpack - QE::PHonon::PH - QE::Modules - ) + PRIVATE + qe_gww_head + qe_gww_minpack + qe_phonon_ph + qe_modules + qe_pw) ########################################################### -#simple_bse.x +# simple_bse.x ########################################################### -set (sources simple_bse/simple_bse.f90) -qe_add_executable(qe_gww_simple_bse_exe ${sources}) -set_target_properties(qe_gww_simple_bse_exe PROPERTIES OUTPUT_NAME simple_bse.x) +set(src_simple_bse_x simple_bse/simple_bse.f90) +qe_add_executable(qe_gww_simple_bse_exe ${src_simple_bse_x}) +set_target_properties(qe_gww_simple_bse_exe + PROPERTIES + OUTPUT_NAME simple_bse.x) target_link_libraries(qe_gww_simple_bse_exe PRIVATE - QE::GWW::simple_bse -) + qe_gww_simplebse + qe_upflib + qe_modules) ############################################################### -#simple_ip.x +# simple_ip.x ################################################################ -set (sources simple_ip/simple_ip.f90) -qe_add_executable(qe_gww_simple_ip_exe ${sources}) -set_target_properties(qe_gww_simple_ip_exe PROPERTIES OUTPUT_NAME simple_ip.x) +set(src_simple_ip_x simple_ip/simple_ip.f90) +qe_add_executable(qe_gww_simple_ip_exe ${src_simple_ip_x}) +set_target_properties(qe_gww_simple_ip_exe + PROPERTIES + OUTPUT_NAME simple_ip.x) target_link_libraries(qe_gww_simple_ip_exe PRIVATE - QE::GWW::simple_ip -) + qe_gww_simpleip + qe_modules) ########################################################### @@ -347,4 +379,10 @@ qe_install_targets( # Executables qe_gww_util_grap_exe qe_gww_util_abcoefftoeps_exe - qe_gww_util_memorypw4gww_exe) + qe_gww_util_memorypw4gww_exe + qe_gww_bse_bse_main_exe + qe_gww_gww_exe + qe_gww_gww_fit_exe + qe_gww_head_exe + qe_gww_simple_bse_exe + qe_gww_simple_ip_exe) diff --git a/HP/CMakeLists.txt b/HP/CMakeLists.txt index fba8f52ed..e17d53c41 100644 --- a/HP/CMakeLists.txt +++ b/HP/CMakeLists.txt @@ -1,4 +1,4 @@ -set(sources +set(src_hp src/hp_allocate_q.f90 src/hp_bcast_input.f90 src/hpcom.f90 @@ -43,32 +43,32 @@ set(sources src/hp_write_chi_full.f90 src/hp_write_dnsq.f90) -qe_add_library(qe_hp ${sources}) -add_library(QE::HP ALIAS qe_hp) +qe_add_library(qe_hp ${src_hp}) target_link_libraries(qe_hp PRIVATE - QE::PW - QE::LR_Modules - QE::XClib - QE::Modules - QE::FFTX - QE::UTILX - QE::UPF) + qe_pw + qe_lr_modules + qe_modules + qe_fftx + qe_upflib + qe_xclib) ########################################################### # hp.x ########################################################### -set(sources src/hp_main.f90) -qe_add_executable(qe_hp_exe ${sources}) -set_target_properties(qe_hp_exe PROPERTIES OUTPUT_NAME hp.x) +set(src_hp_x src/hp_main.f90) +qe_enable_cuda_fortran("${src_hp_x}") +qe_add_executable(qe_hp_exe ${src_hp_x}) +set_target_properties(qe_hp_exe + PROPERTIES + OUTPUT_NAME hp.x) target_link_libraries(qe_hp_exe PRIVATE - QE::PW - QE::LAX - QE::XClib - QE::Modules - QE::HP - QE::UTILX) + qe_pw + qe_lax + qe_modules + qe_hp + qe_xclib) ########################################################### diff --git a/HP/examples/README b/HP/examples/README index fa0ec9966..1060e922d 100644 --- a/HP/examples/README +++ b/HP/examples/README @@ -1,50 +1,6 @@ -These are instructions on how to run the examples for HP package. -To run the examples, you should follow this procedure: - -1) Edit the "environment_variables" file from the main - ESPRESSO directory, setting the following variables as needed: - - BIN_DIR = directory where ESPRESSO executables reside - PSEUDO_DIR = directory where pseudopotential files reside - TMP_DIR = directory to be used as temporary storage area - -2) If you want to test the parallel version of ESPRESSO, you will - usually have to specify a driver program (such as "poe" or "mpirun") - and the number of processors. This can be done by editing PARA_PREFIX - and PARA_POSTFIX variables (in the "environment_variables" file). - Parallel executables will be run by a command like this: - - $PARA_PREFIX hp.x $PARA_POSTFIX < file.in > file.out - - For example, if the command line is like this: - - mpirun -np 8 hp.x -npool 4 < file.in > file.out - - you should set PARA_PREFIX="mpirun -np 8", PARA_POSTFIX="-npool 4". - - See section "Running on parallel machines" of the user guide for details. - Furthermore, if your machine does not support interactive use, you - must run the commands specified below through the batch queueing - system installed on that machine. Ask your system administrator - for instructions. - -3) To run a single example, go to the corresponding directory (for - instance, "example/example01") and execute: - - ./run_example - - This will create a subdirectory "results", containing the input and - output files generated by the calculation. - -4) In each example's directory, the "reference" subdirectory contains - verified output files, that you can check your results against. - - The reference results were generated on a Linux PC with Intel compiler. - On different architectures the precise numbers could be slightly - different, in particular if different FFT dimensions are - automatically selected. For this reason, a plain "diff" of your - results against the reference data doesn't work, or at least, it - requires human inspection of the results. +These examples cover most programs and features of the HP package. +See comments in file "environment_variables" in the top QE directory +for instructions on how to run these examples. ----------------------------------------------------------------------- diff --git a/KS_Solvers/CMakeLists.txt b/KS_Solvers/CMakeLists.txt index e398fc241..e2029a81c 100644 --- a/KS_Solvers/CMakeLists.txt +++ b/KS_Solvers/CMakeLists.txt @@ -1,20 +1,29 @@ -set(sources_davidson +set(src_davidson Davidson_RCI/david_rci.f90 Davidson/cegterg.f90 Davidson/regterg.f90) +qe_enable_cuda_fortran("${src_davidson}") -set(sources_davidson_rci +set(src_davidson_rci Davidson_RCI/david_rci.f90) -set(sources_cg +set(src_cg CG/ccgdiagg.f90 CG/rcgdiagg.f90) -set(sources_ppcg +set(src_ppcg PPCG/ppcg_gamma.f90 PPCG/ppcg_k.f90) +qe_enable_cuda_fortran("${src_ppcg}") -set(sources_paro +set(src_dense + DENSE/rotate_HSpsi_gamma.f90 + DENSE/rotate_HSpsi_k.f90 + DENSE/rotate_wfc_gamma.f90 + DENSE/rotate_wfc_k.f90) +qe_enable_cuda_fortran("${src_dense}") + +set(src_paro ParO/bpcg_gamma.f90 ParO/bpcg_k.f90 ParO/paro_gamma.f90 @@ -23,64 +32,64 @@ set(sources_paro ParO/pcg_k.f90 ParO/paro_gamma_new.f90 ParO/paro_k_new.f90) +qe_enable_cuda_fortran("${src_paro}") -set(sources_dense - DENSE/rotate_HSpsi_gamma.f90 - DENSE/rotate_HSpsi_k.f90 - DENSE/rotate_wfc_gamma.f90 - DENSE/rotate_wfc_k.f90) - -qe_add_library(qe_kssolver_davidson ${sources_davidson}) -add_library(QE::KS_Solvers::Davidson ALIAS qe_kssolver_davidson) +qe_add_library(qe_kssolver_davidson ${src_davidson}) target_link_libraries(qe_kssolver_davidson PRIVATE - QE::OpenMP_Fortran - QE::LAX - QE::UTILX - QE::MPI_Fortran) + qe_openmp_fortran + qe_lax + qe_utilx + qe_mpi_fortran) +if(QE_ENABLE_CUDA) + target_link_libraries(qe_kssolver_davidson + PRIVATE + qe_devxlib) +endif() -qe_add_library(qe_kssolver_davidsonrci ${sources_davidson_rci}) -add_library(QE::KS_Solvers::Davidson_RCI ALIAS qe_kssolver_davidsonrci) +qe_add_library(qe_kssolver_davidsonrci ${src_davidson_rci}) target_link_libraries(qe_kssolver_davidsonrci PRIVATE - QE::LAX - QE::UTILX - QE::MPI_Fortran) + qe_lax + qe_utilx + qe_mpi_fortran) -qe_add_library(qe_kssolver_cg ${sources_cg}) -add_library(QE::KS_Solvers::CG ALIAS qe_kssolver_cg) +qe_add_library(qe_kssolver_cg ${src_cg}) target_link_libraries(qe_kssolver_cg PRIVATE - QE::LAX - QE::UTILX - QE::MPI_Fortran) + qe_lax + qe_utilx + qe_mpi_fortran) +if(QE_ENABLE_CUDA) + target_link_libraries(qe_kssolver_cg + PRIVATE + qe_devxlib) +endif() -qe_add_library(qe_kssolver_ppcg ${sources_ppcg}) -add_library(QE::KS_Solvers::PPCG ALIAS qe_kssolver_ppcg) +qe_add_library(qe_kssolver_ppcg ${src_ppcg}) target_link_libraries(qe_kssolver_ppcg PRIVATE - QE::SCALAPACK - QE::OpenMP_Fortran - QE::LAX - QE::UTILX - QE::MPI_Fortran) + qe_scalapack + qe_openmp_fortran + qe_lax + qe_lapack + qe_utilx + qe_mpi_fortran) -qe_add_library(qe_kssolver_dense ${sources_dense}) -add_library(QE::KS_Solvers::DENSE ALIAS qe_kssolver_dense) +qe_add_library(qe_kssolver_dense ${src_dense}) target_link_libraries(qe_kssolver_dense PRIVATE - QE::LAX - QE::UTILX - QE::MPI_Fortran) + qe_lax + qe_utilx + qe_mpi_fortran) -qe_add_library(qe_kssolver_paro ${sources_paro}) -add_library(QE::KS_Solvers::ParO ALIAS qe_kssolver_paro) +qe_add_library(qe_kssolver_paro ${src_paro}) target_link_libraries(qe_kssolver_paro PRIVATE - QE::KS_Solvers::DENSE - QE::LAX - QE::UTILX - QE::MPI_Fortran) + qe_kssolver_dense + qe_lax + qe_utilx + qe_mpi_fortran) ########################################################### diff --git a/LAXlib/CMakeLists.txt b/LAXlib/CMakeLists.txt index 615707c69..4f5a65fee 100644 --- a/LAXlib/CMakeLists.txt +++ b/LAXlib/CMakeLists.txt @@ -1,4 +1,4 @@ -set(sources +set(src_lax distools.f90 dspev_drv.f90 la_error.f90 @@ -11,17 +11,36 @@ set(sources transto.f90 zhpev_drv.f90 cdiaghg.f90) +qe_enable_cuda_fortran("${src_lax}") -qe_add_library(qe_lax ${sources}) -add_library(QE::LAX ALIAS qe_lax) +qe_add_library(qe_lax ${src_lax}) target_link_libraries(qe_lax PRIVATE - QE::ELPA - QE::SCALAPACK - QE::OpenMP_Fortran - QE::MPI_Fortran - QE::LAPACK - QE::UTILX) + qe_elpa + qe_scalapack + qe_openmp_fortran + qe_mpi_fortran + qe_lapack + qe_utilx) +if(QE_ENABLE_CUDA) + if(QE_ENABLE_LAXLIB_CUSOLVER) + if(CUDAToolkit_VERSION VERSION_LESS 11) + message(FATAL_ERROR "cuSOLVER for LAXLib is only supported from CUDA compiler 11, disable it with '-DQE_ENABLE_LAXLIB_CUSOLVER=OFF'") + endif() + target_link_libraries(qe_lax + PRIVATE + qe_devxlib + CUDA::cusolver) + set_property(TARGET qe_lax APPEND + PROPERTY + COMPILE_DEFINITIONS __USE_CUSOLVER) + else() + target_link_libraries(qe_lax + PRIVATE + qe_devxlib + qe_eigensolver_gpu) + endif() +endif() # LAX relies on header files that should be preprocessed # and renamed *.h -> *.fh due to the fact that those @@ -60,12 +79,18 @@ qe_install_targets(qe_lax) # TODO move all tests to a proper location ########################################################### if(QE_ENABLE_TEST) - qe_add_executable(qe_lax_test test.f90) - set_target_properties(qe_lax_test PROPERTIES OUTPUT_NAME qe_lax_test.x RUNTIME_OUTPUT_DIRECTORY ${QE_TESTS_DIR}) + set(src_lax_test test.f90) + qe_enable_cuda_fortran("${src_lax_test}") + qe_add_executable(qe_lax_test ${src_lax_test}) + set_target_properties(qe_lax_test + PROPERTIES + OUTPUT_NAME qe_lax_test.x + RUNTIME_OUTPUT_DIRECTORY ${QE_TESTS_DIR}) target_link_libraries(qe_lax_test PRIVATE - QE::MPI_Fortran - QE::LAPACK - QE::LAX) - add_test(NAME test_qe_lax COMMAND ${QE_TESTS_DIR}/qe_lax_test.x) + qe_mpi_fortran + qe_lapack + qe_lax) + add_test(NAME test_qe_lax + COMMAND ${QE_TESTS_DIR}/qe_lax_test.x) endif(QE_ENABLE_TEST) diff --git a/LR_Modules/CMakeLists.txt b/LR_Modules/CMakeLists.txt index f2335e939..ccf9208ed 100644 --- a/LR_Modules/CMakeLists.txt +++ b/LR_Modules/CMakeLists.txt @@ -58,15 +58,13 @@ set(sources addusddenseq.f90) qe_add_library(qe_lr_modules ${sources}) -add_library(QE::LR_Modules ALIAS qe_lr_modules) target_link_libraries(qe_lr_modules PRIVATE - QE::Modules - QE::XClib - QE::PW - QE::UPF - QE::UTILX - QE::FFTX) + qe_modules + qe_pw + qe_upflib + qe_fftx + qe_xclib) ########################################################### diff --git a/Modules/CMakeLists.txt b/Modules/CMakeLists.txt index 42caca086..853dc083e 100644 --- a/Modules/CMakeLists.txt +++ b/Modules/CMakeLists.txt @@ -1,4 +1,4 @@ -set(sources +set(src_modules additional_kpoints.f90 autopilot.f90 basic_algebra_routines.f90 @@ -128,24 +128,23 @@ set(sources w0gauss.f90 w1gauss.f90 deviatoric.f90) +qe_enable_cuda_fortran("${src_modules}") -qe_add_library(qe_modules ${sources}) -add_library(QE::Modules ALIAS qe_modules) +qe_add_library(qe_modules ${src_modules}) target_link_libraries(qe_modules PRIVATE - QE::HDF5_Fortran - QE::OpenMP_Fortran - QE::FFTX - QE::LAX - QE::XClib - QE::UPF - QE::CLIB # this is needed only by wrappers.f90 - QE::libbeef - QE::MPI_Fortran - QE::MBD + qe_hdf5_fortran + qe_openmp_fortran + qe_fftx + qe_lax + qe_upflib + qe_clib # this is needed only by wrappers.f90 + qe_mpi_fortran + qe_mbd + qe_xclib PUBLIC - QE::FOX - QE::UTILX) + qe_fox + qe_utilx) ########################################################### diff --git a/NEB/CMakeLists.txt b/NEB/CMakeLists.txt index 69710b986..ca34abeba 100644 --- a/NEB/CMakeLists.txt +++ b/NEB/CMakeLists.txt @@ -1,4 +1,4 @@ -set(sources +set(src_neb src/compute_scf.f90 src/engine_to_path_pos.f90 src/engine_to_path_alat.f90 @@ -25,41 +25,44 @@ set(sources src/set_defaults.f90 src/stop_run_path.f90) -qe_add_library(qe_neb ${sources}) -add_library(QE::NEB ALIAS qe_neb) +qe_add_library(qe_neb ${src_neb}) target_link_libraries(qe_neb PRIVATE - QE::PW - QE::XClib - QE::Modules - QE::UTILX - QE::UPF) + qe_pw + qe_modules + qe_upflib + qe_fftx + qe_xclib) ########################################################### # neb.x ########################################################### -set(sources src/neb.f90) -qe_add_executable(qe_neb_exe ${sources}) -set_target_properties(qe_neb_exe PROPERTIES OUTPUT_NAME neb.x) +set(src_neb_x src/neb.f90) +qe_enable_cuda_fortran("${src_neb_x}") +qe_add_executable(qe_neb_exe ${src_neb_x}) +set_target_properties(qe_neb_exe + PROPERTIES + OUTPUT_NAME neb.x) target_link_libraries(qe_neb_exe PRIVATE - QE::PW - QE::LAX - QE::UTILX - QE::Modules - QE::NEB) + qe_pw + qe_lax + qe_modules + qe_neb) ########################################################### # path_interpolation.x ########################################################### -set(sources src/path_interpolation.f90) -qe_add_executable(qe_neb_pathinterpolation_exe ${sources}) -set_target_properties(qe_neb_pathinterpolation_exe PROPERTIES OUTPUT_NAME path_interpolation.x) +set(src_path_interpolation_x src/path_interpolation.f90) +qe_add_executable(qe_neb_pathinterpolation_exe ${src_path_interpolation_x}) +set_target_properties(qe_neb_pathinterpolation_exe + PROPERTIES + OUTPUT_NAME path_interpolation.x) target_link_libraries(qe_neb_pathinterpolation_exe PRIVATE - QE::Modules - QE::NEB - QE::UPF) + qe_modules + qe_neb + qe_upflib) ########################################################### diff --git a/PHonon/CMakeLists.txt b/PHonon/CMakeLists.txt index f3e64a037..be5107c9c 100644 --- a/PHonon/CMakeLists.txt +++ b/PHonon/CMakeLists.txt @@ -1,4 +1,4 @@ -set(sources_ph +set(src_ph PH/acfdtest.f90 PH/add_dkmds.f90 PH/add_for_charges.f90 @@ -186,10 +186,10 @@ set(sources_ph PH/ahc.f90 PH/postahc.f90) -set(sources_phaux +set(src_phaux PH/write_eigenvectors.f90) -set(sources_gamma +set(src_gamma Gamma/a_h.f90 Gamma/cg_readin.f90 Gamma/cg_setup.f90 @@ -214,213 +214,201 @@ set(sources_gamma Gamma/solve_e.f90 Gamma/solve_ph.f90 Gamma/writedyn.f90) +qe_enable_cuda_fortran("${src_gamma}") -set(sources_fd +set(src_fd FD/stop_pp.f90) - -qe_add_library(qe_phonon_ph ${sources_ph}) -add_library(QE::PHonon::PH ALIAS qe_phonon_ph) +qe_add_library(qe_phonon_ph ${src_ph}) target_link_libraries(qe_phonon_ph PRIVATE - QE::HDF5_Fortran - QE::OpenMP_Fortran - QE::PW - QE::Modules - QE::XClib - QE::LR_Modules - QE::UTILX - QE::UPF - QE::FFTX) + qe_hdf5_fortran + qe_openmp_fortran + qe_pw + qe_modules + qe_lr_modules + qe_upflib + qe_fftx + qe_fox + qe_xclib) -qe_add_library(qe_phonon_phaux ${sources_phaux}) -add_library(QE::PHonon::PHAUX ALIAS qe_phonon_phaux) +qe_add_library(qe_phonon_phaux ${src_phaux}) target_link_libraries(qe_phonon_phaux PRIVATE - QE::Modules - QE::LR_Modules) + qe_modules + qe_lr_modules) -qe_add_library(qe_phonon_gamma ${sources_gamma}) -add_library(QE::PHonon::Gamma ALIAS qe_phonon_gamma) +qe_add_library(qe_phonon_gamma ${src_gamma}) target_link_libraries(qe_phonon_gamma PRIVATE - QE::PW - QE::Modules - QE::XClib - QE::LR_Modules - QE::UPF - QE::FFTX - QE::UTILX - QE::LAX) + qe_pw + qe_modules + qe_lr_modules + qe_upflib + qe_fftx + qe_lax + qe_xclib) -qe_add_library(qe_phonon_fd ${sources_fd}) -add_library(QE::PHonon::FD ALIAS qe_phonon_fd) +qe_add_library(qe_phonon_fd ${src_fd}) target_link_libraries(qe_phonon_fd PRIVATE - QE::PW - QE::UTILX - QE::Modules - QE::LR_Modules) + qe_pw + qe_modules + qe_lr_modules) ########################################################### # ph.x ########################################################### -set(sources PH/phonon.f90) -qe_add_executable(qe_phonon_ph_exe ${sources}) +set(src_phonon_x PH/phonon.f90) +qe_enable_cuda_fortran("${src_phonon_x}") +qe_add_executable(qe_phonon_ph_exe ${src_phonon_x}) set_target_properties(qe_phonon_ph_exe PROPERTIES OUTPUT_NAME ph.x) target_link_libraries(qe_phonon_ph_exe PRIVATE - QE::PW - QE::LAX - QE::Modules - QE::PHonon::PH - QE::UTILX) + qe_pw + qe_lax + qe_modules + qe_phonon_ph) ########################################################### # dynmat.x ########################################################### -set(sources PH/dynmat.f90) -qe_add_executable(qe_phonon_dynmat_exe ${sources}) +set(src_dynmat_x PH/dynmat.f90) +qe_add_executable(qe_phonon_dynmat_exe ${src_dynmat_x}) set_target_properties(qe_phonon_dynmat_exe PROPERTIES OUTPUT_NAME dynmat.x) target_link_libraries(qe_phonon_dynmat_exe PRIVATE - QE::LR_Modules - QE::Modules - QE::UTILX - QE::PHonon::PH - QE::PHonon::PHAUX) + qe_lr_modules + qe_modules + qe_phonon_ph + qe_phonon_phaux + qe_fox) ########################################################### # q2r.x ########################################################### -set(sources PH/q2r.f90) -qe_add_executable(qe_phonon_q2r_exe ${sources}) +set(src_q2r_x PH/q2r.f90) +qe_add_executable(qe_phonon_q2r_exe ${src_q2r_x}) set_target_properties(qe_phonon_q2r_exe PROPERTIES OUTPUT_NAME q2r.x) target_link_libraries(qe_phonon_q2r_exe PRIVATE - QE::Modules - QE::UTILX - QE::PHonon::PH) + qe_modules + qe_phonon_ph) ################################################################## # matdyn.x ################################################################## -set(sources PH/matdyn.f90) -qe_add_executable(qe_phonon_matdyn_exe ${sources}) +set(src_matdyn_x PH/matdyn.f90) +qe_add_executable(qe_phonon_matdyn_exe ${src_matdyn_x}) set_target_properties(qe_phonon_matdyn_exe PROPERTIES OUTPUT_NAME matdyn.x) target_link_libraries(qe_phonon_matdyn_exe PRIVATE - QE::Modules - QE::UTILX - QE::PW - QE::PHonon::PH - QE::PHonon::PHAUX - QE::LR_Modules) + qe_modules + qe_pw + qe_phonon_ph + qe_phonon_phaux + qe_lr_modules) ########################################################### # q2qstar.x ########################################################### -set(sources PH/q2qstar.f90) -qe_add_executable(qe_phonon_q2qstar_exe ${sources}) +set(src_q2qstar_x PH/q2qstar.f90) +qe_add_executable(qe_phonon_q2qstar_exe ${src_q2qstar_x}) set_target_properties(qe_phonon_q2qstar_exe PROPERTIES OUTPUT_NAME q2qstar.x) target_link_libraries(qe_phonon_q2qstar_exe PRIVATE - QE::PW - QE::LR_Modules - QE::Modules - QE::UTILX - QE::PHonon::PH) + qe_pw + qe_lr_modules + qe_modules + qe_phonon_ph) ########################################################### # lambda.x ########################################################### -set(sources PH/lambda.f90) -qe_add_executable(qe_phonon_lambda_exe ${sources}) +set(src_lambda_x PH/lambda.f90) +qe_add_executable(qe_phonon_lambda_exe ${src_lambda_x}) set_target_properties(qe_phonon_lambda_exe PROPERTIES OUTPUT_NAME lambda.x) target_link_libraries(qe_phonon_lambda_exe PRIVATE - QE::Modules - QE::UTILX - QE::PHonon::PH) + qe_modules + qe_phonon_ph) ########################################################### # alpha2f.x ########################################################### -set(sources PH/alpha2f.f90) -qe_add_executable(qe_phonon_alpha2f_exe ${sources}) +set(src_alpha2f_x PH/alpha2f.f90) +qe_add_executable(qe_phonon_alpha2f_exe ${src_alpha2f_x}) set_target_properties(qe_phonon_alpha2f_exe PROPERTIES OUTPUT_NAME alpha2f.x) target_link_libraries(qe_phonon_alpha2f_exe PRIVATE - QE::PW - QE::Modules - QE::UTILX - QE::PHonon::PH) + qe_pw + qe_modules + qe_phonon_ph) ########################################################### # epa.x ########################################################### -set(sources PH/epa.f90) -qe_add_executable(qe_phonon_epa_exe ${sources}) +set(src_epa_x PH/epa.f90) +qe_add_executable(qe_phonon_epa_exe ${src_epa_x}) set_target_properties(qe_phonon_epa_exe PROPERTIES OUTPUT_NAME epa.x) target_link_libraries(qe_phonon_epa_exe PRIVATE - QE::Modules - QE::UTILX - QE::PHonon::PH) + qe_modules + qe_phonon_ph) ########################################################### # fqha.x ########################################################### -set(sources PH/fqha.f90) -qe_add_executable(qe_phonon_fqha_exe ${sources}) +set(src_fqha_x PH/fqha.f90) +qe_add_executable(qe_phonon_fqha_exe ${src_fqha_x}) set_target_properties(qe_phonon_fqha_exe PROPERTIES OUTPUT_NAME fqha.x) target_link_libraries(qe_phonon_fqha_exe PRIVATE - QE::UTILX - QE::PHonon::PH) + qe_utilx + qe_phonon_ph) ########################################################### # fd.x ########################################################### -set(sources FD/fd.f90) -qe_add_executable(qe_phonon_fd_exe ${sources}) +set(src_fd_x FD/fd.f90) +qe_add_executable(qe_phonon_fd_exe ${src_fd_x}) set_target_properties(qe_phonon_fd_exe PROPERTIES OUTPUT_NAME fd.x) target_link_libraries(qe_phonon_fd_exe PRIVATE - QE::PW - QE::UTILX - QE::Modules - QE::PHonon::FD - QE::PHonon::PH) + qe_pw + qe_modules + qe_phonon_fd + qe_phonon_ph + qe_fftx) ########################################################### # fd_ef.x ########################################################### -set(sources FD/fd_ef.f90) -qe_add_executable(qe_phonon_fdef_exe ${sources}) +set(src_fd_ef_x FD/fd_ef.f90) +qe_add_executable(qe_phonon_fdef_exe ${src_fd_ef_x}) set_target_properties(qe_phonon_fdef_exe PROPERTIES OUTPUT_NAME fd_ef.x) target_link_libraries(qe_phonon_fdef_exe PRIVATE - QE::PW - QE::UTILX - QE::Modules - QE::PHonon::FD - QE::PHonon::PH) + qe_pw + qe_modules + qe_phonon_fd + qe_phonon_ph + qe_fftx) ########################################################### # fd_ifc.x ########################################################### -set(sources FD/fd_ifc.f90) -qe_add_executable(qe_phonon_fdifc_exe ${sources}) +set(src_fd_ifc_x FD/fd_ifc.f90) +qe_add_executable(qe_phonon_fdifc_exe ${src_fd_ifc_x}) set_target_properties(qe_phonon_fdifc_exe PROPERTIES OUTPUT_NAME fd_ifc.x) target_link_libraries(qe_phonon_fdifc_exe PRIVATE - QE::PW - QE::UTILX - QE::Modules - QE::PHonon::FD - QE::PHonon::PH) + qe_pw + qe_modules + qe_phonon_fd + qe_phonon_ph + qe_fftx) ########################################################### diff --git a/PHonon/examples/README b/PHonon/examples/README index 4d110d13f..e38ecb21f 100644 --- a/PHonon/examples/README +++ b/PHonon/examples/README @@ -1,68 +1,6 @@ -These are instructions on how to run the examples for PHonon package. -These examples try to exercise all the programs and features -of the PHonon package. -If you find that any relevant feature isn't being tested, -please contact us (or even better, write and send us a new example). - -To run the examples, you should follow this procedure: - -1) Edit the "environment_variables" file from the main - ESPRESSO directory, setting the following variables as needed: - - BIN_DIR = directory where ESPRESSO executables reside - PSEUDO_DIR = directory where pseudopotential files reside - TMP_DIR = directory to be used as temporary storage area - - If you have downloaded the full ESPRESSO distribution, you may set - BIN_DIR=$TOPDIR/bin and PSEUDO_DIR=$TOPDIR/pseudo, where $TOPDIR is - the root of the ESPRESSO source tree. - - TMP_DIR must be a directory you have read and write access to, with - enough available space to host the temporary files produced by the - example runs, and possibly offering high I/O performance (i.e., - don't use an NFS-mounted directory). - -2) If you want to test the parallel version of ESPRESSO, you will - usually have to specify a driver program (such as "poe" or "mpirun") - and the number of processors. This can be done by editing PARA_PREFIX - and PARA_POSTFIX variables (in the "environment_variables" file). - Parallel executables will be run by a command like this: - - $PARA_PREFIX ph.x $PARA_POSTFIX < file.in > file.out - - For example, if the command line is like this (as for an IBM SP): - - poe ph.x -procs 4 < file.in > file.out - - you should set PARA_PREFIX="poe", PARA_POSTFIX="-procs 4". - - See section "Running on parallel machines" of the user guide for details. - Furthermore, if your machine does not support interactive use, you - must run the commands specified below through the batch queueing - system installed on that machine. Ask your system administrator - for instructions. - -3) To run a single example, go to the corresponding directory (for - instance, "example/example01") and execute: - - ./run_example - - This will create a subdirectory "results", containing the input and - output files generated by the calculation. - - Some examples take only a few seconds to run, while others may - require several minutes depending on your system. - -4) In each example's directory, the "reference" subdirectory contains - verified output files, that you can check your results against. - - The reference results were generated on a Linux PC with Intel compiler. - On different architectures the precise numbers could be slightly - different, in particular if different FFT dimensions are - automatically selected. For this reason, a plain "diff" of your - results against the reference data doesn't work, or at least, it - requires human inspection of the results. - +These examples cover most programs and features of the PHonon package. +See comments in file "environment_variables" in the top QE directory +for instructions on how to run these examples. ----------------------------------------------------------------------- LIST AND CONTENT OF THE EXAMPLES diff --git a/PP/CMakeLists.txt b/PP/CMakeLists.txt index eb047042e..ea578032b 100644 --- a/PP/CMakeLists.txt +++ b/PP/CMakeLists.txt @@ -1,4 +1,4 @@ -set(sources +set(src_pp src/addusdens1d.f90 src/add_shift_cc.f90 src/add_shift_lc.f90 @@ -43,466 +43,451 @@ set(sources src/write_hamiltonians.f90 src/xc_vdW_scale_mod.f90 src/projwfc.f90) +qe_enable_cuda_fortran("${src_pp}") -qe_add_library(qe_pp ${sources}) -add_library(QE::PP ALIAS qe_pp) +qe_add_library(qe_pp ${src_pp}) target_compile_definitions(qe_pp PRIVATE "__WANLIB") target_link_libraries(qe_pp PRIVATE - QE::OpenMP_Fortran - QE::FOX - QE::XClib - QE::PW - QE::Modules - QE::UTILX - QE::FFTX - QE::UPF - QE::LAX) + qe_openmp_fortran + qe_pw + qe_modules + qe_fftx + qe_upflib + qe_lax + qe_xclib) ########################################################### # pp.x ########################################################### -set(sources src/postproc.f90) -qe_add_executable(qe_pp_exe ${sources}) +set(src_pp_x src/postproc.f90) +qe_add_executable(qe_pp_exe ${src_pp_x}) set_target_properties(qe_pp_exe PROPERTIES OUTPUT_NAME pp.x) target_link_libraries(qe_pp_exe PRIVATE - QE::PW - QE::Modules - QE::XClib - QE::PP - QE::UTILX) + qe_pw + qe_modules + qe_pp + qe_fftx + qe_xclib) ########################################################### # open_grid.x ########################################################### -set(sources src/open_grid.f90) -qe_add_executable(qe_pp_opengrid_exe ${sources}) +set(src_open_grid_x src/open_grid.f90) +qe_add_executable(qe_pp_opengrid_exe ${src_open_grid_x}) set_target_properties(qe_pp_opengrid_exe PROPERTIES OUTPUT_NAME open_grid.x) target_link_libraries(qe_pp_opengrid_exe PRIVATE - QE::PW - QE::UTILX - QE::Modules - QE::XClib - QE::PP - QE::FFTX) + qe_pw + qe_modules + qe_pp + qe_fftx + qe_upflib + qe_xclib) ########################################################### # average.x ########################################################### -set(sources src/average.f90) -qe_add_executable(qe_pp_average_exe ${sources}) +set(src_average_x src/average.f90) +qe_add_executable(qe_pp_average_exe ${src_average_x}) set_target_properties(qe_pp_average_exe PROPERTIES OUTPUT_NAME average.x) target_link_libraries(qe_pp_average_exe PRIVATE - QE::PW - QE::FFTX - QE::Modules - QE::PP - QE::UTILX) + qe_pw + qe_fftx + qe_modules + qe_pp + qe_upflib + qe_xclib) ########################################################### # bands.x ########################################################### -set(sources src/bands.f90) -qe_add_executable(qe_pp_bands_exe ${sources}) +set(src_bands_x src/bands.f90) +qe_add_executable(qe_pp_bands_exe ${src_bands_x}) set_target_properties(qe_pp_bands_exe PROPERTIES OUTPUT_NAME bands.x) target_link_libraries(qe_pp_bands_exe PRIVATE - QE::PW - QE::Modules - QE::PP - QE::UTILX - QE::UPF) + qe_pw + qe_modules + qe_pp + qe_upflib) ########################################################### # dos.x ########################################################### -set(sources src/dos.f90) -qe_add_executable(qe_pp_dos_exe ${sources}) +set(src_dos_x src/dos.f90) +qe_add_executable(qe_pp_dos_exe ${src_dos_x}) set_target_properties(qe_pp_dos_exe PROPERTIES OUTPUT_NAME dos.x) target_link_libraries(qe_pp_dos_exe PRIVATE - QE::PW - QE::PP - QE::Modules - QE::UTILX) + qe_pw + qe_pp + qe_modules) ########################################################### # pawplot.x ########################################################### -set(sources src/pawplot.f90) -qe_add_executable(qe_pp_pawplot_exe ${sources}) +set(src_pawplot_x src/pawplot.f90) +qe_add_executable(qe_pp_pawplot_exe ${src_pawplot_x}) set_target_properties(qe_pp_pawplot_exe PROPERTIES OUTPUT_NAME pawplot.x) target_link_libraries(qe_pp_pawplot_exe PRIVATE - QE::PW - QE::Modules - QE::PP - QE::UPF - QE::UTILX) + qe_pw + qe_modules + qe_pp + qe_upflib + qe_fftx + qe_xclib) ########################################################### # plan_avg.x ########################################################### -set(sources src/plan_avg.f90) -qe_add_executable(qe_pp_planavg_exe ${sources}) +set(src_plan_avg_x src/plan_avg.f90) +qe_add_executable(qe_pp_planavg_exe ${src_plan_avg_x}) set_target_properties(qe_pp_planavg_exe PROPERTIES OUTPUT_NAME plan_avg.x) target_link_libraries(qe_pp_planavg_exe PRIVATE - QE::PW - QE::Modules - QE::PP - QE::UTILX - QE::UPF) + qe_pw + qe_modules + qe_pp + qe_upflib + qe_fftx) ########################################################### # plotband.x ########################################################### -set(sources src/plotband.f90) -qe_add_executable(qe_pp_plotband_exe ${sources}) +set(src_plotband_x src/plotband.f90) +qe_add_executable(qe_pp_plotband_exe ${src_plotband_x}) set_target_properties(qe_pp_plotband_exe PROPERTIES OUTPUT_NAME plotband.x) target_link_libraries(qe_pp_plotband_exe PRIVATE - QE::UTILX - QE::Modules - QE::PP) + qe_modules + qe_pp) ########################################################### # plotproj.x ########################################################### -set(sources src/plotproj.f90) -qe_add_executable(qe_pp_plotproj_exe ${sources}) +set(src_plotproj_x src/plotproj.f90) +qe_add_executable(qe_pp_plotproj_exe ${src_plotproj_x}) set_target_properties(qe_pp_plotproj_exe PROPERTIES OUTPUT_NAME plotproj.x) target_link_libraries(qe_pp_plotproj_exe PRIVATE - QE::Modules - QE::PP) + qe_modules + qe_pp) ########################################################### # plotrho.x ########################################################### -set(sources src/plotrho.f90) -qe_add_executable(qe_pp_plotrho_exe ${sources}) +set(src_plotrho_x src/plotrho.f90) +qe_add_executable(qe_pp_plotrho_exe ${src_plotrho_x}) set_target_properties(qe_pp_plotrho_exe PROPERTIES OUTPUT_NAME plotrho.x) target_link_libraries(qe_pp_plotrho_exe PRIVATE - QE::Modules - QE::PP) + qe_modules + qe_pp) ########################################################### # pmw.x ########################################################### -set(sources src/poormanwannier.f90) -qe_add_executable(qe_pp_pmw_exe ${sources}) +set(src_pmw_x src/poormanwannier.f90) +qe_add_executable(qe_pp_pmw_exe ${src_pmw_x}) set_target_properties(qe_pp_pmw_exe PROPERTIES OUTPUT_NAME pmw.x) target_link_libraries(qe_pp_pmw_exe PRIVATE - QE::LAPACK - QE::PW - QE::UTILX - QE::Modules - QE::PP - QE::UPF) + qe_lapack + qe_pw + qe_modules + qe_pp + qe_upflib) ########################################################### # xctest.x ########################################################### -set(sources src/xctest.f90) -qe_add_executable(qe_pp_xctest_exe ${sources}) +set(src_xctest_x src/xctest.f90) +qe_add_executable(qe_pp_xctest_exe ${src_xctest_x}) set_target_properties(qe_pp_xctest_exe PROPERTIES OUTPUT_NAME xctest.x) target_link_libraries(qe_pp_xctest_exe PRIVATE - QE::UTILX - QE::Modules - QE::XClib - QE::CPV - QE::PP) + qe_modules + qe_cpv + qe_pp + qe_xclib) ########################################################### # projwfc.x ########################################################### -set(sources src/projwfc.f90) -qe_add_executable(qe_pp_projwfc_exe ${sources}) +set(src_projwfc_x src/projwfc.f90) +qe_add_executable(qe_pp_projwfc_exe ${src_projwfc_x}) set_target_properties(qe_pp_projwfc_exe PROPERTIES OUTPUT_NAME projwfc.x) target_link_libraries(qe_pp_projwfc_exe PRIVATE - QE::LAPACK - QE::PW - QE::Modules - QE::PP - QE::LAX - QE::UTILX - QE::UPF) + qe_lapack + qe_pw + qe_modules + qe_pp + qe_lax + qe_upflib) ########################################################### # pw2wannier90.x ########################################################### -set(sources src/pw2wannier90.f90) -qe_add_executable(qe_pp_pw2wannier90_exe ${sources}) +set(src_pw2wannier90_x src/pw2wannier90.f90) +qe_add_executable(qe_pp_pw2wannier90_exe ${src_pw2wannier90_x}) set_target_properties(qe_pp_pw2wannier90_exe PROPERTIES OUTPUT_NAME pw2wannier90.x) target_link_libraries(qe_pp_pw2wannier90_exe PRIVATE - QE::LAPACK - QE::PW - QE::UTILX - QE::Modules - QE::PP - QE::FFTX - QE::UPF) + qe_lapack + qe_pw + qe_modules + qe_pp + qe_fftx + qe_upflib + qe_xclib) ########################################################### # pw2critic.x ########################################################### -set(sources src/pw2critic.f90) -qe_add_executable(qe_pp_pw2critic_exe ${sources}) +set(src_pw2critic_x src/pw2critic.f90) +qe_add_executable(qe_pp_pw2critic_exe ${src_pw2critic_x}) set_target_properties(qe_pp_pw2critic_exe PROPERTIES OUTPUT_NAME pw2critic.x) target_link_libraries(qe_pp_pw2critic_exe PRIVATE - QE::PW - QE::Modules - QE::PP - QE::UTILX) + qe_pw + qe_modules + qe_pp + qe_fftx) ########################################################### # wfck2r.x ########################################################### -set(sources src/wfck2r.f90) -qe_add_executable(qe_pp_wfck2r_exe ${sources}) +set(src_wfck2r_x src/wfck2r.f90) +qe_add_executable(qe_pp_wfck2r_exe ${src_wfck2r_x}) set_target_properties(qe_pp_wfck2r_exe PROPERTIES OUTPUT_NAME wfck2r.x) target_link_libraries(qe_pp_wfck2r_exe PRIVATE - QE::PW - QE::Modules - QE::PP - QE::UTILX - QE::FFTX) + qe_pw + qe_modules + qe_pp + qe_fftx) ########################################################### # initial_state.x ########################################################### -set(sources src/initial_state.f90) -qe_add_executable(qe_pp_initial_state_exe ${sources}) +set(src_initial_state_x src/initial_state.f90) +qe_add_executable(qe_pp_initial_state_exe ${src_initial_state_x}) set_target_properties(qe_pp_initial_state_exe PROPERTIES OUTPUT_NAME initial_state.x) target_link_libraries(qe_pp_initial_state_exe PRIVATE - QE::PW - QE::Modules - QE::PP - QE::UPF - QE::UTILX) + qe_pw + qe_modules + qe_pp + qe_upflib) ########################################################### # pw2gw.x ########################################################### -set(sources src/pw2gw.f90) -qe_add_executable(qe_pp_pw2gw_exe ${sources}) +set(src_pw2gw_x src/pw2gw.f90) +qe_add_executable(qe_pp_pw2gw_exe ${src_pw2gw_x}) set_target_properties(qe_pp_pw2gw_exe PROPERTIES OUTPUT_NAME pw2gw.x) target_link_libraries(qe_pp_pw2gw_exe PRIVATE - QE::PW - QE::UTILX - QE::Modules - QE::PP - QE::FFTX - QE::UPF - QE::MPI_Fortran) + qe_pw + qe_modules + qe_pp + qe_fftx + qe_upflib + qe_mpi_fortran + qe_xclib) ########################################################### # sumpdos.x ########################################################### -set(sources src/sumpdos.f90) -qe_add_executable(qe_pp_sumpdos_exe ${sources}) +set(src_sumpdos_x src/sumpdos.f90) +qe_add_executable(qe_pp_sumpdos_exe ${src_sumpdos_x}) set_target_properties(qe_pp_sumpdos_exe PROPERTIES OUTPUT_NAME sumpdos.x) target_link_libraries(qe_pp_sumpdos_exe PRIVATE - QE::PP) + qe_pp) ########################################################### # epsilon.x ########################################################### -set(sources src/epsilon.f90) -qe_add_executable(qe_pp_epsilon_exe ${sources}) +set(src_epsilon_x src/epsilon.f90) +qe_add_executable(qe_pp_epsilon_exe ${src_epsilon_x}) set_target_properties(qe_pp_epsilon_exe PROPERTIES OUTPUT_NAME epsilon.x) target_link_libraries(qe_pp_epsilon_exe PRIVATE - QE::PW - QE::Modules - QE::PP - QE::UPF - QE::UTILX) + qe_pw + qe_modules + qe_pp + qe_upflib) ########################################################### # wannier_ham.x ########################################################### -set(sources src/wannier_ham.f90) -qe_add_executable(qe_pp_wannierham_exe ${sources}) +set(src_wannier_ham_x src/wannier_ham.f90) +qe_add_executable(qe_pp_wannierham_exe ${src_wannier_ham_x}) set_target_properties(qe_pp_wannierham_exe PROPERTIES OUTPUT_NAME wannier_ham.x) target_link_libraries(qe_pp_wannierham_exe PRIVATE - QE::CLIB - QE::PW - QE::UTILX - QE::Modules - QE::PP) + qe_clib + qe_pw + qe_modules + qe_pp) ########################################################### # wannier_plot.x ########################################################### -set(sources src/wannier_plot.f90) -qe_add_executable(qe_pp_wannierplot_exe ${sources}) +set(src_wannier_plot_x src/wannier_plot.f90) +qe_add_executable(qe_pp_wannierplot_exe ${src_wannier_plot_x}) set_target_properties(qe_pp_wannierplot_exe PROPERTIES OUTPUT_NAME wannier_plot.x) target_link_libraries(qe_pp_wannierplot_exe PRIVATE - QE::PW - QE::UTILX - QE::Modules - QE::PP - QE::FFTX) + qe_pw + qe_modules + qe_pp + qe_fftx) ########################################################### # molecularpdos.x ########################################################### -set(sources src/molecularpdos.f90) -qe_add_executable(qe_pp_molecularpdos_exe ${sources}) +set(src_molecularpdos_x src/molecularpdos.f90) +qe_add_executable(qe_pp_molecularpdos_exe ${src_molecularpdos_x}) set_target_properties(qe_pp_molecularpdos_exe PROPERTIES OUTPUT_NAME molecularpdos.x) target_link_libraries(qe_pp_molecularpdos_exe PRIVATE - QE::UTILX - QE::Modules - QE::PP) + qe_modules + qe_pp) ########################################################### # pw2bgw.x ########################################################### -set(sources src/pw2bgw.f90) -qe_add_executable(qe_pp_pw2bgw_exe ${sources}) +set(src_pw2bgw_x src/pw2bgw.f90) +qe_add_executable(qe_pp_pw2bgw_exe ${src_pw2bgw_x}) set_target_properties(qe_pp_pw2bgw_exe PROPERTIES OUTPUT_NAME pw2bgw.x) target_link_libraries(qe_pp_pw2bgw_exe PRIVATE - QE::PW - QE::Modules - QE::XClib - QE::PP - QE::UTILX - QE::UPF - QE::FFTX - QE::MPI_Fortran) + qe_pw + qe_modules + qe_pp + qe_upflib + qe_fftx + qe_mpi_fortran + qe_xclib) ########################################################### # fs.x ########################################################### -set(sources src/fermisurface.f90) -qe_add_executable(qe_pp_fermisurface_exe ${sources}) +set(src_fs_x src/fermisurface.f90) +qe_add_executable(qe_pp_fermisurface_exe ${src_fs_x}) set_target_properties(qe_pp_fermisurface_exe PROPERTIES OUTPUT_NAME fs.x) target_link_libraries(qe_pp_fermisurface_exe PRIVATE - QE::PW - QE::UTILX - QE::Modules - QE::PP) + qe_pw + qe_modules + qe_pp) ########################################################### # fermi_velocity.x ########################################################### -set(sources src/fermi_velocity.f90) -qe_add_executable(qe_pp_fermivelocity_exe ${sources}) +set(src_fermi_velocity_x src/fermi_velocity.f90) +qe_add_executable(qe_pp_fermivelocity_exe ${src_fermi_velocity_x}) set_target_properties(qe_pp_fermivelocity_exe PROPERTIES OUTPUT_NAME fermi_velocity.x) target_link_libraries(qe_pp_fermivelocity_exe PRIVATE - QE::PW - QE::UTILX - QE::Modules - QE::PP) + qe_pw + qe_modules + qe_pp) ########################################################### # fermi_proj.x ########################################################### -set(sources src/fermi_proj.f90) -qe_add_executable(qe_pp_fermiproj_exe ${sources}) +set(src_fermi_proj_x src/fermi_proj.f90) +qe_add_executable(qe_pp_fermiproj_exe ${src_fermi_proj_x}) set_target_properties(qe_pp_fermiproj_exe PROPERTIES OUTPUT_NAME fermi_proj.x) target_link_libraries(qe_pp_fermiproj_exe PRIVATE - QE::PW - QE::Modules - QE::PP - QE::UTILX) + qe_pw + qe_modules + qe_pp + qe_upflib) ########################################################### # ppacf.x ########################################################### -set(sources src/ppacf.f90) -qe_add_executable(qe_pp_ppacf_exe ${sources}) +set(src_ppacf_x src/ppacf.f90) +qe_add_executable(qe_pp_ppacf_exe ${src_ppacf_x}) set_target_properties(qe_pp_ppacf_exe PROPERTIES OUTPUT_NAME ppacf.x) target_link_libraries(qe_pp_ppacf_exe PRIVATE - QE::LAPACK - QE::PW - QE::XClib - QE::PP - QE::Modules - QE::UTILX - QE::FFTX) + qe_lapack + qe_pw + qe_pp + qe_modules + qe_fftx + qe_upflib + qe_xclib) ########################################################### # ef.x ########################################################### -set(sources +set(src_ef_x simple_transport/src/cryst_to_car.f90 simple_transport/src/lint.f90 simple_transport/src/ef.f90) -qe_add_executable(qe_pp_st_ef_exe ${sources}) +qe_add_executable(qe_pp_st_ef_exe ${src_ef_x}) set_target_properties(qe_pp_st_ef_exe PROPERTIES OUTPUT_NAME ef.x) target_link_libraries(qe_pp_st_ef_exe PRIVATE - QE::OpenMP_Fortran - QE::Modules) + qe_openmp_fortran + qe_modules) ########################################################### # dos_sp.x ########################################################### -set(sources +set(src_dos_sp_x simple_transport/src/smearing_mod.f90 simple_transport/src/cryst_to_car.f90 simple_transport/src/lint.f90 simple_transport/src/vband_ibz.f90 simple_transport/src/dos.f90) -qe_add_executable(qe_pp_st_dos_exe ${sources}) +qe_add_executable(qe_pp_st_dos_exe ${src_dos_sp_x}) set_target_properties(qe_pp_st_dos_exe PROPERTIES OUTPUT_NAME dos_sp.x) target_link_libraries(qe_pp_st_dos_exe PRIVATE - QE::OpenMP_Fortran - QE::Modules) + qe_openmp_fortran + qe_modules) ########################################################### # fermi_int_0.x ########################################################### -set(sources +set(src_fermi_int_0_x simple_transport/src/cryst_to_car.f90 simple_transport/src/lint.f90 simple_transport/src/vband_ibz.f90 simple_transport/src/fermi_int_0.f90) -qe_add_executable(qe_pp_st_fermiint0_exe ${sources}) +qe_add_executable(qe_pp_st_fermiint0_exe ${src_fermi_int_0_x}) set_target_properties(qe_pp_st_fermiint0_exe PROPERTIES OUTPUT_NAME fermi_int_0.x) target_link_libraries(qe_pp_st_ef_exe PRIVATE - QE::OpenMP_Fortran) + qe_openmp_fortran) ########################################################### # fermi_int_1.x ########################################################### -set(sources +set(src_fermi_int_1_x simple_transport/src/cryst_to_car.f90 simple_transport/src/reducegrid.f90 simple_transport/src/lint.f90 simple_transport/src/vband_ibz.f90 simple_transport/src/fermi_int_1.f90) -qe_add_executable(qe_pp_st_fermiint1_exe ${sources}) +qe_add_executable(qe_pp_st_fermiint1_exe ${src_fermi_int_1_x}) set_target_properties(qe_pp_st_fermiint1_exe PROPERTIES OUTPUT_NAME fermi_int_1.x) target_link_libraries(qe_pp_st_ef_exe PRIVATE - QE::OpenMP_Fortran) + qe_openmp_fortran) ########################################################### diff --git a/PP/examples/README b/PP/examples/README index f2bc88649..14c1fca5d 100644 --- a/PP/examples/README +++ b/PP/examples/README @@ -1,67 +1,6 @@ -These are instructions on how to run the examples for some PostProc -programs included in the Quantum ESPRESSO distribution. -These examples try to exercise all the programs and features -of the PP package. -If you find that any relevant feature isn't being tested, -please contact us (or even better, write and send us a new example). -To run the examples, you should follow this procedure: - -1) Edit the "environment_variables" file from the main - ESPRESSO directory, setting the following variables as needed: - - BIN_DIR = directory where ESPRESSO executables reside - PSEUDO_DIR = directory where pseudopotential files reside - TMP_DIR = directory to be used as temporary storage area - - If you have downloaded the full ESPRESSO distribution, you may set - BIN_DIR=$TOPDIR/bin and PSEUDO_DIR=$TOPDIR/pseudo, where $TOPDIR is - the root of the ESPRESSO source tree. - - TMP_DIR must be a directory you have read and write access to, with - enough available space to host the temporary files produced by the - example runs, and possibly offering high I/O performance (i.e., - don't use an NFS-mounted directory). - -2) If you want to test the parallel version of ESPRESSO, you will - usually have to specify a driver program (such as "poe" or "mpirun") - and the number of processors. This can be done by editing PARA_PREFIX - and PARA_POSTFIX variables (in the "environment_variables" file). - Parallel executables will be run by a command like this: - - $PARA_PREFIX pp.x $PARA_POSTFIX < file.in > file.out - - For example, if the command line is like this (as for an IBM SP): - - poe pp.x -procs 4 < file.in > file.out - - you should set PARA_PREFIX="poe", PARA_POSTFIX="-procs 4". - - See section "Running on parallel machines" of the user guide for details. - Furthermore, if your machine does not support interactive use, you - must run the commands specified below through the batch queueing - system installed on that machine. Ask your system administrator - for instructions. - -3) To run a single example, go to the corresponding directory (for - instance, "example/example01") and execute: - - ./run_example - - This will create a subdirectory "results", containing the input and - output files generated by the calculation. - - Some examples take only a few seconds to run, while others may - require several minutes depending on your system. - -4) In each example's directory, the "reference" subdirectory contains - verified output files, that you can check your results against. - - The reference results were generated on a Linux PC with Intel compiler. - On different architectures the precise numbers could be slightly - different, in particular if different FFT dimensions are - automatically selected. For this reason, a plain "diff" of your - results against the reference data doesn't work, or at least, it - requires human inspection of the results. +These examples cover most programs and features of the PostProc package. +See comments in file "environment_variables" in the top QE directory +for instructions on how to run these examples. ----------------------------------------------------------------------- diff --git a/PW/CMakeLists.txt b/PW/CMakeLists.txt index 4ef2153be..80f024f55 100644 --- a/PW/CMakeLists.txt +++ b/PW/CMakeLists.txt @@ -1,4 +1,4 @@ -set(sources +set(src_pw src/a2fmod.f90 src/add_bfield.f90 src/add_efield.f90 @@ -254,98 +254,119 @@ set(sources src/wannier_check.f90 src/wannier_clean.f90 src/wannier_occ.f90) - -qe_add_library(qe_pw ${sources}) -add_library(QE::PW ALIAS qe_pw) +qe_enable_cuda_fortran("${src_pw}") + +qe_add_library(qe_pw ${src_pw}) target_link_libraries(qe_pw PRIVATE - QE::HDF5_Fortran - QE::ELPA - QE::SCALAPACK - QE::LAX - QE::XClib - QE::UTILX # TODO direct or transitive via QE::LAX? - QE::KS_Solvers::Davidson - QE::KS_Solvers::CG - QE::KS_Solvers::PPCG - QE::KS_Solvers::ParO - QE::UPF # TODO turn to vendorized library from MaX gitrepo ? - QE::Modules - QE::FFTX - QE::DFTD3 - QE::OpenMP_Fortran - QE::MPI_Fortran) + qe_hdf5_fortran + qe_elpa + qe_scalapack + qe_lax + qe_kssolver_davidson + qe_kssolver_cg + qe_kssolver_ppcg + qe_kssolver_paro + qe_upflib # TODO turn to vendorized library from MaX gitrepo ? + qe_modules + qe_fftx + qe_dftd3 + qe_openmp_fortran + qe_mpi_fortran + qe_xclib) +if(QE_ENABLE_CUDA) + target_link_libraries(qe_pw + PRIVATE + qe_devxlib + CUDA::cublas) +endif() ########################################################### # pw.x ########################################################### -set(sources src/pwscf.f90) -qe_add_executable(qe_pw_exe ${sources}) -set_target_properties(qe_pw_exe PROPERTIES OUTPUT_NAME pw.x) +set(src_pw_x src/pwscf.f90) +qe_enable_cuda_fortran("${src_pw_x}") +qe_add_executable(qe_pw_exe ${src_pw_x}) +set_target_properties(qe_pw_exe + PROPERTIES + OUTPUT_NAME pw.x) target_link_libraries(qe_pw_exe PRIVATE - QE::PW - QE::Modules - QE::LAX - QE::UTILX) + qe_pw + qe_modules + qe_lax + qe_lapack + qe_upflib) ########################################################### # ibrav2cell.x ########################################################### -set(sources tools/ibrav2cell.f90) -qe_add_executable(qe_pw_tools_ibrav2cell_exe ${sources}) -set_target_properties(qe_pw_tools_ibrav2cell_exe PROPERTIES OUTPUT_NAME ibrav2cell.x) +set(src_ibrav2cell_X tools/ibrav2cell.f90) +qe_add_executable(qe_pw_tools_ibrav2cell_exe ${src_ibrav2cell_X}) +set_target_properties(qe_pw_tools_ibrav2cell_exe + PROPERTIES + OUTPUT_NAME ibrav2cell.x) target_link_libraries(qe_pw_tools_ibrav2cell_exe PRIVATE - QE::PW - QE::Modules) + qe_pw + qe_modules + qe_lapack) ########################################################### # cell2ibrav.x ########################################################### -set(sources tools/cell2ibrav.f90) -qe_add_executable(qe_pw_tools_cell2ibrav_exe ${sources}) -set_target_properties(qe_pw_tools_cell2ibrav_exe PROPERTIES OUTPUT_NAME cell2ibrav.x) +set(src_cell2ibrav_x tools/cell2ibrav.f90) +qe_add_executable(qe_pw_tools_cell2ibrav_exe ${src_cell2ibrav_x}) +set_target_properties(qe_pw_tools_cell2ibrav_exe + PROPERTIES + OUTPUT_NAME cell2ibrav.x) target_link_libraries(qe_pw_tools_cell2ibrav_exe PRIVATE - QE::PW - QE::Modules) + qe_pw + qe_modules + qe_lapack) ########################################################### # ev.x ########################################################### -set(sources tools/ev.f90) -qe_add_executable(qe_pw_tools_ev_exe ${sources}) -set_target_properties(qe_pw_tools_ev_exe PROPERTIES OUTPUT_NAME ev.x) +set(src_ev_x tools/ev.f90) +qe_add_executable(qe_pw_tools_ev_exe ${src_ev_x}) +set_target_properties(qe_pw_tools_ev_exe + PROPERTIES + OUTPUT_NAME ev.x) target_link_libraries(qe_pw_tools_ev_exe PRIVATE - QE::PW - QE::Modules - QE::UTILX) + qe_pw + qe_modules + qe_lapack) ########################################################### # kpoints.x ########################################################### -set(sources tools/kpoints.f90) -qe_add_executable(qe_pw_tools_kpoints_exe ${sources}) -set_target_properties(qe_pw_tools_kpoints_exe PROPERTIES OUTPUT_NAME kpoints.x) +set(src_kpoints_x tools/kpoints.f90) +qe_add_executable(qe_pw_tools_kpoints_exe ${src_kpoints_x}) +set_target_properties(qe_pw_tools_kpoints_exe + PROPERTIES + OUTPUT_NAME kpoints.x) target_link_libraries(qe_pw_tools_kpoints_exe PRIVATE - QE::PW - QE::Modules - QE::UTILX) + qe_pw + qe_modules + qe_lapack) ########################################################### # pwi2xsf.x ########################################################### -set(sources tools/pwi2xsf.f90) -qe_add_executable(qe_pw_tools_pwi2xsf_exe ${sources}) -set_target_properties(qe_pw_tools_pwi2xsf_exe PROPERTIES OUTPUT_NAME pwi2xsf.x) +set(src_pwi2xsf_x tools/pwi2xsf.f90) +qe_add_executable(qe_pw_tools_pwi2xsf_exe ${src_pwi2xsf_x}) +set_target_properties(qe_pw_tools_pwi2xsf_exe + PROPERTIES + OUTPUT_NAME pwi2xsf.x) target_link_libraries(qe_pw_tools_pwi2xsf_exe PRIVATE - QE::PW - QE::UTILX - QE::Modules) + qe_pw + qe_modules + qe_lapack) ########################################################### diff --git a/PW/examples/README b/PW/examples/README index 8c934e0b6..578d8c940 100644 --- a/PW/examples/README +++ b/PW/examples/README @@ -1,67 +1,6 @@ -These are instructions on how to run the examples for PW package. -These examples try to exercise all the programs and features -of the PW package. -If you find that any relevant feature isn't being tested, -please contact us (or even better, write and send us a new example). - -To run the examples, you should follow this procedure: - -1) Edit the "environment_variables" file from the main - ESPRESSO directory, setting the following variables as needed: - - BIN_DIR = directory where ESPRESSO executables reside - PSEUDO_DIR = directory where pseudopotential files reside - TMP_DIR = directory to be used as temporary storage area - - If you have downloaded the full ESPRESSO distribution, you may set - BIN_DIR=$TOPDIR/bin and PSEUDO_DIR=$TOPDIR/pseudo, where $TOPDIR is - the root of the ESPRESSO source tree. - - TMP_DIR must be a directory you have read and write access to, with - enough available space to host the temporary files produced by the - example runs, and possibly offering high I/O performance (i.e., - don't use an NFS-mounted directory). - -2) If you want to test the parallel version of ESPRESSO, you will - usually have to specify a driver program (such as "poe" or "mpirun") - and the number of processors. This can be done by editing PARA_PREFIX - and PARA_POSTFIX variables (in the "environment_variables" file). - Parallel executables will be run by a command like this: - - $PARA_PREFIX pw.x $PARA_POSTFIX < file.in > file.out - - For example, if the command line is like this (as for an IBM SP): - - poe pw.x -procs 4 < file.in > file.out - - you should set PARA_PREFIX="poe", PARA_POSTFIX="-procs 4". - - See section "Running on parallel machines" of the user guide for details. - Furthermore, if your machine does not support interactive use, you - must run the commands specified below through the batch queueing - system installed on that machine. Ask your system administrator - for instructions. - -3) To run a single example, go to the corresponding directory (for - instance, "example/example01") and execute: - - ./run_example - - This will create a subdirectory "results", containing the input and - output files generated by the calculation. - - Some examples take only a few seconds to run, while others may - require several minutes depending on your system. - -4) In each example's directory, the "reference" subdirectory contains - verified output files, that you can check your results against. - - The reference results were generated on a Linux PC with Intel compiler. - On different architectures the precise numbers could be slightly - different, in particular if different FFT dimensions are - automatically selected. For this reason, a plain "diff" of your - results against the reference data doesn't work, or at least, it - requires human inspection of the results. +These examples cover most programs and features of the PW package. +See comments in file "environment_variables" in the top QE directory +for instructions on how to run these examples. ----------------------------------------------------------------------- diff --git a/PW/src/2Dcutoff.txt b/PW/src/2Dcutoff.txt deleted file mode 100644 index b83c49871..000000000 --- a/PW/src/2Dcutoff.txt +++ /dev/null @@ -1 +0,0 @@ -This is a test, this file represents 2D cutoff modifications diff --git a/PWCOND/CMakeLists.txt b/PWCOND/CMakeLists.txt index 240638cf5..197104654 100644 --- a/PWCOND/CMakeLists.txt +++ b/PWCOND/CMakeLists.txt @@ -44,13 +44,13 @@ qe_add_executable(qe_pwcond_exe ${sources}) set_target_properties(qe_pwcond_exe PROPERTIES OUTPUT_NAME pwcond.x) target_link_libraries(qe_pwcond_exe PRIVATE - QE::LAPACK - QE::PW - QE::Modules - QE::UPF - QE::UTILX - QE::FFTX - QE::MPI_Fortran) + qe_lapack + qe_pw + qe_modules + qe_upflib + qe_fftx + qe_mpi_fortran + qe_xclib) ########################################################### diff --git a/PlotPhon/CMakeLists.txt b/PlotPhon/CMakeLists.txt index fa3b76f9f..e1aed6ac2 100644 --- a/PlotPhon/CMakeLists.txt +++ b/PlotPhon/CMakeLists.txt @@ -1,23 +1,29 @@ ########################################################### # k_for_bands.x ########################################################### -set(sources SRC/K_for_bands.f90) -qe_add_executable(qe_plotphon_kforbands_exe ${sources}) -set_target_properties(qe_plotphon_kforbands_exe PROPERTIES OUTPUT_NAME k_for_bands.x) +set(src_k_for_bands_x SRC/K_for_bands.f90) +qe_add_executable(qe_plotphon_kforbands_exe ${src_k_for_bands_x}) +set_target_properties(qe_plotphon_kforbands_exe + PROPERTIES + OUTPUT_NAME k_for_bands.x) ########################################################### # k_for_bands.x ########################################################### -set(sources SRC/Bands_to_gnuplot.f90) -qe_add_executable(qe_plotphon_bandstognuplot_exe ${sources}) -set_target_properties(qe_plotphon_bandstognuplot_exe PROPERTIES OUTPUT_NAME bands_to_gnuplot.x) +set(src_k_for_bands_x SRC/Bands_to_gnuplot.f90) +qe_add_executable(qe_plotphon_bandstognuplot_exe ${src_k_for_bands_x}) +set_target_properties(qe_plotphon_bandstognuplot_exe + PROPERTIES + OUTPUT_NAME bands_to_gnuplot.x) ########################################################### # E_min_max.x ########################################################### -set(sources SRC/E_min_max.f90) -qe_add_executable(qe_plotphon_eminmax_exe ${sources}) -set_target_properties(qe_plotphon_eminmax_exe PROPERTIES OUTPUT_NAME E_min_max.x) +set(src_E_min_max_x SRC/E_min_max.f90) +qe_add_executable(qe_plotphon_eminmax_exe ${src_E_min_max_x}) +set_target_properties(qe_plotphon_eminmax_exe + PROPERTIES + OUTPUT_NAME E_min_max.x) ########################################################### @@ -25,4 +31,4 @@ qe_install_targets( # Executables qe_plotphon_kforbands_exe qe_plotphon_bandstognuplot_exe - qe_plotphon_eminmax_exe) \ No newline at end of file + qe_plotphon_eminmax_exe) diff --git a/QHA/CMakeLists.txt b/QHA/CMakeLists.txt index 8baac0ae9..b803e2f0a 100644 --- a/QHA/CMakeLists.txt +++ b/QHA/CMakeLists.txt @@ -1,61 +1,75 @@ ########################################################### # atom_info.x ########################################################### -set(sources SRC/atom_info.f90) -qe_add_executable(qe_qha_atominfo_exe ${sources}) -set_target_properties(qe_qha_atominfo_exe PROPERTIES OUTPUT_NAME atom_info.x) +set(src_atom_info_x SRC/atom_info.f90) +qe_add_executable(qe_qha_atominfo_exe ${src_atom_info_x}) +set_target_properties(qe_qha_atominfo_exe + PROPERTIES + OUTPUT_NAME atom_info.x) ########################################################### # Atom_projected_properties.x ########################################################### -set(sources SRC/Atom_projected_properties.f90) -qe_add_executable(qe_qha_atomprojectedproperties_exe ${sources}) -set_target_properties(qe_qha_atomprojectedproperties_exe PROPERTIES OUTPUT_NAME Atom_projected_properties.x) +set(src_Atom_projected_properties_X SRC/Atom_projected_properties.f90) +qe_add_executable(qe_qha_atomprojectedproperties_exe ${src_Atom_projected_properties_X}) +set_target_properties(qe_qha_atomprojectedproperties_exe + PROPERTIES + OUTPUT_NAME Atom_projected_properties.x) ########################################################### # F_QHA.x ########################################################### -set(sources SRC/F_QHA.f90) -qe_add_executable(qe_qha_fqha_exe ${sources}) -set_target_properties(qe_qha_fqha_exe PROPERTIES OUTPUT_NAME F_QHA.x) +set(src_F_QHA_x SRC/F_QHA.f90) +qe_add_executable(qe_qha_fqha_exe ${src_F_QHA_x}) +set_target_properties(qe_qha_fqha_exe + PROPERTIES + OUTPUT_NAME F_QHA.x) ########################################################### # Ghost_DOS.x ########################################################### -set(sources SRC/Ghost_DOS.f90) -qe_add_executable(qe_qha_ghostdos_exe ${sources}) -set_target_properties(qe_qha_ghostdos_exe PROPERTIES OUTPUT_NAME Ghost_DOS.x) +set(src_Ghost_DOS_x SRC/Ghost_DOS.f90) +qe_add_executable(qe_qha_ghostdos_exe ${src_Ghost_DOS_x}) +set_target_properties(qe_qha_ghostdos_exe + PROPERTIES + OUTPUT_NAME Ghost_DOS.x) ########################################################### # Mean_square_displacement.x ########################################################### -set(sources SRC/Mean_square_displacement.f90) -qe_add_executable(qe_qha_meansquaredisplacement_exe ${sources}) -set_target_properties(qe_qha_meansquaredisplacement_exe PROPERTIES OUTPUT_NAME Mean_square_displacement.x) +set(src_Mean_square_displacement_x SRC/Mean_square_displacement.f90) +qe_add_executable(qe_qha_meansquaredisplacement_exe ${src_Mean_square_displacement_x}) +set_target_properties(qe_qha_meansquaredisplacement_exe + PROPERTIES + OUTPUT_NAME Mean_square_displacement.x) ########################################################### # Partial_phonon_DOS.x ########################################################### -set(sources SRC/Partial_phonon_DOS.f90) -qe_add_executable(qe_qha_partialphonondos_exe ${sources}) -set_target_properties(qe_qha_partialphonondos_exe PROPERTIES OUTPUT_NAME Partial_phonon_DOS.x) +set(src_Partial_phonon_DOS_x SRC/Partial_phonon_DOS.f90) +qe_add_executable(qe_qha_partialphonondos_exe ${src_Partial_phonon_DOS_x}) +set_target_properties(qe_qha_partialphonondos_exe + PROPERTIES + OUTPUT_NAME Partial_phonon_DOS.x) ########################################################### # Debye.x ########################################################### -set(sources +set(src_Debye_x Debye/cheval.f Debye/d1mach.f Debye/debye3.f Debye/Debye.f90 Debye/Debye_T.f) -qe_add_executable(qe_qha_debye_exe ${sources}) -set_target_properties(qe_qha_debye_exe PROPERTIES OUTPUT_NAME Debye.x) +qe_add_executable(qe_qha_debye_exe ${src_Debye_x}) +set_target_properties(qe_qha_debye_exe + PROPERTIES + OUTPUT_NAME Debye.x) ########################################################### # phonon_dos.x ########################################################### -set(sources +set(src_phonon_dos_x Phonon_DOS/phonon_dos.f Phonon_DOS/k_brillouin.f Phonon_DOS/generate_tetra.f @@ -63,20 +77,24 @@ set(sources Phonon_DOS/det4.f Phonon_DOS/Tetrahedra.f Phonon_DOS/Integration.f) -qe_add_executable(qe_qha_phonondos_exe ${sources}) -set_target_properties(qe_qha_phonondos_exe PROPERTIES OUTPUT_NAME phonon_dos.x) +qe_add_executable(qe_qha_phonondos_exe ${src_phonon_dos_x}) +set_target_properties(qe_qha_phonondos_exe + PROPERTIES + OUTPUT_NAME phonon_dos.x) ########################################################### # tetra.x ########################################################### -set(sources +set(src_tetra_x Phonon_DOS/tetra.f Phonon_DOS/k_brillouin.f Phonon_DOS/generate_tetra.f Phonon_DOS/det3.f Phonon_DOS/det4.f) -qe_add_executable(qe_qha_tetra_exe ${sources}) -set_target_properties(qe_qha_tetra_exe PROPERTIES OUTPUT_NAME tetra.x) +qe_add_executable(qe_qha_tetra_exe ${src_tetra_x}) +set_target_properties(qe_qha_tetra_exe + PROPERTIES + OUTPUT_NAME tetra.x) ########################################################### @@ -89,4 +107,4 @@ qe_install_targets( qe_qha_partialphonondos_exe qe_qha_debye_exe qe_qha_phonondos_exe - qe_qha_tetra_exe) \ No newline at end of file + qe_qha_tetra_exe) diff --git a/TDDFPT/CMakeLists.txt b/TDDFPT/CMakeLists.txt index 703544e29..1aaef5de0 100644 --- a/TDDFPT/CMakeLists.txt +++ b/TDDFPT/CMakeLists.txt @@ -1,4 +1,4 @@ -set(sources +set(src_tddfpt src/lr_variables.f90 src/lr_charg_resp.f90 src/bcast_lr_input.f90 @@ -52,77 +52,83 @@ set(sources src/orthogonalize_omega.f90 src/mix_pot.f90) -qe_add_library(qe_tddfpt ${sources}) -add_library(QE::TDDFPT ALIAS qe_tddfpt) +qe_add_library(qe_tddfpt ${src_tddfpt}) target_link_libraries(qe_tddfpt PRIVATE - QE::LR_Modules - QE::PW - QE::XClib - QE::Modules - QE::UTILX - QE::UPF - QE::FFTX) + qe_lr_modules + qe_pw + qe_modules + qe_upflib + qe_fftx + qe_xclib) ########################################################### # turbo_lanczos.x ########################################################### -set(sources src/lr_main.f90) -qe_add_executable(qe_tddfpt_turbolanczos_exe ${sources}) -set_target_properties(qe_tddfpt_turbolanczos_exe PROPERTIES OUTPUT_NAME turbo_lanczos.x) +set(src_turbo_lanczos_x src/lr_main.f90) +qe_add_executable(qe_tddfpt_turbolanczos_exe ${src_turbo_lanczos_x}) +set_target_properties(qe_tddfpt_turbolanczos_exe + PROPERTIES + OUTPUT_NAME turbo_lanczos.x) target_link_libraries(qe_tddfpt_turbolanczos_exe PRIVATE - QE::PW - QE::XClib - QE::Modules - QE::TDDFPT - QE::UPF - QE::UTILX) + qe_pw + qe_modules + qe_tddfpt + qe_upflib + qe_fftx + qe_xclib) ########################################################### # turbo_davidson.x ########################################################### -set(sources src/lr_dav_main.f90) -qe_add_executable(qe_tddfpt_turbodavidson_exe ${sources}) -set_target_properties(qe_tddfpt_turbodavidson_exe PROPERTIES OUTPUT_NAME turbo_davidson.x) +set(src_turbo_davidson_x src/lr_dav_main.f90) +qe_add_executable(qe_tddfpt_turbodavidson_exe ${src_turbo_davidson_x}) +set_target_properties(qe_tddfpt_turbodavidson_exe + PROPERTIES + OUTPUT_NAME turbo_davidson.x) target_link_libraries(qe_tddfpt_turbodavidson_exe PRIVATE - QE::PW - QE::XClib - QE::Modules - QE::TDDFPT - QE::UPF - QE::UTILX) + qe_pw + qe_modules + qe_tddfpt + qe_upflib + qe_fftx + qe_xclib) ########################################################### # turbo_eels.x ########################################################### -set(sources src/lr_eels_main.f90) -qe_add_executable(qe_tddfpt_turboeels_exe ${sources}) -set_target_properties(qe_tddfpt_turboeels_exe PROPERTIES OUTPUT_NAME turbo_eels.x) +set(src_turbo_eels_x src/lr_eels_main.f90) +qe_enable_cuda_fortran("${src_turbo_eels_x}") +qe_add_executable(qe_tddfpt_turboeels_exe ${src_turbo_eels_x}) +set_target_properties(qe_tddfpt_turboeels_exe + PROPERTIES + OUTPUT_NAME turbo_eels.x) target_link_libraries(qe_tddfpt_turboeels_exe PRIVATE - QE::PW - QE::LAX - QE::Modules - QE::XClib - QE::TDDFPT - QE::LR_Modules - QE::UPF - QE::UTILX) + qe_pw + qe_lax + qe_modules + qe_tddfpt + qe_lr_modules + qe_upflib + qe_fftx + qe_xclib) ########################################################### # tddfpt_calculate_spectrum.x ########################################################### -set(sources tools/tddfpt_calculate_spectrum.f90) -qe_add_executable(qe_tddfpt_calculatespectrum_exe ${sources}) -set_target_properties(qe_tddfpt_calculatespectrum_exe PROPERTIES OUTPUT_NAME tddfpt_calculate_spectrum.x) +set(src_tddfpt_calculate_spectrum_x tools/tddfpt_calculate_spectrum.f90) +qe_add_executable(qe_tddfpt_calculatespectrum_exe ${src_tddfpt_calculate_spectrum_x}) +set_target_properties(qe_tddfpt_calculatespectrum_exe + PROPERTIES + OUTPUT_NAME tddfpt_calculate_spectrum.x) target_link_libraries(qe_tddfpt_calculatespectrum_exe PRIVATE - QE::LAPACK - QE::UTILX - QE::XClib - QE::Modules) + qe_lapack + qe_modules + qe_xclib) ########################################################### diff --git a/TDDFPT/examples/README b/TDDFPT/examples/README index ea96b573e..c5bbc6ccf 100644 --- a/TDDFPT/examples/README +++ b/TDDFPT/examples/README @@ -1,51 +1,8 @@ -These are instructions on how to run the examples for the TDDFPT package. -To run the examples, you should follow this procedure: - -1) Edit the "environment_variables" file from the main - ESPRESSO directory, setting the following variables as needed: - - BIN_DIR = directory where ESPRESSO executables reside - PSEUDO_DIR = directory where pseudopotential files reside - TMP_DIR = directory to be used as temporary storage area - -2) If you want to test the parallel version of ESPRESSO, you will - usually have to specify a driver program (such as "poe" or "mpirun") - and the number of processors. This can be done by editing PARA_PREFIX - and PARA_POSTFIX variables (in the "environment_variables" file). - Parallel executables will be run by a command like this: - - $PARA_PREFIX turbo_lanczos.x $PARA_POSTFIX < file.in > file.out - - For example, if the command line is like this: - - mpirun -np 8 turbo_lanczos.x < file.in > file.out - - you should set PARA_PREFIX="mpirun -np 8", PARA_POSTFIX=" ". - - See section "Running on parallel machines" of the user guide for details. - Furthermore, if your machine does not support interactive use, you - must run the commands specified below through the batch queueing - system installed on that machine. Ask your system administrator - for instructions. - -3) To run a single example, go to the corresponding directory (for - instance, "example/example01") and execute: - - ./run_example - - This will create a subdirectory "results", containing the input and - output files generated by the calculation. - -4) In each example's directory, the "reference" subdirectory contains - verified output files, that you can check your results against. - - The reference results were generated on a Linux PC with Intel compiler. - On different architectures the precise numbers could be slightly - different, in particular if different FFT dimensions are - automatically selected. For this reason, a plain "diff" of your - results against the reference data doesn't work, or at least, it - requires human inspection of the results. +These examples cover most programs and features of the TDDFPT package. +See comments in file "environment_variables" in the top QE directory +for instructions on how to run these examples. +----------------------------------------------------------------------- LIST AND CONTENT OF THE EXAMPLES diff --git a/TDDFPT/src/lr_alloc_init.f90 b/TDDFPT/src/lr_alloc_init.f90 index 28729172a..5491e99ab 100644 --- a/TDDFPT/src/lr_alloc_init.f90 +++ b/TDDFPT/src/lr_alloc_init.f90 @@ -236,7 +236,6 @@ CONTAINS IF (nkb > 0) THEN ! IF (.not. allocated(becp%r)) CALL allocate_bec_type(nkb,nbnd,becp) - becp%r(:,:) = 0.0d0 ! ALLOCATE(becp_1(nkb,nbnd)) becp_1(:,:) = 0.0d0 @@ -257,7 +256,6 @@ CONTAINS IF (nkb > 0) THEN ! IF(.not. allocated(becp%k)) CALL allocate_bec_type(nkb,nbnd,becp) - becp%k(:,:) = (0.0d0,0.0d0) ! IF (.NOT.eels) THEN ALLOCATE(becp1_c(nkb,nbnd,nks)) diff --git a/UtilXlib/CMakeLists.txt b/UtilXlib/CMakeLists.txt index a33cf23d7..54aeaa58d 100644 --- a/UtilXlib/CMakeLists.txt +++ b/UtilXlib/CMakeLists.txt @@ -1,4 +1,4 @@ -set(sources_util +set(src_util clocks_handler.f90 cuda_util.f90 divide.f90 @@ -16,82 +16,87 @@ set(sources_util thread_util.f90 export_gstart_2_solvers.f90 set_mpi_comm_4_solvers.f90) +qe_enable_cuda_fortran("${src_util}") -set(sources_util_tests - tests/tester.f90 - tests/utils.f90 - tests/mp_world.f90) - -qe_add_library(qe_utilx ${sources_util}) -add_library(QE::UTILX ALIAS qe_utilx) +qe_add_library(qe_utilx ${src_util}) target_link_libraries(qe_utilx PRIVATE - QE::OpenMP_Fortran - QE::CLIB - QE::MPI_Fortran) + qe_openmp_fortran + qe_clib + qe_mpi_fortran) qe_install_targets(qe_utilx) -qe_add_library(qe_utilx_tests ${sources_util_tests}) -add_library(QE::UTILX::TESTS ALIAS qe_utilx_tests) -target_link_libraries(qe_utilx_tests - PRIVATE - QE::UTILX - QE::MPI_Fortran) - -qe_install_targets(qe_utilx_tests) - ########################################################### # tests ########################################################### -set(source_names - test_mp_count_nodes - test_mp_bcast_i1 - test_mp_bcast_i1_gpu - test_mp_bcast_iv - test_mp_bcast_iv_gpu - test_mp_bcast_im - test_mp_bcast_im_gpu - test_mp_bcast_it - test_mp_bcast_it_gpu - test_mp_bcast_i4d_gpu - test_mp_bcast_r4d_gpu - test_mp_bcast_c4d_gpu - test_mp_bcast_c5d_gpu - test_mp_bcast_r5d_gpu - test_mp_bcast_c6d_gpu - test_mp_bcast_iv_buffer - test_mp_bcast_iv_buffer_gpu - test_mp_bcast_lv_buffer - test_mp_bcast_lv_buffer_gpu - test_mp_bcast_rv_buffer - test_mp_bcast_rv_buffer_gpu - test_mp_max_iv_buffer_gpu - test_mp_max_iv_buffer - test_mp_max_rv_buffer - test_mp_max_rv_buffer_gpu - test_mp_min_iv_buffer_gpu - test_mp_min_iv_buffer - test_mp_min_rv_buffer - test_mp_min_rv_buffer_gpu - test_mp_sum_iv_buffer - test_mp_sum_rv_buffer - test_mp_sum_iv_buffer_gpu - test_mp_sum_rv_buffer_gpu) - -# TODO rename all sources *.f90 -> *.F90 -FOREACH(NAME ${source_names}) - set(sources tests/${NAME}.f90) - string(REPLACE "test_" "test_qe_utilx_" TGT_NAME ${NAME}) - qe_add_executable(${TGT_NAME} ${sources}) - set_target_properties(${TGT_NAME} PROPERTIES - OUTPUT_NAME ${TGT_NAME}.x RUNTIME_OUTPUT_DIRECTORY ${QE_TESTS_DIR}) - target_link_libraries(${TGT_NAME} - PRIVATE - QE::UTILX - QE::UTILX::TESTS - QE::MPI_Fortran - QE::Modules) +if(QE_ENABLE_TEST) + set(src_util_tests + tests/tester.f90 + tests/utils.f90 + tests/mp_world.f90) + qe_enable_cuda_fortran("${src_util_tests}") - add_test(NAME ${TGT_NAME} COMMAND ${QE_TESTS_DIR}/${TGT_NAME}.x) -ENDFOREACH(NAME) + qe_add_library(qe_utilx_tests ${src_util_tests}) + target_link_libraries(qe_utilx_tests + PRIVATE + qe_utilx + qe_mpi_fortran) + + qe_install_targets(qe_utilx_tests) + + set(source_names + test_mp_count_nodes + test_mp_bcast_i1 + test_mp_bcast_i1_gpu + test_mp_bcast_iv + test_mp_bcast_iv_gpu + test_mp_bcast_im + test_mp_bcast_im_gpu + test_mp_bcast_it + test_mp_bcast_it_gpu + test_mp_bcast_i4d_gpu + test_mp_bcast_r4d_gpu + test_mp_bcast_c4d_gpu + test_mp_bcast_c5d_gpu + test_mp_bcast_r5d_gpu + test_mp_bcast_c6d_gpu + test_mp_bcast_iv_buffer + test_mp_bcast_iv_buffer_gpu + test_mp_bcast_lv_buffer + test_mp_bcast_lv_buffer_gpu + test_mp_bcast_rv_buffer + test_mp_bcast_rv_buffer_gpu + test_mp_max_iv_buffer_gpu + test_mp_max_iv_buffer + test_mp_max_rv_buffer + test_mp_max_rv_buffer_gpu + test_mp_min_iv_buffer_gpu + test_mp_min_iv_buffer + test_mp_min_rv_buffer + test_mp_min_rv_buffer_gpu + test_mp_sum_iv_buffer + test_mp_sum_rv_buffer + test_mp_sum_iv_buffer_gpu + test_mp_sum_rv_buffer_gpu) + + # TODO rename all sources *.f90 -> *.F90 + set(src_tests) + FOREACH(NAME ${source_names}) + set(src_test tests/${NAME}.f90) + set(src_tests ${src_tests} "${src_test}") + string(REPLACE "test_" "test_qe_utilx_" TGT_NAME ${NAME}) + qe_add_executable(${TGT_NAME} ${src_test}) + set_target_properties(${TGT_NAME} + PROPERTIES + OUTPUT_NAME ${TGT_NAME}.x + RUNTIME_OUTPUT_DIRECTORY ${QE_TESTS_DIR}) + target_link_libraries(${TGT_NAME} + PRIVATE + qe_utilx + qe_utilx_tests + qe_mpi_fortran + qe_modules) + add_test(NAME ${TGT_NAME} COMMAND ${QE_TESTS_DIR}/${TGT_NAME}.x) + ENDFOREACH(NAME) +endif() diff --git a/UtilXlib/mp_base_gpu.f90 b/UtilXlib/mp_base_gpu.f90 index c4060ff77..7a8f5a422 100644 --- a/UtilXlib/mp_base_gpu.f90 +++ b/UtilXlib/mp_base_gpu.f90 @@ -1159,7 +1159,7 @@ SUBROUTINE parallel_max_real_gpu( dim, ps_d, comm, root ) RETURN ! END SUBROUTINE parallel_max_real_gpu -#else -MODULE isntused -END module +!#else +!MODULE isntused +!END module #endif diff --git a/XClib/CMakeLists.txt b/XClib/CMakeLists.txt index 65f255f3a..d268542c6 100644 --- a/XClib/CMakeLists.txt +++ b/XClib/CMakeLists.txt @@ -1,6 +1,4 @@ -set(sources - beefun.c - pbecor.c +set(sources_xclib dft_mod.f90 qe_constants.f90 qe_drivers_d_gga.f90 @@ -25,25 +23,42 @@ set(sources xc_wrapper_lda_lsda.f90 xc_wrapper_mgga.f90) -qe_add_library(qe_xclib ${sources}) -add_library(QE::XClib ALIAS qe_xclib) +qe_add_library(qe_xclib ${sources_xclib}) target_link_libraries(qe_xclib PRIVATE - QE::OpenMP_Fortran - QE::MPI_Fortran) + qe_openmp_fortran + qe_mpi_fortran + qe_libbeef) qe_install_targets(qe_xclib) +########################################################### +# libbeef target +# Note: Moving it to a subdirectory XClib/libbeef is prefered. +# But the legacy Makefile is hard to handle. +########################################################### +set(sources_libbeef + pbecor.c + beefun.c +) +qe_add_library(qe_libbeef ${sources_libbeef}) +target_link_libraries(qe_libbeef PRIVATE qe_lapack) + +qe_install_targets(qe_libbeef) + ########################################################### # xclib_test.x ########################################################### -#if(QE_ENABLE_TEST) -# qe_add_executable(qe_xclib_test xclib_test.f90) -# set_target_properties(qe_xclib_test PROPERTIES OUTPUT_NAME qe_xclib_test.x RUNTIME_OUTPUT_DIRECTORY ${QE_TESTS_DIR}) -# target_link_libraries(qe_xclib_test -# PRIVATE -# QE::OpenMP_Fortran -# QE::MPI_Fortran -# QE::XClib) -# add_test(NAME test_qe_xclib COMMAND ${QE_TESTS_DIR}/qe_xclib_test.x) -#endif(QE_ENABLE_TEST) +if(QE_ENABLE_TEST) + qe_add_executable(qe_xclib_test xclib_test.f90) + set_target_properties(qe_xclib_test + PROPERTIES + OUTPUT_NAME qe_xclib_test.x + RUNTIME_OUTPUT_DIRECTORY ${QE_TESTS_DIR}) + target_link_libraries(qe_xclib_test + PRIVATE + qe_openmp_fortran + qe_mpi_fortran + qe_xclib) + add_test(NAME test_qe_xclib COMMAND ${QE_TESTS_DIR}/qe_xclib_test.x) +endif(QE_ENABLE_TEST) diff --git a/XClib/Makefile b/XClib/Makefile index d769f68f0..9ad6a7b46 100644 --- a/XClib/Makefile +++ b/XClib/Makefile @@ -31,7 +31,7 @@ BEEF = \ pbecor.o \ beefun.o -all: xc_lib.a xclib_test.x +all: xc_lib.a xc_lib.a: $(XCL) $(BEEF) $(AR) $(ARFLAGS) $@ $? @@ -42,6 +42,8 @@ xclib_test.x : xclib_test.o xc_lib.a xclib_test.o xc_lib.a $(BLAS_LIBS) $(LD_LIBS) $(LIBXC_LIBS) - ( cd ../bin ; ln -fs ../XClib/$@ . ) +test : xclib_test.x + clean : - /bin/rm -f *.o *.a *.d *.i *~ *_tmp.f90 *.mod *.L *.x diff --git a/XClib/README.TEST b/XClib/README.TEST new file mode 100644 index 000000000..9103a0d5a --- /dev/null +++ b/XClib/README.TEST @@ -0,0 +1,62 @@ +xclib_test.x is a testing program for the XClib library. + +To compile the test program, once you have properly configured QE, +inside the directory XClib type: + + make test + +Then you can run tests using commands like: + + ./xclib_test.x < input_file > output_file + +Four options available: + +* dft-info: infos on the input dft are provided. If the functionals + functionals are from libxc the external parameters, when + present, are listed with a brief description and their + default value. + Example of input_file content: + + &INPUT_NAMELIST + test='dft-info' + dft1='mgga_x_scan mgga_c_scan' + / + +* gen-benchmark: the program generates a set of data to compare the + XC output to. + Example of input file content: + + &INPUT_NAMELIST + test='gen-benchmark' + family='GGA' + dft1='PBE' + nspin=2 + DF_OK=.FALSE. + / + +* exe-benchmark: the program takes as input the data file generated + previously with the 'gen-benchmark' option and + compares the output of the XC routines. + +* dft-comparison: the program compares two different DFTs on a large + grid of points. Max, min and average percentage + difference between the two dft outputs (energy and + potential) are provided and the points of the grid + where the two output differ are shown. This option + can be used, for example, to find differences between + internal QE functionals and the libxc ones. + Example of input file content: + + &INPUT_NAMELIST + test='dft-comparison', + nspin=2, + family='LDA', + DF_OK=.FALSE., + dft1='sla pz', + dft2='lda_x lda_c_pz' + / + +The testing program is available for LDA, GGA and MGGA functionals. It +also tests the potential derivatives for LDA (dmxc) and GGA (dgcxc) when +the DF_OK variable is set to TRUE. + diff --git a/XClib/pbecor.c b/XClib/pbecor.c index a1a3ff9e0..b408a4189 100755 --- a/XClib/pbecor.c +++ b/XClib/pbecor.c @@ -29,7 +29,7 @@ /* ---------------------------------------------------------------------- */ /* ###################################################################### */ /* ---------------------------------------------------------------------- */ -/* Subroutine */ void gcor2(double a, double a1, double b1, +/* Subroutine */ static void gcor2(double a, double a1, double b1, double b2, double b3, double b4, double rtrs, double *gg, double *ggrs) { diff --git a/XClib/xclib_test.f90 b/XClib/xclib_test.f90 index 72ee3d7ce..55b2edf89 100644 --- a/XClib/xclib_test.f90 +++ b/XClib/xclib_test.f90 @@ -9,13 +9,13 @@ !============================================================================ PROGRAM xclib_test !========================================================================== - !! Testing program for xc_lib library in QE. Different options: + !! Testing program for xc\_lib library in QE. Different options: ! !! * dft-info: provides infos on the input DFT (both QE and Libxc); !! * xc-benchmark: difference with respect to a given set of benchmark data !! (on file); - !! * gen-benchmark: generate set of benchmark data on file; - !! * dft-comparison: show difference between two DFTs (E and V differences). + !! * gen-benchmark: generates set of benchmark data on file; + !! * dft-comparison: shows difference between two DFTs (E and V differences). ! !! Available cases: ! @@ -312,6 +312,10 @@ PROGRAM xclib_test WRITE(stdout,*) CHAR(10)//"MGGA IDs" WRITE(stdout,121) imeta1, is_libxc(5), imetac1, is_libxc(6) ! + IF (ANY(.NOT.is_libxc(:))) THEN + WRITE(stdout,*) CHAR(10)//"References for QE functionals are temporarily& + & listed in Modules/funct.f90" + ENDIF ! #if defined(__LIBXC) ! @@ -356,7 +360,7 @@ PROGRAM xclib_test WRITE(lxc_family,'(a)') "unknown" END SELECT ! - WRITE(*,'("The functional ''", a, "'' is an ", a, ", it belongs to & + WRITE(*,'("The functional ''", a, "'' is a ", a, ", it belongs to & &the ''", a, "'' family and is defined in the reference(s): & &")') TRIM(xc_f03_func_info_get_name(xc_info(i))), TRIM(lxc_kind)& ,TRIM(lxc_family) diff --git a/XSpectra/CMakeLists.txt b/XSpectra/CMakeLists.txt index 4ad817f96..e30fff271 100644 --- a/XSpectra/CMakeLists.txt +++ b/XSpectra/CMakeLists.txt @@ -1,4 +1,5 @@ -set(sources_x +set(src_xspectra + src/xspectra.f90 src/gaunt_mod.f90 src/xspectra_mod.f90 src/radin_mod.f90 @@ -22,71 +23,75 @@ set(sources_x src/io_routines.f90 src/xanes_quadrupole.f90) -set(sources_gipaw +set(src_gipaw src/paw_gipaw.f90 src/gipaw_module.f90 src/init_gipaw_1.f90 src/init_gipaw_2.f90) -qe_add_library(qe_xspectra_gipaw ${sources_gipaw}) -add_library(QE::XSpectra::GIPAW ALIAS qe_xspectra_gipaw) +qe_add_library(qe_xspectra_gipaw ${src_gipaw}) target_link_libraries(qe_xspectra_gipaw PRIVATE - QE::PW - QE::UTILX - QE::Modules - QE::UPF) + qe_pw + qe_modules + qe_upflib + qe_fftx + qe_xclib) -qe_add_library(qe_xspectra ${sources_x}) -add_library(QE::XSpectra ALIAS qe_xspectra) +qe_add_library(qe_xspectra ${src_xspectra}) target_link_libraries(qe_xspectra PRIVATE - QE::PW - QE::UTILX - QE::XSpectra::GIPAW - QE::Modules - QE::UPF) + qe_pw + qe_xspectra_gipaw + qe_modules + qe_upflib + qe_fftx + qe_xclib) ########################################################### # xspectra.x ########################################################### set(sources src/xspectra.f90) qe_add_executable(qe_xspectra_exe ${sources}) -set_target_properties(qe_xspectra_exe PROPERTIES OUTPUT_NAME xspectra.x) +set_target_properties(qe_xspectra_exe + PROPERTIES + OUTPUT_NAME xspectra.x) target_link_libraries(qe_xspectra_exe PRIVATE - QE::PW - QE::Modules - QE::XSpectra - QE::XSpectra::GIPAW - QE::UPF - QE::UTILX) + qe_pw + qe_modules + qe_xspectra + qe_xspectra_gipaw + qe_upflib) ########################################################### # spectra_correction.x ########################################################### -set(sources - src/spectra_correction.f90 - src/gaunt_mod.f90) -qe_add_executable(qe_xspectra_spectracorrection_exe ${sources}) -set_target_properties(qe_xspectra_spectracorrection_exe PROPERTIES OUTPUT_NAME spectra_correction.x) +set(src_spectra_correction_x src/spectra_correction.f90) +qe_add_executable(qe_xspectra_spectracorrection_exe ${src_spectra_correction_x}) +set_target_properties(qe_xspectra_spectracorrection_exe + PROPERTIES + OUTPUT_NAME spectra_correction.x) target_link_libraries(qe_xspectra_spectracorrection_exe PRIVATE - QE::Modules - QE::XSpectra - QE::XSpectra::GIPAW - QE::UTILX) + qe_modules + qe_xspectra + qe_xspectra_gipaw + qe_pw + qe_upflib) ########################################################### # molecularnexafs.x ########################################################### -set(sources src/molecularnexafs.f90) -qe_add_executable(qe_xspectra_molecularnexafs_exe ${sources}) -set_target_properties(qe_xspectra_molecularnexafs_exe PROPERTIES OUTPUT_NAME molecularnexafs.x) +set(src_molecularnexafs_x src/molecularnexafs.f90) +qe_add_executable(qe_xspectra_molecularnexafs_exe ${src_molecularnexafs_x}) +set_target_properties(qe_xspectra_molecularnexafs_exe + PROPERTIES + OUTPUT_NAME molecularnexafs.x) target_link_libraries(qe_xspectra_molecularnexafs_exe PRIVATE - QE::XSpectra - QE::XSpectra::GIPAW) + qe_xspectra + qe_xspectra_gipaw) ########################################################### diff --git a/atomic/CMakeLists.txt b/atomic/CMakeLists.txt index 7ec244948..4bc43c153 100644 --- a/atomic/CMakeLists.txt +++ b/atomic/CMakeLists.txt @@ -98,13 +98,11 @@ set(sources src/parameters.f90) qe_add_library(qe_atomic ${sources}) -add_library(QE::ATOMIC ALIAS qe_atomic) target_link_libraries(qe_atomic PRIVATE - QE::UPF - QE::UTILX - QE::XClib - QE::Modules) + qe_upflib + qe_modules + qe_xclib) ########################################################### # ld1.x @@ -114,12 +112,11 @@ qe_add_executable(qe_atomic_exe ${sources}) set_target_properties(qe_atomic_exe PROPERTIES OUTPUT_NAME ld1.x) target_link_libraries(qe_atomic_exe PRIVATE - QE::UPF - QE::Modules - QE::XClib - QE::ATOMIC - QE::UTILX) - + qe_upflib + qe_modules + qe_atomic + qe_xclib) + ########################################################### qe_install_targets( diff --git a/clib/CMakeLists.txt b/clib/CMakeLists.txt index d07cc07bb..04298a7c0 100644 --- a/clib/CMakeLists.txt +++ b/clib/CMakeLists.txt @@ -15,7 +15,6 @@ set(sources qsort.c) qe_add_library(qe_clib ${sources}) -add_library(QE::CLIB ALIAS qe_clib) ########################################################### diff --git a/cmake/NVFortranCompiler.cmake b/cmake/NVFortranCompiler.cmake index a889c64b9..61646850e 100644 --- a/cmake/NVFortranCompiler.cmake +++ b/cmake/NVFortranCompiler.cmake @@ -2,3 +2,8 @@ qe_add_global_compile_definitions(__PGI) # set optimization specific flags set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mcache_align -Mlarge_arrays") + +if(QE_ENABLE_CUDA) + set(QE_CUDA_COMPILE_OPTIONS "-Mcuda") + set(QE_CUDA_LINK_OPTIONS "-Mcuda") +endif() \ No newline at end of file diff --git a/cmake/qeHelpers.cmake b/cmake/qeHelpers.cmake index a21a1263b..90a95f24d 100644 --- a/cmake/qeHelpers.cmake +++ b/cmake/qeHelpers.cmake @@ -47,8 +47,8 @@ function(qe_preprocess_source IN OUT) VERBATIM) endfunction(qe_preprocess_source) -function(qe_fix_fortran_modules LIB) - set(targets ${LIB} ${ARGN}) +function(qe_fix_fortran_modules TGT) + set(targets ${TGT} ${ARGN}) foreach(tgt IN LISTS targets) get_target_property(tgt_type ${tgt} TYPE) # All of the following target modifications make @@ -59,17 +59,38 @@ function(qe_fix_fortran_modules LIB) get_target_property(tgt_binary_dir ${tgt} BINARY_DIR) set_target_properties(${tgt} PROPERTIES - Fortran_MODULE_DIRECTORY ${tgt_binary_dir}/mod/${LIB}) - # make module directory available for clients of LIB + Fortran_MODULE_DIRECTORY ${tgt_binary_dir}/mod/${TGT}) + # make module directory available for clients of TGT target_include_directories(${tgt} PUBLIC - $ + $ INTERFACE - $) + $) endif() endforeach() endfunction(qe_fix_fortran_modules) +function(qe_enable_cuda_fortran SRCS) + if(QE_ENABLE_CUDA) + foreach(src IN LISTS SRCS) + set_source_files_properties(${src} + PROPERTIES + COMPILE_OPTIONS ${QE_CUDA_COMPILE_OPTIONS}) + endforeach() + endif() +endfunction(qe_enable_cuda_fortran) + +function(_qe_add_cuda_link_flags TGT) + if(CMAKE_Fortran_COMPILER_ID MATCHES "PGI") + get_target_property(target_type ${TGT} TYPE) + if(target_type STREQUAL "EXECUTABLE") + target_link_options(${TGT} + PRIVATE + ${QE_CUDA_COMPILE_OPTIONS}) + endif() + endif() +endfunction(_qe_add_cuda_link_flags) + function(qe_git_submodule_update PATH) find_package(Git) # Old versions of git aren't able to run init+update @@ -98,6 +119,9 @@ function(_qe_add_target TGT) qe_fix_fortran_modules(${TGT}) qe_get_fortran_cpp_flag(f_cpp_flag) target_compile_options(${TGT} PRIVATE $<$:${f_cpp_flag}>) + if(QE_ENABLE_CUDA) + _qe_add_cuda_link_flags(${TGT}) + endif() endfunction(_qe_add_target) function(qe_install_targets TGT) @@ -140,4 +164,4 @@ endfunction(qe_ensure_build_type) if(TARGET QEGlobalCompileDefinitions) qe_install_targets(QEGlobalCompileDefinitions) -endif() +endif() \ No newline at end of file diff --git a/dft-d3/CMakeLists.txt b/dft-d3/CMakeLists.txt index ddc5d22f4..67729e9ed 100644 --- a/dft-d3/CMakeLists.txt +++ b/dft-d3/CMakeLists.txt @@ -1,4 +1,4 @@ -set(sources +set(src_dftd3 common.f90 sizes.f90 pars.f90 @@ -6,24 +6,27 @@ set(sources api.f90 dftd3_qe.f90) -qe_add_library(qe_dftd3 ${sources}) -add_library(QE::DFTD3 ALIAS qe_dftd3) +qe_add_library(qe_dftd3 ${src_dftd3}) target_link_libraries(qe_dftd3 PRIVATE - QE::UTILX - QE::Modules) + qe_modules) ########################################################### # test.x ########################################################### -set(sources test_code.f90) -qe_add_executable(qe_atomic_test_exe ${sources}) -set_target_properties(qe_atomic_test_exe PROPERTIES OUTPUT_NAME qe_dftd3_test_atomic.x RUNTIME_OUTPUT_DIRECTORY ${QE_TESTS_DIR}) -target_link_libraries(qe_atomic_test_exe - PRIVATE - QE::Modules - QE::DFTD3) -# FIXME: Does it work? -#add_test(NAME test_qe_dftd3_atomic COMMAND ${QE_TESTS_DIR}/qe_dftd3_test_atomic.x) +if(QE_ENABLE_TEST) + set(src_dftd3_test test_code.f90) + qe_add_executable(qe_atomic_test_exe ${src_dftd3_test}) + set_target_properties(qe_atomic_test_exe + PROPERTIES + OUTPUT_NAME qe_dftd3_test_atomic.x + RUNTIME_OUTPUT_DIRECTORY ${QE_TESTS_DIR}) + target_link_libraries(qe_atomic_test_exe + PRIVATE + qe_modules + qe_dftd3) + # FIXME: Does it work? + #add_test(NAME test_qe_dftd3_atomic COMMAND ${QE_TESTS_DIR}/qe_dftd3_test_atomic.x) +endif() qe_install_targets(qe_dftd3) diff --git a/environment_variables b/environment_variables index 10b5600a6..0ee61b87c 100644 --- a/environment_variables +++ b/environment_variables @@ -1,32 +1,114 @@ -# environment_variables -- settings for running Quantum ESPRESSO examples -LC_ALL=C -export LC_ALL +# environment_variables -- settings for running Quantum ESPRESSO examples ######## YOU MAY NEED TO EDIT THIS FILE TO MATCH YOUR CONFIGURATION ######## -# BIN_DIR = path of compiled executables -# Usually this is $PREFIX/bin, where $PREFIX is the root of the -# Quantum ESPRESSO source tree. -# PSEUDO_DIR = path of pseudopotentials required by the examples -# if required pseudopotentials are not found in $PSEUDO_DIR, -# example scripts will try to download them from NETWORK_PSEUDO -# TMP_DIR = temporary directory to be used by the examples -# Make sure that it is writable by you and that it doesn't contain -# any valuable data (EVERYTHING THERE WILL BE DESTROYED) +# To run the examples, you should follow this procedure: -# The following should be good for most cases +# 1) Optionally, edit the following variables: + +# BIN_DIR = directory where ESPRESSO executables reside +# PSEUDO_DIR = directory where pseudopotential files reside +# if needed pseudopotentials are not found there, +# they will be downloaded from NETWORK_PSEUDO +# TMP_DIR = directory to be used as temporary storage area +# Make sure that it is writable by you, that it has +# enough available space to host the temporary files, +# preferably offering high I/O performance (i.e., +# don't use an NFS-mounted directory), and that +# it doesn't contain any valuable data: +# EVERYTHING THERE WILL BE DESTROYED + +# The default values set below should be good for most cases + +# 2) For parallel execution, edit the following variables: + +# PARA_PREFIX: prepended to the executable name, typically contains +# the launcher program and the number of processors +# PARA_PREFIX: appended to the executable name, typically contains +# parallelization options + +# Example: if you need to run the code as +# mpirun -np 4 pw.x -nk 1 < file.in > file.out +# then PARA_PREFIX="mpirun -np 4", PARA_POSTFIX="-nk 1" + +# For execution with OpenMP or mixed MPI/OpenMP, you may also need to set +# OMP_NUM_THREADS: number of threads for OpenMP parallelization. + +# For serial execution it should not be needed to specify anything. + +# See section "Running on parallel machines" of the user guide +# for more details + +# BEWARE: most tests and examples are devised to be run serially or on +# a small number of processors; do not use tests and examples to benchmark +# parallelism, do not run on too many processors + +# 3) To run a single example, go to the corresponding directory (for +# instance, "example/example01") and execute: + +# ./run_example + +# This will create a subdirectory "results", containing the input and +# output files generated by the calculation. +# If your machine does not support interactive use, you must execute +# "run_example" throught the batch queueing system running on that machine. +# Ask your system administrator for instructions. + +# Some examples take only a few seconds to run, while others may +# require several minutes depending on your system. + +# 4) In each example's directory, the "reference" subdirectory contains +# verified output files, that you can check your results against. + +# Your results might be slightly different from reference results, +# in particular if different FFT dimensions are automatically selected. +# For this reason, a plain "diff" of your results against the reference +# data may not work and human inspection of the results may be needed. PREFIX=`cd ../../.. ; pwd` +# $PREFIX is the root of the Quantum ESPRESSO source tree. BIN_DIR=$PREFIX/bin PSEUDO_DIR=$PREFIX/pseudo # Beware: everything in $TMP_DIR will be destroyed ! TMP_DIR=$PREFIX/tempdir +PARA_PREFIX=" " +# PARA_PREFIX="mpirun -np 4" + +# available flags: +# -ni n number of images (or -nimage) +# (only for NEB; for PHonon, see below) +# -nk n number of pools (or -npool, -npools) +# -nb n number of band groups (or -nbgrp,-nband_group) +# -nt n number of task groups (or -ntg, -ntask_groups) +# -nd n number of processors for linear algebra +# (or -ndiag, -northo) + +PARA_POSTFIX=" -nk 1 -nd 1 -nb 1 -nt 1 " + +# The following variables are used for image parallelization of PHonon +# (see example in PHonon/examples/Image_example) +# NB: the number of processors in PARA_IMAGE_PREFIX is the product of the +# number of processors in PARA_PREFIX and the number of images in +# PARA_IMAGE_POSTFIX + +PARA_IMAGE_POSTFIX="-ni 2 $PARA_POSTFIX" +PARA_IMAGE_PREFIX="mpirun -np 4" + +# In case of mixed MPI / OpenMP parallelization you may want to limit +# the maximum number to OpenMP threads so that the number of threads +# per MPI process times the number of MPI processes equals the number +# of available cores to avoid hyperthreading + +export OMP_NUM_THREADS=1 + # There should be no need to change anything below this line -NETWORK_PSEUDO=http://www.quantum-espresso.org/wp-content/uploads/upf_files/ +LC_ALL=C +export LC_ALL +NETWORK_PSEUDO=http://www.quantum-espresso.org/wp-content/uploads/upf_files/ # wget or curl needed if some PP has to be downloaded from web site # script wizard will surely find a better way to find what is available @@ -42,53 +124,6 @@ else # echo "curl found" fi -# To run the ESPRESSO programs on a parallel machine, you may have to -# add the appropriate commands (poe, mpirun, mpprun...) and/or options -# (specifying number of processors, pools...) before and after the -# executable's name. That depends on how your machine is configured. -# For example on an IBM SP4: -# -# poe pw.x -procs 4 < file.in > file.out -# ^^^ PARA_PREFIX ^^^^^^^^ PARA_POSTFIX -# -# To run on a single processor, you can usually leave them empty. -# BEWARE: most tests and examples are devised to be run serially or on -# a small number of processors; do not use tests and examples to benchmark -# parallelism, do not run on too many processors - - -PARA_PREFIX=" " -PARA_PREFIX="mpirun -np 4" -# -# available flags: -# -ni n number of images (or -nimage) -# (only for NEB; for PHonon, see below) -# -nk n number of pools (or -npool, -npools) -# -nb n number of band groups (or -nbgrp,-nband_group) -# -nt n number of task groups (or -ntg, -ntask_groups) -# -nd n number of processors for linear algebra -# (or -ndiag, -northo) -# -PARA_POSTFIX=" -nk 1 -nd 1 -nb 1 -nt 1 " -# -# The following variables are used for image parallelization of PHonon -# (see example in PHonon/examples/Image_example) -# NB: the number of processors in PARA_IMAGE_PREFIX is the product of the -# number of processors in PARA_PREFIX and the number of images in -# PARA_IMAGE_POSTFIX -# -PARA_IMAGE_POSTFIX="-ni 2 $PARA_POSTFIX" -PARA_IMAGE_PREFIX="mpirun -np 4" - -# -# In case of mixed MPI / OpenMP parallelization you may want to limit the maximum -# number to OpenMP threads so that the number of threads per MPI process times the -# number of MPI processes equals the number of available cores to avoid hyperthreading -# -# OpenMP parallelization max number of threads -# -export OMP_NUM_THREADS=1 - # function to test the exit status of a job check_failure () { # usage: check_failure $? diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 8d5d4c0f4..b50d8de9d 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -1,14 +1,14 @@ + ########################################################### -# QE::FOX +# FoX ########################################################### if(FOX_ROOT) add_library(qe_fox INTERFACE) - add_library(QE::FOX ALIAS qe_fox) qe_install_targets(qe_fox) target_link_libraries(qe_fox INTERFACE "-L${FOX_ROOT}/lib;-lFoX_dom;-lFoX_sax;-lFoX_wxml;-lFoX_common;-lFoX_utils;-lFoX_fsys") - target_include_directories(qe_fox INTERFACE ${FOX_ROOT}/finclude) + target_include_directories(qe_fox INTERFACE ${FOX_ROOT}/include) else() - message(STATUS "Installing QE::FOX via submodule") + message(STATUS "Installing FoX via submodule") set(fox_targets FoX_fsys FoX_utils @@ -20,20 +20,13 @@ else() qe_git_submodule_update(external/fox) add_subdirectory(fox EXCLUDE_FROM_ALL) add_library(qe_fox INTERFACE) - add_library(QE::FOX ALIAS qe_fox) target_link_libraries(qe_fox INTERFACE ${fox_targets}) qe_fix_fortran_modules(${fox_targets}) qe_install_targets(qe_fox ${fox_targets}) endif() ########################################################### -# QE::libbeef -########################################################### -add_subdirectory(libbeef) -target_link_libraries(qe_libbeef PRIVATE QE::LAPACK) - -########################################################### -# QE::WANNIER90 +# WANNIER90 ########################################################### # TODO look for an externally-provided wannier90 qe_git_submodule_update(external/wannier90) @@ -67,10 +60,9 @@ set(sources wannier90/src/ws_distance.F90) qe_add_library(qe_wannier90 ${sources}) -add_library(QE::WANNIER90 ALIAS qe_wannier90) target_link_libraries(qe_wannier90 PRIVATE - QE::LAPACK) + qe_lapack) ########################################################### # wannier_prog.x @@ -80,7 +72,7 @@ qe_add_executable(qe_wannierprog_exe ${sources}) set_target_properties(qe_wannierprog_exe PROPERTIES OUTPUT_NAME wannier_prog.x) target_link_libraries(qe_wannierprog_exe PRIVATE - QE::WANNIER90) + qe_wannier90) ########################################################### # w90chk2chk.x @@ -90,7 +82,7 @@ qe_add_executable(qe_w90chk2chk_exe ${sources}) set_target_properties(qe_w90chk2chk_exe PROPERTIES OUTPUT_NAME w90chk2chk.x) target_link_libraries(qe_w90chk2chk_exe PRIVATE - QE::WANNIER90) + qe_wannier90) ########################################################### # postw90.x @@ -100,7 +92,7 @@ qe_add_executable(qe_wannier90_postw90_exe ${sources}) set_target_properties(qe_wannier90_postw90_exe PROPERTIES OUTPUT_NAME postw90.x) target_link_libraries(qe_wannier90_postw90_exe PRIVATE - QE::WANNIER90) + qe_wannier90) ########################################################### @@ -113,16 +105,15 @@ qe_install_targets( qe_wannier90_postw90_exe) ########################################################### -# QE::MBD +# MBD ########################################################### if(MBD_ROOT) add_library(qe_mbd INTERFACE) - add_library(QE::MBD ALIAS qe_mbd) qe_install_targets(qe_mbd) target_link_libraries(qe_mbd INTERFACE "-L${MBD_ROOT}/lib;-lmbd") - target_include_directories(qe_mbd INTERFACE ${MBD_ROOT}/finclude) + target_include_directories(qe_mbd INTERFACE ${MBD_ROOT}/include) else() - message(STATUS "Installing QE::MBD via submodule") + message(STATUS "Installing MBD via submodule") qe_git_submodule_update(external/mbd) if(NOT BUILD_SHARED_LIBS) set(BUILD_SHARED_LIBS OFF) @@ -135,8 +126,106 @@ else() unset(BUILD_SHARED_LIBS) endif() add_library(qe_mbd INTERFACE) - add_library(QE::MBD ALIAS qe_mbd) target_link_libraries(qe_mbd INTERFACE Mbd) qe_fix_fortran_modules(Mbd) qe_install_targets(qe_mbd Mbd) endif() + +########################################################### +# Eigensolver_GPU +########################################################### +if(QE_ENABLE_CUDA) + qe_git_submodule_update(external/eigensolver_gpu) + + set(src_eigensolver_gpu + eigensolver_gpu/lib_eigsolve/dsyevd_gpu.F90 + eigensolver_gpu/lib_eigsolve/dsygst_gpu.F90 + eigensolver_gpu/lib_eigsolve/dsygvdx_gpu.F90 + eigensolver_gpu/lib_eigsolve/dsymv_gpu.F90 + eigensolver_gpu/lib_eigsolve/dsytd2_gpu.F90 + eigensolver_gpu/lib_eigsolve/dsytrd_gpu.F90 + eigensolver_gpu/lib_eigsolve/eigsolve_vars.F90 + eigensolver_gpu/lib_eigsolve/toolbox.F90 + eigensolver_gpu/lib_eigsolve/zheevd_gpu.F90 + eigensolver_gpu/lib_eigsolve/zhegst_gpu.F90 + eigensolver_gpu/lib_eigsolve/zhegvdx_gpu.F90 + eigensolver_gpu/lib_eigsolve/zhemv_gpu.F90 + eigensolver_gpu/lib_eigsolve/zhetd2_gpu.F90 + eigensolver_gpu/lib_eigsolve/zhetrd_gpu.F90) + + # See: https://github.com/NVIDIA/Eigensolver_gpu/blob/master/lib_eigsolve/Makefile + # Comment: the flags "-O3 -mp -Mlarge_arrays" are inherited + # from the global flags of PGI compiler + set(FLAGS -pgf90libs -Mcuda) + set(FLAGS2 -pgf90libs -Mcuda,maxregcount:64) + if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) + set(FLAGS3 -pgf90libs -Mcuda=cc35,cc60,nordc,maxregcount:255) + elseif(CMAKE_CUDA_ARCHITECTURES GREATER 60) + set(FLAGS3 -pgf90libs -Mcuda=cc60,nordc,maxregcount:255) + else() + set(FLAGS3 -pgf90libs -Mcuda=nordc,maxregcount:255) + endif() + set_source_files_properties( + eigensolver_gpu/lib_eigsolve/dsyevd_gpu.F90 + eigensolver_gpu/lib_eigsolve/dsygst_gpu.F90 + eigensolver_gpu/lib_eigsolve/dsygvdx_gpu.F90 + eigensolver_gpu/lib_eigsolve/dsytd2_gpu.F90 + eigensolver_gpu/lib_eigsolve/dsytrd_gpu.F90 + eigensolver_gpu/lib_eigsolve/eigsolve_vars.F90 + eigensolver_gpu/lib_eigsolve/toolbox.F90 + eigensolver_gpu/lib_eigsolve/zheevd_gpu.F90 + eigensolver_gpu/lib_eigsolve/zhegst_gpu.F90 + eigensolver_gpu/lib_eigsolve/zhegvdx_gpu.F90 + eigensolver_gpu/lib_eigsolve/zhetrd_gpu.F90 + PROPERTIES + COMPILE_OPTIONS "${FLAGS}") + set_source_files_properties( + eigensolver_gpu/lib_eigsolve/zhetd2_gpu.F90 + eigensolver_gpu/lib_eigsolve/dsymv_gpu.F90 + PROPERTIES + COMPILE_OPTIONS "${FLAGS2}") + set_source_files_properties( + eigensolver_gpu/lib_eigsolve/zhemv_gpu.F90 + PROPERTIES + COMPILE_OPTIONS "${FLAGS3}") + + add_library(qe_eigensolver_gpu ${src_eigensolver_gpu}) + qe_fix_fortran_modules(qe_eigensolver_gpu) + + target_link_libraries(qe_eigensolver_gpu + PRIVATE + qe_openmp_fortran) + if(QE_ENABLE_CUDA) + target_link_libraries(qe_eigensolver_gpu + PRIVATE + CUDA::cusolver) + endif() + + qe_install_targets(qe_eigensolver_gpu) +endif() + +########################################################### +# DeviceXlib +########################################################### +qe_git_submodule_update(external/devxlib) + +set(src_devxlib + devxlib/src/deviceXlib_mod.f90 + devxlib/src/device_memcpy.f90 + devxlib/src/device_memcpy_mod.f90 + devxlib/src/device_auxfunc.f90 + devxlib/src/device_auxfunc_mod.f90 + devxlib/src/device_fbuff.f90 + devxlib/src/device_fbuff_mod.f90 + devxlib/src/timer_mod.f90 + devxlib/src/timer.c) +qe_enable_cuda_fortran("${src_devxlib}") + +qe_add_library(qe_devxlib ${src_devxlib}) + +target_include_directories(qe_devxlib + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/devxlib/src") +target_include_directories(qe_devxlib + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/devxlib/include") + +qe_install_targets(qe_devxlib) diff --git a/external/devxlib b/external/devxlib index a9f7a1b01..00c140557 160000 --- a/external/devxlib +++ b/external/devxlib @@ -1 +1 @@ -Subproject commit a9f7a1b01ab10e00cae22a5dca4f73ebf7e4917d +Subproject commit 00c140557725bdd9b155566924c01cfe3d61081a diff --git a/external/eigensolver_gpu b/external/eigensolver_gpu new file mode 160000 index 000000000..d0197c76a --- /dev/null +++ b/external/eigensolver_gpu @@ -0,0 +1 @@ +Subproject commit d0197c76ae76bbf4d3fed20444fac31af550069d diff --git a/external/fox b/external/fox index 6fef49bcf..819745f58 160000 --- a/external/fox +++ b/external/fox @@ -1 +1 @@ -Subproject commit 6fef49bcfc4a380432f15734ed0ca1f0b0388977 +Subproject commit 819745f5849de5c9de516be133ab206691738257 diff --git a/external/libbeef/AUTHORS b/external/libbeef/AUTHORS deleted file mode 100644 index 11141fc9c..000000000 --- a/external/libbeef/AUTHORS +++ /dev/null @@ -1,2 +0,0 @@ -Johannes Voss -Chris P. O'Grady diff --git a/external/libbeef/CMakeLists.txt b/external/libbeef/CMakeLists.txt deleted file mode 100644 index b3ad4ff0e..000000000 --- a/external/libbeef/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -set(sources - pbecor.c - beefun.c -) - -qe_add_library(qe_libbeef ${sources}) -add_library(QE::libbeef ALIAS qe_libbeef) - -########################################################### - -qe_install_targets(qe_libbeef) diff --git a/external/libbeef/COPYING.LIB b/external/libbeef/COPYING.LIB deleted file mode 100644 index 65c5ca88a..000000000 --- a/external/libbeef/COPYING.LIB +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/external/libbeef/Makefile b/external/libbeef/Makefile deleted file mode 100644 index e1b4f23c2..000000000 --- a/external/libbeef/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -# Makefile for libbeef - -include ../make.inc - -OBJS = \ -pbecor.o \ -beefun.o - -# PGI requires -c11 to understand __thread -# See https://www.pgroup.com/userforum/viewtopic.php?t=5504 -ifneq (,$(findstring -D__PGI,$(DFLAGS))) - CFLAGS := -c11 $(CFLAGS) -endif - -all : libbeef.a - -libbeef.a : $(OBJS) - $(AR) $(ARFLAGS) $@ $? - $(RANLIB) $@ - -source : - co -l $(OBJS:.o=.c) - -clean : - - rm -f libbeef.a *.o *.mod *.i core* - -include make.depend diff --git a/external/libbeef/beefleg.h b/external/libbeef/beefleg.h deleted file mode 100755 index 8aac045d1..000000000 --- a/external/libbeef/beefleg.h +++ /dev/null @@ -1,604 +0,0 @@ -#ifndef beefleg_h -#define beefleg_h 1 - -#define PACKAGE "libbeef" -#define VERSION "0.1.2" - -#define nsamples 2000 - -#define nmax 30 - -extern void dgemv_(const char *, const int *, const int *, const double *, - double *, const int *, double *, const int *, const double *, double *, - const int *); - -extern double ddot_(const int *, double *, const int *, double *, const int *); - -//beef exchange enhancement factor legendre polynomial coefficients -static double mi[] = { - 1.516501714304992365356, - 0.441353209874497942611, --0.091821352411060291887, --0.023527543314744041314, - 0.034188284548603550816, - 0.002411870075717384172, --0.014163813515916020766, - 0.000697589558149178113, - 0.009859205136982565273, --0.006737855050935187551, --0.001573330824338589097, - 0.005036146253345903309, --0.002569472452841069059, --0.000987495397608761146, - 0.002033722894696920677, --0.000801871884834044583, --0.000668807872347525591, - 0.001030936331268264214, --0.000367383865990214423, --0.000421363539352619543, - 0.000576160799160517858, --0.000083465037349510408, --0.000445844758523195788, - 0.000460129009232047457, --0.000005231775398304339, --0.000423957047149510404, - 0.000375019067938866537, - 0.000021149381251344578, --0.000190491156503997170, - 0.000073843624209823442 -}; - -//LDA & PBE correlation fractions used in beef-vdw xc -#define beefldacfrac 0.600166476948828631066 -#define beefpbecfrac (1.-beefldacfrac) - - -// beefmat * v = beefcoeff -// v: random (normal distr.) vector of length nmax+1 -static double beefmat[] = { - -2.7893711480032735e-01, -8.6580724524194852e-02, -5.5855907920886121e-02, - -3.3705005058645578e-02, -4.3991742039673903e-02, -2.4503491855613693e-02, - -1.3276193914397489e-02, -1.0509981726996720e-02, 4.2736634878270653e-04, - -4.9364956797540301e-04, -1.6134327119866773e-05, 3.4041925565998549e-04, - 4.2194739762228741e-04, 3.9977584934996758e-04, 1.1522770556196138e-04, - -5.2518450332638647e-04, -6.8117173319719984e-04, 2.0498699215888136e-04, - 4.0709718001654695e-04, -3.1397756373086392e-04, -6.0280544285656027e-05, - 3.3690663944239876e-05, -8.7385100446171526e-05, 1.5545027014986438e-04, - 2.7350091678557105e-04, -2.9477110266707567e-04, -5.5111864348780239e-04, - -1.9845827344304281e-06, -5.5546346992523670e-07, 1.5757159312984489e-09, - -9.8638360313498823e-10, -5.6208383185068933e-01, 2.2379503986741371e-02, - -5.0188674858065566e-02, -1.0302738542444243e-02, 3.0842482402716567e-03, - 7.9398824949748013e-03, 1.0555998187519086e-02, 1.3916427746131796e-02, - 1.7298034502763783e-03, -5.8169770527605202e-04, 4.9364929282124325e-04, - -4.4290949121031880e-04, -3.9198121318981879e-04, -3.6534622625584713e-04, - -4.7114114975009910e-04, -2.4624251970801044e-04, 1.7073071859719576e-04, - 2.0139877514473921e-04, -1.3423791911459609e-03, 9.9452128430699261e-04, - 2.8066850900814681e-04, -2.5321027319004011e-04, 1.4191449559300789e-04, - -2.5212971013654833e-04, -4.3474684754492607e-04, 4.6639558737092136e-04, - 8.6407197243737791e-04, 2.6613581886016500e-06, 5.9459265456201591e-07, - -2.1667614837265335e-09, 1.8987772398720476e-09, -4.1889825595060054e-01, - 8.5309440012684659e-02, 8.2089214257576273e-02, 2.1077454514367565e-02, - 2.4532065239845659e-02, 7.4593299022751702e-03, -8.7517164279600317e-04, - -7.5265340074405305e-03, -2.5422677040271217e-03, 1.9258113062046427e-03, - -1.4277299038031868e-03, 1.1632400701295784e-03, 7.7905784582151959e-04, - 7.1923875622523117e-04, 1.1434833169743359e-03, 1.2109589432120641e-03, - 3.7371827694673783e-04, -6.7100742746982825e-04, 2.0114487626275396e-03, - -1.3549460104091665e-03, -3.9362157100724109e-04, 3.7367806138690598e-04, - -1.8998730194510536e-04, 3.1812219820918941e-04, 5.1233069841357781e-04, - -5.4519175224189951e-04, -1.0076338494328359e-03, -2.6644162301442129e-06, - -5.5425012262767719e-07, 2.0811491412188100e-09, -1.0854717505095305e-08, - -7.8070096027212280e-02, 1.5779809309447619e-03, 1.6547556985414585e-01, - -1.3284202027172546e-02, -4.8425651568221604e-03, -1.5820217046914831e-02, - -8.3911788548852520e-03, -9.8708341526036868e-03, 1.9755560754605148e-03, - -1.4412634043633693e-03, 2.5726826620675299e-03, -1.5774278285877145e-03, - -1.6040605215626427e-03, -9.9797875806281093e-04, -1.6266596812565389e-03, - -1.3222744001110936e-03, -5.5977328518908812e-04, 6.7762959885338150e-04, - -1.6052185640557444e-03, 7.9066006345622562e-04, 2.7398130030301674e-04, - -1.4701727220069440e-04, 1.8423874587621713e-04, -3.2444289888527587e-04, - -4.2892623856473176e-04, 4.6193135460255924e-04, 8.4044927357011508e-04, - 2.5615438451876899e-06, -5.1314624282347763e-07, 2.8785391639650792e-08, - 3.4633391551776865e-09, 7.4241087552789436e-02, -5.4280040120440022e-03, - 6.5534412833281500e-02, -7.3676789884596569e-02, 4.9126066596337937e-04, - -6.3741847170612764e-03, 1.8022920362862328e-02, 1.8147438420912709e-02, - 5.1281518861036367e-03, 1.5643329785525021e-03, -3.7674334940365298e-05, - 1.9161460751596674e-03, 5.1303002399607958e-04, 1.1737495095273077e-03, - 2.7424831860945863e-04, 2.8929440491493800e-04, -1.3643930832243434e-04, - -3.8451058499636436e-04, -1.6446493569519672e-04, 2.8198101717418872e-04, - 2.6836258430682717e-04, -3.6245004889293744e-04, -2.7038853806751870e-04, - 2.6824785565116667e-04, 3.4596717548757025e-04, -3.3476584292450472e-04, - -6.2707939650082545e-04, 1.6303349067490777e-06, -5.3243973391468833e-07, - 9.8897384913597132e-10, -1.1961348316752441e-07, 1.9219539790640294e-02, - -2.0206764138287829e-04, -5.1969726886217447e-02, -5.1327669591491869e-02, - 3.7207131447838271e-02, -9.1864376240948491e-03, 4.0521588009745941e-03, - -1.9708740524219115e-02, -1.5528257052606061e-04, 5.5272314173948405e-03, - 3.6065107786608893e-04, 2.2921209578475239e-03, -6.0493119937173306e-04, - 1.3264010830068790e-03, 1.1925154671001486e-03, 2.5367108496124960e-03, - 2.0471466747371895e-04, -1.0084615091179223e-03, 2.0269870158526730e-03, - -1.8142343224067773e-03, -3.1916624486206900e-04, 1.0899323113728922e-03, - 1.5977194189760289e-04, -3.6993982697979287e-04, -2.8095429889228639e-04, - 3.3673412008212799e-04, 5.3016256566782382e-04, 2.2603641905826421e-06, - -6.0162376060668507e-06, 2.0626271307694735e-07, 2.7080875890664975e-10, - -1.9932513600214176e-02, -3.1590139025144408e-03, -4.1290926781928680e-02, - 2.2930887771390233e-02, 2.8588480718176067e-02, -2.5422538807935227e-02, - 7.4291651267536559e-03, -5.6441743796061304e-03, 9.6583047441454531e-03, - 2.4324308684833340e-03, 5.3063140357734774e-03, 6.1327502623585652e-04, - -3.3301168451738139e-03, -1.8166489805542909e-04, -4.2805082728751571e-03, - -2.7235276457503932e-03, -1.2671126744029327e-03, 3.3085897019266428e-04, - -3.7988540725469797e-03, 1.9997662400812392e-03, 1.2349981809226202e-03, - -1.3462418114106411e-03, -5.3437809436454619e-04, 2.4103065487655935e-04, - 3.4813005143659336e-04, -2.3243343778689025e-04, -4.5159874040786652e-04, - 1.5119074547806086e-05, -6.9011025175958165e-07, 2.3330273843525182e-09, - -5.3842762631498313e-07, 4.3011798669764258e-04, 9.9552785066539138e-04, - 1.6367943477601170e-02, 4.2785050543760354e-02, -2.0452568930084115e-02, - -1.9227084404651550e-02, 1.4373130724756761e-02, 5.7276357414483758e-03, - 1.2758307452167408e-02, 3.2112729756378741e-03, 5.4991197676025035e-03, - 3.2296047342698880e-03, -2.1286546465503209e-03, 2.9476536066769593e-03, - 1.0201559844743992e-03, 3.2954854849929749e-03, -1.1813139734199577e-03, - -1.4174365268660759e-03, 2.5658999230135306e-03, -2.9526732455200390e-03, - -9.7004938493557751e-05, 1.7437271881877081e-03, 5.9754565134489387e-05, - -6.0036116600961198e-04, -1.3230631539389915e-04, 2.6028153195231722e-04, - 1.6677911152304927e-04, 1.3884201313790570e-06, -2.2530742330382744e-05, - 7.3805127855484125e-07, -5.8273323257104446e-10, 4.9290906772224263e-03, - 3.0610869932292733e-03, 1.4313796146577058e-02, 4.8181769157442842e-04, - -2.5982977487858137e-02, 2.4348378769669884e-02, 9.0510010545148799e-03, - -1.3516528967376500e-02, -1.8726098827207454e-03, 1.2390557446126603e-02, - -9.1227025683008613e-04, 7.0364465776508378e-03, -1.4088125053006069e-03, - 3.4067454992656385e-03, -1.2603784560760989e-03, 2.1812385869284081e-03, - 2.1084324466647831e-05, -2.2698924902178428e-03, -2.2226191104179477e-03, - 1.3339278571527775e-03, 1.8204956012944679e-03, -1.3446791863853983e-03, - -9.9909759668189119e-04, 2.3435102450791270e-04, 2.5254141307444526e-04, - 1.1134484630654041e-04, 1.5286842865445637e-04, 4.7770176810314048e-05, - -3.0570574206400900e-09, -1.8280421027556346e-09, -1.5932607092782039e-06, - -2.8110227717260271e-03, -3.1231467242703289e-03, -7.5951163296362686e-03, - -2.1260181962774405e-02, 1.4990600431812426e-03, 2.6948085160114123e-02, - -1.3125993744515290e-02, 2.5328095875940654e-03, 5.1350312584983243e-03, - -1.6143115098225704e-03, 8.1287346936694729e-03, -3.6059174026760633e-04, - -5.6502508444833946e-03, 6.6779252331724626e-04, -5.0326662554609552e-03, - -1.8088213195257283e-03, -3.7431045571209194e-03, 8.3448014976049661e-05, - -9.8614380505414540e-04, -2.6401009553883316e-03, 5.9341419291161312e-04, - 2.0739686828981424e-03, -5.9797634333075985e-05, -1.0872087775937360e-03, - 8.0967213780402546e-05, 1.7373279075753355e-04, -3.9850700378931683e-04, - 4.7334970806959295e-07, -5.5985173946584438e-05, 1.9031863901026922e-06, - 3.4027792381324185e-09, -3.1280359588473967e-04, 5.0300486943160054e-04, - -2.8683399135020489e-03, -1.2008277866989911e-03, 1.4099834934249001e-02, - -9.5346660390286091e-03, -2.3740581166392327e-02, 1.3188455344687964e-02, - -1.4460548177748710e-03, -4.2037545782719751e-03, 1.4670013169385359e-03, - 1.9671337767890882e-03, -1.3025084329530438e-03, 3.1550217754350482e-03, - 8.6233628968752322e-04, 5.0634050666416948e-03, 6.8840641553373526e-04, - -3.8643121063023107e-03, 2.7532585912541218e-04, -2.1002860074291254e-04, - 2.2359939934659696e-03, -1.3840652254543024e-03, -1.6763605667005842e-03, - 3.7098662305387614e-04, 5.0284264148414009e-04, 2.1342825683299952e-04, - 2.9361015559854043e-04, 1.0312347464059402e-04, 2.3987071391277137e-07, - -2.9324654172546502e-09, -3.6710510430712760e-06, 1.3368121380154261e-03, - 1.4877365013506760e-03, 4.2337278687268184e-03, 8.9532297499984297e-03, - 3.2367419938850294e-03, -1.6509842616506145e-02, 4.2662388175525008e-03, - 5.1287520687677045e-03, -1.9318765281838401e-02, 1.2840401098951606e-03, - -8.9041973081194960e-03, 2.5805526816426402e-03, 1.9426554396526879e-03, - 2.1383002718137539e-03, -1.1198522043181984e-03, -4.5860467230069113e-04, - -3.0213216077694940e-03, 4.3803366522670416e-05, -2.8955020910217968e-03, - -7.6188510148852908e-04, 1.4406655488350538e-03, 1.9913160267415798e-03, - -1.9574454921368270e-04, -1.6206278579913766e-03, -4.2397416300276465e-05, - 5.2668955401950952e-04, -3.1473706074703137e-04, 1.1305854764916919e-06, - -1.1025780419487959e-04, 4.0231475478550114e-06, 7.4448742155610599e-10, - -5.7542806536456988e-04, -1.3962047676911223e-03, -7.7910733149695881e-04, - -2.0293445396823073e-03, -8.0584277113443983e-03, 9.2561802708384982e-04, - 1.8365141864082186e-02, -8.0855208176669503e-03, -5.9567473717600629e-03, - -1.0813373009694597e-02, -5.3648971000046697e-04, -8.0483569657769771e-03, - -1.1786907195179093e-03, -3.4585921438278584e-03, -2.8048252033714858e-03, - -1.3298062340290390e-03, 1.2174093629560551e-04, -1.8509549096989374e-03, - 1.7726580693748909e-03, -2.4617807425807501e-03, 1.3327542858251992e-03, - -4.2946375589953463e-04, -1.9574487953845573e-03, 3.0631609184529331e-04, - 8.7082976920211514e-04, 2.2107939301901358e-04, 2.5002382690157145e-04, - 1.8567319491871292e-04, 1.0950042045068506e-06, -1.4260985857055198e-09, - -7.2146860148408335e-06, -2.6604588926341721e-04, 1.1930752380141212e-04, - -1.5904049684056826e-03, -2.5464828659123254e-03, 2.4562492448205900e-04, - 8.2137273331999595e-03, 7.2372122281901669e-04, -8.0305782586859338e-03, - 1.6461891735701385e-02, -7.4726404087930879e-03, -3.3308999994364785e-03, - -3.8605578571737301e-03, 5.1939018263187650e-03, -7.4783594984583011e-04, - 4.7329846259356904e-03, 2.5576434013004864e-03, 1.3184094162786905e-03, - -2.2296241792944498e-04, -2.1461375216242336e-03, 1.7064815869658875e-03, - 1.6793057923813973e-03, 5.9966950380175297e-04, -4.2596934644769784e-04, - -1.6262797376181580e-03, 5.5748735064045878e-06, 7.1301762682680220e-04, - -5.4170894930021419e-04, 4.0926971253201973e-07, -1.8615721232857828e-04, - 7.4644639020998914e-06, -8.8402142176878236e-10, 3.1357190287392180e-04, - 7.9597866907847245e-04, 1.2242374484315670e-03, 2.2432983924643968e-03, - 3.7360392631435374e-03, -1.8346315422847415e-04, -8.9447986235832600e-03, - 5.1170003773556103e-03, 9.8612943651755561e-03, 1.2982450375216243e-02, - -5.9568539025605695e-03, 8.8293572499739410e-04, 5.2355853108957354e-03, - -2.5140777372805192e-03, 9.4718806147847093e-04, -4.8498469710574546e-03, - -1.1455902067634613e-03, 2.5278263036861127e-03, 8.7518557957694308e-04, - -1.4988946837090279e-03, -1.6587461108646788e-04, 5.3010146581652820e-04, - -1.4769598311308706e-03, 1.4099290153743994e-04, 1.0210377105148046e-03, - 3.4652152930751690e-04, 4.2894782721634181e-04, 2.8827160262158191e-04, - 1.9605575118429994e-06, -2.6869941750589450e-09, -1.2686959481251205e-05, - 6.2118690045315475e-05, -6.9266581150996000e-04, 6.5114347606650224e-05, - -4.6299515842343356e-04, -2.6341253451073600e-03, -4.1145044177758354e-03, - -1.3119014396461980e-03, 4.3517571287416384e-03, -9.0629517469005098e-03, - 1.0876617207688946e-02, 9.5074167710495622e-03, -2.5681139285186438e-03, - -2.5209727209737111e-03, -4.9645213357883220e-03, 5.0815058814798492e-04, - -9.0717430454276401e-04, 4.8990052765759216e-03, -3.5042177275447457e-04, - 2.2376237780211885e-03, 1.3560371613952321e-03, -3.8279814357953214e-05, - -6.5921630983060725e-04, -3.2119768671761486e-04, -1.1111879074490862e-03, - -4.4176453802506131e-05, 8.8890690397482855e-04, -5.3043155420778626e-04, - 1.6971000247480230e-06, -2.7469671290871004e-04, 1.2580575273862472e-05, - -9.0683882200211484e-10, -2.1359674139973282e-04, -4.0018169945925451e-05, - -5.7750576026077195e-04, -6.4180711343731465e-04, 2.0302930490348061e-04, - 1.6351119341946150e-03, 3.9857022191808573e-03, -2.7095680824841474e-03, - -7.2175363048520022e-03, -7.8163708147656330e-03, 1.0173365767109905e-02, - 6.1359344279036691e-03, -6.9549366450624847e-04, 2.6363883393387536e-03, - 4.5181771577114923e-03, 7.7785558025172258e-04, -4.3496217454422854e-05, - 4.1922339149713331e-03, -1.4074237424951059e-03, 1.5659520740856784e-03, - -1.6703844903901651e-03, 9.5438736622087395e-04, -1.6173074048544354e-04, - 3.9478874219593374e-05, 1.1039556457800360e-03, 1.9664021921996113e-04, - 1.6363589600986673e-04, 3.9163960761265886e-04, 2.3447662266569635e-06, - -1.4333073815630597e-09, -2.0502087244552265e-05, 2.2157620440394014e-06, - 6.6750032941751845e-04, 2.9172971033746323e-04, 7.9020703940250027e-04, - 1.5587178279708612e-03, 1.1620151775589892e-03, 6.2240236463069490e-05, - -1.3811367430065333e-03, 4.3748403598123124e-03, -8.6101227336660233e-03, - -7.4310448077580761e-03, 8.9021093046344479e-03, -3.0274072215419764e-03, - 3.1660132630635129e-03, -3.1477368993255051e-03, -2.9597559782082706e-03, - -2.1155096110190175e-04, 7.7091015293960735e-04, 3.3072902087843219e-03, - 4.6210608863975580e-04, -1.6061209355446389e-03, -2.0187418413509014e-03, - -6.4876860796269075e-06, 1.6522153071454654e-04, -1.6726296267198875e-04, - 9.2431208321653788e-04, -2.2287583148094444e-04, 2.5511431088727062e-06, - -3.6039970881849361e-04, 1.9688235979535197e-05, -3.7457192432901044e-09, - 2.5807620945812000e-04, -7.2244544324433571e-04, 1.0790368127414874e-04, - -4.1760238948185046e-04, -1.7448269612268148e-03, -1.8016710613760290e-03, - -1.5859335586748617e-03, 1.4175473106720754e-03, 3.3556271404118544e-03, - 3.5652147444237134e-03, -8.8148399469076526e-03, -6.3781804659885089e-03, - -6.8481681048368718e-03, 1.0276546730352168e-03, -3.5612851303833347e-03, - 3.8919808800686800e-03, 1.9980897223815432e-03, -1.2128395513872237e-03, - -5.8259865297205136e-04, 1.8850909766925110e-03, -2.0200258452286943e-03, - 1.0659318264400290e-03, 1.6146290527533289e-03, -2.5678274788187096e-04, - 6.8608350772634814e-04, 4.4674639554755061e-05, -2.3738712621118025e-05, - 4.6909565196073496e-04, 3.2750985126758742e-06, -1.0508877359882054e-09, - -3.0995955086127838e-05, -2.6090295873073399e-04, 2.2593157068985373e-04, - -2.5873340354153014e-04, -1.0432034069002237e-04, 5.3396230602151349e-04, - 8.3941703085044705e-04, 7.7616674863855578e-04, -7.3565108539809835e-05, - -2.3655096266623783e-03, 4.8338632155411811e-03, 3.7305174303572204e-03, - -9.4123048258186546e-03, 4.0467754114985001e-03, 4.1042735786481280e-03, - 4.5660113084445712e-04, 2.9056073274273363e-03, -4.9773047112733606e-03, - 7.5914148822592612e-04, -1.3672500116079960e-03, -1.1515008332860619e-03, - -1.5774145860636551e-03, -1.3874200763924686e-03, 2.9523415504071265e-04, - 1.6475835121375531e-03, -8.6718480733062874e-05, 4.5719257547222248e-04, - -8.8416958937781763e-05, 2.5419846171150652e-06, -4.1745943816031057e-04, - 2.9037338003440348e-05, -4.8641001503932725e-09, -3.3875340880671390e-06, - 3.8854434947631496e-04, 1.5255986580861542e-04, 4.4231876423827599e-04, - 8.5687765241308279e-04, 4.9705062382093303e-04, 7.8437184053581466e-05, - -5.8370635976557955e-04, -6.5015462417685062e-04, -1.9275788771249507e-03, - 5.4025542446396813e-03, 3.7050329130392900e-03, 9.5337152347673010e-03, - -1.8500719493484013e-03, -2.5998770090829969e-03, -1.7921763933910746e-03, - -1.5070360642670615e-03, -4.6225189534133604e-03, 9.6896548007970973e-04, - 1.9780464301734265e-04, 7.8226350391399229e-04, -7.4948199490994564e-04, - 2.2162510831858499e-03, -3.7065352470400629e-04, -1.9080725631003573e-04, - -5.1697784965698951e-05, -5.6772926264705180e-05, 4.8008042025353599e-04, - 2.9689347658160229e-06, -4.0508153712783222e-09, -4.4376992450690561e-05, - 2.8656860643779843e-04, -6.0723827461135922e-04, 8.9652701855479268e-05, - -3.3722363780791357e-04, -1.2273225745712776e-03, -1.1208506603616873e-03, - -5.7376759633318995e-04, 5.0470316291295603e-04, 1.1372295314039857e-03, - -1.8742615395240399e-03, -1.7699835210057207e-03, 6.4172581555616923e-03, - -2.2641737523530618e-03, -8.3905329914488857e-03, 1.1962776747535253e-03, - 1.1168936154126797e-03, 1.7441657118701060e-03, -1.5880517854128917e-03, - -3.3283970696354036e-03, -1.9452225624805367e-03, 2.7709962173234177e-04, - 1.7334196123640587e-03, 4.8378489526356490e-04, 1.8299929821834237e-03, - 1.4411009104043159e-05, -2.5608521367940406e-04, 1.3956561131376027e-04, - 3.8404496716179571e-06, -4.1420194476987372e-04, 4.0763682598377557e-05, - -4.3001030012746268e-09, -3.2795025947796546e-04, 2.7837362859566109e-04, - -2.5801815520712324e-04, -7.6884800996573273e-05, 4.4699382189544756e-04, - 6.8551289269577612e-04, 6.0741397737702470e-04, -1.8499524748852945e-05, - -5.4196601279355773e-04, 1.3208939489178523e-03, -2.5964000584312000e-03, - -1.7336470429971179e-03, -7.5603676752781131e-03, 2.9070149137429155e-04, - 6.4482227927468751e-03, -2.1489444199310035e-03, -1.4230490906760446e-03, - 1.8169764635181242e-03, 6.7983720224022826e-05, -2.1561275597188445e-03, - 2.7260521253352332e-03, -1.8300026665438493e-03, 5.4963459881875632e-04, - -4.5219985324618448e-05, -9.7394557008500474e-04, -2.1933952472490118e-04, - -2.2310319932044201e-04, 3.8834937158853952e-04, 1.9039628159021295e-06, - -5.5536157089227886e-09, -6.0675975477065685e-05, 9.3302639864854266e-05, - 2.3339579903288108e-04, 1.7775902384819042e-04, 3.4243433084381097e-04, - 5.5750335496336815e-04, 2.5233808615771091e-04, -1.1281124813925308e-04, - -3.4268677698185476e-04, -8.3165051103961077e-05, 8.8429111750297617e-05, - 1.1803214341051613e-03, -3.3597902952208895e-03, 8.2300563761220677e-04, - 7.7568191353945860e-03, -2.1323883809726602e-04, -4.5235513690711085e-03, - 3.3544646570372125e-03, -1.8547392389106984e-04, 1.7056584504294026e-03, - 1.7389044210859308e-03, 2.5624656326692715e-03, 2.1075918064110007e-03, - 1.7655688651649145e-04, 2.4347639496794055e-04, 8.0341660812841874e-05, - -8.6035464445300672e-04, 4.0853119890643127e-04, 3.1106201761768523e-06, - -3.2463367641115013e-04, 5.4867873654193066e-05, -7.1952746762362615e-09, - 2.0035305510703163e-04, -4.1470564629065068e-04, 7.7757242307016758e-05, - -2.0649053086643453e-04, -8.1705094869878570e-04, -7.7590949646469095e-04, - -4.4764387897257323e-04, 2.4235976605899791e-04, 5.0719709556882437e-04, - -6.0619460486065918e-04, 7.7723307065286659e-04, 9.7970695866240890e-04, - 4.4325535716739336e-03, 8.6565714933583399e-04, -5.6874671538713886e-03, - 3.6369082580526703e-03, 3.9496935822962058e-03, 3.9128965494382630e-03, - -6.2754528357869619e-04, -1.1570007004839940e-03, -3.3166553408609271e-04, - 5.4384291000910984e-04, -1.8705788666701219e-03, 2.9405172845078166e-04, - -1.2222588412306808e-03, -2.2891603541204061e-04, -2.1467092296314339e-04, - 1.7478332775632674e-04, 1.3972574343180186e-06, -5.7279591476758486e-09, - -7.9742615225032346e-05, -3.0075798989147681e-04, 1.4118701101636561e-04, - -2.4240631409222973e-04, -1.1785201583561527e-04, 2.4193417610447515e-04, - 4.6523705060868783e-04, 4.9129251547784113e-04, 9.9916536450085264e-05, - -4.1041593831106369e-04, 5.0541939579484883e-04, -7.7438126257460419e-04, - 1.3270121215682937e-03, -4.2642936680703606e-04, -5.0811628681540644e-03, - -1.2244180097435811e-03, 4.5000172726604943e-03, -4.6485436804198947e-03, - 2.4095129398396579e-03, 2.6249577773794232e-03, 2.0560610805366521e-03, - 4.2673006136392647e-04, -1.0417284476604593e-03, -4.4756553523878279e-04, - -1.7156599571386166e-03, 1.5837278146672791e-04, -1.0292671007440847e-03, - 3.5034243358238187e-04, 9.3524701103512595e-07, -1.3324582404794741e-04, - 7.1217236168440604e-05, -8.4826920074820654e-09, 8.8487458676305089e-05, - 2.5411257464301760e-04, 1.1631330722711955e-04, 2.4706559772584943e-04, - 5.0363596168365393e-04, 3.2925334215437298e-04, 5.4865482297388669e-05, - -2.4984731108154343e-04, -1.5023316925162974e-04, 5.7089788276837070e-05, - 3.9200009487858244e-05, -6.0053644013143307e-04, -1.9471560296367080e-03, - -8.0439039738820761e-04, 2.8398775343293813e-03, -2.5148892944348586e-03, - -3.4385946494612835e-03, -4.3967414780182847e-03, 4.8062801167336061e-04, - 3.2538487861870366e-03, -2.4653635511351106e-03, 1.6210813355552567e-03, - -1.8960620163814548e-03, 2.9334053827329834e-04, -4.6008176198270929e-04, - -5.2750995834480166e-05, -3.5881015258430354e-05, -1.5733251013534650e-04, - -8.0433630524953438e-07, -9.3134893153291366e-09, -1.0126700420616725e-04, - 1.3524438560090350e-04, -2.3657150167652783e-04, 8.4063693464263644e-05, - -7.3284196918286295e-05, -4.5747684911547662e-04, -4.9385229541419780e-04, - -3.4615227602379921e-04, 7.6053373209164201e-05, 3.4515183198076101e-04, - -3.4930928458053499e-04, 2.9241034735481098e-04, -2.7639227986046247e-04, - 3.6654015848700347e-04, 2.4583473727325294e-03, 1.3808700892046131e-03, - -2.2854206521655813e-03, 2.8668302261101726e-03, -2.3837177410215723e-03, - -3.2669763894858229e-03, -3.1927275211167719e-03, -3.2249104816820815e-03, - -1.7758589472062628e-03, -4.6211772345946937e-04, -1.5913577025463228e-03, - 5.2209681324993251e-05, -3.3172305063837123e-04, 9.3645090863664495e-05, - -4.0531462102762323e-07, 1.5379696379095242e-04, 8.9553577540403740e-05, - -8.3095679845718682e-09, -7.7614312182869432e-05, -6.9224510403129077e-05, - -7.0511436907771101e-05, -9.2092390003882744e-05, -1.3108592128347423e-04, - -5.2166463363986037e-05, 3.8189747222245900e-05, 9.7034215578165717e-05, - 6.6698289420144591e-06, 4.1465837932271208e-05, -8.6491223894963871e-05, - 1.8599835598442636e-04, 4.5419293400123992e-04, 2.4637402659425338e-04, - -6.6384442423605484e-04, 7.0859502436792013e-04, 1.0992380591874002e-03, - 1.4314937223341589e-03, -1.4570501008170258e-04, -1.3731334006113543e-03, - 1.2298515850134274e-03, -8.9292439144695148e-04, 1.6314598205173117e-03, - -2.6215137530695448e-04, 1.1695055548712869e-03, 2.1630290489579952e-04, - 2.0790865575842334e-04, -5.6795284112210593e-04, -3.6817519448666263e-06, - -1.3232041203107141e-08, -1.2483857322058414e-04, -6.8648130614685716e-06, - 9.4884349344528113e-05, 2.8169710973816057e-06, 5.5314611665325722e-05, - 1.8193865910137160e-04, 1.6376627773798306e-04, 8.6804623936378438e-05, - -5.8747038363387132e-05, -1.0309325547777985e-04, 8.5655035651616525e-05, - -3.9013644288256400e-05, -2.9972201744199742e-06, -1.4223835592234795e-04, - -6.1728813484959516e-04, -4.8730493463071016e-04, 5.0616799947066483e-04, - -7.6210587996690783e-04, 7.8977404395214165e-04, 1.1085140504767312e-03, - 1.1732659695961691e-03, 1.5071570177655463e-03, 1.0707318594434011e-03, - 3.9653242216132148e-04, 1.4685549102334643e-03, -1.3178963305750352e-04, - 1.0036937264612503e-03, -3.8330969230438306e-04, -4.6956191298802305e-06, - 5.0244872004260070e-04, 1.0955078418257361e-04, -1.4102930471052401e-08, - 5.3903360902318162e-02, 4.5646784742740532e-01, -2.3775359618348597e-02, - -1.0804428280726967e-02, -1.2685075587595527e-02, -6.5186790847643755e-03, - -2.6801719660519757e-03, -1.0219114528977680e-03, 6.2601830432405575e-04, - -5.0759231993347616e-04, 3.5935438417533216e-04, -2.0299577991029813e-04, - -1.1528037487456212e-04, -8.6914308586454053e-05, -2.3170116329541290e-04, - -3.4162104059285499e-04, -2.0297105465141889e-04, 1.6362554140599247e-04, - -2.5010861768559074e-04, 1.3249006118439094e-04, 4.3449210292733832e-05, - -4.5596513172512997e-05, 9.5088226421318060e-06, -1.4531856486312905e-05, - -1.3596189144146172e-05, 1.3812870532393629e-05, 2.4491439899588591e-05, - 2.8004467174549986e-08, -1.8015504836958041e-08, 1.1727867063472466e-10, - 3.1916369403073135e-10 -}; - - -//Legendre polynomial calculation macros and functions - -#define calcleg(x) { \ - L[1] = x; int i=0; \ - for(i=2;i -#include -#include -#include - -#include "beefleg.h" - -#include "pbecor.h" - -// evaluate bee exchange energy and its derivatives de/drho and ( de/d|grad rho| ) / |grad rho| -void beefx_(double *r, double *g, double *e, double *dr, double *dg, int *addlda) -{ - double s2,t,r43,r83,s,sx,dx,fx,dl,dfx; - const int n=nmax; - const int i1=1; - const int i2=1; - - switch(beeftype) { - case 0: //BEEF-vdW xc - r43 = pow(*r, 4./3.); - r83 = r43*r43; - sx = r2e * r43; - dx = 4./3. * sx / (*r); - - s2 = *g*pix / r83; - s = sqrt(s2); - t = 2.*s2/(4.+s2)-1.; - - if(beeforder==-1) - { - calclegdleg(t); - - if(!(*addlda)) - fx = ddot_(&n, mi, &i1, L, &i2) - 1.; - else - fx = ddot_(&n, mi, &i1, L, &i2); - dl = ddot_(&n, mi, &i1, dL, &i2); - - dfx = dl*( 4.*s / (4.+s2) - 4.*s2*s/sq(4.+s2) ); - *dr = dx*fx - 4./3.*s2/(s*(*r))*sx*dfx; - *dg = sx*dfx*pix/(s*r83); - *e = sx*fx; - return; - } - - if(beeforder>=0) - { - (*LdLn[beeforder])(t, &fx, &dl); - - dfx = dl*( 4.*s / (4.+s2) - 4.*s2*s/sq(4.+s2) ); - *dr = dx*fx - 4./3.*s2/(s*(*r))*sx*dfx; - *dg = sx*dfx*pix/(s*r83); - *e = sx*fx; - } - else - { - *dr = 0.; - *dg = 0.; - *e = 0.; - } - - break; - } -} - - -// evaluate local part of bee correlation and its derivatives de/drho and ( de/d|grad rho| ) / |grad rho| -void beeflocalcorr_(double *r, double *g, double *e, double *dr, double *dg, int *addlda) -{ - double rs, ldac, ldadr, pbec, pbedr, pbed2rho; - - if(beeforder>=0) - { - *e = 0.; - *dr = 0.; - *dg = 0.; - return; - } - - switch(beeftype) { - case 0: //BEEF-vdW xc - rs = invpi075tothird / pow(*r,1./3.); - corpbe(rs, 0.5/r2k * sqrt(*g*rs) / (*r), - (beeforder>-3), 1, &ldac, &ldadr, &pbec, &pbedr, &pbed2rho); - - if(beeforder==-1) - { - if(!(*addlda)) - { - *e = beefpbecfrac*pbec*(*r); - *dr = beefpbecfrac*pbedr; - } - else - { - *e = (beefpbecfrac*pbec+ldac)*(*r); - *dr = beefpbecfrac*pbedr+ldadr; - } - *dg = beefpbecfrac*pbed2rho / (*r); - return; - } - - if(beeforder==-2) - { - *e = pbec*(*r); - *dr = pbedr; - *dg = pbed2rho / (*r); - } - else if(beeforder==-3) - { - *e = ldac*(*r); - *dr = ldadr; - *dg = 0.; - } - else - { - *e = 0.; - *dr = 0.; - *dg = 0.; - } - - break; - } -} - -// evaluate bee exchange energy only -void beefxpot_(double *r, double *g, double *e, int *addlda) -{ - double s2,t,s,r43; - const int n=nmax; - const int i1=1; - const int i2=1; - - switch(beeftype) { - case 0: //BEEF-vdW xc - r43 = pow(*r, 4./3.); - - s2 = *g*pix / (r43*r43); - t = 2.*s2/(4.+s2)-1.; - - if(beeforder==-1) - { - calcleg(t); - - if(!(*addlda)) - *e = (ddot_(&n, mi, &i1, L, &i2) - 1.) * r2e * r43; - else - *e = ddot_(&n, mi, &i1, L, &i2) * r2e * r43; - return; - } - - if(beeforder>=0) - *e = (*Ln[beeforder])(t) * r2e * r43; - else - *e = 0.; - - break; - } -} - -// evaluate local part of bee correlation - energy only -void beeflocalcorrpot_(double *r, double *g, double *e, int *addlda) -{ - double rs, ldac, ldadr, pbec, pbedr, pbed2rho; - - if(beeforder>=0) - { - *e = 0.; - return; - } - - switch(beeftype) { - case 0: //BEEF-vdW xc - rs = invpi075tothird / pow(*r,1./3.); - corpbe(rs, 0.5/r2k * sqrt(*g*rs) / (*r), - (beeforder>-3), 0, &ldac, &ldadr, &pbec, &pbedr, &pbed2rho); - - if(beeforder==-1) - { - if(!(*addlda)) - *e = beefpbecfrac*pbec*(*r); - else - *e = (beefpbecfrac*pbec+ldac)*(*r); - return; - } - - if(beeforder==-2) - *e = pbec*(*r); - else if(beeforder==-3) - *e = ldac*(*r); - else - *e = 0.; - - break; - } -} - - - -// evaluate local part of bee correlation for spin polarized system -void beeflocalcorrspin_(double *r, double *z, double *g, double *e, - double *drup, double *drdown, double *dg, int *addlda) { - double rs, ldac, ldadrup, ldadrdown, pbec, pbedrup, pbedrdown, pbed2rho; - - if(beeforder>=0) - { - *e = 0.; - *drup = 0.; - *drdown = 0.; - *dg = 0.; - return; - } - - switch(beeftype) { - case 0: //BEEF-vdW xc - rs = invpi075tothird / pow(*r,1./3.); - corpbespin(rs, 0.5/r2k * sqrt(*g*rs) / (*r), *z, - (beeforder>-3), 1, &ldac, &ldadrup, &ldadrdown, &pbec, - &pbedrup, &pbedrdown, &pbed2rho); - - if(beeforder==-1) - { - if(!(*addlda)) - { - *e = beefpbecfrac*pbec*(*r); - *drup = beefpbecfrac*pbedrup; - *drdown = beefpbecfrac*pbedrdown; - } - else - { - *e = (beefpbecfrac*pbec+ldac)*(*r); - *drup = beefpbecfrac*pbedrup+ldadrup; - *drdown = beefpbecfrac*pbedrdown+ldadrdown; - } - *dg = beefpbecfrac*pbed2rho / (*r); - return; - } - - if(beeforder==-2) - { - *e = pbec*(*r); - *drup = pbedrup; - *drdown = pbedrdown; - *dg = pbed2rho / (*r); - } - else if(beeforder==-3) - { - *e = ldac*(*r); - *drup = ldadrup; - *drdown = ldadrdown; - *dg = 0.; - } - else - { - *e = 0.; - *drup = 0.; - *drdown = 0.; - *dg = 0.; - } - - break; - } -} - -// evaluate local part of bee correlation for spin polarized system - energy only -void beeflocalcorrpotspin_(double *r, double *z, double *g, double *e, int *addlda) -{ - double rs, ldac, ldadrup, ldadrdown, pbec, pbedrup, pbedrdown, pbed2rho; - - if(beeforder>=0) - { - *e = 0.; - return; - } - - switch(beeftype) { - case 0: //BEEF-vdW xc - rs = invpi075tothird / pow(*r,1./3.); - corpbespin(rs, 0.5/r2k * sqrt(*g*rs) / (*r), *z, - (beeforder>-3), 0, &ldac, &ldadrup, &ldadrdown, &pbec, - &pbedrup, &pbedrdown, &pbed2rho); - - if(beeforder==-1) - { - if(!(*addlda)) - *e = beefpbecfrac*pbec*(*r); - else - *e = (beefpbecfrac*pbec+ldac)*(*r); - return; - } - - if(beeforder==-2) - *e = pbec*(*r); - else if(beeforder==-3) - *e = ldac*(*r); - else - *e = 0.; - - break; - } -} - - - -// mode >= 0: for perturbed parameters --- calc Legendre order mode only -// -1: standard beefxc expansion coefficients -// -2: PBE correlation only -// -3: LDA correlation only -// else: no correlation either -void beefsetmode_(int *mode) -{ - beeforder = *mode; -} - -// initialize pseudo random number generator -void beefrandinit_(unsigned int *seed) -{ - srandom(*seed); -} - -// initialize pseudo random number generator with default seed -void beefrandinitdef_() -{ - srandom(defaultseed); -} - -// calculate ensemble energies -void beefensemble_(double *beefxc, double *ensemble) -{ - double vec[nmax+2],randvec[nmax+1]; - const double alpha=1.; - const double beta=0.; - const int m=nmax+1; - const int n=nmax+1; - const int la=nmax+1; - const int ix=1; - const int iy=1; - const int n2=nmax+2; - - int i=0; - int j=0; - for(i=0;i - -/* Table of constant values */ - -#define c_b3 .0310907 -#define c_b4 .2137 -#define c_b5 7.5957 -#define c_b6 3.5876 -#define c_b7 1.6382 -#define c_b8 .49294 -#define c_b9 .01554535 -#define c_b10 .20548 -#define c_b11 14.1189 -#define c_b12 6.1977 -#define c_b13 3.3662 -#define c_b14 .62517 -#define c_b15 .0168869 -#define c_b16 .11125 -#define c_b17 10.357 -#define c_b18 3.6231 -#define c_b19 .88026 -#define c_b20 .49671 - -/* ---------------------------------------------------------------------- */ -/* ###################################################################### */ -/* ---------------------------------------------------------------------- */ -/* Subroutine */ static void gcor2(double a, double a1, double b1, - double b2, double b3, double b4, double rtrs, - double *gg, double *ggrs) -{ - /* Local variables */ - double q0, q1, q2, q3; - -/* slimmed down version of GCOR used in PW91 routines, to interpolate */ -/* LSD correlation energy, as given by (10) of */ -/* J. P. Perdew and Y. Wang, Phys. Rev. B {\bf 45}, 13244 (1992). */ -/* K. Burke, May 11, 1996. */ - q0 = a * -2. * (a1 * rtrs * rtrs + 1.); - q1 = a * 2. * rtrs * (b1 + rtrs * (b2 + rtrs * (b3 + b4 * rtrs))) - ; - q2 = log(1. / q1 + 1.); - *gg = q0 * q2; - q3 = a * (b1 / rtrs + b2 * 2. + rtrs * (b3 * 3. + b4 * 4. * rtrs)) - ; - *ggrs = a * -2. * a1 * q2 - q0 * q3 / (q1 * (q1 + 1.)); -} /* gcor2_ */ - - -#define gamma 0.03109069086965489503494086371273 -#define beta 0.06672455060314922 -#define delta (beta/gamma) -#define phi 0.409240950261429630406974844266531 -#define GAM 0.5198420997897463295344212145565 -#define fzz (8./(9.*GAM)) - - -/* ###################################################################### */ -/* ---------------------------------------------------------------------- */ -/* Subroutine */ void corpbe(double rs, double t, - int lgga, - int lpot, double *ec, double *vc, - double *h__, double *dvc, double *dv2rho) -{ - /* Local variables */ - double b, b2, q4, t2, q5, t4, - ep, eu, pon, - eurs, rtrs; - double tmp1,tmp2,tmp3; - -/* ---------------------------------------------------------------------- */ -/* Official PBE correlation code. K. Burke, May 14, 1996. */ -/* INPUT: RS=SEITZ RADIUS=(3/4pi rho)^(1/3) */ -/* : ZET=RELATIVE SPIN POLARIZATION = (rhoup-rhodn)/rho */ -/* : t=ABS(GRAD rho)/(rho*2.*KS*G) -- only needed for PBE */ -/* : UU=(GRAD rho)*GRAD(ABS(GRAD rho))/(rho**2 * (2*KS*G)**3) */ -/* : VV=(LAPLACIAN rho)/(rho * (2*KS*G)**2) */ -/* : WW=(GRAD rho)*(GRAD ZET)/(rho * (2*KS*G)**2 */ -/* : UU,VV,WW, only needed for PBE potential */ -/* : lgga=flag to do gga (0=>LSD only) */ -/* : lpot=flag to do potential (0=>energy only) */ -/* output: ec=lsd correlation energy from [a] */ -/* : vcup=lsd up correlation potential */ -/* : vcdn=lsd dn correlation potential */ -/* : h=NONLOCAL PART OF CORRELATION ENERGY PER ELECTRON */ -/* : dvcup=nonlocal correction to vcup */ -/* : dvcdn=nonlocal correction to vcdn */ -/* ---------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------- */ -/* References: */ -/* [a] J.P.~Perdew, K.~Burke, and M.~Ernzerhof, */ -/* {\sl Generalized gradient approximation made simple}, sub. */ -/* to Phys. Rev.Lett. May 1996. */ -/* [b] J. P. Perdew, K. Burke, and Y. Wang, {\sl Real-space cutoff */ -/* construction of a generalized gradient approximation: The PW91 */ -/* density functional}, submitted to Phys. Rev. B, Feb. 1996. */ -/* [c] J. P. Perdew and Y. Wang, Phys. Rev. B {\bf 45}, 13244 (1992). */ -/* ---------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------- */ -/* thrd*=various multiples of 1/3 */ -/* numbers for use in LSD energy spin-interpolation formula, [c](9). */ -/* GAM= 2^(4/3)-2 */ -/* FZZ=f''(0)= 8/(9*GAM) */ -/* numbers for construction of PBE */ -/* gamma=(1-log(2))/pi^2 */ -/* bet=coefficient in gradient expansion for correlation, [a](4). */ -/* eta=small number to stop d phi/ dzeta from blowing up at */ -/* |zeta|=1. */ -/* ---------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------- */ -/* find LSD energy contributions, using [c](10) and Table I[c]. */ -/* EU=unpolarized LSD correlation energy */ -/* EURS=dEU/drs */ -/* EP=fully polarized LSD correlation energy */ -/* EPRS=dEP/drs */ -/* ALFM=-spin stiffness, [c](3). */ -/* ALFRSM=-dalpha/drs */ -/* F=spin-scaling factor from [c](9). */ -/* construct ec, using [c](8) */ - rtrs = sqrt(rs); - gcor2(c_b3, c_b4, c_b5, c_b6, c_b7, c_b8, rtrs, &eu, &eurs); -/* Computing 4th power */ - *ec = eu; -/* ---------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------- */ -/* LSD potential from [c](A1) */ -/* ECRS = dEc/drs [c](A2) */ -/* ECZET=dEc/dzeta [c](A3) */ -/* FZ = dF/dzeta [c](A4) */ -/* Computing 3rd power */ - *vc = eu - rs * eurs / 3.; - if (lgga == 0) { - return; - } -/* ---------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------- */ -/* PBE correlation energy */ -/* G=phi(zeta), given after [a](3) */ -/* DELT=bet/gamma */ -/* B=A of [a](8) */ -/* Computing 3rd power */ - pon = -eu / gamma; - b = delta / (exp(pon) - 1.); - b2 = b * b; - t2 = t * t; - t4 = t2 * t2; - q4 = b * t2 + 1.; - q5 = b * t2 + 1. + b2 * t4; - *h__ = gamma * log(q4 * delta * t2 / q5 + 1.); - if (lpot == 0) { - return; - } -/* ---------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------- */ -/* ENERGY DONE. NOW THE POTENTIAL. */ - tmp1 = q4/q5; - tmp2 = b2*t4*(1.+q4)/(q5*q5); - tmp3 = 1./(1.+delta*t2*tmp1); - - *dvc = *h__ - beta*t2 * (7./3.*tmp1 + tmp2*((b+delta)*(*vc-eu)/beta-7./3.)) * tmp3; - *dv2rho = 0.5*beta*phi*rs*(tmp1 - tmp2) * tmp3; -} /* corpbe_ */ - - -/* ###################################################################### */ -/* ---------------------------------------------------------------------- */ -/* Subroutine */ void corpbespin(double rs, double t, double zet, - int lgga, - int lpot, double *ec, double *vcup, double *vcdown, - double *h__, double *dvcup, double *dvcdown, double *dv2rho) -{ - /* Local variables */ - double b, b2, q4, t2, q5, t4, - ep, eu, pon, - alfm, eprs, eurs, rtrs, f, z4, ecrs, fz, eczet, comm, g, g2, g3, dg; - double tmp1,tmp2,tmp3,tmp4; - double alfrsm; - -/* ---------------------------------------------------------------------- */ -/* Official PBE correlation code. K. Burke, May 14, 1996. */ -/* INPUT: RS=SEITZ RADIUS=(3/4pi rho)^(1/3) */ -/* : ZET=RELATIVE SPIN POLARIZATION = (rhoup-rhodn)/rho */ -/* : t=ABS(GRAD rho)/(rho*2.*KS*G) -- only needed for PBE */ -/* : UU=(GRAD rho)*GRAD(ABS(GRAD rho))/(rho**2 * (2*KS*G)**3) */ -/* : VV=(LAPLACIAN rho)/(rho * (2*KS*G)**2) */ -/* : WW=(GRAD rho)*(GRAD ZET)/(rho * (2*KS*G)**2 */ -/* : UU,VV,WW, only needed for PBE potential */ -/* : lgga=flag to do gga (0=>LSD only) */ -/* : lpot=flag to do potential (0=>energy only) */ -/* output: ec=lsd correlation energy from [a] */ -/* : vcup=lsd up correlation potential */ -/* : vcdn=lsd dn correlation potential */ -/* : h=NONLOCAL PART OF CORRELATION ENERGY PER ELECTRON */ -/* : dvcup=nonlocal correction to vcup */ -/* : dvcdn=nonlocal correction to vcdn */ -/* ---------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------- */ -/* References: */ -/* [a] J.P.~Perdew, K.~Burke, and M.~Ernzerhof, */ -/* {\sl Generalized gradient approximation made simple}, sub. */ -/* to Phys. Rev.Lett. May 1996. */ -/* [b] J. P. Perdew, K. Burke, and Y. Wang, {\sl Real-space cutoff */ -/* construction of a generalized gradient approximation: The PW91 */ -/* density functional}, submitted to Phys. Rev. B, Feb. 1996. */ -/* [c] J. P. Perdew and Y. Wang, Phys. Rev. B {\bf 45}, 13244 (1992). */ -/* ---------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------- */ -/* thrd*=various multiples of 1/3 */ -/* numbers for use in LSD energy spin-interpolation formula, [c](9). */ -/* GAM= 2^(4/3)-2 */ -/* FZZ=f''(0)= 8/(9*GAM) */ -/* numbers for construction of PBE */ -/* gamma=(1-log(2))/pi^2 */ -/* bet=coefficient in gradient expansion for correlation, [a](4). */ -/* eta=small number to stop d phi/ dzeta from blowing up at */ -/* |zeta|=1. */ -/* ---------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------- */ -/* find LSD energy contributions, using [c](10) and Table I[c]. */ -/* EU=unpolarized LSD correlation energy */ -/* EURS=dEU/drs */ -/* EP=fully polarized LSD correlation energy */ -/* EPRS=dEP/drs */ -/* ALFM=-spin stiffness, [c](3). */ -/* ALFRSM=-dalpha/drs */ -/* F=spin-scaling factor from [c](9). */ -/* construct ec, using [c](8) */ - rtrs = sqrt(rs); - gcor2(c_b3, c_b4, c_b5, c_b6, c_b7, c_b8, rtrs, &eu, &eurs); - gcor2(c_b9, c_b10, c_b11, c_b12, c_b13, c_b14, rtrs, &ep, &eprs); - gcor2(c_b15, c_b16, c_b17, c_b18, c_b19, c_b20, rtrs, &alfm, &alfrsm); -/* Computing 4th power */ - z4 = zet*zet*zet*zet; - f = (pow(1.+zet,4./3.)+pow(1.-zet,4./3.)-2.)/GAM; - *ec = eu*(1.-f*z4) + ep*f*z4 - alfm*f*(1.-z4)/fzz; -/* ---------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------- */ -/* LSD potential from [c](A1) */ -/* ECRS = dEc/drs [c](A2) */ -/* ECZET=dEc/dzeta [c](A3) */ -/* FZ = dF/dzeta [c](A4) */ -/* Computing 3rd power */ - ecrs = eurs*(1.-f*z4)+eprs*f*z4-alfrsm*f*(1.-z4)/fzz; - fz = 4./3.*(pow(1.+zet,1./3.)-pow(1.-zet,1./3.))/GAM; - eczet = 4.*pow(zet,3)*f*(ep-eu+alfm/fzz)+fz*(z4*ep-z4*eu-(1.-z4)*alfm/fzz); - comm = *ec - rs*ecrs/3. - zet*eczet; - *vcup = comm + eczet; - *vcdown = comm - eczet; - if (lgga == 0) { - return; - } -/* ---------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------- */ -/* PBE correlation energy */ -/* G=phi(zeta), given after [a](3) */ -/* DELT=bet/gamma */ -/* B=A of [a](8) */ -/* Computing 3rd power */ - g = 0.5*(pow(1.+zet,2./3.)+pow(1.-zet,2./3.)); - g2 = g*g; - g3 = g2*g; - dg = (1./3.) * (pow(1.+zet,-1./3.)-pow(1.-zet,-1./3.)); - pon = -(*ec) / (g3*gamma); - b = delta / (exp(pon) - 1.); - t /= g; - b2 = b * b; - t2 = t * t; - t4 = t2 * t2; - q4 = b * t2 + 1.; - q5 = b * t2 + 1. + b2 * t4; - *h__ = g3 * gamma * log(q4 * delta * t2 / q5 + 1.); - if (lpot == 0) { - return; - } -/* ---------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------- */ -/* ENERGY DONE. NOW THE POTENTIAL. */ - tmp1 = q4/q5; - tmp2 = b2*t4*(1.+q4)/(q5*q5); - tmp3 = 1./(1.+delta*t2*tmp1); - tmp4 = dg * (3.*(*h__)/g - beta*t2*g2*(2.*tmp1 - tmp2*(3.*(b+delta)*(*ec)/(beta*g3)+2.))*tmp3); - - *dvcup = *h__ - beta*g3*t2 * (7./3.*tmp1 + tmp2*((b+delta)*(*vcup-(*ec))/(beta*g3)-7./3.)) * tmp3 - + tmp4*(1.-zet); - *dvcdown = *h__ - beta*g3*t2 * (7./3.*tmp1 + tmp2*((b+delta)*(*vcdown-(*ec))/(beta*g3)-7./3.)) * tmp3 - - tmp4*(1.+zet); - *dv2rho = 0.5*beta*g*phi*rs*(tmp1 - tmp2) * tmp3; -} /* corpbe_ */ diff --git a/external/libbeef/pbecor.h b/external/libbeef/pbecor.h deleted file mode 100755 index a52bf8f18..000000000 --- a/external/libbeef/pbecor.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef pbecor_h -#define pbecor_h 1 - -extern void corpbe(double, double, - int, int, double *, double *, - double *, double *, double *); - -void corpbespin(double, double, double, - int, int, double *, double *, double *, - double *, double *, double *, double *); - -#define invpi075tothird 0.620350490899400016668006812047780 -#define r2k 1.56318528359354405905402280568002 - -#endif diff --git a/install/m4/x_ac_qe_cc.m4 b/install/m4/x_ac_qe_cc.m4 index a1bbe70ff..3ab86989d 100644 --- a/install/m4/x_ac_qe_cc.m4 +++ b/install/m4/x_ac_qe_cc.m4 @@ -9,7 +9,7 @@ case "$arch:$f90_flavor" in *:ifort* ) try_cc="icc ecc $try_cc" ;; -*:pgf90 ) +*:pgf90 | *:nvfortran ) try_cc="pgcc $try_cc" ;; cray*:* ) @@ -45,8 +45,9 @@ try_cpp="cpp" case "$arch:$cc" in *:pgcc ) - # Do I need preprocessing here? try_cflags="-fast -Mpreprocess" + # Workaround for BEEF compilation with PGI v.19 and previous + if test "$f90_flavor" = "pgf90"; then try_cflags="-c11 $try_cflags"; fi ;; crayxt*:cc ) # Actually we need something like is done for ftn to detect diff --git a/upflib/CMakeLists.txt b/upflib/CMakeLists.txt index a8567db59..bb5040125 100644 --- a/upflib/CMakeLists.txt +++ b/upflib/CMakeLists.txt @@ -1,4 +1,4 @@ -set(sources +set(src_upflib atom.f90 atomic_number.f90 upf_erf.f90 @@ -30,38 +30,46 @@ set(sources xmltools.f90 ylmr2.f90) -qe_add_library(qe_upflib ${sources}) -add_library(QE::UPF ALIAS qe_upflib) +qe_add_library(qe_upflib ${src_upflib}) target_link_libraries(qe_upflib PRIVATE - QE::MPI_Fortran - QE::LAPACK - QE::UTILX - QE::FOX) + qe_mpi_fortran + qe_lapack + qe_utilx + qe_fox) +if(QE_ENABLE_CUDA) + target_link_libraries(qe_upflib + PRIVATE + qe_devxlib) +endif() ############################################################## # virtual_v2.x ############################################################## -set(sources virtual_v2.f90) -qe_add_executable(qe_upflib_virtual_v2_exe ${sources}) -set_target_properties(qe_upflib_virtual_v2_exe PROPERTIES OUTPUT_NAME virtual_v2.x) +set(src_virtual_v2_x virtual_v2.f90) +qe_add_executable(qe_upflib_virtual_v2_exe ${src_virtual_v2_x}) +set_target_properties(qe_upflib_virtual_v2_exe + PROPERTIES + OUTPUT_NAME virtual_v2.x) target_link_libraries(qe_upflib_virtual_v2_exe - PRIVATE - QE::UPF) + PRIVATE + qe_upflib) ########################################################### # upfconv.x ########################################################### -set(sources +set(src_upfconv_x upfconv.f90 casino_pp.f90 ) -qe_add_executable(qe_upflib_upfconv_exe ${sources}) -set_target_properties(qe_upflib_upfconv_exe PROPERTIES OUTPUT_NAME upfconv.x) +qe_add_executable(qe_upflib_upfconv_exe ${src_upfconv_x}) +set_target_properties(qe_upflib_upfconv_exe + PROPERTIES + OUTPUT_NAME upfconv.x) target_link_libraries(qe_upflib_upfconv_exe - PRIVATE - QE::UPF) + PRIVATE + qe_upflib) ############################################################################ qe_install_targets(qe_upflib - qe_upflib_virtual_v2_exe - qe_upflib_upfconv_exe) + qe_upflib_virtual_v2_exe + qe_upflib_upfconv_exe)