3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-07 06:33:48 +01:00
This commit is contained in:
Olivier Parcollet 2017-12-07 15:56:05 +01:00
parent d7d720141e
commit ae548d48da
8 changed files with 56 additions and 61 deletions

View File

@ -2,45 +2,49 @@
set (DFT_TOOLS_VERSION "1.5") set (DFT_TOOLS_VERSION "1.5")
set (DFT_TOOLS_RELEASE "1.5.0") set (DFT_TOOLS_RELEASE "1.5.0")
# Append triqs installed files to the cmake load path # Default to Release build type
list(APPEND CMAKE_MODULE_PATH ${TRIQS_PATH}/share/triqs/cmake) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Type of build" FORCE)
endif()
message( STATUS "-------- BUILD-TYPE: ${CMAKE_BUILD_TYPE} -------------")
# start configuration # start configuration
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
project(dft_tools CXX Fortran) project(dft_tools CXX Fortran)
set(CMAKE_BUILD_TYPE Release)
enable_testing()
# Load TRIQS, including all predefined variables from TRIQS installation # Use shared libraries
find_package(TRIQS REQUIRED) set(BUILD_SHARED_LIBS ON)
# Load TRIQS and Cpp2Py
find_package(TRIQS 1.5 EXACT REQUIRED)
find_package(Cpp2Py REQUIRED)
# Check that versions are compatible
if(NOT DFT_TOOLS_VERSION EQUAL TRIQS_VERSION)
message(FATAL_ERROR "The application version is not compatible with the TRIQS library (TRIQS library version: ${TRIQS_VERSION} while this application version: ${DFT_TOOLS_VERSION})")
endif()
if (NOT ${TRIQS_WITH_PYTHON_SUPPORT}) if (NOT ${TRIQS_WITH_PYTHON_SUPPORT})
MESSAGE(FATAL_ERROR "dft_tools require Python support in TRIQS") MESSAGE(FATAL_ERROR "dft_tools require Python support in TRIQS")
endif() endif()
# Get hash # Default Install directory to TRIQS_ROOT if not given. Checks an absolute name is given.
triqs_get_git_hash(${CMAKE_SOURCE_DIR} "DFT_TOOLS") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR (NOT IS_ABSOLUTE ${CMAKE_INSTALL_PREFIX}))
if(${GIT_RESULT} EQUAL 0) message(STATUS " No install prefix given (or invalid). Defaulting to TRIQS_ROOT")
message(STATUS "Hash: ${DFT_TOOLS_GIT_HASH}") set(CMAKE_INSTALL_PREFIX ${TRIQS_ROOT} CACHE PATH "default install path" FORCE)
endif(${GIT_RESULT} EQUAL 0) endif()
message(STATUS "-------- CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX} -------------")
# We want to be installed in the TRIQS tree # Macro defined in TRIQS which picks the hash of repo.
set(CMAKE_INSTALL_PREFIX ${TRIQS_PATH}) triqs_get_git_hash_of_source_dir(DFT_TOOLS_GIT_HASH)
message(STATUS "Git hash: ${DFT_TOOLS_GIT_HASH}")
add_subdirectory(fortran/dmftproj) add_subdirectory(fortran/dmftproj)
# Add the compiling options (-D... ) for C++ # Add the compiling options (-D... ) for C++
message(STATUS "TRIQS : Adding compilation flags detected by the library (C++11/14, libc++, etc...) ") message(STATUS "TRIQS : Adding compilation flags detected by the library (C++11/14, libc++, etc...) ")
add_definitions(${TRIQS_CXX_DEFINITIONS})
add_subdirectory(c++) add_subdirectory(c++)
add_subdirectory(python) add_subdirectory(python)
add_subdirectory(shells) add_subdirectory(shells)
add_subdirectory(test) add_subdirectory(test)
option(BUILD_DOC "Build documentation" OFF) option(BUILD_DOC "Build documentation" OFF)
if(${BUILD_DOC}) if(${BUILD_DOC})
if(NOT TRIQS_WITH_DOCUMENTATION) if(NOT TRIQS_WITH_DOCUMENTATION)

View File

@ -1,7 +1,6 @@
# Linking and include info
add_library(atm_c dos_tetra3d.hpp dos_tetra3d.cpp argsort.hpp argsort.cpp) add_library(atm_c dos_tetra3d.hpp dos_tetra3d.cpp argsort.hpp argsort.cpp)
set_target_properties(atm_c PROPERTIES LINKER_LANGUAGE CXX) target_link_libraries(atm_c triqs)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/c++/plovasp/atm ${TRIQS_INCLUDE_ALL}) target_compile_options(atm_c PRIVATE -std=c++14)
install(TARGETS atm_c DESTINATION lib) install(TARGETS atm_c DESTINATION lib)

View File

@ -1,24 +1,13 @@
find_package(TriqsTest)
enable_testing() enable_testing()
# Linking and include info
#add_library(atm_c dos_tetra3d.hpp dos_tetra3d.cpp argsort.h argsort.c)
#set_target_properties(atm_c PROPERTIES LINKER_LANGUAGE CXX)
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/c++/plovasp/atm ${TRIQS_INCLUDE_ALL})
FILE(GLOB TestList RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) FILE(GLOB TestList RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
FOREACH( TestName1 ${TestList} ) FOREACH( TestName1 ${TestList} )
STRING(REPLACE ".cpp" "" TestName ${TestName1}) STRING(REPLACE ".cpp" "" TestName ${TestName1})
add_executable( ${TestName} ${CMAKE_CURRENT_SOURCE_DIR}/${TestName}.cpp ) add_executable( ${TestName} ${TestName}.cpp )
target_link_libraries( ${TestName} atm_c ${TRIQS_LIBRARY_ALL} ) target_link_libraries( ${TestName} atm_c triqs)
triqs_set_rpath_for_target( ${TestName} ) triqs_set_rpath_for_target( ${TestName} )
triqs_add_cpp_test( ${TestName} ) add_test(NAME ${TestName} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${t})
if (TESTS_C_WITH_VALGRIND)
add_test ( ${TestName}_valgrind valgrind --error-exitcode=1 ${CMAKE_CURRENT_BINARY_DIR}/${TestName})
endif()
ENDFOREACH( TestName1 ${TestList} ) ENDFOREACH( TestName1 ${TestList} )
#add_executable(test_atm test2py.cpp)
#target_link_libraries(test_atm atm_c)
#add_subdirectory(test)

View File

@ -6,7 +6,7 @@ set(SOURCES modules.f dmftproj.f readcomline.f set_ang_trans.f setsym.f
# The main target and what to link with... # The main target and what to link with...
add_executable(dmftproj ${SOURCES}) add_executable(dmftproj ${SOURCES})
target_link_libraries(dmftproj ${TRIQS_LIBRARY_LAPACK}) target_link_libraries(dmftproj "-framework Accelerate") #${TRIQS_LIBRARY_LAPACK})
# where to install # where to install
install (TARGETS dmftproj DESTINATION bin) install (TARGETS dmftproj DESTINATION bin)

View File

@ -1,16 +1,18 @@
# where will the python end up in triqs? # where will the python end up in triqs?
set(python_destination pytriqs/applications/dft) set(python_destination pytriqs/applications/dft)
set(PYTHON_LIB_DEST ${CPP2PY_PYTHON_LIB_DEST_ROOT}/pytriqs/cthyb)
# site_customize for build # site_customize for build
set(package_name "pytriqs.applications") set(package_name "pytriqs.applications")
configure_file(${CMAKE_SOURCE_DIR}/cmake/sitecustomize.py ${CMAKE_CURRENT_BINARY_DIR}/sitecustomize.py @ONLY) configure_file(${CMAKE_SOURCE_DIR}/cmake/sitecustomize.py ${CMAKE_CURRENT_BINARY_DIR}/sitecustomize.py @ONLY)
# make a local pytriqs copy
triqs_prepare_local_pytriqs(${python_destination})
# VASP converter # VASP converter
add_subdirectory(converters/plovasp) add_subdirectory(converters/plovasp)
# add version file # add version file
configure_file(version.py.in version.py) configure_file(version.py.in version.py @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version.py DESTINATION ${TRIQS_PYTHON_LIB_DEST_ROOT}/${python_destination}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version.py DESTINATION ${PYTHON_LIB_DEST})

View File

@ -1,11 +1,13 @@
set(python_destination pytriqs/applications/dft/converters/plovasp) set(python_destination pytriqs/applications/dft/converters/plovasp)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${TRIQS_INCLUDE_ALL}) add_cpp2py_module(atm)
triqs_python_extension(atm ${python_destination}) target_link_libraries(atm atm_c triqs)
target_link_libraries(atm atm_c ${TRIQS_LIBRARY_ALL}) #triqs_set_rpath_for_target(atm)
triqs_set_rpath_for_target(atm) target_compile_options(atm PRIVATE -std=c++14)
# This we need in order for tests to work # This we need in order for tests to work
add_custom_command(TARGET atm POST_BUILD COMMAND ln -fs ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}/atm.so ${CMAKE_BINARY_DIR}/python/dft/converters/plovasp) #add_custom_command(TARGET atm POST_BUILD COMMAND ln -fs ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}/atm.so ${CMAKE_BINARY_DIR}/python/dft/converters/plovasp)
install (TARGETS atm DESTINATION ${PYTHON_LIB_DEST})
install (TARGETS atm DESTINATION ${TRIQS_PYTHON_LIB_DEST_ROOT}/${python_destination})

View File

@ -1,6 +1,6 @@
# Generated automatically using the command : # Generated automatically using the command :
# c++2py.py -m atm -o atm --moduledoc "Analytical Tetrahedron Method for DOS" ../../../c++/plovasp/atm/dos_tetra3d.hpp # c++2py.py -m atm -o atm --moduledoc "Analytical Tetrahedron Method for DOS" ../../../c++/plovasp/atm/dos_tetra3d.hpp
from wrap_generator import * from cpp2py.wrap_generator import *
# The module # The module
module = module_(full_name = "atm", doc = "Analytical Tetrahedron Method for calculating DOS", app_name = "atm") module = module_(full_name = "atm", doc = "Analytical Tetrahedron Method for calculating DOS", app_name = "atm")

View File

@ -1,20 +1,19 @@
# load triqs helper to set up tests
find_package(TriqsTest)
# Copy h5 files to binary dir # Copy h5 files to binary dir
FILE(GLOB all_h5_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h5) FILE(GLOB all_h5_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h5)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/${all_h5_files} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/${all_h5_files} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
# Copy other files # Copy other files
FILE(COPY SrVO3.pmat SrVO3.struct SrVO3.outputs SrVO3.oubwin SrVO3.ctqmcout SrVO3.symqmc SrVO3.sympar SrVO3.parproj hk_convert_hamiltonian.hk LaVO3-Pnma_hr.dat LaVO3-Pnma.inp DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) FILE(COPY SrVO3.pmat SrVO3.struct SrVO3.outputs SrVO3.oubwin SrVO3.ctqmcout SrVO3.symqmc SrVO3.sympar SrVO3.parproj hk_convert_hamiltonian.hk LaVO3-Pnma_hr.dat LaVO3-Pnma.inp DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
triqs_add_python_test(wien2k_convert) # List all tests
triqs_add_python_test(hk_convert) set(all_tests wien2k_convert hk_convert w90_convert sumkdft_basic srvo3_Gloc srvo3_transp sigma_from_file blockstructure)
triqs_add_python_test(w90_convert)
triqs_add_python_test(sumkdft_basic) foreach(t ${all_tests})
triqs_add_python_test(srvo3_Gloc) add_test(NAME ${t} COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/${t}.py)
triqs_add_python_test(srvo3_transp) endforeach()
triqs_add_python_test(sigma_from_file)
triqs_add_python_test(blockstructure) # Set the PythonPath : put the build dir first (in case there is an installed version).
set_property(TEST ${all_tests} PROPERTY ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/python:$ENV{PYTHONPATH} )
# VASP converter tests # VASP converter tests
add_subdirectory(plovasp) add_subdirectory(plovasp)