if(NOT BUILD_TESTING)
  return()
endif()
# Please place additional tests in alphabetical order
list(APPEND test_cases test_activedensitymatrix)
list(APPEND test_cases test_activedftengine)
list(APPEND test_cases test_adiis)
list(APPEND test_cases test_anderson)
list(APPEND test_cases test_aobasis)
list(APPEND test_cases test_aomatrix)
list(APPEND test_cases test_aomatrix3d)
list(APPEND test_cases test_aoshell)
list(APPEND test_cases test_aotransform)
list(APPEND test_cases test_aopotential)
list(APPEND test_cases test_atom)
list(APPEND test_cases test_basisset)
list(APPEND test_cases test_bfgs_trm)
list(APPEND test_cases test_bse)
list(APPEND test_cases test_bsecoupling)
list(APPEND test_cases test_bse_operator)
list(APPEND test_cases test_bseoperator_btda)
list(APPEND test_cases test_convergenceacc)
list(APPEND test_cases test_cubefile_writer)
if(USE_CUDA)
  list(APPEND test_cases test_cudapipeline)
  list(APPEND test_cases test_cudamatrix)
endif()
list(APPEND test_cases test_davidson)
list(APPEND test_cases test_DeltaQ_filter)
list(APPEND test_cases test_density_filter)
list(APPEND test_cases test_densityintegration)
list(APPEND test_cases test_dftcoupling)
list(APPEND test_cases test_dftengine)
list(APPEND test_cases test_diabatization)
list(APPEND test_cases test_diis)
list(APPEND test_cases test_dipoledipoleinteraction)
list(APPEND test_cases test_ecpaobasis)
list(APPEND test_cases test_eeinteractor)
list(APPEND test_cases test_eigen)
list(APPEND test_cases test_eris)
list(APPEND test_cases test_espfit)
list(APPEND test_cases test_gaussian_quadratures)
list(APPEND test_cases test_gaussianwriter)
list(APPEND test_cases test_glink)
list(APPEND test_cases test_gnode)
list(APPEND test_cases test_grid)
list(APPEND test_cases test_gw)
list(APPEND test_cases test_hdf5)
list(APPEND test_cases test_hist)
list(APPEND test_cases test_incrementalfockbuilder)
list(APPEND test_cases test_indexparser)
list(APPEND test_cases test_jobtopology)
list(APPEND test_cases test_localisation_filter)
list(APPEND test_cases test_molden)
list(APPEND test_cases test_newton_rapson)
list(APPEND test_cases test_orbitals)
list(APPEND test_cases test_orca)
list(APPEND test_cases test_orbreorder)
list(APPEND test_cases test_oscillatorstrength_filter)
list(APPEND test_cases test_overlap_filter)
list(APPEND test_cases test_parallelism)
list(APPEND test_cases test_pmlocalization)
list(APPEND test_cases test_polarsite)
list(APPEND test_cases test_populationanalysis)
list(APPEND test_cases test_polarsegment)
list(APPEND test_cases test_ppm)
list(APPEND test_cases test_qmatom)
list(APPEND test_cases test_qmfragment)
list(APPEND test_cases test_qmnblist)
list(APPEND test_cases test_qmpair)
list(APPEND test_cases test_qmmolecule)
list(APPEND test_cases test_qmstate)
list(APPEND test_cases test_radial_euler_maclaurin_rule)
list(APPEND test_cases test_rate_engine)
list(APPEND test_cases test_regular_grid)
list(APPEND test_cases test_rpa)
list(APPEND test_cases test_rpa_h2p)
list(APPEND test_cases test_segment)
list(APPEND test_cases test_segmentmapper)
list(APPEND test_cases test_sigma_exact)
list(APPEND test_cases test_sigma_ppm)
list(APPEND test_cases test_sigma_cda)
list(APPEND test_cases test_sphere_lebedev_rule)
list(APPEND test_cases test_statetracker)
list(APPEND test_cases test_staticsite)
list(APPEND test_cases test_symmetric_matrix)
list(APPEND test_cases test_threecenter_dft)
list(APPEND test_cases test_threecenter_gwbse)
list(APPEND test_cases test_topology)
list(APPEND test_cases test_transition_densities)	
list(APPEND test_cases test_truncdftengine)
list(APPEND test_cases test_trustregion)
list(APPEND test_cases test_vc2index)
list(APPEND test_cases test_vxc_potential)
list(APPEND test_cases test_vxc_grid)

# build and run unit tests
foreach(PROG ${test_cases} )
  add_executable(unit_${PROG} ${PROG}.cc)
  target_compile_definitions(unit_${PROG} PRIVATE XTP_TEST_DATA_FOLDER="${CMAKE_CURRENT_SOURCE_DIR}/DataFiles")
  target_link_libraries(unit_${PROG} votca_xtp Boost::unit_test_framework Libint2::int2 ECPINT::ecpint)
  target_compile_definitions(unit_${PROG} PRIVATE BOOST_TEST_DYN_LINK)
  file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Run_unit_${PROG})
  add_test(NAME unit_${PROG} COMMAND $<TARGET_FILE:unit_${PROG}> WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Run_unit_${PROG})
endforeach(PROG)

# build and run xtp integration tests
if(RUN_XTP_INTEGRATIONTESTS)
  # xtp_map test
  set(RUNPATH ${CMAKE_CURRENT_BINARY_DIR}/Run_xtp_map)
  set(REFPATH ${CMAKE_CURRENT_SOURCE_DIR}/DataFiles/xtp_integration_tests)
  file(MAKE_DIRECTORY ${RUNPATH})
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/system.xml ${RUNPATH}/system.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/MD_FILES ${RUNPATH}/MD_FILES)
  add_test(NAME integration_Run_xtp_map COMMAND xtp_map -t MD_FILES/topol.tpr -c MD_FILES/conf.gro -s system.xml -f state_map.hdf5 WORKING_DIRECTORY ${RUNPATH})
  if(HAS_HDF5_COMPARE)
    add_test(NAME integration_Compare_xtp_map_output COMMAND ${Python_EXECUTABLE} $<TARGET_FILE:VOTCA::votca_compare_hdf5> --ignore-attr XTPVersion --atol 1e-12 --rtol 1e-8 ${REFPATH}/state_map.hdf5 ${RUNPATH}/state_map.hdf5 WORKING_DIRECTORY ${RUNPATH})
    set_tests_properties(integration_Compare_xtp_map_output PROPERTIES DEPENDS integration_Run_xtp_map)
  else()
    message(STATUS "Skipping HDF5 comparison test for integration_Run_xtp_map (votca_compare_hdf5 not found)")
  endif()

  # xtp_run -e mapchecker
  set(VOTCASHARE_DIR ${XTP_SOURCE_DIR}/share)
  set(RUNPATH ${CMAKE_CURRENT_BINARY_DIR}/Run_xtp_run_mapchecker)
  file(MAKE_DIRECTORY ${RUNPATH})
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/system.xml ${RUNPATH}/system.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/mapchecker.xml ${RUNPATH}/mapchecker.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/MD_FILES ${RUNPATH}/MD_FILES)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/QC_FILES ${RUNPATH}/QC_FILES)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/MP_FILES ${RUNPATH}/MP_FILES)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/state_map.hdf5 ${RUNPATH}/state.hdf5)
  add_test(NAME integration_Run_xtp_run_mapchecker COMMAND xtp_run -e mapchecker -o mapchecker.xml -f state.hdf5 -s 0 WORKING_DIRECTORY ${RUNPATH})
  set_tests_properties(integration_Run_xtp_run_mapchecker PROPERTIES ENVIRONMENT "VOTCASHARE=${VOTCASHARE_DIR}")
  add_test(NAME integration_Compare_xtp_run_mapchecker COMMAND ${Python_EXECUTABLE} $<TARGET_FILE:VOTCA::votca_compare_pdb> ${REFPATH}/qm_segments_n_step_0.pdb ${RUNPATH}/qm_segments_n_step_0.pdb  --ignore-serial --ignore-occupancy --ignore-bfactor  WORKING_DIRECTORY ${RUNPATH})
  set_tests_properties(integration_Compare_xtp_run_mapchecker PROPERTIES DEPENDS integration_Run_xtp_run_mapchecker)

  # xtp_run -e neighborlist
  set(RUNPATH ${CMAKE_CURRENT_BINARY_DIR}/Run_xtp_run_neighborlist)
  file(MAKE_DIRECTORY ${RUNPATH})
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/neighborlist.xml ${RUNPATH}/neighborlist.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${REFPATH}/state_map.hdf5 ${RUNPATH}/state.hdf5)
  add_test(NAME integration_Run_xtp_run_neighborlist COMMAND xtp_run -e neighborlist -o neighborlist.xml -f state.hdf5  WORKING_DIRECTORY ${RUNPATH})
  set_tests_properties(integration_Run_xtp_run_neighborlist PROPERTIES ENVIRONMENT "VOTCASHARE=${VOTCASHARE_DIR}")
  if(HAS_HDF5_COMPARE)
    add_test(NAME integration_Compare_xtp_run_neighborlist_output COMMAND ${Python_EXECUTABLE} $<TARGET_FILE:VOTCA::votca_compare_hdf5> --ignore-attr XTPVersion --atol 1e-8 --rtol 1e-6 ${REFPATH}/state_neighborlist.hdf5 ${RUNPATH}/state.hdf5 WORKING_DIRECTORY ${RUNPATH})
    set_tests_properties(integration_Compare_xtp_run_neighborlist_output PROPERTIES DEPENDS integration_Run_xtp_run_neighborlist)
  else()
    message(STATUS "Skipping HDF5 comparison test for integration_Run_xtp_run_neighborlist (votca_compare_hdf5 not found)")
  endif()

  # xtp_run -e einternal
  set(RUNPATH ${CMAKE_CURRENT_BINARY_DIR}/Run_xtp_run_einternal)
  file(MAKE_DIRECTORY ${RUNPATH})
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/system.xml ${RUNPATH}/system.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${REFPATH}/state_neighborlist.hdf5 ${RUNPATH}/state.hdf5)
  add_test(NAME integration_Run_xtp_run_einternal COMMAND xtp_run -e einternal -c energies_file=system.xml -f state.hdf5 WORKING_DIRECTORY ${RUNPATH})
  set_tests_properties(integration_Run_xtp_run_einternal PROPERTIES ENVIRONMENT "VOTCASHARE=${VOTCASHARE_DIR}")
  if(HAS_HDF5_COMPARE)
    add_test(NAME integration_Compare_xtp_run_einternal_output COMMAND ${Python_EXECUTABLE} $<TARGET_FILE:VOTCA::votca_compare_hdf5> --ignore-attr XTPVersion --atol 1e-12 --rtol 1e-8 ${REFPATH}/state_einternal.hdf5 ${RUNPATH}/state.hdf5 WORKING_DIRECTORY ${RUNPATH})
    set_tests_properties(integration_Compare_xtp_run_einternal_output PROPERTIES DEPENDS integration_Run_xtp_run_einternal)
  else()
    message(STATUS "Skipping HDF5 comparison test for integration_Run_xtp_run_einternal (votca_compare_hdf5 not found)")
  endif()

  # xtp_parallel -e qmmm (MM only) -j write
  set(RUNPATH ${CMAKE_CURRENT_BINARY_DIR}/Run_xtp_parallel_qmmm_write)
  file(MAKE_DIRECTORY ${RUNPATH})
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/system.xml ${RUNPATH}/system.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${REFPATH}/state_einternal.hdf5 ${RUNPATH}/state.hdf5)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/qmmm_mm.xml ${RUNPATH}/qmmm_mm.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/MD_FILES ${RUNPATH}/MD_FILES)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/QC_FILES ${RUNPATH}/QC_FILES)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/MP_FILES ${RUNPATH}/MP_FILES)
  add_test(NAME integration_Run_xtp_parallel_qmmm_write COMMAND xtp_parallel -e qmmm -o qmmm_mm.xml -f state.hdf5 -x 1 -t 1 -j write WORKING_DIRECTORY ${RUNPATH})
  set_tests_properties(integration_Run_xtp_parallel_qmmm_write PROPERTIES ENVIRONMENT "VOTCASHARE=${VOTCASHARE_DIR}")
  if(HAS_XML_COMPARE)
    add_test(NAME integration_Compare_xtp_parallel_qmmm_write_output COMMAND ${Python_EXECUTABLE} $<TARGET_FILE:VOTCA::votca_compare_xml> ${REFPATH}/qmmm_mm_write.jobs ${RUNPATH}/qmmm_mm.jobs --atol 1e-12 --rtol 1e-8 WORKING_DIRECTORY ${RUNPATH})
    set_tests_properties(integration_Compare_xtp_parallel_qmmm_write_output PROPERTIES DEPENDS integration_Run_xtp_parallel_qmmm_write)
  else()
    message(STATUS "Skipping XML comparison test for integration_Run_xtp_parallel_qmmm_write (votca_compare_xml not found)")
  endif()

  # xtp_parallel -e qmmm (MM only) -j run
  set(RUNPATH ${CMAKE_CURRENT_BINARY_DIR}/Run_xtp_parallel_qmmm_run)
  file(MAKE_DIRECTORY ${RUNPATH})
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/system.xml ${RUNPATH}/system.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${REFPATH}/state_einternal.hdf5 ${RUNPATH}/state.hdf5)
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${REFPATH}/qmmm_mm.jobs ${RUNPATH}/qmmm_mm.jobs)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/qmmm_mm.xml ${RUNPATH}/qmmm_mm.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/MD_FILES ${RUNPATH}/MD_FILES)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/QC_FILES ${RUNPATH}/QC_FILES)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/MP_FILES ${RUNPATH}/MP_FILES)
  add_test(NAME integration_Run_xtp_parallel_qmmm_run COMMAND xtp_parallel -e qmmm -o qmmm_mm.xml -f state.hdf5 -x 1 -t 1 -j run WORKING_DIRECTORY ${RUNPATH})
  set_tests_properties(integration_Run_xtp_parallel_qmmm_run PROPERTIES ENVIRONMENT "VOTCASHARE=${VOTCASHARE_DIR}")
  if(HAS_XML_COMPARE)
    add_test(NAME integration_Compare_xtp_parallel_qmmm_run_output COMMAND ${Python_EXECUTABLE} $<TARGET_FILE:VOTCA::votca_compare_xml> ${REFPATH}/qmmm_mm_run.jobs ${RUNPATH}/qmmm_mm.jobs --ignore-tag Compute_Time --ignore-tag host --ignore-tag time --atol 1e-12 --rtol 1e-8 WORKING_DIRECTORY ${RUNPATH})
    set_tests_properties(integration_Compare_xtp_parallel_qmmm_run_output PROPERTIES DEPENDS integration_Run_xtp_parallel_qmmm_run)
  else()
    message(STATUS "Skipping XML comparison test for integration_Run_xtp_parallel_qmmm_run (votca_compare_xml not found)")
  endif()

  # xtp_parallel -e qmmm (MM only) -j read
  set(RUNPATH ${CMAKE_CURRENT_BINARY_DIR}/Run_xtp_parallel_qmmm_read)
  file(MAKE_DIRECTORY ${RUNPATH})
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/system.xml ${RUNPATH}/system.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${REFPATH}/state_einternal.hdf5 ${RUNPATH}/state.hdf5)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/qmmm_mm.xml ${RUNPATH}/qmmm_mm.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/qmmm_mm_run.jobs ${RUNPATH}/qmmm_mm.jobs)
  add_test(NAME integration_Run_xtp_parallel_qmmm_read COMMAND xtp_parallel -e qmmm -o qmmm_mm.xml -f state.hdf5 -x 1 -t 1 -j read WORKING_DIRECTORY ${RUNPATH})
  set_tests_properties(integration_Run_xtp_parallel_qmmm_read PROPERTIES ENVIRONMENT "VOTCASHARE=${VOTCASHARE_DIR}")
  if(HAS_HDF5_COMPARE)
    add_test(NAME integration_Compare_xtp_parallel_qmmm_read_output COMMAND ${Python_EXECUTABLE} $<TARGET_FILE:VOTCA::votca_compare_hdf5> --ignore-attr XTPVersion --atol 1e-12 --rtol 1e-8 ${REFPATH}/state_qmmm.hdf5 ${RUNPATH}/state.hdf5 WORKING_DIRECTORY ${RUNPATH})
    set_tests_properties(integration_Compare_xtp_parallel_qmmm_read_output PROPERTIES DEPENDS integration_Run_xtp_parallel_qmmm_read)
  else()
    message(STATUS "Skipping HDF5 comparison test for integration_Run_xtp_parallel_qmmm_read (votca_compare_hdf5 not found)")
  endif()

  # xtp_parallel -e eqm -j write
  set(RUNPATH ${CMAKE_CURRENT_BINARY_DIR}/Run_xtp_parallel_eqm_write)
  file(MAKE_DIRECTORY ${RUNPATH})
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/system.xml ${RUNPATH}/system.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${REFPATH}/state_qmmm.hdf5 ${RUNPATH}/state.hdf5)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/eqm.xml ${RUNPATH}/eqm.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/MD_FILES ${RUNPATH}/MD_FILES)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/QC_FILES ${RUNPATH}/QC_FILES)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/MP_FILES ${RUNPATH}/MP_FILES)
  add_test(NAME integration_Run_xtp_parallel_eqm_write COMMAND xtp_parallel -e eqm -o eqm.xml -f state.hdf5 -x 1 -t 1 -j write WORKING_DIRECTORY ${RUNPATH})
  set_tests_properties(integration_Run_xtp_parallel_eqm_write PROPERTIES ENVIRONMENT "VOTCASHARE=${VOTCASHARE_DIR}")
  if(HAS_XML_COMPARE)
    add_test(NAME integration_Compare_xtp_parallel_eqm_write_output COMMAND ${Python_EXECUTABLE} $<TARGET_FILE:VOTCA::votca_compare_xml> ${REFPATH}/eqm_write.jobs ${RUNPATH}/eqm.jobs --atol 1e-12 --rtol 1e-8 WORKING_DIRECTORY ${RUNPATH})
    set_tests_properties(integration_Compare_xtp_parallel_eqm_write_output PROPERTIES DEPENDS integration_Run_xtp_parallel_eqm_write)
  else()
    message(STATUS "Skipping XML comparison test for integration_Run_xtp_parallel_eqm_write (votca_compare_xml not found)")
  endif()

  # xtp_parallel -e eqm -j run
  set(RUNPATH ${CMAKE_CURRENT_BINARY_DIR}/Run_xtp_parallel_eqm_run)
  file(MAKE_DIRECTORY ${RUNPATH})
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/system.xml ${RUNPATH}/system.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${REFPATH}/state_qmmm.hdf5 ${RUNPATH}/state.hdf5)
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${REFPATH}/eqm_run.in ${RUNPATH}/eqm.jobs)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/eqm.xml ${RUNPATH}/eqm.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/MD_FILES ${RUNPATH}/MD_FILES)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/QC_FILES ${RUNPATH}/QC_FILES)
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${REFPATH}/MP_FILES ${RUNPATH}/MP_FILES)
  add_test(NAME integration_Run_xtp_parallel_eqm_run COMMAND xtp_parallel -e eqm -o eqm.xml -f state.hdf5 -x 1 -t 1 -j run WORKING_DIRECTORY ${RUNPATH})
  set_tests_properties(integration_Run_xtp_parallel_eqm_run PROPERTIES ENVIRONMENT "VOTCASHARE=${VOTCASHARE_DIR}")
  if(HAS_XML_COMPARE)
    add_test(NAME integration_Compare_xtp_parallel_eqm_run_output COMMAND ${Python_EXECUTABLE} $<TARGET_FILE:VOTCA::votca_compare_xml> ${REFPATH}/eqm_run.jobs ${RUNPATH}/eqm.jobs   --ignore-tag Compute_Time --ignore-tag host --ignore-tag time --rtol 1e-8 --atol 1e-12 --tag-tol qp_energy:2e-7:5e-6 --tag-tol gw_energy:2e-7:5e-6 --tag-tol dft_energy:2e-7:5e-6 --tag-tol omega:2e-7:5e-6 --signflip-tag Trdipole WORKING_DIRECTORY ${RUNPATH})
    set_tests_properties(integration_Compare_xtp_parallel_eqm_run_output PROPERTIES DEPENDS integration_Run_xtp_parallel_eqm_run)
  else()
    message(STATUS "Skipping XML comparison test for integration_Run_xtp_parallel_eqm_run (votca_compare_xml not found)")
  endif()
  if(HAS_HDF5_COMPARE)
    add_test(NAME integration_Compare_xtp_parallel_eqm_run_output2 COMMAND ${Python_EXECUTABLE} $<TARGET_FILE:VOTCA::votca_compare_hdf5> --ignore-attr XTPVersion --atol 1e-6 --rtol 1e-7  --td-atol 3e-6 ${REFPATH}/OR_FILES/molecules/frame_0/molecule_0.orb ${RUNPATH}/OR_FILES/molecules/frame_0/molecule_0.orb WORKING_DIRECTORY ${RUNPATH})
    add_test(NAME integration_Compare_xtp_parallel_eqm_run_output3 COMMAND ${Python_EXECUTABLE} $<TARGET_FILE:VOTCA::votca_compare_hdf5> --ignore-attr XTPVersion --atol 1e-6 --rtol 1e-7  --td-atol 3e-6 ${REFPATH}/OR_FILES/molecules/frame_0/molecule_1.orb ${RUNPATH}/OR_FILES/molecules/frame_0/molecule_1.orb WORKING_DIRECTORY ${RUNPATH})
    set_tests_properties(integration_Compare_xtp_parallel_eqm_run_output2 PROPERTIES DEPENDS integration_Run_xtp_parallel_eqm_run)
    set_tests_properties(integration_Compare_xtp_parallel_eqm_run_output3 PROPERTIES DEPENDS integration_Run_xtp_parallel_eqm_run)
  else()
    message(STATUS "Skipping HDF5 comparison test for integration_Run_xtp_parallel_eqm_run (votca_compare_hdf5 not found)")
  endif()
  add_test(NAME integration_Compare_xtp_parallel_eqm_run_output4 COMMAND ${Python_EXECUTABLE} $<TARGET_FILE:VOTCA::votca_compare_mps> ${REFPATH}/MP_FILES/frame_0/n2s1/Methane_0_n2s1.mps ${RUNPATH}/MP_FILES/frame_0/n2s1/Methane_0_n2s1.mps --allow-charge-sign --atol 1e-7 --rtol 1e-8 WORKING_DIRECTORY ${RUNPATH})
  add_test(NAME integration_Compare_xtp_parallel_eqm_run_output5 COMMAND ${Python_EXECUTABLE} $<TARGET_FILE:VOTCA::votca_compare_mps> ${REFPATH}/MP_FILES/frame_0/n2s1/Methane_1_n2s1.mps ${RUNPATH}/MP_FILES/frame_0/n2s1/Methane_1_n2s1.mps --allow-charge-sign --atol 1e-7 --rtol 1e-8 WORKING_DIRECTORY ${RUNPATH})

  # xtp_parallel -e iqm -j write
  set(RUNPATH ${CMAKE_CURRENT_BINARY_DIR}/Run_xtp_parallel_iqm_write)
  file(MAKE_DIRECTORY ${RUNPATH})
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/system.xml ${RUNPATH}/system.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${REFPATH}/state_qmmm.hdf5 ${RUNPATH}/state.hdf5)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/iqm.xml ${RUNPATH}/iqm.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/MD_FILES ${RUNPATH}/MD_FILES)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/QC_FILES ${RUNPATH}/QC_FILES)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/MP_FILES ${RUNPATH}/MP_FILES)
  add_test(NAME integration_Run_xtp_parallel_iqm_write COMMAND xtp_parallel -e iqm -o iqm.xml -f state.hdf5 -x 1 -t 1 -j write WORKING_DIRECTORY ${RUNPATH})
  set_tests_properties(integration_Run_xtp_parallel_iqm_write PROPERTIES ENVIRONMENT "VOTCASHARE=${VOTCASHARE_DIR}")
  if(HAS_XML_COMPARE)
    add_test(NAME integration_Compare_xtp_parallel_iqm_write_output COMMAND ${Python_EXECUTABLE} $<TARGET_FILE:VOTCA::votca_compare_xml> ${REFPATH}/iqm_write.jobs ${RUNPATH}/iqm.jobs --atol 1e-12 --rtol 1e-8 WORKING_DIRECTORY ${RUNPATH})
    set_tests_properties(integration_Compare_xtp_parallel_iqm_write_output PROPERTIES DEPENDS integration_Run_xtp_parallel_iqm_write)
  else()
    message(STATUS "Skipping XML comparison test for integration_Run_xtp_parallel_iqm_write (votca_compare_xml not found)")
  endif()


  # xtp_parallel -e iqm -j run
  set(RUNPATH ${CMAKE_CURRENT_BINARY_DIR}/Run_xtp_parallel_iqm_run)
  file(MAKE_DIRECTORY ${RUNPATH})
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/system.xml ${RUNPATH}/system.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${REFPATH}/state_qmmm.hdf5 ${RUNPATH}/state.hdf5)
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${REFPATH}/iqm_run.in ${RUNPATH}/iqm.jobs)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/iqm.xml ${RUNPATH}/iqm.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/MD_FILES ${RUNPATH}/MD_FILES)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/QC_FILES ${RUNPATH}/QC_FILES)
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${REFPATH}/OR_FILES ${RUNPATH}/OR_FILES)
  add_test(NAME integration_Run_xtp_parallel_iqm_run COMMAND xtp_parallel -e iqm -o iqm.xml -f state.hdf5 -x 1 -t 1 -j run WORKING_DIRECTORY ${RUNPATH})
  set_tests_properties(integration_Run_xtp_parallel_iqm_run PROPERTIES ENVIRONMENT "VOTCASHARE=${VOTCASHARE_DIR}")
  if(HAS_XML_COMPARE)
    add_test(NAME integration_Compare_xtp_parallel_iqm_run_output COMMAND ${Python_EXECUTABLE} $<TARGET_FILE:VOTCA::votca_compare_xml> ${REFPATH}/iqm_run.jobs ${RUNPATH}/iqm.jobs  --ignore-tag Compute_Time --ignore-tag host --ignore-tag time --rtol 1e-5 --atol 1e-6 --signflip-tag Trdipole WORKING_DIRECTORY ${RUNPATH})
    set_tests_properties(integration_Compare_xtp_parallel_iqm_run_output PROPERTIES DEPENDS integration_Run_xtp_parallel_iqm_run)
  else()
    message(STATUS "Skipping XML comparison test for integration_Run_xtp_parallel_iqm_run (votca_compare_xml not found)")
  endif()

  # xtp_parallel -e iqm -j read
  set(RUNPATH ${CMAKE_CURRENT_BINARY_DIR}/Run_xtp_parallel_iqm_read)
  file(MAKE_DIRECTORY ${RUNPATH})
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/system.xml ${RUNPATH}/system.xml)
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${REFPATH}/state_qmmm.hdf5 ${RUNPATH}/state.hdf5)
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${REFPATH}/iqm_run.jobs ${RUNPATH}/iqm.jobs)
  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${REFPATH}/iqm.xml ${RUNPATH}/iqm.xml)
  add_test(NAME integration_Run_xtp_parallel_iqm_read COMMAND xtp_parallel -e iqm -o iqm.xml -f state.hdf5 -x 1 -t 1 -j read WORKING_DIRECTORY ${RUNPATH})
  set_tests_properties(integration_Run_xtp_parallel_iqm_read PROPERTIES ENVIRONMENT "VOTCASHARE=${VOTCASHARE_DIR}")
  if(HAS_HDF5_COMPARE)
    add_test(NAME integration_Compare_xtp_parallel_iqm_read_output COMMAND ${Python_EXECUTABLE} $<TARGET_FILE:VOTCA::votca_compare_hdf5> --ignore-attr XTPVersion --atol 1e-6 --rtol 1e-7  --td-atol 3e-6 ${REFPATH}/state_iqm.hdf5 ${RUNPATH}/state.hdf5 WORKING_DIRECTORY ${RUNPATH})
    set_tests_properties(integration_Compare_xtp_parallel_iqm_read_output PROPERTIES DEPENDS integration_Run_xtp_parallel_iqm_read)
  else()
    message(STATUS "Skipping HDF5 comparison test for integration_Run_xtp_parallel_iqm_read (votca_compare_hdf5 not found)")
  endif()
 
endif()