From 93aba408f9442b65c9ce89802b210bfcf8c3de29 Mon Sep 17 00:00:00 2001 From: Growl Date: Wed, 22 Jul 2026 18:46:34 +0800 Subject: [PATCH 1/3] CMake: Refactor feature build requirements into source/CMakeLists.txt --- CMakeLists.txt | 97 +-------------------------------- source/CMakeLists.txt | 124 ++++++++++++++++++++++++++++++++---------- 2 files changed, 97 insertions(+), 124 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 45e866eb54..3973573205 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,27 +136,6 @@ if(NOT DEFINED NVHPC_ROOT_DIR AND DEFINED ENV{NVHPC_ROOT}) CACHE PATH "Path to NVIDIA HPC SDK root directory.") endif() -# Feature definitions are collected while options and dependencies are resolved -# below. They are applied to targets in source/CMakeLists.txt. -set_property(GLOBAL PROPERTY ABACUS_FEATURE_DEFINITIONS "") - -function(abacus_normalize_definitions out_var) - set(_defs) - foreach(_def IN LISTS ARGN) - if(_def MATCHES "^-D(.+)") - list(APPEND _defs "${CMAKE_MATCH_1}") - else() - list(APPEND _defs "${_def}") - endif() - endforeach() - set(${out_var} ${_defs} PARENT_SCOPE) -endfunction() - -function(abacus_add_feature_definitions) - abacus_normalize_definitions(_defs ${ARGN}) - set_property(GLOBAL APPEND PROPERTY ABACUS_FEATURE_DEFINITIONS ${_defs}) -endfunction() - # enable json support if(ENABLE_RAPIDJSON) find_package(RapidJSON CONFIG REQUIRED) @@ -167,7 +146,6 @@ if(ENABLE_RAPIDJSON) "Check if your RapidJSON installation provides a complete exported CMake configuration." ) endif() - abacus_add_feature_definitions(__RAPIDJSON) endif() # get commit info @@ -193,7 +171,6 @@ if(COMMIT_INFO) WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} RESULT_VARIABLE GIT_COMMIT_DATE_RESULT) if(GIT_COMMIT_HASH_RESULT EQUAL 0 AND GIT_COMMIT_DATE_RESULT EQUAL 0) - abacus_add_feature_definitions(COMMIT_INFO) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/commit.h" "#define COMMIT \"${GIT_COMMIT_HASH} (${GIT_COMMIT_DATE})\"\n") set(ABACUS_COMMIT_INFO_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}") @@ -272,14 +249,6 @@ if (USE_DSP) set(ABACUS_BIN_NAME abacus_dsp) endif() -if (USE_CUDA_ON_DCU) - abacus_add_feature_definitions(__CUDA_ON_DCU) -endif() - -if (USE_CUDA_MPI) - abacus_add_feature_definitions(__CUDA_MPI) -endif() - list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${PROJECT_SOURCE_DIR}/cmake/modules") @@ -359,45 +328,23 @@ if(CMAKE_CXX_COMPILER_ID MATCHES Intel) ) endif() -if(ENABLE_ABACUS_LIBM) - abacus_add_feature_definitions(__ABACUS_LIBM) -endif() - if(ENABLE_NATIVE_OPTIMIZATION) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native") endif() -# Windows (native build, e.g. MinGW-w64 or MSVC) portability defines: -# _USE_MATH_DEFINES - expose M_PI and friends from -# NOMINMAX - stop defining min()/max() macros -# _CRT_SECURE_NO_WARNINGS - silence CRT "use _s function" deprecations -if(WIN32) - abacus_add_feature_definitions(_USE_MATH_DEFINES NOMINMAX _CRT_SECURE_NO_WARNINGS) -endif() - if(ENABLE_LCAO) - abacus_add_feature_definitions(__LCAO) if(ENABLE_ELPA) find_package(ELPA REQUIRED) - abacus_add_feature_definitions(__ELPA) - endif() - if(ENABLE_FFT_TWO_CENTER) - abacus_add_feature_definitions(USE_NEW_TWO_CENTER) endif() if(ENABLE_PEXSI) find_package(PEXSI REQUIRED CONFIG) if(PEXSI_VERSION VERSION_LESS "2.0.0") message(FATAL_ERROR "PEXSI >= 2.0.0 is required") endif() - abacus_add_feature_definitions(__PEXSI) set(CMAKE_CXX_STANDARD 14) endif() endif() -if(DEBUG_INFO) - abacus_add_feature_definitions(__DEBUG) -endif() - if(ENABLE_MPI) if(NOT CMAKE_CROSSCOMPILING) # FindMPI runs a probe executable to determine the MPI library version, @@ -406,18 +353,9 @@ if(ENABLE_MPI) set(MPI_DETERMINE_LIBRARY_VERSION TRUE) endif() find_package(MPI COMPONENTS CXX REQUIRED) - abacus_add_feature_definitions(__MPI) -endif() - - -if (USE_DSP) - abacus_add_feature_definitions(__DSP) endif() - - -if (USE_SW) - abacus_add_feature_definitions(__SW) +if(USE_SW) set(SW ON) endif() @@ -440,10 +378,8 @@ if(USE_KML) endif() find_package(KML REQUIRED COMPONENTS ${_kml_components}) - abacus_add_feature_definitions(__KML) elseif(MKLROOT OR MKL_ROOT) find_package(MKL REQUIRED) - abacus_add_feature_definitions(__MKL) elseif(NOT USE_SW) find_package(Lapack REQUIRED) # ScaLAPACK is a distributed-memory library and is only needed for the @@ -538,8 +474,6 @@ if(USE_CUDA) endif() enable_language(CUDA) if(USE_CUDA) - abacus_add_feature_definitions(__CUDA) - abacus_add_feature_definitions(__UT_USE_CUDA) if (CMAKE_BUILD_TYPE STREQUAL "Debug") set(CMAKE_CUDA_FLAGS_DEBUG "${CMAKE_CUDA_FLAGS_DEBUG} -g -G" CACHE STRING "CUDA flags for debug build" FORCE) endif() @@ -547,7 +481,6 @@ if(USE_CUDA) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=${OpenMP_CXX_FLAGS}" CACHE STRING "CUDA flags" FORCE) endif() if (ENABLE_NCCL_PARALLEL_DEVICE) - abacus_add_feature_definitions(__NCCL_PARALLEL_DEVICE) include(cmake/modules/SetupNccl.cmake) abacus_setup_nccl() endif() @@ -616,9 +549,6 @@ if(USE_ROCM) ) endif() - abacus_add_feature_definitions(__ROCM) - abacus_add_feature_definitions(__UT_USE_ROCM) - abacus_add_feature_definitions(__HIP_PLATFORM_HCC__) endif() if(ENABLE_ASAN) @@ -632,10 +562,6 @@ if(ENABLE_ASAN) add_link_options(-fsanitize=address) endif() -if(ENABLE_FLOAT_FFTW) - abacus_add_feature_definitions(__ENABLE_FLOAT_FFTW) -endif() - if(ENABLE_MLALGO) find_path(libnpy_SOURCE_DIR npy.hpp HINTS ${libnpy_INCLUDE_DIR}) if(NOT libnpy_SOURCE_DIR) @@ -648,8 +574,6 @@ if(ENABLE_MLALGO) FetchContent_MakeAvailable(libnpy) else() endif() - - abacus_add_feature_definitions(__MLALGO) endif() # Torch uses outdated components to detect CUDA arch, causing failure on @@ -683,7 +607,6 @@ if (ENABLE_CNPY) # find ZLIB and link find_package(ZLIB REQUIRED) - abacus_add_feature_definitions(__USECNPY) endif() function(git_submodule_update) @@ -714,11 +637,6 @@ if(ENABLE_LIBRI) find_package(LibRI REQUIRED) find_package(LibComm REQUIRED) find_package(cereal REQUIRED CONFIG) - abacus_add_feature_definitions(__EXX EXX_DM=3 EXX_H_COMM=2 TEST_EXX_LCAO=0 - TEST_EXX_RADIAL=1) - if(ENABLE_EXX_DEV) - abacus_add_feature_definitions(__EXX_DEV) - endif() endif() if(ENABLE_LIBXC) @@ -726,35 +644,22 @@ if(ENABLE_LIBXC) if(Libxc_VERSION VERSION_LESS "5.1.7") message(FATAL_ERROR "Libxc >= 5.1.7 is required") endif() - abacus_add_feature_definitions(USE_LIBXC) endif() if(DEFINED DeePMD_DIR) - abacus_add_feature_definitions(__DPMD HIGH_PREC) - add_compile_options(-Wl,--no-as-needed) find_package(DeePMD REQUIRED) - if(DeePMDC_FOUND) - abacus_add_feature_definitions(__DPMDC) - endif() endif() if(DEFINED NEP_DIR) find_package(NEP REQUIRED) - - if(NEP_FOUND) - abacus_add_feature_definitions(__NEP) - endif() endif() if(DEFINED TensorFlow_DIR) find_package(TensorFlow REQUIRED) endif() -abacus_add_feature_definitions(__FFTW3 __SELINV METIS) - if(MATH_INFO) message(STATUS "Will gather math lib info.") - abacus_add_feature_definitions(GATHER_INFO) # modifications on blas_connector and lapack_connector endif() diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 7273c6b8d7..e1d6eccc99 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -28,6 +28,56 @@ add_library(abacus_compile_requirements INTERFACE) add_library(abacus::compile_requirements ALIAS abacus_compile_requirements) +set(_abacus_feature_definitions + __FFTW3 + $<$:__RAPIDJSON> + $<$:__CUDA_ON_DCU> + $<$:__CUDA_MPI> + $<$:__ABACUS_LIBM> + $<$:_USE_MATH_DEFINES> + $<$:NOMINMAX> + $<$:_CRT_SECURE_NO_WARNINGS> + $<$:__LCAO> + $<$:__ELPA> + $<$:USE_NEW_TWO_CENTER> + $<$:__PEXSI> + $<$:__DEBUG> + $<$:__MPI> + $<$:__DSP> + $<$:__SW> + $<$:__KML> + $<$>,$>:__MKL> + $<$:__CUDA> + $<$:__UT_USE_CUDA> + $<$:__NCCL_PARALLEL_DEVICE> + $<$:__ROCM> + $<$:__UT_USE_ROCM> + $<$:__HIP_PLATFORM_HCC__> + $<$:__ENABLE_FLOAT_FFTW> + $<$:__MLALGO> + $<$:__USECNPY> + $<$:__EXX> + $<$:EXX_DM=3> + $<$:EXX_H_COMM=2> + $<$:TEST_EXX_LCAO=0> + $<$:TEST_EXX_RADIAL=1> + $<$:__EXX_DEV> + $<$:USE_LIBXC> + $<$:GATHER_INFO>) + +if(ABACUS_COMMIT_INFO_INCLUDE_DIR) + list(APPEND _abacus_feature_definitions COMMIT_INFO) +endif() +if(DEFINED DeePMD_DIR) + list(APPEND _abacus_feature_definitions __DPMD HIGH_PREC) + if(DeePMDC_FOUND) + list(APPEND _abacus_feature_definitions __DPMDC) + endif() +endif() +if(DEFINED NEP_DIR AND NEP_FOUND) + list(APPEND _abacus_feature_definitions __NEP) +endif() + target_include_directories(abacus_compile_requirements INTERFACE ${ABACUS_SOURCE_DIR} ${ABACUS_SOURCE_DIR}/source_base/module_container) @@ -184,22 +234,19 @@ endif() # Optional external feature libraries # ------------------------------------------------------------------------------ -set(_abacus_feature_libs) +set(_abacus_feature_libs + $<$:RapidJSON> + $<$:ELPA::ELPA> + $<$:PEXSI::PEXSI> + $<$:cnpy> + $<$:ZLIB::ZLIB> + $<$:cereal::cereal> + $<$:Libxc::xc>) set(_abacus_feature_include_dirs) set(_abacus_feature_compile_options) -if(ENABLE_RAPIDJSON) - list(APPEND _abacus_feature_libs RapidJSON) -endif() - -if(ENABLE_LCAO) - if(ENABLE_ELPA) - list(APPEND _abacus_feature_libs ELPA::ELPA) - list(APPEND _abacus_feature_include_dirs ${ELPA_INCLUDE_DIR}) - endif() - if(ENABLE_PEXSI) - list(APPEND _abacus_feature_libs PEXSI::PEXSI) - endif() +if(ENABLE_ELPA) + list(APPEND _abacus_feature_include_dirs ${ELPA_INCLUDE_DIR}) endif() if(ENABLE_MLALGO) @@ -217,7 +264,6 @@ if(ENABLE_MLALGO OR DEFINED Torch_DIR) endif() if(ENABLE_CNPY) - list(APPEND _abacus_feature_libs cnpy ZLIB::ZLIB) if(cnpy_INCLUDE_DIR) list(APPEND _abacus_feature_include_dirs ${cnpy_INCLUDE_DIR}) endif() @@ -229,13 +275,7 @@ endif() if(ENABLE_LIBRI) list(APPEND _abacus_feature_include_dirs ${LIBRI_DIR}/include - ${LIBCOMM_DIR}/include - ) - list(APPEND _abacus_feature_libs cereal::cereal) -endif() - -if(ENABLE_LIBXC) - list(APPEND _abacus_feature_libs Libxc::xc) + ${LIBCOMM_DIR}/include) endif() if(DEFINED DeePMD_DIR) @@ -309,6 +349,10 @@ endif() target_link_libraries(abacus_feature_libs INTERFACE ${_abacus_feature_libs}) +if(DEFINED DeePMD_DIR AND UNIX AND NOT APPLE) + target_link_options(abacus_feature_libs INTERFACE "LINKER:--no-as-needed") +endif() + target_include_directories(abacus_compile_requirements INTERFACE ${_abacus_feature_include_dirs}) target_compile_options(abacus_compile_requirements INTERFACE @@ -342,6 +386,18 @@ endforeach() # Per-target feature definitions and common compile usage requirements # ------------------------------------------------------------------------------ +function(abacus_normalize_definitions out_var) + set(_defs) + foreach(_def IN LISTS ARGN) + if(_def MATCHES "^-D(.+)") + list(APPEND _defs "${CMAKE_MATCH_1}") + else() + list(APPEND _defs "${_def}") + endif() + endforeach() + set(${out_var} ${_defs} PARENT_SCOPE) +endfunction() + define_property( DIRECTORY PROPERTY ABACUS_DISABLED_FEATURE_DEFINITIONS @@ -358,12 +414,14 @@ define_property( function(abacus_disable_feature_definitions) abacus_normalize_definitions(_defs ${ARGN}) - set_property(DIRECTORY APPEND PROPERTY ABACUS_DISABLED_FEATURE_DEFINITIONS ${_defs}) + set_property(DIRECTORY APPEND PROPERTY + ABACUS_DISABLED_FEATURE_DEFINITIONS ${_defs}) endfunction() function(abacus_add_local_feature_definitions) abacus_normalize_definitions(_defs ${ARGN}) - set_property(DIRECTORY APPEND PROPERTY ABACUS_LOCAL_FEATURE_DEFINITIONS ${_defs}) + set_property(DIRECTORY APPEND PROPERTY + ABACUS_LOCAL_FEATURE_DEFINITIONS ${_defs}) endfunction() function(abacus_apply_build_options target) @@ -382,19 +440,21 @@ function(abacus_apply_build_options target) endif() get_target_property(_source_dir "${target}" SOURCE_DIR) - get_property(_defs GLOBAL PROPERTY ABACUS_FEATURE_DEFINITIONS) + set(_defs "${_abacus_feature_definitions}") get_property(_disabled DIRECTORY "${_source_dir}" PROPERTY ABACUS_DISABLED_FEATURE_DEFINITIONS) get_property(_local DIRECTORY "${_source_dir}" PROPERTY ABACUS_LOCAL_FEATURE_DEFINITIONS) if(_disabled) - list(REMOVE_ITEM _defs ${_disabled}) + # Filter after conditional definitions have been evaluated. + string(JOIN "|" _disabled_regex ${_disabled}) + set(_defs "$") endif() if(_local) list(APPEND _defs ${_local}) endif() if(_defs) - list(REMOVE_DUPLICATES _defs) - target_compile_definitions("${target}" PRIVATE ${_defs}) + target_compile_definitions("${target}" PRIVATE + "$") endif() target_link_libraries("${target}" PRIVATE abacus::compile_requirements) @@ -681,7 +741,15 @@ install(PROGRAMS ${ABACUS_BIN_PATH} TYPE BIN) # Windows because symlink creation needs elevated/developer-mode privileges and # the executable carries an .exe suffix anyway. if(NOT WIN32) - install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${ABACUS_BIN_NAME} ${CMAKE_INSTALL_PREFIX}/bin/abacus WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin)") + install( + CODE " + execute_process( + COMMAND ${CMAKE_COMMAND} -E create_symlink + ${ABACUS_BIN_NAME} + ${CMAKE_INSTALL_PREFIX}/bin/abacus + WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin + COMMAND_ERROR_IS_FATAL ANY) + ") endif() if(ENABLE_COVERAGE) From e026e646dbe1a0e1c17721d2dad0bd6072b1d96d Mon Sep 17 00:00:00 2001 From: Growl Date: Fri, 24 Jul 2026 11:58:36 +0800 Subject: [PATCH 2/3] Rename feature compile definitions (suggested by @ZhouXY-PKU) --- source/CMakeLists.txt | 8 ++++---- source/source_base/math_chebyshev.cpp | 6 +++--- source/source_base/math_chebyshev.h | 2 +- source/source_base/module_fft/fft_bundle.cpp | 2 +- .../source_base/test/math_chebyshev_test.cpp | 4 ++-- .../test_parallel/math_chebyshev_mpi_test.cpp | 4 ++-- source/source_basis/module_pw/test/pw_test.cpp | 2 +- .../source_basis/module_pw/test/test-big.cpp | 2 +- .../source_basis/module_pw/test/test-other.cpp | 18 +++++++++--------- .../source_basis/module_pw/test/test1-2-2.cpp | 12 ++++++------ source/source_basis/module_pw/test/test1-2.cpp | 12 ++++++------ source/source_basis/module_pw/test/test1-3.cpp | 12 ++++++------ source/source_basis/module_pw/test/test1-4.cpp | 18 +++++++++--------- source/source_basis/module_pw/test/test1-5.cpp | 18 +++++++++--------- source/source_basis/module_pw/test/test2-2.cpp | 2 +- source/source_basis/module_pw/test/test2-3.cpp | 2 +- source/source_basis/module_pw/test/test3-2.cpp | 2 +- .../source_basis/module_pw/test/test3-3-2.cpp | 2 +- source/source_basis/module_pw/test/test3-3.cpp | 2 +- source/source_basis/module_pw/test/test4-2.cpp | 12 ++++++------ source/source_basis/module_pw/test/test4-3.cpp | 12 ++++++------ source/source_basis/module_pw/test/test4-4.cpp | 18 +++++++++--------- source/source_basis/module_pw/test/test4-5.cpp | 18 +++++++++--------- .../source_basis/module_pw/test/test5-3-1.cpp | 12 ++++++------ .../source_basis/module_pw/test/test5-4-1.cpp | 12 ++++++------ .../source_basis/module_pw/test/test5-4-2.cpp | 12 ++++++------ .../source_basis/module_pw/test/test6-3-1.cpp | 12 ++++++------ .../source_basis/module_pw/test/test6-4-1.cpp | 12 ++++++------ .../source_basis/module_pw/test/test6-4-2.cpp | 12 ++++++------ .../source_basis/module_pw/test/test7-2-1.cpp | 2 +- .../source_basis/module_pw/test/test7-3-1.cpp | 2 +- .../source_basis/module_pw/test/test7-3-2.cpp | 2 +- .../source_basis/module_pw/test/test8-2-1.cpp | 2 +- .../source_basis/module_pw/test/test8-3-1.cpp | 2 +- .../source_basis/module_pw/test/test8-3-2.cpp | 2 +- source/source_estate/module_pot/pot_xc.cpp | 4 ++-- .../module_surchem/test/CMakeLists.txt | 2 +- source/source_hamilt/module_xc/libxc_abacus.h | 4 ++-- .../source_hamilt/module_xc/libxc_gga_wrap.cpp | 2 +- .../source_hamilt/module_xc/libxc_lda_wrap.cpp | 2 +- .../module_xc/libxc_mgga_wrap.cpp | 2 +- source/source_hamilt/module_xc/libxc_pot.cpp | 2 +- source/source_hamilt/module_xc/libxc_setup.cpp | 2 +- source/source_hamilt/module_xc/libxc_tools.cpp | 2 +- .../source_hamilt/module_xc/xc_functional.cpp | 12 ++++++------ source/source_hamilt/module_xc/xc_functional.h | 4 ++-- source/source_hamilt/module_xc/xc_gga_wrap.cpp | 2 +- source/source_hamilt/module_xc/xc_grad.cpp | 6 +++--- source/source_hamilt/module_xc/xc_lda_wrap.cpp | 4 ++-- source/source_hamilt/module_xc/xc_pot.cpp | 6 +++--- .../source_io/module_chgpot/write_libxc_r.cpp | 4 ++-- source/source_io/module_chgpot/write_libxc_r.h | 4 ++-- .../source_io/module_ctrl/ctrl_output_fp.cpp | 4 ++-- source/source_io/module_ml/io_npz.cpp | 6 +++--- .../read_input_item_output.cpp | 8 ++++---- .../read_input_item_system.cpp | 4 ++-- .../module_parameter/read_set_globalv.cpp | 2 +- .../test_serial/read_input_item_test.cpp | 2 +- source/source_lcao/LCAO_init_basis.cpp | 2 +- .../ao_to_mo_transformer/test/CMakeLists.txt | 2 +- .../module_lr/dm_trans/test/CMakeLists.txt | 2 +- .../module_lr/esolver_lrtd_lcao.cpp | 2 +- .../module_lr/potentials/pot_hxc_lrtd.cpp | 2 +- .../module_lr/potentials/xc_kernel.cpp | 6 +++--- .../module_lr/potentials/xc_kernel.h | 2 +- .../module_lr/utils/test/CMakeLists.txt | 2 +- .../module_operator_lcao/test/CMakeLists.txt | 2 +- source/source_pw/module_pwdft/forces_cc.cpp | 4 ++-- source/source_pw/module_pwdft/setup_pwrho.cpp | 2 +- source/source_pw/module_pwdft/setup_pwwfc.cpp | 2 +- source/source_pw/module_pwdft/stress_cc.cpp | 4 ++-- source/source_pw/module_stodft/sto_elecond.cpp | 2 +- source/source_pw/module_stodft/sto_elecond.h | 2 +- source/source_pw/module_stodft/sto_func.cpp | 2 +- source/source_pw/module_stodft/sto_tool.cpp | 4 ++-- 75 files changed, 204 insertions(+), 204 deletions(-) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index e1d6eccc99..8eee24b465 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -39,7 +39,7 @@ set(_abacus_feature_definitions $<$:_CRT_SECURE_NO_WARNINGS> $<$:__LCAO> $<$:__ELPA> - $<$:USE_NEW_TWO_CENTER> + $<$:__FFT_TWO_CENTER> $<$:__PEXSI> $<$:__DEBUG> $<$:__MPI> @@ -53,16 +53,16 @@ set(_abacus_feature_definitions $<$:__ROCM> $<$:__UT_USE_ROCM> $<$:__HIP_PLATFORM_HCC__> - $<$:__ENABLE_FLOAT_FFTW> + $<$:__FLOAT_FFTW> $<$:__MLALGO> - $<$:__USECNPY> + $<$:__CNPY> $<$:__EXX> $<$:EXX_DM=3> $<$:EXX_H_COMM=2> $<$:TEST_EXX_LCAO=0> $<$:TEST_EXX_RADIAL=1> $<$:__EXX_DEV> - $<$:USE_LIBXC> + $<$:__LIBXC> $<$:GATHER_INFO>) if(ABACUS_COMMIT_INFO_INCLUDE_DIR) diff --git a/source/source_base/math_chebyshev.cpp b/source/source_base/math_chebyshev.cpp index b7e59a89f9..9bf4e93aa7 100644 --- a/source/source_base/math_chebyshev.cpp +++ b/source/source_base/math_chebyshev.cpp @@ -28,7 +28,7 @@ void FFTW::execute_fftw() fftw_execute(this->coef_plan); } -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW FFTW::FFTW(const int norder2_in) { ccoef = (fftwf_complex*)fftw_malloc(sizeof(fftwf_complex) * norder2_in); @@ -762,12 +762,12 @@ bool Chebyshev::checkconverge( // we only have two examples: double and float. template class Chebyshev; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW template class Chebyshev; #endif #if ((defined __CUDA) || (defined __ROCM)) template class Chebyshev; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW template class Chebyshev; #endif #endif diff --git a/source/source_base/math_chebyshev.h b/source/source_base/math_chebyshev.h index 3d534b911c..cd66b6a110 100644 --- a/source/source_base/math_chebyshev.h +++ b/source/source_base/math_chebyshev.h @@ -253,7 +253,7 @@ class FFTW fftw_plan coef_plan; }; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW template <> class FFTW { diff --git a/source/source_base/module_fft/fft_bundle.cpp b/source/source_base/module_fft/fft_bundle.cpp index a1292c34e4..2bca85aefc 100644 --- a/source/source_base/module_fft/fft_bundle.cpp +++ b/source/source_base/module_fft/fft_bundle.cpp @@ -54,7 +54,7 @@ void FFT_Bundle::initfft(int nx_in, { double_flag = true; } -#if not defined(__ENABLE_FLOAT_FFTW) +#if not defined(__FLOAT_FFTW) if (this->device == "cpu") { ModuleBase::WARNING_QUIT("FFT_Bundle", "Please enable float fftw in the cmake to use float fft"); diff --git a/source/source_base/test/math_chebyshev_test.cpp b/source/source_base/test/math_chebyshev_test.cpp index ada96fe0f9..85838354c6 100644 --- a/source/source_base/test/math_chebyshev_test.cpp +++ b/source/source_base/test/math_chebyshev_test.cpp @@ -56,7 +56,7 @@ class toolfunc spin_out[LDA * i + 1] = factor * j * spin_in[LDA * i]; } } -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW float x7(float x) { return pow(x, 7); @@ -394,7 +394,7 @@ TEST_F(MathChebyshevTest, recurs) delete p_chetest; } -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW TEST_F(MathChebyshevTest, calcoef_real_float) { auto fun_x6f = [&](float x) { return fun.x6(x); }; diff --git a/source/source_base/test_parallel/math_chebyshev_mpi_test.cpp b/source/source_base/test_parallel/math_chebyshev_mpi_test.cpp index 09bcfb1bab..e628bb1274 100644 --- a/source/source_base/test_parallel/math_chebyshev_mpi_test.cpp +++ b/source/source_base/test_parallel/math_chebyshev_mpi_test.cpp @@ -52,7 +52,7 @@ class toolfunc spin_out[LDA * i + 1] = factor * j * spin_in[LDA * i]; } } -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW float x7(float x) { return pow(x, 7); @@ -164,7 +164,7 @@ TEST_F(MathChebyshevTest, checkconverge) delete p_chetest; } -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW TEST_F(MathChebyshevTest, checkconverge_float) { const int norder = 100; diff --git a/source/source_basis/module_pw/test/pw_test.cpp b/source/source_basis/module_pw/test/pw_test.cpp index 0377802c43..47787fbf13 100644 --- a/source/source_basis/module_pw/test/pw_test.cpp +++ b/source/source_basis/module_pw/test/pw_test.cpp @@ -38,7 +38,7 @@ int main(int argc, char **argv) { int kpar; kpar = 1; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW precision_flag = "mixing"; #else precision_flag = "double"; diff --git a/source/source_basis/module_pw/test/test-big.cpp b/source/source_basis/module_pw/test/test-big.cpp index f1c2082d0b..eca02c91a2 100644 --- a/source/source_basis/module_pw/test/test-big.cpp +++ b/source/source_basis/module_pw/test/test-big.cpp @@ -77,7 +77,7 @@ TEST_F(PWTEST,test_big) delete p_pw; delete p_pwk; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW fftwf_cleanup(); #endif } diff --git a/source/source_basis/module_pw/test/test-other.cpp b/source/source_basis/module_pw/test/test-other.cpp index e6efa90654..6cd746f776 100644 --- a/source/source_basis/module_pw/test/test-other.cpp +++ b/source/source_basis/module_pw/test/test-other.cpp @@ -40,7 +40,7 @@ TEST_F(PWTEST,test_other) pwktest.initparameters(true, 20, nks, kvec_d); pwktest.setuptransform(); pwktest.collect_local_pw(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwktest.set_precision("single"); #endif pwktest.initparameters(true, 8, nks, kvec_d); @@ -49,7 +49,7 @@ TEST_F(PWTEST,test_other) const int nrxx = pwktest.nrxx; std::complex * rhor1 = new std::complex [nrxx]; std::complex * rhor2 = new std::complex [nrxx]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofr1 = new complex [nrxx]; complex * rhofr2 = new complex [nrxx]; #endif @@ -59,7 +59,7 @@ TEST_F(PWTEST,test_other) const int npwk = pwktest.npwk[ik]; std::complex * rhog1 = new std::complex [npwk]; std::complex * rhog2 = new std::complex [npwk]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofg1 = new complex [npwk]; complex * rhofg2 = new complex [npwk]; #endif @@ -68,7 +68,7 @@ TEST_F(PWTEST,test_other) rhog1[ig] = 1.0/(pwktest.getgk2(ik,ig)+1) + ModuleBase::IMAG_UNIT / (std::abs(pwktest.getgdirect(ik,ig).x+1) + 1); rhog2[ig] = 1.0/(pwktest.getgk2(ik,ig)+1) + ModuleBase::IMAG_UNIT / (std::abs(pwktest.getgdirect(ik,ig).x+1) + 1); } -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW for(int ig = 0 ; ig < npwk ; ++ig) { rhofg1[ig] = 1.0/(pwktest.getgk2(ik,ig)+1) + ModuleBase::IMAG_UNIT / (std::abs(pwktest.getgdirect(ik,ig).x+1) + 1); @@ -88,7 +88,7 @@ TEST_F(PWTEST,test_other) { EXPECT_NEAR(std::abs(rhog1[ig]),std::abs(rhog2[ig]),1e-8); } -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwktest.recip_to_real(ctx, rhofg1, rhofr1, ik); pwktest.recip2real(rhofg2, rhofr2, ik); for(int ir = 0 ; ir < nrxx; ++ir) @@ -107,14 +107,14 @@ TEST_F(PWTEST,test_other) delete [] rhog1; delete [] rhog2; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete [] rhofg1; delete [] rhofg2; #endif } delete [] rhor1; delete [] rhor2; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete [] rhofr1; delete [] rhofr2; #endif @@ -123,7 +123,7 @@ TEST_F(PWTEST,test_other) double* d_kvec_c = pwktest.get_kvec_c_data(); double* d_gcar = pwktest.get_gcar_data(); double* d_gk2 = pwktest.get_gk2_data(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW float* s_kvec_c = pwktest.get_kvec_c_data(); float* s_gcar = pwktest.get_gcar_data(); float* s_gk2 = pwktest.get_gk2_data(); @@ -136,7 +136,7 @@ TEST_F(PWTEST,test_other) delete p_pw; delete p_pwk; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW fftwf_cleanup(); #endif } diff --git a/source/source_basis/module_pw/test/test1-2-2.cpp b/source/source_basis/module_pw/test/test1-2-2.cpp index 45df3c906d..559cc39a24 100644 --- a/source/source_basis/module_pw/test/test1-2-2.cpp +++ b/source/source_basis/module_pw/test/test1-2-2.cpp @@ -119,7 +119,7 @@ TEST_F(PWTEST,test1_2_2) } } double * rhor = new double [nrxx]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofg = new complex [npw]; complex * rhofgr = new complex [nmaxgr]; complex * rhofgout = new complex [npw]; @@ -145,7 +145,7 @@ TEST_F(PWTEST,test1_2_2) pwtest.recip2real(rhogr,(double*)rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.recip2real(rhofg,rhofr);//check out-of-place transform pwtest.recip2real(rhofgr,(float*)rhofgr);//check in-place transform @@ -158,7 +158,7 @@ TEST_F(PWTEST,test1_2_2) { EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhor[ixy*nplane+iz],1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),((double*)rhogr)[ixy*nplane+iz],1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofr[ixy*nplane+iz],1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),((float*)rhofgr)[ixy*nplane+iz],1e-4); #endif @@ -171,7 +171,7 @@ TEST_F(PWTEST,test1_2_2) pwtest.real2recip((double*)rhogr,rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.real2recip(rhofr,rhofgout);//check out-of-place transform pwtest.real2recip((float*)rhofgr,rhofgr);//check in-place transform @@ -183,7 +183,7 @@ TEST_F(PWTEST,test1_2_2) EXPECT_NEAR(rhog[ig].imag(),rhogout[ig].imag(),1e-6); EXPECT_NEAR(rhogr[ig].real(),rhogout[ig].real(),1e-6); EXPECT_NEAR(rhogr[ig].imag(),rhogout[ig].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(rhofg[ig].real(),rhofgout[ig].real(),1e-4); EXPECT_NEAR(rhofg[ig].imag(),rhofgout[ig].imag(),1e-4); EXPECT_NEAR(rhofgr[ig].real(),rhofgout[ig].real(),1e-4); @@ -198,7 +198,7 @@ TEST_F(PWTEST,test1_2_2) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete [] rhofg; delete [] rhofgout; delete [] rhofr; diff --git a/source/source_basis/module_pw/test/test1-2.cpp b/source/source_basis/module_pw/test/test1-2.cpp index b5bd1c29ab..127f064713 100644 --- a/source/source_basis/module_pw/test/test1-2.cpp +++ b/source/source_basis/module_pw/test/test1-2.cpp @@ -113,7 +113,7 @@ TEST_F(PWTEST,test1_2) rhogr[ig] = 1.0/(pwtest.gg[ig]+1) + ModuleBase::IMAG_UNIT / (std::abs(pwtest.gdirect[ig].x+1) + 1); } std::complex * rhor = new std::complex [nrxx]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofg = new complex [npw]; complex * rhofgr = new complex [nmaxgr]; complex * rhofgout = new complex [npw]; @@ -129,7 +129,7 @@ TEST_F(PWTEST,test1_2) pwtest.recip2real(rhogr,rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.recip2real(rhofg,rhofr);//check out-of-place transform pwtest.recip2real(rhofgr,rhofgr);//check in-place transform @@ -144,7 +144,7 @@ TEST_F(PWTEST,test1_2) EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhor[ixy*nplane+iz].imag(),1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhogr[ixy*nplane+iz].real(),1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhogr[ixy*nplane+iz].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofr[ixy*nplane+iz].real(),1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhofr[ixy*nplane+iz].imag(),1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofgr[ixy*nplane+iz].real(),1e-4); @@ -159,7 +159,7 @@ TEST_F(PWTEST,test1_2) pwtest.real2recip(rhogr,rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.real2recip(rhofr,rhofgout);//check out-of-place transform pwtest.real2recip(rhofgr,rhofgr);//check in-place transform @@ -171,7 +171,7 @@ TEST_F(PWTEST,test1_2) EXPECT_NEAR(rhog[ig].imag(),rhogout[ig].imag(),1e-6); EXPECT_NEAR(rhogr[ig].real(),rhogout[ig].real(),1e-6); EXPECT_NEAR(rhogr[ig].imag(),rhogout[ig].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(rhofg[ig].real(),rhofgout[ig].real(),1e-4); EXPECT_NEAR(rhofg[ig].imag(),rhofgout[ig].imag(),1e-4); EXPECT_NEAR(rhofgr[ig].real(),rhofgout[ig].real(),1e-4); @@ -186,7 +186,7 @@ TEST_F(PWTEST,test1_2) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete [] rhofg; delete [] rhofgout; delete [] rhofr; diff --git a/source/source_basis/module_pw/test/test1-3.cpp b/source/source_basis/module_pw/test/test1-3.cpp index 961260a47d..e877d32110 100644 --- a/source/source_basis/module_pw/test/test1-3.cpp +++ b/source/source_basis/module_pw/test/test1-3.cpp @@ -114,7 +114,7 @@ TEST_F(PWTEST,test1_3) } } double * rhor = new double [nrxx]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofg = new complex [npw]; complex * rhofgr = new complex [nmaxgr]; complex * rhofgout = new complex [npw]; @@ -135,7 +135,7 @@ TEST_F(PWTEST,test1_3) pwtest.recip2real(rhogr,(double*)rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.recip2real(rhofg,rhofr);//check out-of-place transform pwtest.recip2real(rhofgr,(float*)rhofgr);//check in-place transform @@ -148,7 +148,7 @@ TEST_F(PWTEST,test1_3) { EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhor[ixy*nplane+iz],1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),((double*)rhogr)[ixy*nplane+iz],1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofr[ixy*nplane+iz],1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),((float*)rhofgr)[ixy*nplane+iz],1e-4); #endif @@ -160,7 +160,7 @@ TEST_F(PWTEST,test1_3) pwtest.real2recip((double*)rhogr,rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.real2recip(rhofr,rhofgout);//check out-of-place transform pwtest.real2recip((float*)rhofgr,rhofgr);//check in-place transform @@ -172,7 +172,7 @@ TEST_F(PWTEST,test1_3) EXPECT_NEAR(rhog[ig].imag(),rhogout[ig].imag(),1e-6); EXPECT_NEAR(rhogr[ig].real(),rhogout[ig].real(),1e-6); EXPECT_NEAR(rhogr[ig].imag(),rhogout[ig].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(rhofg[ig].real(),rhofgout[ig].real(),1e-4); EXPECT_NEAR(rhofg[ig].imag(),rhofgout[ig].imag(),1e-4); EXPECT_NEAR(rhofgr[ig].real(),rhofgout[ig].real(),1e-4); @@ -187,7 +187,7 @@ TEST_F(PWTEST,test1_3) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete [] rhofg; delete [] rhofgout; delete [] rhofr; diff --git a/source/source_basis/module_pw/test/test1-4.cpp b/source/source_basis/module_pw/test/test1-4.cpp index 61d403c30e..c390e4d405 100644 --- a/source/source_basis/module_pw/test/test1-4.cpp +++ b/source/source_basis/module_pw/test/test1-4.cpp @@ -69,7 +69,7 @@ TEST_F(PWTEST,test1_4) std::complex *tmp = new std::complex [nx*ny*nz]; std::complex * rhor = new std::complex [nrxx]; std::complex * rhogr = new std::complex [nmaxgr]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofr = new complex [nrxx]; complex * rhofgr = new complex [nmaxgr]; #endif @@ -122,7 +122,7 @@ TEST_F(PWTEST,test1_4) #endif std::complex * rhog = new std::complex [npwk]; std::complex * rhogout = new std::complex [npwk]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofg = new complex [npwk]; complex * rhofgout = new complex [npwk]; #endif @@ -131,7 +131,7 @@ TEST_F(PWTEST,test1_4) rhog[ig] = 1.0/(pwtest.getgk2(ik,ig)+1) + ModuleBase::IMAG_UNIT / (std::abs(pwtest.getgdirect(ik,ig).x+1) + 1); rhogr[ig] = 1.0/(pwtest.getgk2(ik,ig)+1) + ModuleBase::IMAG_UNIT / (std::abs(pwtest.getgdirect(ik,ig).x+1) + 1); } -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW for(int ig = 0 ; ig < npwk ; ++ig) { rhofg[ig] = 1.0/(pwtest.getgk2(ik,ig)+1) + ModuleBase::IMAG_UNIT / (std::abs(pwtest.getgdirect(ik,ig).x+1) + 1); @@ -143,7 +143,7 @@ TEST_F(PWTEST,test1_4) pwtest.recip2real(rhogr,rhogr,ik); //check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.recip2real(rhofg,rhofr,ik); //check out-of-place transform pwtest.recip2real(rhofgr,rhofgr,ik); //check in-place transform @@ -158,7 +158,7 @@ TEST_F(PWTEST,test1_4) EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhor[ixy*nplane+iz].imag(),1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhogr[ixy*nplane+iz].real(),1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhogr[ixy*nplane+iz].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofr[ixy*nplane+iz].real(),1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhofr[ixy*nplane+iz].imag(),1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofgr[ixy*nplane+iz].real(),1e-4); @@ -170,7 +170,7 @@ TEST_F(PWTEST,test1_4) pwtest.real2recip(rhor,rhogout,ik); pwtest.real2recip(rhogr,rhogr,ik); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.real2recip(rhofr,rhofgout,ik); pwtest.real2recip(rhofgr,rhofgr,ik); @@ -182,7 +182,7 @@ TEST_F(PWTEST,test1_4) EXPECT_NEAR(rhog[ig].imag(),rhogout[ig].imag(),1e-6); EXPECT_NEAR(rhog[ig].real(),rhogr[ig].real(),1e-6); EXPECT_NEAR(rhog[ig].imag(),rhogr[ig].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(rhofg[ig].real(),rhofgout[ig].real(),1e-4); EXPECT_NEAR(rhofg[ig].imag(),rhofgout[ig].imag(),1e-4); EXPECT_NEAR(rhofg[ig].real(),rhofgr[ig].real(),1e-4); @@ -193,7 +193,7 @@ TEST_F(PWTEST,test1_4) delete [] rhog; delete [] rhogout; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete [] rhofg; delete [] rhofgout; #endif @@ -215,7 +215,7 @@ TEST_F(PWTEST,test1_4) delete[] kvec_d; delete[] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete[] rhofr; delete[] rhofgr; fftwf_cleanup(); diff --git a/source/source_basis/module_pw/test/test1-5.cpp b/source/source_basis/module_pw/test/test1-5.cpp index 7f07659d2d..b7fc738076 100644 --- a/source/source_basis/module_pw/test/test1-5.cpp +++ b/source/source_basis/module_pw/test/test1-5.cpp @@ -60,7 +60,7 @@ TEST_F(PWTEST,test1_5) std::complex *tmp = new std::complex [nx*ny*nz]; std::complex * rhogr = new std::complex [nmaxgr]; double * rhor = new double [nrxx]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW float * rhofr = new float [nrxx]; complex * rhofgr = new complex [nmaxgr]; #endif @@ -115,7 +115,7 @@ TEST_F(PWTEST,test1_5) #endif std::complex * rhog = new std::complex [npwk]; std::complex * rhogout = new std::complex [npwk]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofg = new complex [npwk]; complex * rhofgout = new complex [npwk]; #endif @@ -130,7 +130,7 @@ TEST_F(PWTEST,test1_5) rhogr[ig]+=ModuleBase::IMAG_UNIT / (std::abs(f.x+1) + 1); } } -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW for(int ig = 0 ; ig < npwk ; ++ig) { rhofg[ig] = 1.0/(pwtest.getgk2(ik,ig)+1); @@ -148,7 +148,7 @@ TEST_F(PWTEST,test1_5) pwtest.recip2real(rhogr,(double*)rhogr,ik); //check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.recip2real(rhofg,rhofr,ik); //check out-of-place transform pwtest.recip2real(rhofgr,(float*)rhofgr,ik); //check in-place transform @@ -161,7 +161,7 @@ TEST_F(PWTEST,test1_5) { EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhor[ixy*nplane+iz],1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),((double*)rhogr)[ixy*nplane+iz],1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofr[ixy*nplane+iz],1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),((float*)rhofgr)[ixy*nplane+iz],1e-4); #endif @@ -172,7 +172,7 @@ TEST_F(PWTEST,test1_5) pwtest.real2recip((double*)rhogr,rhogr,ik); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.real2recip(rhofr,rhofgout,ik); pwtest.real2recip((float*)rhofgr,rhofgr,ik); @@ -184,7 +184,7 @@ TEST_F(PWTEST,test1_5) EXPECT_NEAR(rhog[ig].imag(),rhogout[ig].imag(),1e-6); EXPECT_NEAR(rhog[ig].real(),rhogr[ig].real(),1e-6); EXPECT_NEAR(rhog[ig].imag(),rhogr[ig].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(rhofg[ig].real(),rhofgout[ig].real(),1e-6); EXPECT_NEAR(rhofg[ig].imag(),rhofgout[ig].imag(),1e-6); EXPECT_NEAR(rhofg[ig].real(),rhofgr[ig].real(),1e-6); @@ -195,7 +195,7 @@ TEST_F(PWTEST,test1_5) delete [] rhog; delete [] rhogout; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete [] rhofg; delete [] rhofgout; #endif @@ -216,7 +216,7 @@ TEST_F(PWTEST,test1_5) delete[] kvec_d; delete[] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete[] rhofr; delete[] rhofgr; fftwf_cleanup(); diff --git a/source/source_basis/module_pw/test/test2-2.cpp b/source/source_basis/module_pw/test/test2-2.cpp index 63e074ea9a..4912e44f30 100644 --- a/source/source_basis/module_pw/test/test2-2.cpp +++ b/source/source_basis/module_pw/test/test2-2.cpp @@ -129,7 +129,7 @@ TEST_F(PWTEST,test2_2) delete [] rhor; delete []tmp; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW fftwf_cleanup(); #endif } \ No newline at end of file diff --git a/source/source_basis/module_pw/test/test2-3.cpp b/source/source_basis/module_pw/test/test2-3.cpp index 7286f06ca6..d5c716f107 100644 --- a/source/source_basis/module_pw/test/test2-3.cpp +++ b/source/source_basis/module_pw/test/test2-3.cpp @@ -131,7 +131,7 @@ TEST_F(PWTEST,test2_3) delete [] tmp; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW fftwf_cleanup(); #endif } \ No newline at end of file diff --git a/source/source_basis/module_pw/test/test3-2.cpp b/source/source_basis/module_pw/test/test3-2.cpp index 2164cefe53..2029e58312 100644 --- a/source/source_basis/module_pw/test/test3-2.cpp +++ b/source/source_basis/module_pw/test/test3-2.cpp @@ -145,7 +145,7 @@ TEST_F(PWTEST,test3_2) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW fftwf_cleanup(); #endif } \ No newline at end of file diff --git a/source/source_basis/module_pw/test/test3-3-2.cpp b/source/source_basis/module_pw/test/test3-3-2.cpp index 8c0afa7de9..080ca626bc 100644 --- a/source/source_basis/module_pw/test/test3-3-2.cpp +++ b/source/source_basis/module_pw/test/test3-3-2.cpp @@ -157,7 +157,7 @@ TEST_F(PWTEST,test3_3_2) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW fftwf_cleanup(); #endif } \ No newline at end of file diff --git a/source/source_basis/module_pw/test/test3-3.cpp b/source/source_basis/module_pw/test/test3-3.cpp index 6b4c00b795..f8931ec758 100644 --- a/source/source_basis/module_pw/test/test3-3.cpp +++ b/source/source_basis/module_pw/test/test3-3.cpp @@ -152,7 +152,7 @@ TEST_F(PWTEST,test3_3) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW fftwf_cleanup(); #endif } \ No newline at end of file diff --git a/source/source_basis/module_pw/test/test4-2.cpp b/source/source_basis/module_pw/test/test4-2.cpp index 8be35d9afc..3c7b944cd1 100644 --- a/source/source_basis/module_pw/test/test4-2.cpp +++ b/source/source_basis/module_pw/test/test4-2.cpp @@ -107,7 +107,7 @@ TEST_F(PWTEST,test4_2) } std::complex * rhor = new std::complex [nrxx]; ModuleBase::GlobalFunc::ZEROS(rhor, nrxx); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofg = new complex [npw]; complex * rhofgr = new complex [nmaxgr]; complex * rhofgout = new complex [npw]; @@ -124,7 +124,7 @@ TEST_F(PWTEST,test4_2) pwtest.recip2real(rhogr,rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.recip2real(rhofg,rhofr,true, float(1));//check out-of-place transform pwtest.recip2real(rhofgr,rhofgr);//check in-place transform @@ -139,7 +139,7 @@ TEST_F(PWTEST,test4_2) EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhor[ixy*nplane+iz].imag(),1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhogr[ixy*nplane+iz].real(),1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhogr[ixy*nplane+iz].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofr[ixy*nplane+iz].real(),1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhofr[ixy*nplane+iz].imag(),1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofgr[ixy*nplane+iz].real(),1e-4); @@ -154,7 +154,7 @@ TEST_F(PWTEST,test4_2) pwtest.real2recip(rhogr,rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW ModuleBase::GlobalFunc::ZEROS(rhofgout, npw); pwtest.real2recip(rhofr,rhofgout, true, float(1));//check out-of-place transform @@ -167,7 +167,7 @@ TEST_F(PWTEST,test4_2) EXPECT_NEAR(rhog[ig].imag(),rhogout[ig].imag(),1e-6); EXPECT_NEAR(rhogr[ig].real(),rhogout[ig].real(),1e-6); EXPECT_NEAR(rhogr[ig].imag(),rhogout[ig].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(rhofg[ig].real(),rhofgout[ig].real(),1e-4); EXPECT_NEAR(rhofg[ig].imag(),rhofgout[ig].imag(),1e-4); EXPECT_NEAR(rhofgr[ig].real(),rhofgout[ig].real(),1e-4); @@ -182,7 +182,7 @@ TEST_F(PWTEST,test4_2) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete [] rhofg; delete [] rhofgout; delete [] rhofr; diff --git a/source/source_basis/module_pw/test/test4-3.cpp b/source/source_basis/module_pw/test/test4-3.cpp index a2f60a0b9c..514fb10318 100644 --- a/source/source_basis/module_pw/test/test4-3.cpp +++ b/source/source_basis/module_pw/test/test4-3.cpp @@ -115,7 +115,7 @@ TEST_F(PWTEST,test4_3) } double * rhor = new double [nrxx]; ModuleBase::GlobalFunc::ZEROS(rhor, nrxx); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofg = new complex [npw]; complex * rhofgr = new complex [nmaxgr]; complex * rhofgout = new complex [npw]; @@ -137,7 +137,7 @@ TEST_F(PWTEST,test4_3) pwtest.recip2real(rhogr,(double*)rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.recip2real(rhofg,rhofr,true,float(1));//check out-of-place transform pwtest.recip2real(rhofgr,(float*)rhofgr);//check in-place transform @@ -152,7 +152,7 @@ TEST_F(PWTEST,test4_3) { EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhor[ixy*nplane+iz],1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),((double*)rhogr)[ixy*nplane+iz],1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofr[ixy*nplane+iz],1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),((float*)rhofgr)[ixy*nplane+iz],1e-4); #endif @@ -164,7 +164,7 @@ TEST_F(PWTEST,test4_3) pwtest.real2recip((double*)rhogr,rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW ModuleBase::GlobalFunc::ZEROS(rhofgout, npw); pwtest.real2recip(rhofr,rhofgout,true,float(1));//check out-of-place transform @@ -177,7 +177,7 @@ TEST_F(PWTEST,test4_3) EXPECT_NEAR(rhog[ig].imag(),rhogout[ig].imag(),1e-6); EXPECT_NEAR(rhogr[ig].real(),rhogout[ig].real(),1e-6); EXPECT_NEAR(rhogr[ig].imag(),rhogout[ig].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(rhofg[ig].real(),rhofgout[ig].real(),1e-4); EXPECT_NEAR(rhofg[ig].imag(),rhofgout[ig].imag(),1e-4); EXPECT_NEAR(rhofgr[ig].real(),rhofgout[ig].real(),1e-4); @@ -192,7 +192,7 @@ TEST_F(PWTEST,test4_3) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete [] rhofg; delete [] rhofgout; delete [] rhofr; diff --git a/source/source_basis/module_pw/test/test4-4.cpp b/source/source_basis/module_pw/test/test4-4.cpp index dd96674440..19a403a4e7 100644 --- a/source/source_basis/module_pw/test/test4-4.cpp +++ b/source/source_basis/module_pw/test/test4-4.cpp @@ -62,7 +62,7 @@ TEST_F(PWTEST,test4_4) std::complex *tmp = new std::complex [nx*ny*nz]; std::complex * rhor = new std::complex [nrxx]; std::complex * rhogr = new std::complex [nmaxgr]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofr = new complex [nrxx]; complex * rhofgr = new complex [nmaxgr]; #endif @@ -115,7 +115,7 @@ TEST_F(PWTEST,test4_4) #endif std::complex * rhog = new std::complex [npwk]; std::complex * rhogout = new std::complex [npwk]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofg = new complex [npwk]; complex * rhofgout = new complex [npwk]; #endif @@ -124,7 +124,7 @@ TEST_F(PWTEST,test4_4) rhog[ig] = 1.0/(pwtest.getgk2(ik,ig)+1) + ModuleBase::IMAG_UNIT / (std::abs(pwtest.getgdirect(ik,ig).x+1) + 1); rhogr[ig] = 1.0/(pwtest.getgk2(ik,ig)+1) + ModuleBase::IMAG_UNIT / (std::abs(pwtest.getgdirect(ik,ig).x+1) + 1); } -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW for(int ig = 0 ; ig < npwk ; ++ig) { rhofg[ig] = 1.0/(pwtest.getgk2(ik,ig)+1) + ModuleBase::IMAG_UNIT / (std::abs(pwtest.getgdirect(ik,ig).x+1) + 1); @@ -137,7 +137,7 @@ TEST_F(PWTEST,test4_4) pwtest.recip2real(rhogr,rhogr,ik); //check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW ModuleBase::GlobalFunc::ZEROS(rhofr, nrxx); pwtest.recip2real(rhofg,rhofr,ik, true, float(1)); //check out-of-place transform @@ -153,7 +153,7 @@ TEST_F(PWTEST,test4_4) EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhor[ixy*nplane+iz].imag(),1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhogr[ixy*nplane+iz].real(),1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhogr[ixy*nplane+iz].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofr[ixy*nplane+iz].real(),1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhofr[ixy*nplane+iz].imag(),1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofgr[ixy*nplane+iz].real(),1e-4); @@ -167,7 +167,7 @@ TEST_F(PWTEST,test4_4) pwtest.real2recip(rhogr,rhogr,ik); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW ModuleBase::GlobalFunc::ZEROS(rhofgout, npwk); pwtest.real2recip(rhofr,rhofgout,ik, true, float(1)); @@ -180,7 +180,7 @@ TEST_F(PWTEST,test4_4) EXPECT_NEAR(rhog[ig].imag(),rhogout[ig].imag(),1e-6); EXPECT_NEAR(rhog[ig].real(),rhogr[ig].real(),1e-6); EXPECT_NEAR(rhog[ig].imag(),rhogr[ig].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(rhofg[ig].real(),rhofgout[ig].real(),1e-4); EXPECT_NEAR(rhofg[ig].imag(),rhofgout[ig].imag(),1e-4); EXPECT_NEAR(rhofg[ig].real(),rhofgr[ig].real(),1e-4); @@ -191,7 +191,7 @@ TEST_F(PWTEST,test4_4) delete [] rhog; delete [] rhogout; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete [] rhofg; delete [] rhofgout; #endif @@ -219,7 +219,7 @@ TEST_F(PWTEST,test4_4) delete[] kvec_d; delete[] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete[] rhofr; delete[] rhofgr; fftwf_cleanup(); diff --git a/source/source_basis/module_pw/test/test4-5.cpp b/source/source_basis/module_pw/test/test4-5.cpp index 2027e7b3f9..1cc051b8fa 100644 --- a/source/source_basis/module_pw/test/test4-5.cpp +++ b/source/source_basis/module_pw/test/test4-5.cpp @@ -61,7 +61,7 @@ TEST_F(PWTEST,test4_5) std::complex *tmp = new std::complex [nx*ny*nz]; std::complex * rhogr = new std::complex [nmaxgr]; double * rhor = new double [nrxx]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW float * rhofr = new float [nrxx]; complex * rhofgr = new complex [nmaxgr]; #endif @@ -116,7 +116,7 @@ TEST_F(PWTEST,test4_5) #endif std::complex * rhog = new std::complex [npwk]; std::complex * rhogout = new std::complex [npwk]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofg = new complex [npwk]; complex * rhofgout = new complex [npwk]; #endif @@ -131,7 +131,7 @@ TEST_F(PWTEST,test4_5) rhogr[ig]+=ModuleBase::IMAG_UNIT / (std::abs(f.x+1) + 1); } } -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW for(int ig = 0 ; ig < npwk ; ++ig) { rhofg[ig] = 1.0/(pwtest.getgk2(ik,ig)+1); @@ -149,7 +149,7 @@ TEST_F(PWTEST,test4_5) pwtest.recip2real(rhogr,(double*)rhogr,ik); //check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW ModuleBase::GlobalFunc::ZEROS(rhofr, nrxx); pwtest.recip2real(rhofg,rhofr,ik); //check out-of-place transform @@ -163,7 +163,7 @@ TEST_F(PWTEST,test4_5) { EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhor[ixy*nplane+iz],1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),((double*)rhogr)[ixy*nplane+iz],1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofr[ixy*nplane+iz],1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),((float*)rhofgr)[ixy*nplane+iz],1e-4); #endif @@ -175,7 +175,7 @@ TEST_F(PWTEST,test4_5) pwtest.real2recip((double*)rhogr,rhogr,ik); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW ModuleBase::GlobalFunc::ZEROS(rhofgout, npwk); pwtest.real2recip(rhofr,rhofgout,ik,true, 1.0); @@ -188,7 +188,7 @@ TEST_F(PWTEST,test4_5) EXPECT_NEAR(rhog[ig].imag(),rhogout[ig].imag(),1e-6); EXPECT_NEAR(rhog[ig].real(),rhogr[ig].real(),1e-6); EXPECT_NEAR(rhog[ig].imag(),rhogr[ig].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(rhofg[ig].real(),rhofgout[ig].real(),1e-6); EXPECT_NEAR(rhofg[ig].imag(),rhofgout[ig].imag(),1e-6); EXPECT_NEAR(rhofg[ig].real(),rhofgr[ig].real(),1e-6); @@ -199,7 +199,7 @@ TEST_F(PWTEST,test4_5) delete [] rhog; delete [] rhogout; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete [] rhofg; delete [] rhofgout; #endif @@ -221,7 +221,7 @@ TEST_F(PWTEST,test4_5) delete[] kvec_d; delete[] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete[] rhofr; delete[] rhofgr; fftwf_cleanup(); diff --git a/source/source_basis/module_pw/test/test5-3-1.cpp b/source/source_basis/module_pw/test/test5-3-1.cpp index 21ffbbd87d..dcc17dc16f 100644 --- a/source/source_basis/module_pw/test/test5-3-1.cpp +++ b/source/source_basis/module_pw/test/test5-3-1.cpp @@ -117,7 +117,7 @@ TEST_F(PWTEST,test5_3_1) } } double * rhor = new double [nrxx]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofg = new complex [npw]; complex * rhofgr = new complex [nmaxgr]; complex * rhofgout = new complex [npw]; @@ -138,7 +138,7 @@ TEST_F(PWTEST,test5_3_1) pwtest.recip2real(rhogr,(double*)rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.recip2real(rhofg,rhofr);//check out-of-place transform pwtest.recip2real(rhofgr,(float*)rhofgr);//check in-place transform @@ -151,7 +151,7 @@ TEST_F(PWTEST,test5_3_1) { EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhor[ixy*nplane+iz],1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),((double*)rhogr)[ixy*nplane+iz],1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofr[ixy*nplane+iz],1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),((float*)rhofgr)[ixy*nplane+iz],1e-4); #endif @@ -163,7 +163,7 @@ TEST_F(PWTEST,test5_3_1) pwtest.real2recip((double*)rhogr,rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.real2recip(rhofr,rhofgout);//check out-of-place transform pwtest.real2recip((float*)rhofgr,rhofgr);//check in-place transform @@ -175,7 +175,7 @@ TEST_F(PWTEST,test5_3_1) EXPECT_NEAR(rhog[ig].imag(),rhogout[ig].imag(),1e-6); EXPECT_NEAR(rhogr[ig].real(),rhogout[ig].real(),1e-6); EXPECT_NEAR(rhogr[ig].imag(),rhogout[ig].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(rhofg[ig].real(),rhofgout[ig].real(),1e-4); EXPECT_NEAR(rhofg[ig].imag(),rhofgout[ig].imag(),1e-4); EXPECT_NEAR(rhofgr[ig].real(),rhofgout[ig].real(),1e-4); @@ -190,7 +190,7 @@ TEST_F(PWTEST,test5_3_1) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete [] rhofg; delete [] rhofgout; delete [] rhofr; diff --git a/source/source_basis/module_pw/test/test5-4-1.cpp b/source/source_basis/module_pw/test/test5-4-1.cpp index ae3dfd647c..99c4e3ebee 100644 --- a/source/source_basis/module_pw/test/test5-4-1.cpp +++ b/source/source_basis/module_pw/test/test5-4-1.cpp @@ -108,7 +108,7 @@ TEST_F(PWTEST,test5_4_1) rhogr[ig] = 1.0/(pwtest.gg[ig]+1) + ModuleBase::IMAG_UNIT / (std::abs(pwtest.gdirect[ig].x+1) + 1); } std::complex * rhor = new std::complex [nrxx]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofg = new complex [npw]; complex * rhofgr = new complex [nmaxgr]; complex * rhofgout = new complex [npw]; @@ -124,7 +124,7 @@ TEST_F(PWTEST,test5_4_1) pwtest.recip2real(rhogr,rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.recip2real(rhofg,rhofr);//check out-of-place transform pwtest.recip2real(rhofgr,rhofgr);//check in-place transform @@ -139,7 +139,7 @@ TEST_F(PWTEST,test5_4_1) EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhor[ixy*nplane+iz].imag(),1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhogr[ixy*nplane+iz].real(),1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhogr[ixy*nplane+iz].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofr[ixy*nplane+iz].real(),1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhofr[ixy*nplane+iz].imag(),1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofgr[ixy*nplane+iz].real(),1e-4); @@ -154,7 +154,7 @@ TEST_F(PWTEST,test5_4_1) pwtest.real2recip(rhogr,rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.real2recip(rhofr,rhofgout);//check out-of-place transform pwtest.real2recip(rhofgr,rhofgr);//check in-place transform @@ -166,7 +166,7 @@ TEST_F(PWTEST,test5_4_1) EXPECT_NEAR(rhog[ig].imag(),rhogout[ig].imag(),1e-6); EXPECT_NEAR(rhogr[ig].real(),rhogout[ig].real(),1e-6); EXPECT_NEAR(rhogr[ig].imag(),rhogout[ig].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(rhofg[ig].real(),rhofgout[ig].real(),1e-4); EXPECT_NEAR(rhofg[ig].imag(),rhofgout[ig].imag(),1e-4); EXPECT_NEAR(rhofgr[ig].real(),rhofgout[ig].real(),1e-4); @@ -181,7 +181,7 @@ TEST_F(PWTEST,test5_4_1) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete [] rhofg; delete [] rhofgout; delete [] rhofr; diff --git a/source/source_basis/module_pw/test/test5-4-2.cpp b/source/source_basis/module_pw/test/test5-4-2.cpp index 95bbc3f114..8ecf24f56b 100644 --- a/source/source_basis/module_pw/test/test5-4-2.cpp +++ b/source/source_basis/module_pw/test/test5-4-2.cpp @@ -108,7 +108,7 @@ TEST_F(PWTEST,test5_4_2) rhogr[ig] = 1.0/(pwtest.gg[ig]+1) + ModuleBase::IMAG_UNIT / (std::abs(pwtest.gdirect[ig].x+1) + 1); } std::complex * rhor = new std::complex [nrxx]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofg = new complex [npw]; complex * rhofgr = new complex [nmaxgr]; complex * rhofgout = new complex [npw]; @@ -124,7 +124,7 @@ TEST_F(PWTEST,test5_4_2) pwtest.recip2real(rhogr,rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.recip2real(rhofg,rhofr);//check out-of-place transform pwtest.recip2real(rhofgr,rhofgr);//check in-place transform @@ -139,7 +139,7 @@ TEST_F(PWTEST,test5_4_2) EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhor[ixy*nplane+iz].imag(),1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhogr[ixy*nplane+iz].real(),1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhogr[ixy*nplane+iz].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofr[ixy*nplane+iz].real(),1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhofr[ixy*nplane+iz].imag(),1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofgr[ixy*nplane+iz].real(),1e-4); @@ -154,7 +154,7 @@ TEST_F(PWTEST,test5_4_2) pwtest.real2recip(rhogr,rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.real2recip(rhofr,rhofgout);//check out-of-place transform pwtest.real2recip(rhofgr,rhofgr);//check in-place transform @@ -166,7 +166,7 @@ TEST_F(PWTEST,test5_4_2) EXPECT_NEAR(rhog[ig].imag(),rhogout[ig].imag(),1e-6); EXPECT_NEAR(rhogr[ig].real(),rhogout[ig].real(),1e-6); EXPECT_NEAR(rhogr[ig].imag(),rhogout[ig].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(rhofg[ig].real(),rhofgout[ig].real(),1e-4); EXPECT_NEAR(rhofg[ig].imag(),rhofgout[ig].imag(),1e-4); EXPECT_NEAR(rhofgr[ig].real(),rhofgout[ig].real(),1e-4); @@ -181,7 +181,7 @@ TEST_F(PWTEST,test5_4_2) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete [] rhofg; delete [] rhofgout; delete [] rhofr; diff --git a/source/source_basis/module_pw/test/test6-3-1.cpp b/source/source_basis/module_pw/test/test6-3-1.cpp index 0ade256922..ebc371adfd 100644 --- a/source/source_basis/module_pw/test/test6-3-1.cpp +++ b/source/source_basis/module_pw/test/test6-3-1.cpp @@ -117,7 +117,7 @@ TEST_F(PWTEST,test6_3_1) } } double * rhor = new double [nrxx]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofg = new complex [npw]; complex * rhofgr = new complex [nmaxgr]; complex * rhofgout = new complex [npw]; @@ -138,7 +138,7 @@ TEST_F(PWTEST,test6_3_1) pwtest.recip2real(rhogr,(double*)rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.recip2real(rhofg,rhofr);//check out-of-place transform pwtest.recip2real(rhofgr,(float*)rhofgr);//check in-place transform @@ -151,7 +151,7 @@ TEST_F(PWTEST,test6_3_1) { EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhor[ixy*nplane+iz],1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),((double*)rhogr)[ixy*nplane+iz],1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofr[ixy*nplane+iz],1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),((float*)rhofgr)[ixy*nplane+iz],1e-4); #endif @@ -163,7 +163,7 @@ TEST_F(PWTEST,test6_3_1) pwtest.real2recip((double*)rhogr,rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.real2recip(rhofr,rhofgout);//check out-of-place transform pwtest.real2recip((float*)rhofgr,rhofgr);//check in-place transform @@ -175,7 +175,7 @@ TEST_F(PWTEST,test6_3_1) EXPECT_NEAR(rhog[ig].imag(),rhogout[ig].imag(),1e-6); EXPECT_NEAR(rhogr[ig].real(),rhogout[ig].real(),1e-6); EXPECT_NEAR(rhogr[ig].imag(),rhogout[ig].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(rhofg[ig].real(),rhofgout[ig].real(),1e-4); EXPECT_NEAR(rhofg[ig].imag(),rhofgout[ig].imag(),1e-4); EXPECT_NEAR(rhofgr[ig].real(),rhofgout[ig].real(),1e-4); @@ -190,7 +190,7 @@ TEST_F(PWTEST,test6_3_1) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete [] rhofg; delete [] rhofgout; delete [] rhofr; diff --git a/source/source_basis/module_pw/test/test6-4-1.cpp b/source/source_basis/module_pw/test/test6-4-1.cpp index 145071dea0..3dac91f638 100644 --- a/source/source_basis/module_pw/test/test6-4-1.cpp +++ b/source/source_basis/module_pw/test/test6-4-1.cpp @@ -108,7 +108,7 @@ TEST_F(PWTEST,test6_4_1) rhogr[ig] = 1.0/(pwtest.gg[ig]+1) + ModuleBase::IMAG_UNIT / (std::abs(pwtest.gdirect[ig].x+1) + 1); } std::complex * rhor = new std::complex [nrxx]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofg = new complex [npw]; complex * rhofgr = new complex [nmaxgr]; complex * rhofgout = new complex [npw]; @@ -124,7 +124,7 @@ TEST_F(PWTEST,test6_4_1) pwtest.recip2real(rhogr,rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.recip2real(rhofg,rhofr);//check out-of-place transform pwtest.recip2real(rhofgr,rhofgr);//check in-place transform @@ -139,7 +139,7 @@ TEST_F(PWTEST,test6_4_1) EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhor[ixy*nplane+iz].imag(),1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhogr[ixy*nplane+iz].real(),1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhogr[ixy*nplane+iz].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofr[ixy*nplane+iz].real(),1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhofr[ixy*nplane+iz].imag(),1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofgr[ixy*nplane+iz].real(),1e-4); @@ -154,7 +154,7 @@ TEST_F(PWTEST,test6_4_1) pwtest.real2recip(rhogr,rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.real2recip(rhofr,rhofgout);//check out-of-place transform pwtest.real2recip(rhofgr,rhofgr);//check in-place transform @@ -166,7 +166,7 @@ TEST_F(PWTEST,test6_4_1) EXPECT_NEAR(rhog[ig].imag(),rhogout[ig].imag(),1e-6); EXPECT_NEAR(rhogr[ig].real(),rhogout[ig].real(),1e-6); EXPECT_NEAR(rhogr[ig].imag(),rhogout[ig].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(rhofg[ig].real(),rhofgout[ig].real(),1e-4); EXPECT_NEAR(rhofg[ig].imag(),rhofgout[ig].imag(),1e-4); EXPECT_NEAR(rhofgr[ig].real(),rhofgout[ig].real(),1e-4); @@ -181,7 +181,7 @@ TEST_F(PWTEST,test6_4_1) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete [] rhofg; delete [] rhofgout; delete [] rhofr; diff --git a/source/source_basis/module_pw/test/test6-4-2.cpp b/source/source_basis/module_pw/test/test6-4-2.cpp index 1f84f987a9..644d8fc3f4 100644 --- a/source/source_basis/module_pw/test/test6-4-2.cpp +++ b/source/source_basis/module_pw/test/test6-4-2.cpp @@ -108,7 +108,7 @@ TEST_F(PWTEST,test6_4_2) rhogr[ig] = 1.0/(pwtest.gg[ig]+1) + ModuleBase::IMAG_UNIT / (std::abs(pwtest.gdirect[ig].x+1) + 1); } std::complex * rhor = new std::complex [nrxx]; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW complex * rhofg = new complex [npw]; complex * rhofgr = new complex [nmaxgr]; complex * rhofgout = new complex [npw]; @@ -124,7 +124,7 @@ TEST_F(PWTEST,test6_4_2) pwtest.recip2real(rhogr,rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.recip2real(rhofg,rhofr);//check out-of-place transform pwtest.recip2real(rhofgr,rhofgr);//check in-place transform @@ -139,7 +139,7 @@ TEST_F(PWTEST,test6_4_2) EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhor[ixy*nplane+iz].imag(),1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhogr[ixy*nplane+iz].real(),1e-6); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhogr[ixy*nplane+iz].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofr[ixy*nplane+iz].real(),1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].imag(),rhofr[ixy*nplane+iz].imag(),1e-4); EXPECT_NEAR(tmp[ixy * nz + startiz + iz].real(),rhofgr[ixy*nplane+iz].real(),1e-4); @@ -154,7 +154,7 @@ TEST_F(PWTEST,test6_4_2) pwtest.real2recip(rhogr,rhogr);//check in-place transform -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW pwtest.real2recip(rhofr,rhofgout);//check out-of-place transform pwtest.real2recip(rhofgr,rhofgr);//check in-place transform @@ -166,7 +166,7 @@ TEST_F(PWTEST,test6_4_2) EXPECT_NEAR(rhog[ig].imag(),rhogout[ig].imag(),1e-6); EXPECT_NEAR(rhogr[ig].real(),rhogout[ig].real(),1e-6); EXPECT_NEAR(rhogr[ig].imag(),rhogout[ig].imag(),1e-6); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW EXPECT_NEAR(rhofg[ig].real(),rhofgout[ig].real(),1e-4); EXPECT_NEAR(rhofg[ig].imag(),rhofgout[ig].imag(),1e-4); EXPECT_NEAR(rhofgr[ig].real(),rhofgout[ig].real(),1e-4); @@ -181,7 +181,7 @@ TEST_F(PWTEST,test6_4_2) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW delete [] rhofg; delete [] rhofgout; delete [] rhofr; diff --git a/source/source_basis/module_pw/test/test7-2-1.cpp b/source/source_basis/module_pw/test/test7-2-1.cpp index 4a046cd6fa..23d5e57ff7 100644 --- a/source/source_basis/module_pw/test/test7-2-1.cpp +++ b/source/source_basis/module_pw/test/test7-2-1.cpp @@ -155,7 +155,7 @@ TEST_F(PWTEST,test7_2_1) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW fftwf_cleanup(); #endif } \ No newline at end of file diff --git a/source/source_basis/module_pw/test/test7-3-1.cpp b/source/source_basis/module_pw/test/test7-3-1.cpp index c64ced34b2..86fa350ec2 100644 --- a/source/source_basis/module_pw/test/test7-3-1.cpp +++ b/source/source_basis/module_pw/test/test7-3-1.cpp @@ -148,7 +148,7 @@ TEST_F(PWTEST,test7_3_1) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW fftwf_cleanup(); #endif } \ No newline at end of file diff --git a/source/source_basis/module_pw/test/test7-3-2.cpp b/source/source_basis/module_pw/test/test7-3-2.cpp index 345bb42ce0..fb3fde857e 100644 --- a/source/source_basis/module_pw/test/test7-3-2.cpp +++ b/source/source_basis/module_pw/test/test7-3-2.cpp @@ -149,7 +149,7 @@ TEST_F(PWTEST,test7_3_2) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW fftwf_cleanup(); #endif } \ No newline at end of file diff --git a/source/source_basis/module_pw/test/test8-2-1.cpp b/source/source_basis/module_pw/test/test8-2-1.cpp index 1230c7f5ef..8bcbbaa5e0 100644 --- a/source/source_basis/module_pw/test/test8-2-1.cpp +++ b/source/source_basis/module_pw/test/test8-2-1.cpp @@ -156,7 +156,7 @@ TEST_F(PWTEST,test8_2_1) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW fftwf_cleanup(); #endif } \ No newline at end of file diff --git a/source/source_basis/module_pw/test/test8-3-1.cpp b/source/source_basis/module_pw/test/test8-3-1.cpp index 336db41847..11a703df41 100644 --- a/source/source_basis/module_pw/test/test8-3-1.cpp +++ b/source/source_basis/module_pw/test/test8-3-1.cpp @@ -148,7 +148,7 @@ TEST_F(PWTEST,test8_3_1) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW fftwf_cleanup(); #endif } \ No newline at end of file diff --git a/source/source_basis/module_pw/test/test8-3-2.cpp b/source/source_basis/module_pw/test/test8-3-2.cpp index 2b43e83b52..41a5f1fdf6 100644 --- a/source/source_basis/module_pw/test/test8-3-2.cpp +++ b/source/source_basis/module_pw/test/test8-3-2.cpp @@ -149,7 +149,7 @@ TEST_F(PWTEST,test8_3_2) delete [] rhogr; fftw_cleanup(); -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW fftwf_cleanup(); #endif } \ No newline at end of file diff --git a/source/source_estate/module_pot/pot_xc.cpp b/source/source_estate/module_pot/pot_xc.cpp index 056af3099e..19815f843a 100644 --- a/source/source_estate/module_pot/pot_xc.cpp +++ b/source/source_estate/module_pot/pot_xc.cpp @@ -4,7 +4,7 @@ #include "source_hamilt/module_xc/xc_functional.h" #include "source_io/module_parameter/parameter.h" -#ifdef USE_LIBXC +#ifdef __LIBXC #include "source_hamilt/module_xc/libxc_abacus.h" #endif @@ -23,7 +23,7 @@ void PotXC::cal_v_eff(const Charge*const chg, const UnitCell*const ucell, Module if (XC_Functional::get_ked_flag()) { -#ifdef USE_LIBXC +#ifdef __LIBXC const double hybrid_alpha = XC_Functional::get_hybrid_alpha(); #ifdef __EXX const double hse_omega = XC_Functional::get_hse_omega(); diff --git a/source/source_hamilt/module_surchem/test/CMakeLists.txt b/source/source_hamilt/module_surchem/test/CMakeLists.txt index 3c29b35123..6b0c4e9c53 100644 --- a/source/source_hamilt/module_surchem/test/CMakeLists.txt +++ b/source/source_hamilt/module_surchem/test/CMakeLists.txt @@ -1,5 +1,5 @@ abacus_disable_feature_definitions(__LCAO) -abacus_disable_feature_definitions(USE_LIBXC) +abacus_disable_feature_definitions(__LIBXC) install(DIRECTORY support DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) list(APPEND depend_files diff --git a/source/source_hamilt/module_xc/libxc_abacus.h b/source/source_hamilt/module_xc/libxc_abacus.h index 0c912858bf..bc584b7518 100644 --- a/source/source_hamilt/module_xc/libxc_abacus.h +++ b/source/source_hamilt/module_xc/libxc_abacus.h @@ -1,7 +1,7 @@ #ifndef LIBXC_ABACUS_H #define LIBXC_ABACUS_H -#ifdef USE_LIBXC +#ifdef __LIBXC #include "source_base/matrix.h" #include "source_base/vector3.h" @@ -243,6 +243,6 @@ namespace XC_Functional_Libxc } // namespace XC_Functional_Libxc -#endif // USE_LIBXC +#endif // __LIBXC #endif // LIBXC_ABACUS_H diff --git a/source/source_hamilt/module_xc/libxc_gga_wrap.cpp b/source/source_hamilt/module_xc/libxc_gga_wrap.cpp index cd5aaeb858..bd86a46657 100644 --- a/source/source_hamilt/module_xc/libxc_gga_wrap.cpp +++ b/source/source_hamilt/module_xc/libxc_gga_wrap.cpp @@ -1,4 +1,4 @@ -#ifdef USE_LIBXC +#ifdef __LIBXC #include "libxc_abacus.h" #ifdef __EXX diff --git a/source/source_hamilt/module_xc/libxc_lda_wrap.cpp b/source/source_hamilt/module_xc/libxc_lda_wrap.cpp index 646d65edbf..4b81e97cf7 100644 --- a/source/source_hamilt/module_xc/libxc_lda_wrap.cpp +++ b/source/source_hamilt/module_xc/libxc_lda_wrap.cpp @@ -1,4 +1,4 @@ -#ifdef USE_LIBXC +#ifdef __LIBXC #include "libxc_abacus.h" #ifdef __EXX diff --git a/source/source_hamilt/module_xc/libxc_mgga_wrap.cpp b/source/source_hamilt/module_xc/libxc_mgga_wrap.cpp index 2c7d700f43..35ea9e4313 100644 --- a/source/source_hamilt/module_xc/libxc_mgga_wrap.cpp +++ b/source/source_hamilt/module_xc/libxc_mgga_wrap.cpp @@ -2,7 +2,7 @@ // it includes 1 subroutine: // 1. tau_xc -#ifdef USE_LIBXC +#ifdef __LIBXC #include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info #include "source_hamilt/module_xc/xc_functional.h" diff --git a/source/source_hamilt/module_xc/libxc_pot.cpp b/source/source_hamilt/module_xc/libxc_pot.cpp index 9d70a41274..6f605bbd48 100644 --- a/source/source_hamilt/module_xc/libxc_pot.cpp +++ b/source/source_hamilt/module_xc/libxc_pot.cpp @@ -1,4 +1,4 @@ -#ifdef USE_LIBXC +#ifdef __LIBXC #include "xc_functional.h" #include "libxc_abacus.h" diff --git a/source/source_hamilt/module_xc/libxc_setup.cpp b/source/source_hamilt/module_xc/libxc_setup.cpp index 84972a8063..3b29edf727 100644 --- a/source/source_hamilt/module_xc/libxc_setup.cpp +++ b/source/source_hamilt/module_xc/libxc_setup.cpp @@ -1,4 +1,4 @@ -#ifdef USE_LIBXC +#ifdef __LIBXC #include "libxc_abacus.h" #include "source_io/module_parameter/parameter.h" diff --git a/source/source_hamilt/module_xc/libxc_tools.cpp b/source/source_hamilt/module_xc/libxc_tools.cpp index b66e1b1b26..916732fa8d 100644 --- a/source/source_hamilt/module_xc/libxc_tools.cpp +++ b/source/source_hamilt/module_xc/libxc_tools.cpp @@ -1,4 +1,4 @@ -#ifdef USE_LIBXC +#ifdef __LIBXC #include "libxc_abacus.h" #include "xc_functional.h" diff --git a/source/source_hamilt/module_xc/xc_functional.cpp b/source/source_hamilt/module_xc/xc_functional.cpp index bef9d91b2b..ae41bb48cd 100644 --- a/source/source_hamilt/module_xc/xc_functional.cpp +++ b/source/source_hamilt/module_xc/xc_functional.cpp @@ -3,7 +3,7 @@ #include "source_base/global_function.h" #include "source_base/tool_title.h" -#ifdef USE_LIBXC +#ifdef __LIBXC #include "libxc_abacus.h" #endif @@ -154,7 +154,7 @@ void XC_Functional::set_xc_type(const std::string xc_func_in) func_type = 2; use_libxc = false; } -#ifdef USE_LIBXC +#ifdef __LIBXC else if ( xc_func == "SCAN") { func_id.push_back(XC_MGGA_X_SCAN); @@ -220,7 +220,7 @@ void XC_Functional::set_xc_type(const std::string xc_func_in) func_type = 4; use_libxc = false; } -#ifdef USE_LIBXC +#ifdef __LIBXC else if( xc_func == "HSE") { func_id.push_back(XC_HYB_GGA_XC_HSE06); @@ -278,7 +278,7 @@ void XC_Functional::set_xc_type(const std::string xc_func_in) #endif else { -#ifdef USE_LIBXC +#ifdef __LIBXC //see if it matches libxc functionals const std::pair> type_id = XC_Functional_Libxc::set_xc_type_libxc(xc_func); func_type = std::get<0>(type_id); @@ -320,7 +320,7 @@ void XC_Functional::set_xc_type(const std::string xc_func_in) // } // #endif -#ifndef USE_LIBXC +#ifndef __LIBXC if(xc_func == "SCAN" || xc_func == "HSE" || xc_func == "SCAN0" || xc_func == "MULLER" || xc_func == "POWER" || xc_func == "WP22" || xc_func == "CWP22" || xc_func == "LC_PBE" || xc_func == "LC_WPBE" || xc_func == "LRC_WPBE" || @@ -336,7 +336,7 @@ void XC_Functional::set_xc_type(const std::string xc_func_in) std::string XC_Functional::output_info() { ModuleBase::TITLE("XC_Functional", "output_info"); -#ifdef USE_LIBXC +#ifdef __LIBXC if(use_libxc) { std::stringstream ss; diff --git a/source/source_hamilt/module_xc/xc_functional.h b/source/source_hamilt/module_xc/xc_functional.h index ceb8135399..540469b81e 100644 --- a/source/source_hamilt/module_xc/xc_functional.h +++ b/source/source_hamilt/module_xc/xc_functional.h @@ -5,11 +5,11 @@ #ifndef XC_FUNCTIONAL_H #define XC_FUNCTIONAL_H -#ifdef USE_LIBXC +#ifdef __LIBXC #include #else #include "xc_ids.h" -#endif // ifdef USE_LIBXC +#endif // ifdef __LIBXC #include "source_base/macros.h" #include "source_base/global_function.h" #include "source_base/vector3.h" diff --git a/source/source_hamilt/module_xc/xc_gga_wrap.cpp b/source/source_hamilt/module_xc/xc_gga_wrap.cpp index c907610fc6..cdcfdb4a72 100644 --- a/source/source_hamilt/module_xc/xc_gga_wrap.cpp +++ b/source/source_hamilt/module_xc/xc_gga_wrap.cpp @@ -10,7 +10,7 @@ #include #include "source_base/global_function.h" -#ifdef USE_LIBXC +#ifdef __LIBXC #include "libxc_abacus.h" #endif diff --git a/source/source_hamilt/module_xc/xc_grad.cpp b/source/source_hamilt/module_xc/xc_grad.cpp index c16dcc718b..12788b60a6 100644 --- a/source/source_hamilt/module_xc/xc_grad.cpp +++ b/source/source_hamilt/module_xc/xc_grad.cpp @@ -17,7 +17,7 @@ #include #include -#ifdef USE_LIBXC +#ifdef __LIBXC #include "libxc_abacus.h" #ifdef __EXX #include "source_hamilt/module_xc/exx_info.h" @@ -298,7 +298,7 @@ void XC_Functional::gradcorr( } if (use_libxc && is_stress) { -#ifdef USE_LIBXC +#ifdef __LIBXC if(func_type == 3 || func_type == 5) { double v3xc = 0.0; @@ -355,7 +355,7 @@ void XC_Functional::gradcorr( { if(use_libxc) { -#ifdef USE_LIBXC +#ifdef __LIBXC double sxc = 0.0; double v1xcup = 0.0; double v1xcdw = 0.0; diff --git a/source/source_hamilt/module_xc/xc_lda_wrap.cpp b/source/source_hamilt/module_xc/xc_lda_wrap.cpp index db15f92eca..5a3b700107 100644 --- a/source/source_hamilt/module_xc/xc_lda_wrap.cpp +++ b/source/source_hamilt/module_xc/xc_lda_wrap.cpp @@ -5,9 +5,9 @@ // 2. xc_spin, which is the spin polarized counterpart of xc // 3. xc_spin_libxc, which is the wrapper for LDA functional, spin polarized -#ifdef USE_LIBXC +#ifdef __LIBXC #include -#endif // ifdef USE_LIBXC +#endif // ifdef __LIBXC #include "xc_functional.h" #include diff --git a/source/source_hamilt/module_xc/xc_pot.cpp b/source/source_hamilt/module_xc/xc_pot.cpp index a0e905e591..1f8a3dcd32 100644 --- a/source/source_hamilt/module_xc/xc_pot.cpp +++ b/source/source_hamilt/module_xc/xc_pot.cpp @@ -9,7 +9,7 @@ #include "source_io/module_parameter/parameter.h" #include "xc_functional.h" -#ifdef USE_LIBXC +#ifdef __LIBXC #include "libxc_abacus.h" #ifdef __EXX #include "source_hamilt/module_xc/exx_info.h" @@ -31,7 +31,7 @@ std::tuple XC_Functional::v_xc( if (use_libxc) { -#ifdef USE_LIBXC +#ifdef __LIBXC return XC_Functional_Libxc::v_xc_libxc(XC_Functional::get_func_id(), nrxx, ucell->omega, @@ -144,7 +144,7 @@ std::tuple XC_Functional::v_xc( if(use_libxc) { -#ifdef USE_LIBXC +#ifdef __LIBXC double rhoup = arhox * (1.0+zeta) / 2.0; double rhodw = arhox * (1.0-zeta) / 2.0; XC_Functional_Libxc::xc_spin_libxc(XC_Functional::get_func_id(), rhoup, rhodw, exc, vxc[0], vxc[1], hybrid_alpha, hse_omega); diff --git a/source/source_io/module_chgpot/write_libxc_r.cpp b/source/source_io/module_chgpot/write_libxc_r.cpp index 0579650aa6..d13e756385 100644 --- a/source/source_io/module_chgpot/write_libxc_r.cpp +++ b/source/source_io/module_chgpot/write_libxc_r.cpp @@ -3,7 +3,7 @@ // DATE : 2024-09-12 //====================== -#ifdef USE_LIBXC +#ifdef __LIBXC #include "write_libxc_r.h" #include "source_base/parallel_comm.h" @@ -498,4 +498,4 @@ void ModuleIO::write_cube_core( #endif // #ifdef __MPI -#endif // USE_LIBXC +#endif // __LIBXC diff --git a/source/source_io/module_chgpot/write_libxc_r.h b/source/source_io/module_chgpot/write_libxc_r.h index db9b3b62ff..58e2f21556 100644 --- a/source/source_io/module_chgpot/write_libxc_r.h +++ b/source/source_io/module_chgpot/write_libxc_r.h @@ -6,7 +6,7 @@ #ifndef WRITE_LIBXC_R_H #define WRITE_LIBXC_R_H -#ifdef USE_LIBXC +#ifdef __LIBXC #include #include @@ -49,6 +49,6 @@ namespace ModuleIO #endif } -#endif // USE_LIBXC +#endif // __LIBXC #endif // WRITE_LIBXC_R_H diff --git a/source/source_io/module_ctrl/ctrl_output_fp.cpp b/source/source_io/module_ctrl/ctrl_output_fp.cpp index 87aa062bc0..fccc39537f 100644 --- a/source/source_io/module_ctrl/ctrl_output_fp.cpp +++ b/source/source_io/module_ctrl/ctrl_output_fp.cpp @@ -6,7 +6,7 @@ #include "source_io/module_chgpot/write_elecstat_pot.h" // use write_elecstat_pot #include "source_io/module_elf/write_elf.h" -#ifdef USE_LIBXC +#ifdef __LIBXC #include "source_io/module_chgpot/write_libxc_r.h" #endif @@ -186,7 +186,7 @@ void ctrl_output_fp(UnitCell& ucell, PARAM.globalv.two_fermi); } -#ifdef USE_LIBXC +#ifdef __LIBXC // 7) write xc(r) if (PARAM.inp.out_xc_r[0] >= 0 && should_output) { diff --git a/source/source_io/module_ml/io_npz.cpp b/source/source_io/module_ml/io_npz.cpp index b0eede9f15..39168d45d2 100644 --- a/source/source_io/module_ml/io_npz.cpp +++ b/source/source_io/module_ml/io_npz.cpp @@ -10,7 +10,7 @@ #include "source_lcao/module_hcontainer/hcontainer_funcs.h" #endif -#ifdef __USECNPY +#ifdef __CNPY #include "cnpy.h" #endif @@ -24,7 +24,7 @@ void read_mat_npz(const Parallel_Orbitals* paraV, { ModuleBase::TITLE("ModuleIO", "read_mat_npz"); -#ifdef __USECNPY +#ifdef __CNPY #ifdef __MPI @@ -326,7 +326,7 @@ void output_mat_npz_impl(const UnitCell& ucell, std::string& zipname, const hami { ModuleBase::TITLE("ModuleIO", "output_mat_npz"); -#ifdef __USECNPY +#ifdef __CNPY std::string filename = ""; if(GlobalV::MY_RANK == 0) diff --git a/source/source_io/module_parameter/read_input_item_output.cpp b/source/source_io/module_parameter/read_input_item_output.cpp index 7feb150507..99591a4d27 100644 --- a/source/source_io/module_parameter/read_input_item_output.cpp +++ b/source/source_io/module_parameter/read_input_item_output.cpp @@ -1162,7 +1162,7 @@ The circle order of the charge density on real space grids is: x is the outer lo item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.out_xc_r[0] >= 0) { -#ifndef USE_LIBXC +#ifndef __LIBXC ModuleBase::WARNING_QUIT("ReadInput", "INPUT out_xc_r is only aviailable with Libxc"); #endif } @@ -1195,7 +1195,7 @@ The circle order of the charge density on real space grids is: x is the outer lo item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.out_hr_npz) { -#ifndef __USECNPY +#ifndef __CNPY ModuleBase::WARNING_QUIT("ReadInput", "to write in npz format, please " "recompile with -DENABLE_CNPY=1"); @@ -1217,7 +1217,7 @@ The circle order of the charge density on real space grids is: x is the outer lo item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.out_hsr_npz) { -#ifndef __USECNPY +#ifndef __CNPY ModuleBase::WARNING_QUIT("ReadInput", "to write in npz format, please " "recompile with -DENABLE_CNPY=1"); @@ -1239,7 +1239,7 @@ The circle order of the charge density on real space grids is: x is the outer lo item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.out_dm_npz) { -#ifndef __USECNPY +#ifndef __CNPY ModuleBase::WARNING_QUIT("ReadInput", "to write in npz format, please " "recompile with -DENABLE_CNPY=1"); diff --git a/source/source_io/module_parameter/read_input_item_system.cpp b/source/source_io/module_parameter/read_input_item_system.cpp index 3b0ae011ec..d4ce16c963 100644 --- a/source/source_io/module_parameter/read_input_item_system.cpp +++ b/source/source_io/module_parameter/read_input_item_system.cpp @@ -766,7 +766,7 @@ Available options are: // cpu single precision is not supported while float_fftw lib is not available if (para.inp.device == "cpu" && para.inp.precision == "single") { -#ifndef __ENABLE_FLOAT_FFTW +#ifndef __FLOAT_FFTW ModuleBase::WARNING_QUIT( "ReadInput", "Single precision with cpu is not supported while float_fftw lib is not available; \ @@ -859,7 +859,7 @@ Available options are: } if (para.input.dm_to_rho) { -#ifndef __USECNPY +#ifndef __CNPY ModuleBase::WARNING_QUIT("ReadInput", "to write in npz format, please " "recompile with -DENABLE_CNPY=1"); diff --git a/source/source_io/module_parameter/read_set_globalv.cpp b/source/source_io/module_parameter/read_set_globalv.cpp index 94c0095c27..3b395e6b8f 100644 --- a/source/source_io/module_parameter/read_set_globalv.cpp +++ b/source/source_io/module_parameter/read_set_globalv.cpp @@ -66,7 +66,7 @@ void ReadInput::set_globalv(const Input_para& inp, System_para& sys) sys.all_ks_run = false; } // set the has_double_data and has_float_data -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW bool float_cond = inp.cal_cond && inp.esolver_type == "sdft"; #else bool float_cond = false; diff --git a/source/source_io/test_serial/read_input_item_test.cpp b/source/source_io/test_serial/read_input_item_test.cpp index 61673a418c..6d9cb980fe 100644 --- a/source/source_io/test_serial/read_input_item_test.cpp +++ b/source/source_io/test_serial/read_input_item_test.cpp @@ -1025,7 +1025,7 @@ TEST_F(InputTest, Item_test2) output = testing::internal::GetCapturedStdout(); EXPECT_THAT(output, testing::HasSubstr("NOTICE")); -#ifndef __USECNPY +#ifndef __CNPY param.input.dm_to_rho = true; GlobalV::NPROC = 1; testing::internal::CaptureStdout(); diff --git a/source/source_lcao/LCAO_init_basis.cpp b/source/source_lcao/LCAO_init_basis.cpp index 6fecf44fa5..0044e83bad 100644 --- a/source/source_lcao/LCAO_init_basis.cpp +++ b/source/source_lcao/LCAO_init_basis.cpp @@ -63,7 +63,7 @@ void init_basis_lcao(Parallel_Orbitals& pv, two_center_bundle.build_beta(ucell.ntype, lcao_nl->get_nonlocal().Beta); } -#ifdef USE_NEW_TWO_CENTER +#ifdef __FFT_TWO_CENTER two_center_bundle.tabulate(); #else two_center_bundle.tabulate(lcao_ecut, lcao_dk, lcao_dr, lcao_rmax); diff --git a/source/source_lcao/module_lr/ao_to_mo_transformer/test/CMakeLists.txt b/source/source_lcao/module_lr/ao_to_mo_transformer/test/CMakeLists.txt index fe0f12cc70..de89102427 100644 --- a/source/source_lcao/module_lr/ao_to_mo_transformer/test/CMakeLists.txt +++ b/source/source_lcao/module_lr/ao_to_mo_transformer/test/CMakeLists.txt @@ -1,4 +1,4 @@ -abacus_disable_feature_definitions(USE_LIBXC) +abacus_disable_feature_definitions(__LIBXC) AddTest( TARGET MODULE_LR_ao_to_mo_test LIBS parameter base container device psi diff --git a/source/source_lcao/module_lr/dm_trans/test/CMakeLists.txt b/source/source_lcao/module_lr/dm_trans/test/CMakeLists.txt index d89d366b1c..6894e57ab2 100644 --- a/source/source_lcao/module_lr/dm_trans/test/CMakeLists.txt +++ b/source/source_lcao/module_lr/dm_trans/test/CMakeLists.txt @@ -1,4 +1,4 @@ -abacus_disable_feature_definitions(USE_LIBXC) +abacus_disable_feature_definitions(__LIBXC) AddTest( TARGET MODULE_LR_dm_trans_test LIBS parameter psi base device container diff --git a/source/source_lcao/module_lr/esolver_lrtd_lcao.cpp b/source/source_lcao/module_lr/esolver_lrtd_lcao.cpp index 1b157e00da..9e57ab09b1 100644 --- a/source/source_lcao/module_lr/esolver_lrtd_lcao.cpp +++ b/source/source_lcao/module_lr/esolver_lrtd_lcao.cpp @@ -67,7 +67,7 @@ inline int cal_nupdown_form_occ(const ModuleBase::matrix& wg) inline void setup_2center_table(TwoCenterBundle& two_center_bundle, LCAO_Orbitals& orb, UnitCell& ucell) { // set up 2-center table -#ifdef USE_NEW_TWO_CENTER +#ifdef __FFT_TWO_CENTER two_center_bundle.tabulate(); #else two_center_bundle.tabulate(inp.lcao_ecut, inp.lcao_dk, inp.lcao_dr, inp.lcao_rmax); diff --git a/source/source_lcao/module_lr/potentials/pot_hxc_lrtd.cpp b/source/source_lcao/module_lr/potentials/pot_hxc_lrtd.cpp index 68deeb1d92..97406b8c1d 100644 --- a/source/source_lcao/module_lr/potentials/pot_hxc_lrtd.cpp +++ b/source/source_lcao/module_lr/potentials/pot_hxc_lrtd.cpp @@ -45,7 +45,7 @@ namespace LR ModuleBase::timer::end("PotHxcLR", "cal_v_eff"); return; } // no xc -#ifdef USE_LIBXC +#ifdef __LIBXC this->kernel_to_potential_[spin_type_](rho[0], v_eff, ispin_op); #else throw std::domain_error("GlobalV::XC_Functional::get_func_type() =" + std::to_string(XC_Functional::get_func_type()) diff --git a/source/source_lcao/module_lr/potentials/xc_kernel.cpp b/source/source_lcao/module_lr/potentials/xc_kernel.cpp index 8a6d36cf76..de7146db67 100644 --- a/source/source_lcao/module_lr/potentials/xc_kernel.cpp +++ b/source/source_lcao/module_lr/potentials/xc_kernel.cpp @@ -7,7 +7,7 @@ #include #include #include "source_io/module_output/cube_io.h" -#ifdef USE_LIBXC +#ifdef __LIBXC #include #include "source_hamilt/module_xc/libxc_abacus.h" #endif @@ -48,7 +48,7 @@ LR::KernelXC::KernelXC(const ModulePW::PW_Basis& rho_basis, return; } -#ifdef USE_LIBXC +#ifdef __LIBXC if (lr_init_xc_kernel[0] == "from_charge_file") { assert(lr_init_xc_kernel.size() >= 2); @@ -111,7 +111,7 @@ inline void cutoff_grid_data_spin2(std::vector& func, const std::vecto } } -#ifdef USE_LIBXC +#ifdef __LIBXC void LR::KernelXC::f_xc_libxc(const int& nspin, const double& omega, const double& tpiba, const double* const* const rho_gs, const double* const rho_core) { ModuleBase::TITLE("XC_Functional", "f_xc_libxc"); diff --git a/source/source_lcao/module_lr/potentials/xc_kernel.h b/source/source_lcao/module_lr/potentials/xc_kernel.h index b3be26c58b..087867c61e 100644 --- a/source/source_lcao/module_lr/potentials/xc_kernel.h +++ b/source/source_lcao/module_lr/potentials/xc_kernel.h @@ -32,7 +32,7 @@ namespace LR CREF3(v2sigma2_drho_du_u); CREF3(v2sigma2_drho_du_d); CREF3(v2sigma2_drho_dd_u); CREF3(v2sigma2_drho_dd_d); const std::vector>>& drho_gs = drho_gs_; private: -#ifdef USE_LIBXC +#ifdef __LIBXC /// @brief Calculate the XC kernel using libxc. void f_xc_libxc(const int& nspin, const double& omega, const double& tpiba, const double* const* const rho_gs, const double* const rho_core = nullptr); #endif diff --git a/source/source_lcao/module_lr/utils/test/CMakeLists.txt b/source/source_lcao/module_lr/utils/test/CMakeLists.txt index 30beb2d88a..150ba6f583 100644 --- a/source/source_lcao/module_lr/utils/test/CMakeLists.txt +++ b/source/source_lcao/module_lr/utils/test/CMakeLists.txt @@ -1,4 +1,4 @@ -abacus_disable_feature_definitions(USE_LIBXC) +abacus_disable_feature_definitions(__LIBXC) AddTest( TARGET MODULE_LR_lr_util_phys_test LIBS parameter base device container planewave #for FFT diff --git a/source/source_lcao/module_operator_lcao/test/CMakeLists.txt b/source/source_lcao/module_operator_lcao/test/CMakeLists.txt index 86c6727359..10f7cd6185 100644 --- a/source/source_lcao/module_operator_lcao/test/CMakeLists.txt +++ b/source/source_lcao/module_operator_lcao/test/CMakeLists.txt @@ -1,5 +1,5 @@ if(ENABLE_LCAO) -abacus_disable_feature_definitions(USE_NEW_TWO_CENTER) +abacus_disable_feature_definitions(__FFT_TWO_CENTER) AddTest( TARGET MODULE_LCAO_operator_overlap_test diff --git a/source/source_pw/module_pwdft/forces_cc.cpp b/source/source_pw/module_pwdft/forces_cc.cpp index 31ae94f1ff..98358f49ed 100644 --- a/source/source_pw/module_pwdft/forces_cc.cpp +++ b/source/source_pw/module_pwdft/forces_cc.cpp @@ -22,7 +22,7 @@ #endif -#ifdef USE_LIBXC +#ifdef __LIBXC #include "source_hamilt/module_xc/libxc_abacus.h" #endif @@ -63,7 +63,7 @@ void Forces::cal_force_cc(ModuleBase::matrix& forcecc, #endif if (XC_Functional::get_ked_flag()) { -#ifdef USE_LIBXC +#ifdef __LIBXC const auto etxc_vtxc_v = XC_Functional_Libxc::v_xc_meta(XC_Functional::get_func_id(), rho_basis->nrxx, ucell_in.omega, ucell_in.tpiba, chr, PARAM.inp.nspin, hybrid_alpha, hse_omega); diff --git a/source/source_pw/module_pwdft/setup_pwrho.cpp b/source/source_pw/module_pwdft/setup_pwrho.cpp index 156c5b27bb..c0d7c6f5bf 100644 --- a/source/source_pw/module_pwdft/setup_pwrho.cpp +++ b/source/source_pw/module_pwdft/setup_pwrho.cpp @@ -34,7 +34,7 @@ void pw::setup_pwrho( } // for GPU -#if (not defined(__ENABLE_FLOAT_FFTW) and (defined(__CUDA) || defined(__RCOM))) +#if (not defined(__FLOAT_FFTW) and (defined(__CUDA) || defined(__RCOM))) if (fft_device == "gpu") { fft_precision = "double"; diff --git a/source/source_pw/module_pwdft/setup_pwwfc.cpp b/source/source_pw/module_pwdft/setup_pwwfc.cpp index 5ed26ba397..bd99afed03 100644 --- a/source/source_pw/module_pwdft/setup_pwwfc.cpp +++ b/source/source_pw/module_pwdft/setup_pwwfc.cpp @@ -26,7 +26,7 @@ void pw::setup_pwwfc(const Input_para& inp, fft_device = "cpu"; } std::string fft_precision = inp.precision; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW if (inp.cal_cond && inp.esolver_type == "sdft") { fft_precision = "mixing"; diff --git a/source/source_pw/module_pwdft/stress_cc.cpp b/source/source_pw/module_pwdft/stress_cc.cpp index 0be8ef75c8..7e1456cc9c 100644 --- a/source/source_pw/module_pwdft/stress_cc.cpp +++ b/source/source_pw/module_pwdft/stress_cc.cpp @@ -6,7 +6,7 @@ #include "source_base/timer.h" #include "source_estate/cal_ux.h" -#ifdef USE_LIBXC +#ifdef __LIBXC #include "source_hamilt/module_xc/libxc_abacus.h" #endif @@ -59,7 +59,7 @@ void Stress_Func::stress_cc(ModuleBase::matrix& sigma, #endif if (XC_Functional::get_ked_flag()) { -#ifdef USE_LIBXC +#ifdef __LIBXC const auto etxc_vtxc_v = XC_Functional_Libxc::v_xc_meta(XC_Functional::get_func_id(), rho_basis->nrxx, ucell.omega, ucell.tpiba, chr, PARAM.inp.nspin, hybrid_alpha, hse_omega); diff --git a/source/source_pw/module_stodft/sto_elecond.cpp b/source/source_pw/module_stodft/sto_elecond.cpp index 505ced5549..032d40dd5d 100644 --- a/source/source_pw/module_stodft/sto_elecond.cpp +++ b/source/source_pw/module_stodft/sto_elecond.cpp @@ -37,7 +37,7 @@ Sto_EleCond::Sto_EleCond(UnitCell* p_ucell_in, this->nbands_sto = p_stowf_in->nchi; this->stofunc.set_E_range(&stoche.emin_sto, &stoche.emax_sto); this->cond_dtbatch = PARAM.inp.cond_dtbatch; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW if(!std::is_same::value) { this->hamilt_sto_ = new hamilt::HamiltSdftPW, Device>(p_elec_in->pot, p_wfcpw_in, p_kv_in, p_ppcell_in, p_ucell_in, 1, &this->low_emin_, &this->low_emax_); diff --git a/source/source_pw/module_stodft/sto_elecond.h b/source/source_pw/module_stodft/sto_elecond.h index 540e9880c4..c54a2682f6 100644 --- a/source/source_pw/module_stodft/sto_elecond.h +++ b/source/source_pw/module_stodft/sto_elecond.h @@ -10,7 +10,7 @@ template class Sto_EleCond : protected EleCond { public: -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW using lowTYPE = float; // Here we use float to accelerate the calculation, which is enough for the accuracy #else using lowTYPE = double; diff --git a/source/source_pw/module_stodft/sto_func.cpp b/source/source_pw/module_stodft/sto_func.cpp index eb30289b3c..d8935c7f7f 100644 --- a/source/source_pw/module_stodft/sto_func.cpp +++ b/source/source_pw/module_stodft/sto_func.cpp @@ -224,6 +224,6 @@ REAL Sto_Func::nroot_gauss(REAL rawe) const // we only have two examples: double and float. template class Sto_Func; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW template class Sto_Func; #endif diff --git a/source/source_pw/module_stodft/sto_tool.cpp b/source/source_pw/module_stodft/sto_tool.cpp index 8eac10985e..d21851fa9a 100644 --- a/source/source_pw/module_stodft/sto_tool.cpp +++ b/source/source_pw/module_stodft/sto_tool.cpp @@ -143,14 +143,14 @@ psi::Psi, Device>* gatherchi_op::operator() } template struct check_che_op; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW template struct check_che_op; #endif template struct gatherchi_op; template struct gatherchi_op; #if ((defined __CUDA) || (defined __ROCM)) template struct check_che_op; -#ifdef __ENABLE_FLOAT_FFTW +#ifdef __FLOAT_FFTW template struct check_che_op; #endif template struct gatherchi_op; From 2cc5064c2b8bd672c8370425568a95a9f7773418 Mon Sep 17 00:00:00 2001 From: Growl Date: Fri, 24 Jul 2026 13:42:45 +0800 Subject: [PATCH 3/3] Comment out ENABLE_EXX_DEV option --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3973573205..27a8848f4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,11 +68,13 @@ option(ENABLE_CNPY "Enable cnpy usage" OFF) cmake_dependent_option(ENABLE_ELPA "Enable ELPA for LCAO" ON "ENABLE_LCAO;ENABLE_MPI" OFF) cmake_dependent_option(ENABLE_LIBRI "Enable LibRI for hybrid functional" OFF "ENABLE_LCAO;ENABLE_MPI" OFF) -cmake_dependent_option(ENABLE_EXX_DEV "Enable LibRI developing features" OFF "ENABLE_LIBRI" OFF) cmake_dependent_option(ENABLE_PEXSI "Enable PEXSI for LCAO" OFF "ENABLE_LCAO;ENABLE_MPI" OFF) cmake_dependent_option(ENABLE_MLALGO "Enable the machine learning algorithms" OFF "ENABLE_LCAO;ENABLE_MPI" OFF) +# EXX_DEV works with libRI PR#10 which is not merged into main branch; disabling it +# cmake_dependent_option(ENABLE_EXX_DEV "Enable LibRI developing features" OFF "ENABLE_LIBRI" OFF) + # Two-center FFT is only used in LCAO cmake_dependent_option(ENABLE_FFT_TWO_CENTER "Enable FFT-based two-center integral method" ON "ENABLE_LCAO" OFF)