Skip to content

Commit

Permalink
Add CMake dependencies for GPAW4QMCPACK converter
Browse files Browse the repository at this point in the history
  • Loading branch information
Juha Tiihonen committed Dec 20, 2021
1 parent a83be6d commit 198d6a9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,19 @@ if(NOT QMC_NO_SLOW_CUSTOM_TESTING_COMMANDS)
endif()
endif()

#-------------------------------------------------------------------
# Check if GPAW and ASE are available
#-------------------------------------------------------------------
if(NOT QMC_NO_SLOW_CUSTOM_TESTING_COMMANDS)
test_python_module(ase HAVE_ASE)
test_python_module(gpaw HAVE_GPAW)
if(HAVE_ASE AND HAVE_GPAW)
message(STATUS "Successfully imported ASE and GPAW python modules.")
else()
message(STATUS "Unable to import GPAW and ASE python modules. GPAW converter tests will not be run.")
endif()
endif()

#-------------------------------------------------------------------
# Check if QE executables available at QE_BIN or on the PATH
#-------------------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion src/QMCTools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ if(USE_OBJECT_TARGET)
target_link_libraries(qmcfinitesize qmcparticle qmcutil)
endif()

configure_file(gpaw4qmcpack ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/gpaw4qmcpack COPYONLY)
if (HAVE_ASE AND HAVE_GPAW)
configure_file(gpaw4qmcpack ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/gpaw4qmcpack COPYONLY)
endif()

install(TARGETS convert4qmc qmc-extract-eshdf-kvectors qmc-get-supercell qmc-check-affinity convertpw4qmc qmcfinitesize
RUNTIME DESTINATION bin)
Expand Down
29 changes: 15 additions & 14 deletions tests/converter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,20 @@ add_converter_test(test_diamond2_rmg)
add_converter_test(test_O_rmg)

# add tests for GPAW4QMCPACK converter
function(ADD_GPAW4QMCPACK_TEST test_name)
if (HAVE_GPAW AND HAVE_ASE)
function(ADD_GPAW4QMCPACK_TEST test_name)
set(EXE_NAME ${qmcpack_BINARY_DIR}/bin/gpaw4qmcpack)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/gpaw4qmcpack_test.py"
"${CMAKE_CURRENT_BINARY_DIR}")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/${test_name}"
"${CMAKE_CURRENT_BINARY_DIR}/${test_name}")
add_test(NAME gpaw4qmcpack_test COMMAND "${CMAKE_CURRENT_BINARY_DIR}/gpaw4qmcpack_test.py"
"${CMAKE_CURRENT_BINARY_DIR}/${test_name}"
execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/gpaw4qmcpack_test.py"
"${CMAKE_CURRENT_BINARY_DIR}")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/${test_name}"
"${CMAKE_CURRENT_BINARY_DIR}/${test_name}")
add_test(NAME gpaw4qmcpack_test COMMAND "${CMAKE_CURRENT_BINARY_DIR}/gpaw4qmcpack_test.py"
"${CMAKE_CURRENT_BINARY_DIR}/${test_name}"
--exe "${EXE_NAME}" --h5diff "${HDF5_DIFF_EXECUTABLE}")
message(${EXE_NAME})
set_tests_properties(gpaw4qmcpack_test PROPERTIES
FAIL_REGULAR_EXPRESSION " FAIL"
PASS_REGULAR_EXPRESSION " pass"
TIMEOUT 120 LABELS "converter;deterministic")
endfunction()
add_gpaw4qmcpack_test(test_Si_diamond)
set_tests_properties(gpaw4qmcpack_test PROPERTIES
FAIL_REGULAR_EXPRESSION " FAIL"
PASS_REGULAR_EXPRESSION " pass"
TIMEOUT 120 LABELS "converter;deterministic")
endfunction()
add_gpaw4qmcpack_test(test_Si_diamond)
endif()

0 comments on commit 198d6a9

Please sign in to comment.