3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-25 13:53:40 +01:00

First commit : triqs libs version 1.0 alpha1

for earlier commits, see TRIQS0.x repository.
This commit is contained in:
Olivier Parcollet 2013-07-17 19:24:07 +02:00
commit f2c7d449cc
866 changed files with 73407 additions and 0 deletions

99
CITATIONS.bib Normal file
View File

@ -0,0 +1,99 @@
TRIQS is a part of our scientific work and we would appreciate if projects
using it will include a citation to TRIQS. In order to help you, we provide this
BibTeX digest of the papers relevant for the various TRIQS modules.
--------------------------------------------------------------------------------
THE TRIQS PROJECT BASIC COMPONENTS (Green's functions, HDF archives, ...)
--------------------------------------------------------------------------------
A companion paper will be published soon
@Misc{triqs_project,
author = {Ferrero, Michel and Parcollet, Olivier},
title = {{TRIQS}: a {T}oolbox for {R}esearch in {I}nteracting {Q}uantum {S}ystems},
url = {http://ipht.cea.fr/triqs}
}
--------------------------------------------------------------------------------
EXTENSION MODULES: Hybridization Quantum Monte Carlo
--------------------------------------------------------------------------------
@Article{triqs_ctqmc_solver_boehnke,
volume = {84},
month = {Aug},
numpages = {13},
author = {Boehnke, Lewin and Hafermann, Hartmut and Ferrero, Michel and Lechermann, Frank and Parcollet, Olivier},
year = {2011},
url = {http://link.aps.org/doi/10.1103/PhysRevB.84.075145},
doi = {10.1103/PhysRevB.84.075145},
issue = {7},
title = {Orthogonal polynomial representation of imaginary-time Green's functions},
publisher = {American Physical Society},
pages = {075145},
journal = {Phys. Rev. B}
}
@Article{triqs_ctqmc_solver_werner1,
volume = {97},
month = {Aug},
numpages = {4},
author = {Werner, Philipp and Comanac, Armin and de' Medici, Luca and Troyer, Matthias and Millis, Andrew J.},
year = {2006},
url = {http://link.aps.org/doi/10.1103/PhysRevLett.97.076405},
doi = {10.1103/PhysRevLett.97.076405},
issue = {7},
title = {Continuous-Time Solver for Quantum Impurity Models},
publisher = {American Physical Society},
pages = {076405},
journal = {Phys. Rev. Lett.}
}
@Article{triqs_ctqmc_solver_werner2,
volume = {74},
month = {Oct},
numpages = {13},
author = {Werner, Philipp and Millis, Andrew J.},
year = {2006},
url = {http://link.aps.org/doi/10.1103/PhysRevB.74.155107},
doi = {10.1103/PhysRevB.74.155107},
issue = {15},
title = {Hybridization expansion impurity solver: General formulation and application to Kondo lattice and two-orbital models},
publisher = {American Physical Society},
pages = {155107},
journal = {Phys. Rev. B}
}
--------------------------------------------------------------------------------
EXTENSION MODULES: Wien2K interface
--------------------------------------------------------------------------------
@Article{triqs_wien2k_interface,
volume = {80},
month = {Aug},
numpages = {15},
author = {Aichhorn, Markus and Pourovskii, Leonid and Vildosola, Veronica and Ferrero, Michel and Parcollet, Olivier and Miyake, Takashi and Georges, Antoine and Biermann, Silke},
year = {2009},
url = {http://link.aps.org/doi/10.1103/PhysRevB.80.085101},
doi = {10.1103/PhysRevB.80.085101},
issue = {8},
title = {Dynamical mean-field theory within an augmented plane-wave framework: Assessing electronic correlations in the iron pnictide LaFeAsO},
publisher = {American Physical Society},
pages = {085101},
journal = {Phys. Rev. B}
}
@Article{triqs_wien2k_full_charge_SC,
doi = {10.1103/PhysRevB.84.054529},
month = {Aug},
issue = {5},
author = {Aichhorn, Markus and Pourovskii, Leonid and Georges, Antoine},
year = {2011},
url = {http://link.aps.org/doi/10.1103/PhysRevB.84.054529},
publisher = {American Physical Society},
title = {Importance of electronic correlations for structural and magnetic properties of the iron pnictide superconductor LaFeAsO},
pages = {054529},
journal = {Phys. Rev. B},
volume = {84},
numpages = {7}
}

474
CMakeLists.txt Normal file
View File

@ -0,0 +1,474 @@
###################################################################################
#
# TRIQS: a Toolbox for Research in Interacting Quantum Systems
#
# Copyright (C) 2013 by O. Parcollet, M. Ferrero, A. Antipov
#
# TRIQS is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# TRIQS. If not, see <http://www.gnu.org/licenses/>.
#
###################################################################################
#version number of the library
set (TRIQS_VERSION "1.0.0")
# Path for local cmake modules
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
# Where is triqs source
set(TRIQS_SOURCE_DIR "${CMAKE_SOURCE_DIR}")
# a default version : by default installation in the build dir :
# useful for developer : everything is at the same place, easy to clean.
# pass -DCMAKE_INSTALL_PREFIX to overrule
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/INSTALL_DIR" CACHE PATH "TRIQS install prefix" )
message(STATUS "Installation directory is ${CMAKE_INSTALL_PREFIX}")
# Forbid compilation in the source dir... to force good practice
# and because I have not checked it (copy of various file before compilation may mess it up)
if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
message(FATAL_ERROR "I am sorry, the on-site compilation is disabled at the moment. Use another directory")
endif (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
# nasty policy for escaping in string....
cmake_policy(SET CMP0011 OLD)
cmake_policy(SET CMP0005 NEW)
cmake_policy(SET CMP0003 NEW) #cmake --help-policy CMP0003
cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)
project (AllPrograms C CXX Fortran)
## C & C++ Headers
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
# Make sure the rpath is set fine after installation
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# First check the C++ compiler
find_package(CompilerCheck)
# Include TRIQS cmake macros
find_package(TriqsMacros)
# Static built ? TO BE RECHECKED ...
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
string(COMPARE EQUAL ${BUILD_SHARED_LIBS} "OFF" TRIQS_BUILD_STATIC)
if (TRIQS_BUILD_STATIC)
message(STATUS "STATIC Built ")
else (TRIQS_BUILD_STATIC)
message(STATUS "DYNAMIC Built ")
endif (TRIQS_BUILD_STATIC)
# RPATH setting (before compiling boost)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
else()
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()
# #################################
# Python support
# #################################
# TEST AND DEBUG THE OFF OPTION
# option is set first time, once for all. No change.
#option(PythonSupport "Build with Python support (i.e. pytriqs, etc..) : OFF NOT TESTED ?" ON)
set(PythonSupport NOT WithoutPython)
if (PythonSupport)
set(TRIQS_WITH_PYTHON_SUPPORT 1) # for the triqs_config.h file configuration
find_package(Python REQUIRED)
if (NOT PYTHONLIBS_FOUND)
message (FATAL_ERROR "Can not find python. You can use -DWithoutPython to build a pure C++ version.")
endif()
set (TRIQS_LIBRARY_PYTHON ${PYTHON_LIBRARY} ${PYTHON_EXTRA_LIBS})
set (TRIQS_INCLUDE_PYTHON ${PYTHON_INCLUDE_DIRS} ${PYTHON_NUMPY_INCLUDE_DIR})
include_directories(SYSTEM ${TRIQS_INCLUDE_PYTHON} )
#include_directories(SYSTEM ${PYTHON_NUMPY_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS})
link_libraries( ${TRIQS_LIBRARY_PYTHON})
message (STATUS "Numpy include in ${PYTHON_NUMPY_INCLUDE_DIR}")
# The C API of numpy has changed with 1.7.0, the macro is a version switch in a few files of the libs.
if (PYTHON_NUMPY_VERSION VERSION_LESS "1.7.0")
set(TRIQS_NUMPY_VERSION_LT_17 1)
endif()
# Installation : Final destination of the python modules
string(REGEX REPLACE ".*/lib" "lib" TRIQS_PYTHON_LIB_DEST_ROOT ${PYTHON_SITE_PKG} )
set( TRIQS_PYTHON_LIB_DEST ${TRIQS_PYTHON_LIB_DEST_ROOT}/pytriqs )
message(STATUS "Python modules will be installed in ${CMAKE_INSTALL_PREFIX}/${TRIQS_PYTHON_LIB_DEST}")
# build pytriqs scripts
add_subdirectory(shells bin)
endif (PythonSupport)
# #################################
# MPI
# #################################
message( STATUS "-------- MPI detection -------------")
find_package(MPI)
if (NOT MPI_CXX_FOUND)
message(FATAL_ERROR "TRIQS requires MPI")
endif()
set(TRIQS_CXX_DEFINITIONS ${TRIQS_CXX_DEFINITIONS} ${MPI_CXX_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS})
#add_definitions( ${MPI_CXX_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS})
include_directories(SYSTEM ${MPI_CXX_INCLUDE_PATH})
link_libraries( ${MPI_CXX_LIBRARIES})
set(TRIQS_LIBRARY_MPI ${MPI_CXX_LIBRARIES})
set(TRIQS_INCLUDE_MPI ${MPI_CXX_INCLUDE_PATH})
set(TRIQS_COMPILE_FLAGS_MPI ${MPI_CXX_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS})
message(STATUS "MPI CXX compiler : ${MPI_CXX_COMPILER}")
message(STATUS "MPI_COMPILE_FLAGS : ${TRIQS_COMPILE_FLAGS_MPI} ")
message(STATUS "MPI_CXX_INCLUDE_PATH : ${MPI_CXX_INCLUDE_PATH}")
# #################################
# Boost detection
# #################################
message( STATUS "-------- Boost detection -------------")
# Check user input for BOOST_SOURCE_DIR
if(BOOST_SOURCE_DIR)
if(NOT IS_ABSOLUTE ${BOOST_SOURCE_DIR})
Message(FATAL_ERROR "You must specify an absolute path for BOOST_SOURCE_DIR.")
endif(NOT IS_ABSOLUTE ${BOOST_SOURCE_DIR})
STRING(REGEX MATCH "~\\/" TILDE "${BOOST_SOURCE_DIR}")
if(TILDE)
Message(FATAL_ERROR "You should not use the tilde symbol ~. Please write the full absolute path for BOOST_SOURCE_DIR.")
endif(TILDE)
# compile boost if necessary
set(ALPS_BOOST_LIBRARY_NAME "boost_for_triqs" )
set(ALPS_HAVE_MPI 1)
set(ALPS_HAVE_BOOST_MPI 1)
set(BUILD_BOOST_MPI TRUE)
set(BUILD_BOOST_PYTHON TRUE)
add_subdirectory(foreignlibs/boost)
include_directories(SYSTEM ${BOOST_INCLUDE_DIR})
else(BOOST_SOURCE_DIR)
if (NOT Boost_ROOT_DIR_found)
set( Boost_ROOT_DIR ${BOOST_ROOT_DIR})
endif (NOT Boost_ROOT_DIR_found)
# if static build, request static lib
if(TRIQS_BUILD_STATIC)
set(Boost_USE_STATIC_LIBS ON)
else()
set(Boost_USE_STATIC_LIBS OFF)
endif()
# icc requires a higher version
if(CMAKE_COMPILER_IS_ICC)
set(BOOST_VERSION 1.53)
else()
set(BOOST_VERSION 1.46)
endif()
if (PythonSupport)
find_package(Boost ${BOOST_VERSION} REQUIRED COMPONENTS mpi python serialization ) #filesystem )
Else()
find_package(Boost ${BOOST_VERSION} REQUIRED COMPONENTS mpi serialization ) #filesystem )
endif()
if (NOT Boost_FOUND)
message(FATAL_ERROR "Boost not found")
endif()
message(STATUS "BOOST has been detected")
include_directories(${Boost_INCLUDE_DIRS})
#include_directories(${BOOST_INSTALL_ROOT_DIR}/include)
set(BOOST_LIBRARY ${Boost_LIBRARIES}) #${BOOST_PYTHON_LIB} ${BOOST_SERIALIZATION_LIB} ${BOOST_FILESYSTEM_LIB} ${BOOST_MPI_LIB})
set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
endif(BOOST_SOURCE_DIR)
message(STATUS "Boost include dir : ${BOOST_INCLUDE_DIR}")
message(STATUS "Boost libraries : ${BOOST_LIBRARY}")
#------------------------
# copy boost into pytriqs/boost
#------------------------
if (PythonSupport)
if(NOT BOOST_SOURCE_DIR)
if(NOT BOOST_MODULE_DIR)
EXEC_PYTHON_SCRIPT ("import boost; print boost.__path__[0]" BOOST_MODULE_DIR)
endif(NOT BOOST_MODULE_DIR)
# first create the dir, since pytriqs will be configured later
execute_process(COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/pytriqs/ )
execute_process(COMMAND ln -fs ${BOOST_MODULE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/pytriqs/)
install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pytriqs/boost DESTINATION ${TRIQS_PYTHON_LIB_DEST})
endif(NOT BOOST_SOURCE_DIR)
endif (PythonSupport)
# on 64 bit machines
if (CMAKE_SIZEOF_VOID_P EQUAL 8) # for 64 bits machines
message( STATUS "64 bit machine : Adding -fpic ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic" )
set(TRIQS_CXX_DEFINITIONS ${TRIQS_CXX_DEFINITIONS} -fpic)
endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
# #################################
# Lapack
# #################################
message( STATUS "-------- Lapack detection -------------")
#option(LAPACK_64_BIT "Use 64-bit version of LAPACK" OFF)
#set (BIND_FORTRAN_INTEGER_8 ${LAPACK_64_BIT})
if (NOT LAPACK_FOUND)
find_package(Lapack)
endif (NOT LAPACK_FOUND)
if (REQUIRE_PTHREAD)
set(LAPACK_LIBRARY "${LAPACK_LIBRARY};${PTHREAD_LIBRARY}")
set(LAPACK_LIBRARIES "${LAPACK_LIBRARIES};${PTHREAD_LIBRARY}")
endif (REQUIRE_PTHREAD)
set(LAPACK_LIBS ${LAPACK_LIBRARY} ${BLAS_LIBRARY} ${LAPACK_LINKER_FLAGS} CACHE STRING "Flags to link Lapack and Blas")
set(TRIQS_LIBRARY_LAPACK ${LAPACK_LIBS})
if(MAC_VECLIB)
set(TRIQS_LIBRARY_LAPACK "-framework vecLib ${TRIQS_LIBRARY_LAPACK}")
endif(MAC_VECLIB)
message(STATUS "Lapack libraries : ${TRIQS_LIBRARY_LAPACK}")
link_libraries(${TRIQS_LIBRARY_LAPACK})
# #################################
# HDF5
# #################################
message( STATUS "-------- HDF5 detection -------------")
# on weiss, it is 2.8.2 and we should not put HL, on 12.04 we need to put it...
if ( ${CMAKE_VERSION} VERSION_LESS "2.8.6") # CHECK THIS BOUND, where are the cmake changelogs ??
find_package(HDF5 REQUIRED C CXX )
else(${CMAKE_VERSION} VERSION_LESS "2.8.6")
find_package(HDF5 REQUIRED C CXX HL )
endif(${CMAKE_VERSION} VERSION_LESS "2.8.6")
if(NOT HDF5_FOUND)
message(FATAL_ERROR "Require hdf5 1.8.2 or higher. Set HDF5_HOME")
endif()
if(HDF5_IS_PARALLEL)
message(FATAL "parallel(MPI) hdf5 is detected. The standard version is preferred.")
endif(HDF5_IS_PARALLEL)
message( STATUS " HDF5_LIBRARIES = ${HDF5_LIBRARIES} ")
mark_as_advanced(HDF5_DIR) # defined somewhere else ? what is it ?
include_directories (SYSTEM ${HDF5_INCLUDE_DIR})
link_libraries (${HDF5_LIBRARIES} ) #${HDF5_CXX_LIBRARIES} )
set(TRIQS_LIBRARY_HDF5 ${HDF5_LIBRARIES})
set(TRIQS_INCLUDE_HDF5 ${HDF5_INCLUDE_DIR})
set(TRIQS_CXX_DEFINITIONS ${TRIQS_CXX_DEFINITIONS} ${HDF5_DEFINITIONS})
set(TRIQS_HDF5_DIFF_EXECUTABLE ${HDF5_DIFF_EXECUTABLE})
# #################################
# Other libs
# #################################
# GMP
message( STATUS "-------- GMP detection -------------")
find_package(GMP)
include_directories(SYSTEM ${GMP_INCLUDE_DIR})
link_libraries(${GMP_LIBRARIES})
set(TRIQS_LIBRARY_GMP ${GMP_LIBRARIES} ${GMPXX_LIBRARIES})
set(TRIQS_INCLUDE_GMP ${GMP_INCLUDE_DIR})
# FFTW
message( STATUS "-------- FFTW detection -------------")
find_package(FFTW)
include_directories(SYSTEM ${FFTW_INCLUDE_DIR})
link_libraries( ${FFTW_LIBRARIES})
set(TRIQS_LIBRARY_FFTW ${FFTW_LIBRARIES})
set(TRIQS_INCLUDE_FFTW ${FFTW_INCLUDE_DIR})
# remove the possible horrible pthread bug on os X !!( on gcc, old, before clang... is it really needed now ???)
# check for clang compiler ?? on gcc, os X snow leopard, it MUST be set
# since _REENTRANT is mysteriously set and this leads to random stalling of the code....
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(TRIQS_CXX_DEFINITIONS ${TRIQS_CXX_DEFINITIONS} -pthread )
endif( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
#
## Remove the test from the build ?
option(Build_Triqs_General_Tools_Test "Build the test of the general tool ? ( array class , ... ) " ON)
# 64 bits machine ?
#if(CMAKE_SIZEOF_VOID_P EQUAL 8 OR CMAKE_GENERATOR MATCHES Win64)
# set (TRIQS_64BIT ON)
#endif(CMAKE_SIZEOF_VOID_P EQUAL 8 OR CMAKE_GENERATOR MATCHES Win64)
# is it useful ?
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Type of build" FORCE)
mark_as_advanced(CMAKE_BUILD_TYPE)
endif(NOT CMAKE_BUILD_TYPE)
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
# Fortran bindings
option(BIND_FORTRAN_LOWERCASE "FORTRAN functions are compiled WITHOUT a trailing underscore" OFF)
mark_as_advanced(BIND_FORTRAN_LOWERCASE)
if (BIND_FORTRAN_LOWERCASE)
set(TRIQS_BIND_FORTRAN_LOWERCASE OFF )
endif (BIND_FORTRAN_LOWERCASE)
message( STATUS "-------- git and hash detection -------------")
# git
Find_package(Git3) # our local version of FindGit...
if (GIT_FOUND)
GIT_TREE_INFO ( ${CMAKE_SOURCE_DIR} "GIT")
message(STATUS "Git hash ${GIT_HASH}")
message(STATUS "Git branch : ${GIT_BRANCHES}")
set (TRIQS_GIT_HASH ${GIT_HASH})
endif (GIT_FOUND)
# Compute WhoAmI and hostname
# Change this : make a version module
EXECUTE_PROCESS(COMMAND hostname OUTPUT_VARIABLE myHostName RESULT_VARIABLE returncode OUTPUT_STRIP_TRAILING_WHITESPACE)
EXECUTE_PROCESS(COMMAND id -un OUTPUT_VARIABLE WhoAmI RESULT_VARIABLE returncode OUTPUT_STRIP_TRAILING_WHITESPACE)
set(TRIQS_HOSTNAME ${myHostName})
set(TRIQS_COMPILEDBY ${WhoAmI})
# TRIQS cmake file and config.h
message( STATUS "-------- Making TRIQSConfig.cmake -------------")
get_property(ALL_DEFS GLOBAL PROPERTY TRIQS_COMPIL_DEFINITIONS)
configure_file(./cmake/triqs_config.h.in Config/triqs_config.h @ONLY)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
configure_file(./cmake/TRIQSConfig.cmake.in Config/TRIQSConfig.cmake @ONLY)
else()
configure_file(./cmake/TRIQSConfig.cmake.in Config/TRIQSConfig1.cmake @ONLY )
EXEC_PYTHON_SCRIPT( "import re;open('${CMAKE_CURRENT_BINARY_DIR}/Config/TRIQSConfig.cmake','w').write(re.sub(r';*\\s*-framework\\s+([a-zA-Z_][a-zA-Z_0-9]*)',r' \"-framework \\1\"',open('${CMAKE_CURRENT_BINARY_DIR}/Config/TRIQSConfig1.cmake').read()))", ConfigFile)
endif()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Config/TRIQSConfig.cmake DESTINATION share/triqs/cmake)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Config/triqs_config.h DESTINATION include/triqs)
install(FILES ${CMAKE_SOURCE_DIR}/cmake/FindTRIQS.cmake DESTINATION share/triqs/cmake)
configure_file(./cmake/FindTriqsTest.cmake.in Config//FindTriqsTest.cmake @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Config/FindTriqsTest.cmake DESTINATION share/triqs/cmake)
install(FILES ${CMAKE_SOURCE_DIR}/cmake/run_test.cmake DESTINATION share/triqs/cmake)
#
enable_testing()
##------------------------
# Documentation
##------------------------
option(Build_Documentation "Build the documentation ?" OFF)
option(Build_PDF_Documentation "Build the pdf documentation ?" OFF)
#------------------------
# link libs for shared libs or for pytriqs
#------------------------
set(TRIQS_LINK_LIBS
${TRIQS_LIBRARY_PYTHON}
${FFTW_LIBRARIES}
${BOOST_LIBRARY}
${LAPACK_LIBS}
${GMP_LIBRARIES} ${GMPXX_LIBRARIES}
)
# General include header
# remove this dep to C++
include_directories(${TRIQS_SOURCE_DIR})
#------------------------
# General triqs libraries
#------------------------
message( STATUS "TRIQS_CXX_DEFINITIONS = ${TRIQS_CXX_DEFINITIONS}")
# needed for utility/first_include.hpp that includes either the triqs_config.h installed in the proper directory
# (Case of an installed lib) or the triqs_config.h just generated in the built dir (when compiling the lib itself).
add_definitions ( ${TRIQS_CXX_DEFINITIONS} -DTRIQS_BUILDING_LIBRARY -I ${CMAKE_BINARY_DIR}/Config)
add_subdirectory(${TRIQS_SOURCE_DIR}/triqs triqs)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
list (REMOVE_DUPLICATES TRIQS_LINK_LIBS)
endif( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
#------------------------
# Applications
#------------------------
#add_subdirectory(${TRIQS_SOURCE_DIR}/applications )
#------------------------
# pytriqs modules
#------------------------
if (PythonSupport)
message( STATUS "-------- Preparing Cython modules -------------")
add_subdirectory(${TRIQS_SOURCE_DIR}/pytriqs )
endif (PythonSupport)
#------------------------
# tests
#------------------------
add_subdirectory(${TRIQS_SOURCE_DIR}/test )
#------------------------
# Documentation
#------------------------
if (Build_Documentation)
message( STATUS "-------- Prepare documentation -------------")
add_subdirectory (${TRIQS_SOURCE_DIR}/doc )
#add_dependencies(docs_sphinx py_sources)
message( STATUS "----------------------------------------")
endif (Build_Documentation)
#------------------------
# FindTRIQS needs to be configured and installed
#------------------------
install (FILES ${CMAKE_SOURCE_DIR}/cmake/FindTRIQS.cmake DESTINATION share/triqs/cmake)
#------------------------
# Packaging
#------------------------
# make the source package
set(TAR_SRC_FILE ${CMAKE_CURRENT_BINARY_DIR}/triqs_src.tgz)
set(TAR_SRC_DIRBUILD ${CMAKE_CURRENT_BINARY_DIR}/triqs_src_tgz_build)
add_custom_command( OUTPUT ${TAR_SRC_FILE} COMMAND mkdir -p ${TAR_SRC_DIRBUILD} && cd ${TAR_SRC_DIRBUILD} && ${Subversion_SVN_EXECUTABLE} export --force ${Project_WC_URL} triqs_src && tar cvzf ${TAR_SRC_FILE} triqs_src)
add_custom_target(src_tgz DEPENDS ${TAR_SRC_FILE})
# .deb and dmg
INCLUDE(InstallRequiredSystemLibraries)
# Prepare the postinstall and preremoval for debian
configure_file(${TRIQS_SOURCE_DIR}/cmake/prerm.in ${CMAKE_CURRENT_BINARY_DIR}/prerm)
configure_file(${TRIQS_SOURCE_DIR}/cmake/postinst.in ${CMAKE_CURRENT_BINARY_DIR}/postinst)
set(CPACK_PACKAGE_NAME "triqs")
set(CPACK_PACKAGE_FILE_NAME "triqs")
set(CPACK_PACKAGE_VENDOR "The TRIQS collaboration")
set(CPACK_DEBIAN_PACKAGE_SECTION "Science")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "TRIQS, a Toolbox for Research in Quantum Interacting Systems")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
set(CPACK_PACKAGE_CONTACT "Olivier Parcollet <olivier.parcollet@cea.fr>")
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "9")
set(CPACK_PACKAGE_VERSION_PATCH "1-2")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "TRIQS_${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_STRIP_FILES "bin/pytriqs")
set(CPACK_SOURCE_STRIP_FILES "")
set(CPACK_PACKAGE_EXECUTABLES "pytriqs" "pytriqs")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "openmpi-bin(>=1.4), libblas-dev (>=1.2), ipython (>=0.12), libfftw3-dev (>=3.2), hdf5-tools (>=1.8), python-matplotlib (>=1.1) ")
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${CMAKE_CURRENT_BINARY_DIR}/prerm;${CMAKE_CURRENT_BINARY_DIR}/postinst)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CPACK_GENERATOR TGZ DEB)
endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
INCLUDE(CPack)

674
COPYING.txt Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

18
LICENSE.txt Normal file
View File

@ -0,0 +1,18 @@
TRIQS: a Toolbox for Research in Interacting Quantum Systems
Copyright (C) 2011 by M. Ferrero, O. Parcollet
TRIQS is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
TRIQS (in the file COPYING.txt in this directory). If not, see
<http://www.gnu.org/licenses/>.

13
README.txt Normal file
View File

@ -0,0 +1,13 @@
The TRIQS website is under http://ipht.cea.fr/triqs. Start there
to learn about TRIQS.
To install TRIQS, follow the installation steps given under
http://ipht.cea.fr/triqs/doc/user_manual/install/install.html
Before you proceed, make sure you have read the LICENSE.txt file.
Enjoy!
The TRIQS team

47
cmake/BuildSphinx.cmake Normal file
View File

@ -0,0 +1,47 @@
# Copyright Olivier Parcollet 2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# This module looks for sphinx documentation tool
# and define a function that prepares the Makefile for sphinx-build
FIND_PROGRAM(SPHINXBUILD_EXECUTABLE
NAMES sphinx-build sphinx-build-2.6
PATHS $ENV{HOME}/bin /usr/bin /opt/local/bin
PATH_SUFFIXES bin
)
if (NOT SPHINXBUILD_EXECUTABLE)
MESSAGE(FATAL_ERROR "I can not find sphinx to build the triqs documentation")
else (NOT SPHINXBUILD_EXECUTABLE)
MESSAGE(STATUS "sphinx-build program found at ${SPHINXBUILD_EXECUTABLE} ")
endif (NOT SPHINXBUILD_EXECUTABLE)
# a little hack to make the doc being compiled by pytriqs itself !
# so that autodoc loading works...
if (TRIQS_BUILD_STATIC)
SET(SPHINXBUILD_EXECUTABLE PYTHONPATH=${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/bin/pytriqs ${SPHINXBUILD_EXECUTABLE})
else (TRIQS_BUILD_STATIC)
SET(SPHINXBUILD_EXECUTABLE ${CMAKE_BINARY_DIR}/run_pytriqs_for_test.sh ${SPHINXBUILD_EXECUTABLE})
endif (TRIQS_BUILD_STATIC)
# handle the QUIETLY and REQUIRED arguments and set SPHINXBUILD_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SPHINX DEFAULT_MSG SPHINXBUILD_EXECUTABLE)
MARK_AS_ADVANCED( SPHINXBUILD_EXECUTABLE )
SET(sphinx_top ${CMAKE_CURRENT_BINARY_DIR}/html/contents.html)
add_custom_command(OUTPUT ${sphinx_top} DEPENDS ${SOURCES} COMMAND ${SPHINXBUILD_EXECUTABLE} -c . -b html ${DOC_SOURCE} html)
add_custom_target(docs_sphinx${DOC_EXT} ALL DEPENDS ${sphinx_top} ${DOC_SOURCE})
if (Build_PDF_Documentation)
SET(sphinx_top_pdf ${CMAKE_CURRENT_BINARY_DIR}/latex/TRIQS.pdf)
add_custom_command(OUTPUT ${sphinx_top_pdf} DEPENDS ${SOURCES} COMMAND ${SPHINXBUILD_EXECUTABLE} -c . -b latex ${DOC_SOURCE} latex && cd latex
&& pdflatex -interaction=nonstopmode TRIQS.tex && pdflatex -interaction=nonstopmode TRIQS.tex)
add_custom_target(docs_sphinx_pdf${DOC_EXT} ALL DEPENDS ${sphinx_top_pdf} ${DOC_SOURCE})
endif()

302
cmake/CompileBoost.cmake Normal file
View File

@ -0,0 +1,302 @@
# Copyright Olivier Parcollet 2011 : modified to remove pyalps install
# Copyright Matthias Troyer 2009 - 2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# libboost
#
set (Boost_ROOT_DIR ${BOOST_SOURCE_DIR})
set(BOOST_SOURCES "")
set(BOOST_MPI_PYTHON_SOURCES "")
set(BOOST_LINK_LIBS "")
# Boost.Date_Time
if(BUILD_BOOST_DATE_TIME)
set(DIRECTORY "${Boost_ROOT_DIR}/libs/date_time/src")
set(SOURCES gregorian/date_generators.cpp gregorian/greg_month.cpp gregorian/greg_weekday.cpp
gregorian/gregorian_types.cpp posix_time/posix_time_types.cpp)
foreach(S ${SOURCES})
if(EXISTS ${DIRECTORY}/${S})
set(BOOST_SOURCES ${BOOST_SOURCES} ${DIRECTORY}/${S})
endif(EXISTS ${DIRECTORY}/${S})
endforeach(S)
endif(BUILD_BOOST_DATE_TIME)
# Boost.Filesystem
if(BUILD_BOOST_FILESYSTEM)
set(DIRECTORY "${Boost_ROOT_DIR}/libs/filesystem")
set(SOURCES
codecvt_error_category.cpp operations.cpp path.cpp path_traits.cpp
portability.cpp unique_path.cpp utf8_codecvt_facet.cpp
windows_file_codecvt.cpp v2_operations.cpp v2_path.cpp v2_portability.cpp)
foreach (D ${DIRECTORY}/src ${DIRECTORY}/v2/src ${DIRECTORY}/v3/src)
foreach(S ${SOURCES})
if(EXISTS ${D}/${S})
set(BOOST_SOURCES ${BOOST_SOURCES} ${D}/${S})
endif(EXISTS ${D}/${S})
endforeach(S)
endforeach(D)
endif(BUILD_BOOST_FILESYSTEM)
# Boost.ProgramOptions
if(BUILD_BOOST_PROGRAM_OPTIONS)
set(DIRECTORY "${Boost_ROOT_DIR}/libs/program_options/src")
set(SOURCES cmdline.cpp config_file.cpp options_description.cpp parsers.cpp
variables_map.cpp value_semantic.cpp positional_options.cpp utf8_codecvt_facet.cpp
convert.cpp winmain.cpp)
foreach(S ${SOURCES})
if(EXISTS ${DIRECTORY}/${S})
set(BOOST_SOURCES ${BOOST_SOURCES} ${DIRECTORY}/${S})
endif(EXISTS ${DIRECTORY}/${S})
endforeach(S)
endif(BUILD_BOOST_PROGRAM_OPTIONS)
# Boost.Regex
if(BUILD_BOOST_REGEX)
set(DIRECTORY "${Boost_ROOT_DIR}/libs/regex/src")
set(SOURCES c_regex_traits.cpp cpp_regex_traits.cpp cregex.cpp fileiter.cpp icu.cpp
instances.cpp posix_api.cpp regex.cpp regex_debug.cpp regex_raw_buffer.cpp
regex_traits_defaults.cpp static_mutex.cpp usinstances.cpp w32_regex_traits.cpp
wc_regex_traits.cpp wide_posix_api.cpp winstances.cpp)
foreach(S ${SOURCES})
if(EXISTS ${DIRECTORY}/${S})
set(BOOST_SOURCES ${BOOST_SOURCES} ${DIRECTORY}/${S})
endif(EXISTS ${DIRECTORY}/${S})
endforeach(S)
endif(BUILD_BOOST_REGEX)
# Boost.Serialization
if(BUILD_BOOST_SERIALIZATION)
set(DIRECTORY "${Boost_ROOT_DIR}/libs/serialization/src")
set(SOURCES archive_exception.cpp basic_archive.cpp
basic_iarchive.cpp basic_iserializer.cpp basic_oarchive.cpp
basic_oserializer.cpp basic_pointer_iserializer.cpp
basic_pointer_oserializer.cpp basic_serializer_map.cpp
basic_text_iprimitive.cpp basic_text_oprimitive.cpp
basic_text_wiprimitive.cpp basic_text_woprimitive.cpp
basic_xml_archive.cpp binary_iarchive.cpp binary_oarchive.cpp
binary_wiarchive.cpp binary_woarchive.cpp codecvt_null.cpp
extended_type_info.cpp extended_type_info_no_rtti.cpp
extended_type_info_typeid.cpp polymorphic_iarchive.cpp
polymorphic_oarchive.cpp shared_ptr_helper.cpp stl_port.cpp
text_iarchive.cpp text_oarchive.cpp text_wiarchive.cpp
text_woarchive.cpp utf8_codecvt_facet.cpp void_cast.cpp
xml_archive_exception.cpp xml_grammar.cpp xml_iarchive.cpp
xml_oarchive.cpp xml_wgrammar.cpp xml_wiarchive.cpp
xml_woarchive.cpp)
foreach(S ${SOURCES})
if(EXISTS ${DIRECTORY}/${S})
set(BOOST_SOURCES ${BOOST_SOURCES} ${DIRECTORY}/${S})
endif(EXISTS ${DIRECTORY}/${S})
endforeach(S)
endif(BUILD_BOOST_SERIALIZATION)
# Boost.Python
if(BUILD_BOOST_PYTHON)
set(BOOST_LINK_LIBS ${BOOST_LINK_LIBS} ${PYTHON_LIBRARY} ${PYTHON_EXTRA_LIBS})
set(DIRECTORY "${Boost_ROOT_DIR}/libs/python/src")
set(SOURCES dict.cpp errors.cpp exec.cpp import.cpp list.cpp long.cpp
module.cpp numeric.cpp object_operators.cpp object_protocol.cpp slice.cpp
str.cpp tuple.cpp wrapper.cpp converter/arg_to_python_base.cpp
converter/builtin_converters.cpp converter/from_python.cpp
converter/registry.cpp converter/type_id.cpp object/class.cpp
object/enum.cpp object/function.cpp object/function_doc_signature.cpp
object/inheritance.cpp object/iterator.cpp object/life_support.cpp
object/pickle_support.cpp object/stl_iterator.cpp
)
foreach(S ${SOURCES})
if(EXISTS ${DIRECTORY}/${S})
set(BOOST_SOURCES ${BOOST_SOURCES} ${DIRECTORY}/${S})
endif(EXISTS ${DIRECTORY}/${S})
endforeach(S)
add_definitions(-DBOOST_PYTHON_SOURCE)
endif(BUILD_BOOST_PYTHON)
# Boost.System
if(BUILD_BOOST_SYSTEM)
set(DIRECTORY "${Boost_ROOT_DIR}/libs/system/src")
set(SOURCES error_code.cpp)
foreach(S ${SOURCES})
if(EXISTS ${DIRECTORY}/${S})
set(BOOST_SOURCES ${BOOST_SOURCES} ${DIRECTORY}/${S})
endif(EXISTS ${DIRECTORY}/${S})
endforeach(S)
endif(BUILD_BOOST_SYSTEM)
# Boost.MPI
if(BUILD_BOOST_MPI)
IF(NOT WIN32)
set(BOOST_LINK_LIBS ${BOOST_LINK_LIBS} ${MPI_LIBRARIES})
ENDIF(NOT WIN32)
set(DIRECTORY "${Boost_ROOT_DIR}/libs/mpi/src")
set(SOURCES broadcast.cpp communicator.cpp computation_tree.cpp
content_oarchive.cpp environment.cpp exception.cpp graph_communicator.cpp
group.cpp intercommunicator.cpp mpi_datatype_cache.cpp
mpi_datatype_oarchive.cpp packed_iarchive.cpp packed_oarchive.cpp
packed_skeleton_iarchive.cpp packed_skeleton_oarchive.cpp
point_to_point.cpp request.cpp timer.cpp
)
foreach(S ${SOURCES})
if(EXISTS ${DIRECTORY}/${S})
set(BOOST_SOURCES ${BOOST_SOURCES} ${DIRECTORY}/${S})
endif(EXISTS ${DIRECTORY}/${S})
endforeach(S)
endif(BUILD_BOOST_MPI)
# Boost.Thread
if(BUILD_BOOST_THREAD)
if (NOT WIN32)
set(BOOST_LINK_LIBS ${BOOST_LINK_LIBS} ${PTHREAD_LIBRARY})
endif (NOT WIN32)
set(DIRECTORY "${Boost_ROOT_DIR}/libs/thread/src")
if (WIN32)
set(SOURCES win32/thread.cpp win32/tss_dll.cpp win32/tss_pe.cpp)
else (WIN32)
set(SOURCES pthread/once.cpp pthread/thread.cpp)
endif(WIN32)
foreach(S ${SOURCES})
if(EXISTS ${DIRECTORY}/${S})
set(BOOST_SOURCES ${BOOST_SOURCES} ${DIRECTORY}/${S})
endif(EXISTS ${DIRECTORY}/${S})
endforeach(S)
endif(BUILD_BOOST_THREAD)
# Boost.MPI Python bindings
if (BUILD_BOOST_MPI AND BUILD_BOOST_PYTHON AND NOT ALPS_BUILD_SOURCE AND Boost_ROOT_DIR)
set(DIRECTORY "${Boost_ROOT_DIR}/libs/mpi/src/python")
set(SOURCES collectives.cpp py_communicator.cpp datatypes.cpp
documentation.cpp py_environment.cpp py_nonblocking.cpp py_exception.cpp
module.cpp py_request.cpp skeleton_and_content.cpp status.cpp py_timer.cpp
serialize.cpp
)
foreach(S ${SOURCES})
if(EXISTS ${DIRECTORY}/${S})
set(BOOST_MPI_PYTHON_SOURCES ${BOOST_MPI_PYTHON_SOURCES} ${DIRECTORY}/${S})
endif(EXISTS ${DIRECTORY}/${S})
endforeach(S)
if (BOOST_MPI_PYTHON_SOURCES)
python_add_module(mpi ${BOOST_MPI_PYTHON_SOURCES})
if(BUILD_SHARED_LIBS)
set_target_properties(mpi PROPERTIES COMPILE_DEFINITIONS "${ALPS_SHARED_CPPFLAGS}")
if(WIN32 AND NOT UNIX)
set_target_properties(mpi PROPERTIES SUFFIX ".pyd")
endif(WIN32 AND NOT UNIX)
endif (BUILD_SHARED_LIBS)
set_target_properties(mpi PROPERTIES PREFIX "")
target_link_libraries(mpi ${ALPS_BOOST_LIBRARY_NAME} ${BOOST_LINK_LIBS})
endif(BOOST_MPI_PYTHON_SOURCES)
endif (BUILD_BOOST_MPI AND BUILD_BOOST_PYTHON AND NOT ALPS_BUILD_SOURCE AND Boost_ROOT_DIR)
#######################################################################
# install
#######################################################################
# Setting "boost" target not needed when precompiled Boost libraries found.
if (NOT Boost_FOUND)
add_library(${ALPS_BOOST_LIBRARY_NAME} ${BOOST_SOURCES})
target_link_libraries(${ALPS_BOOST_LIBRARY_NAME} ${BOOST_LINK_LIBS})
# Boost.Test
if(BUILD_BOOST_TEST AND NOT ALPS_FOR_VISTRAILS)
set(DIRECTORY "${Boost_ROOT_DIR}/libs/test/src")
set(SOURCES compiler_log_formatter.cpp debug.cpp
execution_monitor.cpp framework.cpp
interaction_based.cpp logged_expectations.cpp plain_report_formatter.cpp
progress_monitor.cpp results_collector.cpp results_reporter.cpp
test_tools.cpp unit_test_log.cpp unit_test_main.cpp
unit_test_monitor.cpp unit_test_parameters.cpp unit_test_suite.cpp
xml_log_formatter.cpp xml_report_formatter.cpp
)
set (TEST_EXEC_MON_SOURCES "")
foreach(S ${SOURCES})
if(EXISTS ${DIRECTORY}/${S})
set(TEST_EXEC_MON_SOURCES ${TEST_EXEC_MON_SOURCES} ${DIRECTORY}/${S})
endif(EXISTS ${DIRECTORY}/${S})
endforeach(S)
set(SOURCES ${SOURCES} exception_safety.cpp)
set (UTF_SOURCES "")
foreach(S ${SOURCES})
if(EXISTS ${DIRECTORY}/${S})
set(UTF_SOURCES ${UTF_SOURCES} ${DIRECTORY}/${S})
endif(EXISTS ${DIRECTORY}/${S})
endforeach(S)
set(SOURCES execution_monitor.cpp debug.cpp cpp_main.cpp )
set (PRG_EXEC_MON_SOURCES "")
foreach(S ${SOURCES})
if(EXISTS ${DIRECTORY}/${S})
set(PRG_EXEC_MON_SOURCES ${PRG_EXEC_MON_SOURCES} ${DIRECTORY}/${S})
endif(EXISTS ${DIRECTORY}/${S})
endforeach(S)
add_library(boost_unit_test_framework ${UTF_SOURCES})
add_library(boost_test_exec_monitor ${TEST_EXEC_MON_SOURCES})
add_library(boost_prg_exec_monitor ${PRG_EXEC_MON_SOURCES})
if(BUILD_SHARED_LIBS)
set_target_properties(boost_unit_test_framework PROPERTIES COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK=1)
set_target_properties(boost_test_exec_monitor PROPERTIES COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK=1)
set_target_properties(boost_prg_exec_monitor PROPERTIES COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK=1)
endif(BUILD_SHARED_LIBS)
endif(BUILD_BOOST_TEST AND NOT ALPS_FOR_VISTRAILS)
if(WIN32)
if(BUILD_SHARED_LIBS)
set_target_properties(boost PROPERTIES COMPILE_DEFINITIONS BOOST_THREAD_BUILD_DLL=1)
else(BUILD_SHARED_LIBS)
set_target_properties(boost PROPERTIES COMPILE_DEFINITIONS BOOST_THREAD_BUILD_LIB=1)
endif(BUILD_SHARED_LIBS)
endif(WIN32)
if (NOT ALPS_BUILD_SOURCE)
if(MSVC)
get_target_property(LIB_NAME ${ALPS_BOOST_LIBRARY_NAME} LOCATION)
add_custom_command(TARGET ${ALPS_BOOST_LIBRARY_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${LIB_NAME} ${PROJECT_BINARY_DIR}/bin)
endif(MSVC)
if (ALPS_FOR_VISTRAILS)
SET_TARGET_PROPERTIES(${ALPS_BOOST_LIBRARY_NAME}
PROPERTIES BUILD_WITH_INSTALL_RPATH ON
INSTALL_NAME_DIR "@executable_path/../Frameworks"
)
endif (ALPS_FOR_VISTRAILS)
if (ALPS_INSTALL_VISTRAILS_PACKAGES)
install(TARGETS ${ALPS_BOOST_LIBRARY_NAME} COMPONENT vistrails
RUNTIME DESTINATION ${VISTRAILS_DYLIB_DIR}
ARCHIVE DESTINATION ${VISTRAILS_DYLIB_DIR}
LIBRARY DESTINATION ${VISTRAILS_DYLIB_DIR})
endif (ALPS_INSTALL_VISTRAILS_PACKAGES)
if (NOT ALPS_FOR_VISTRAILS)
install(TARGETS ${ALPS_BOOST_LIBRARY_NAME} COMPONENT libraries
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
if (ALPS_INSTALL_BOOST_TEST)
install(TARGETS boost_unit_test_framework boost_test_exec_monitor boost_prg_exec_monitor
COMPONENT libraries
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
endif(ALPS_INSTALL_BOOST_TEST)
endif (NOT ALPS_FOR_VISTRAILS)
endif (NOT ALPS_BUILD_SOURCE)
endif (NOT Boost_FOUND)

1290
cmake/Doxyfile.in Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,38 @@
#
# This macro builds the f2py module
# - target_name
# -
#
macro (BuildF2pyModule target_name modulename module_pyf_name filelist1)
set(filelist ${filelist1} ${ARGN})
set(filename temp_script.py)
# Copy all the files
EXECUTE_PROCESS(COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/${module_pyf_name} ${CMAKE_CURRENT_BINARY_DIR} )
FOREACH( f ${filelist})
EXECUTE_PROCESS(COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/${f} ${CMAKE_CURRENT_BINARY_DIR} )
ENDFOREACH(f)
# write the script that will build the f2py extension
SET(filename ${CMAKE_CURRENT_BINARY_DIR}/${filename} )
FILE(WRITE ${filename} "import sys\n")
FILE(APPEND ${filename} "from numpy.f2py import main\n")
FILE(APPEND ${filename} "sys.argv = [''] +'-c --f77exec=${CMAKE_Fortran_COMPILER} --f90exec=${CMAKE_Fortran_COMPILER} -m ${modulename} ${modulename}.pyf ${filelist} -llapack'.split()\n")
FILE(APPEND ${filename} "main()\n")
# We had the normal target of the module
add_custom_target(${target_name} ALL DEPENDS ${modulename}.so)
# TODO : to be corrected with the filelist is more than one file.
# ... and a special target to build vertex.so, that depends on the sources files
add_custom_command(OUTPUT ${modulename}.so
COMMAND echo See `pwd`/f2pyBuild.log for logs
COMMAND ${PYTHON_INTERPRETER} temp_script.py > f2pyBuild.log 2>&1
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${filelist} ${CMAKE_CURRENT_SOURCE_DIR}/${module_pyf_name}
)
#FILE(RELATIVE_PATH rel ${CMAKE_SOURCE_DIR}/Modules ${CMAKE_CURRENT_SOURCE_DIR}/)
#install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${modulename}.so
# DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/${ExecutableName}/triqs/${rel}/..)
endmacro (BuildF2pyModule)

View File

@ -0,0 +1,91 @@
# Copyright Olivier Parcollet 2012
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
#
# Compilers are sorted by group of interoperability
# group 1 : fully compliant C++11 compiler
# gcc 4.8.1 and higher, clang >= 3.3
# group 1 : older gcc, ok with workaround
# group 2 : Intel 14.0 : almost C++11, but with Intel workaround
# group 3 : Intel 13.0 : messy compiler...
# group 0 : other
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} --version
OUTPUT_VARIABLE _compiler_output RESULT_VARIABLE returncode OUTPUT_STRIP_TRAILING_WHITESPACE)
set(compiler_version_min "4.6.3")
set(compiler_name "gcc")
set(compiler_group 1)
string(REGEX REPLACE ".*([2-5]\\.[0-9]\\.[0-9]).*" "\\1" compiler_version ${_compiler_output})
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} --version
OUTPUT_VARIABLE _compiler_output RESULT_VARIABLE returncode OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_COMPILER_IS_CLANG TRUE )
set(compiler_name "clang")
set(compiler_group 1)
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Apple which does not has the official clang version number ...
string(REGEX REPLACE ".*LLVM ([2-5]\\.[0-9]).*" "\\1" compiler_version ${_compiler_output})
#set( compiler_version_min "3.2")
else()
string(REGEX REPLACE ".*([2-5]\\.[0-9]).*" "\\1" compiler_version ${_compiler_output})
endif()
set( compiler_version_min "3.2")
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel")
EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
OUTPUT_VARIABLE compiler_version RESULT_VARIABLE returncode OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_COMPILER_IS_ICC TRUE )
set(compiler_version_min "13.0.0")
set(compiler_name "Intel icc")
set(compiler_group 3)
#string(REGEX REPLACE "[^0-9]*([0-9]+\\.[0-9]\\.[0-9]).*" "\\1" compiler_version ${_compiler_output})
# for intel 14.0 /test
link_libraries( -lomp_db )
else ()
set(compiler_version_min "0.0")
set(compiler_group 0)
set(line_of_star "\n************************** WARNING ************************************\n")
MESSAGE( WARNING "${line_of_star} Compiler not recognized by TRIQS : TRIQS may compile .. or not ${line_of_star}")
#message(FATAL_ERROR "Your C++ compiler does not support C++11.")
endif ()
MESSAGE( STATUS "Compiler is ${compiler_name} with version ${compiler_version}")
# Check version
if(compiler_version VERSION_LESS ${compiler_version_min} )
set(line_of_star "\n************************** FATAL ERROR ************************************\n")
MESSAGE( FATAL_ERROR "${line_of_star}You are using the ${compiler_name} compiler but your compiler is too old :\n TRIQS requires version >= ${compiler_version_min} while you have ${compiler_version}\n ${line_of_star}")
endif(compiler_version VERSION_LESS ${compiler_version_min} )
# Now add some definitions ...
# on OS X : for clang, add the infamous -stdlib=libc++
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if (CMAKE_COMPILER_IS_CLANG)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ ")
MESSAGE(STATUS "Adding compilation flags -stdlib=libc++ ")
else (CMAKE_COMPILER_IS_CLANG)
MESSAGE( WARNING "${line_of_star}You are on Os X but your are not using clang. This is NOT recommended...${line_of_star}")
endif (CMAKE_COMPILER_IS_CLANG)
ENDIF( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# for icc, add the very infamous flags or calculation of boost::math bessel function are wrong !!
# tested on boost 1.53
IF(CMAKE_COMPILER_IS_ICC)
set(TRIQS_CXX_DEFINITIONS ${TRIQS_CXX_DEFINITIONS} -DTRIQS_WORKAROUND_INTEL_COMPILER_BUGS -DBOOST_MATH_DISABLE_STD_FPCLASSIFY)
#add_definitions( -DTRIQS_WORKAROUND_INTEL_COMPILER_BUGS -DBOOST_MATH_DISABLE_STD_FPCLASSIFY)
MESSAGE(STATUS " Adding compilation flags -DTRIQS_WORKAROUND_INTEL_COMPILER_BUGS -DBOOST_MATH_DISABLE_STD_FPCLASSIFY")
ENDIF(CMAKE_COMPILER_IS_ICC)

View File

@ -0,0 +1,35 @@
# Compile and link with python
#link_libraries(${PYTHON_LIBRARY} ${PYTHON_EXTRA_LIBS} )
include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_NUMPY_INCLUDE_DIR})
function (python_register_dynamic_module NickName)
set_property (GLOBAL APPEND PROPERTY DEPENDANCE_TO_ADD triqs_${NickName} )
set_property (GLOBAL APPEND PROPERTY Modules_actually_compiled ${NickName} )
endfunction (python_register_dynamic_module NickName)
# This function add the target to build a python module
#
# NickName =
# ModuleName = the python name of the module
# ModuleDest = path in the pytriqs tree [ FOR INSTALLATION ONLY] IMPROVE MAKE THIS OPTIONAL (for test)
macro (cython_module NickName ModuleName)
MESSAGE(STATUS "Preparing cython module ${NickName} ")
get_filename_component(CYTHON_EXECUTABLE_PATH ${PYTHON_INTERPRETER} PATH)
SET(CYTHON_EXECUTABLE ${CYTHON_EXECUTABLE_PATH}/cython CACHE STRING "Path to the cython executable")
SET(cython_src ${CMAKE_CURRENT_SOURCE_DIR}/${ModuleName}.pyx )
FILE(GLOB all_pyx_src RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.pyx *.pxd )
SET(cython_wrap ${CMAKE_CURRENT_BINARY_DIR}/wrap_${NickName}_by_cython.cpp)
add_custom_command (OUTPUT ${cython_wrap} DEPENDS ${all_pyx_src} COMMAND ${CYTHON_EXECUTABLE} ${cython_src} -I ${CMAKE_CURRENT_SOURCE_DIR}/ -I${CMAKE_SOURCE_DIR}/pytriqs/pxd -X embedsignature=True --cplus -o ${cython_wrap} )
add_custom_target(cython_${NickName} ALL DEPENDS ${cython_wrap})
add_library(${ModuleName} MODULE ${cython_wrap} )
set_target_properties(${ModuleName} PROPERTIES PREFIX "") #eliminate the lib in front of the module name
target_link_libraries(${ModuleName} ${TRIQS_LINK_LIBS} triqs)
if (${ARGN} MATCHES "")
install (TARGETS ${ModuleName} DESTINATION ${TRIQS_PYTHON_LIB_DEST}/${ARGN} )
endif (${ARGN} MATCHES "")
set_property (GLOBAL APPEND PROPERTY DEPENDANCE_TO_ADD triqs_${NickName} )
endmacro (cython_module)

38
cmake/FindFFTW.cmake Normal file
View File

@ -0,0 +1,38 @@
# Copyright Olivier Parcollet 2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# This module looks for fftw.
# It sets up : FFTW_INCLUDE_DIR, FFTW_LIBRARIES
#
SET(TRIAL_PATHS
$ENV{FFTW_ROOT}/include
${FFTW_ROOT}/include
/usr/include
/usr/local/include
/opt/local/include
/sw/include
)
FIND_PATH(FFTW_INCLUDE_DIR fftw3.h ${TRIAL_PATHS} DOC "Include for FFTW")
SET(TRIAL_LIBRARY_PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
$ENV{FFTW_ROOT}/lib
${FFTW_ROOT}/lib
)
SET(FFTW_LIBRARIES "FFTW_LIBRARIES-NOTFOUND" CACHE STRING "FFTW library")
# Try to detect the lib
FIND_LIBRARY(FFTW_LIBRARIES fftw3 ${TRIAL_LIBRARY_PATHS} DOC "FFTW library")
mark_as_advanced(FFTW_INCLUDE_DIR)
mark_as_advanced(FFTW_LIBRARIES)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW DEFAULT_MSG FFTW_LIBRARIES FFTW_INCLUDE_DIR)

24
cmake/FindGMP.cmake Normal file
View File

@ -0,0 +1,24 @@
# Try to find the GMP librairies
# GMP_FOUND - system has GMP lib
# GMP_INCLUDE_DIR - the GMP include directory
# GMP_LIBRARIES - Libraries needed to use GMP
# Copyright (c) 2006, Laurent Montel, <montel@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (GMP_INCLUDE_DIR AND GMP_LIBRARIES)
# Already in cache, be silent
set(GMP_FIND_QUIETLY TRUE)
endif (GMP_INCLUDE_DIR AND GMP_LIBRARIES)
find_path(GMP_INCLUDE_DIR NAMES gmp.h )
find_library(GMP_LIBRARIES NAMES gmp libgmp )
find_library(GMPXX_LIBRARIES NAMES gmpxx libgmpxx )
MESSAGE(STATUS "GMP libs: " ${GMP_LIBRARIES} " " ${GMPXX_LIBRARIES} )
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMP DEFAULT_MSG GMP_INCLUDE_DIR GMP_LIBRARIES)
mark_as_advanced(GMP_INCLUDE_DIR GMP_LIBRARIES GMPXX_LIBRARIES)

38
cmake/FindGSL.cmake Normal file
View File

@ -0,0 +1,38 @@
# Copyright Olivier Parcollet 2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# This module looks for fftw.
# It sets up : GSL_INCLUDE_DIR, GSL_LIBRARIES
#
SET(TRIAL_PATHS
$ENV{GSL_ROOT}/include
${GSL_ROOT}/include
/usr/include
/usr/local/include
/opt/local/include
/sw/include
)
FIND_PATH(GSL_INCLUDE_DIR gsl/gsl_math.h ${TRIAL_PATHS} DOC "Include for GSL")
SET(TRIAL_LIBRARY_PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
$ENV{GSL_ROOT}/lib
${GSL_ROOT}/lib
)
SET(GSL_LIBRARIES "GSL_LIBRARIES-NOTFOUND" CACHE STRING "GSL library")
# Try to detect the lib
FIND_LIBRARY(GSL_LIBRARIES gsl ${TRIAL_LIBRARY_PATHS} DOC "GSL library")
mark_as_advanced(GSL_INCLUDE_DIR)
mark_as_advanced(GSL_LIBRARIES)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GSL DEFAULT_MSG GSL_LIBRARIES GSL_INCLUDE_DIR)

79
cmake/FindGit3.cmake Normal file
View File

@ -0,0 +1,79 @@
#
#Find a Git SCM client.
#
#GIT_FOUND - True if Git was found.
#GIT_EXECUTABLE - Path to the git binary.
#GIT_VERSION - Version of found git binary.
#
#If Git is found, then following function(s) are defined:
#GIT_TREE_INFO( DIR PREFIX )
# Extracts info from given tree.
# Arguments:
# DIR - Where the git tree is.
# PREFIX - A prefix for defined variables.
# Defined variables:
# ${PREFIX}_HASH - A hash of HEAD revision.
# ${PREFIX}_HASH_SHORT - An abbreviation of the hash.
#
IF( GIT_EXECUTABLE )
# Already in cache, be silent
SET( Git_FIND_QUIETLY TRUE )
ENDIF( GIT_EXECUTABLE )
FIND_PROGRAM( GIT_EXECUTABLE git
DOC "Path to the git binary." )
# handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( Git DEFAULT_MSG GIT_EXECUTABLE )
MARK_AS_ADVANCED( GIT_EXECUTABLE GIT_VERSION )
IF( GIT_FOUND )
EXECUTE_PROCESS( COMMAND "${GIT_EXECUTABLE}" --version
OUTPUT_VARIABLE GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE )
STRING( REPLACE "git version " "" GIT_VERSION
"${GIT_VERSION}" )
FUNCTION( GIT_TREE_INFO DIR PREFIX )
EXECUTE_PROCESS( COMMAND "${GIT_EXECUTABLE}" rev-parse HEAD
WORKING_DIRECTORY "${DIR}"
RESULT_VARIABLE GIT_RESULT
OUTPUT_VARIABLE "${PREFIX}_HASH"
ERROR_VARIABLE GIT_ERROR
OUTPUT_STRIP_TRAILING_WHITESPACE )
IF( NOT ${GIT_RESULT} EQUAL 0 )
MESSAGE( STATUS "This is not a git clone" )
#MESSAGE( STATUS " in more details : ... command '${GIT_EXECUTABLE} rev-parse HEAD' failed with following output:\n ..... ${GIT_ERROR}" )
ENDIF( NOT ${GIT_RESULT} EQUAL 0 )
EXECUTE_PROCESS( COMMAND "${GIT_EXECUTABLE}" rev-parse --short HEAD
WORKING_DIRECTORY "${DIR}"
RESULT_VARIABLE GIT_RESULT
OUTPUT_VARIABLE "${PREFIX}_HASH_SHORT"
ERROR_VARIABLE GIT_ERROR
OUTPUT_STRIP_TRAILING_WHITESPACE )
IF( NOT ${GIT_RESULT} EQUAL 0 )
#MESSAGE( STATUS " Not a git clone" )
#MESSAGE( SEND_ERROR "Command '${GIT_EXECUTABLE} rev-parse --short HEAD' failed with following output:\n${GIT_ERROR}" )
ENDIF( NOT ${GIT_RESULT} EQUAL 0 )
EXECUTE_PROCESS( COMMAND "${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD
#EXECUTE_PROCESS( COMMAND "${GIT_EXECUTABLE}" branch | grep \\*
WORKING_DIRECTORY "${DIR}"
RESULT_VARIABLE GIT_RESULT
OUTPUT_VARIABLE "${PREFIX}_BRANCHES"
ERROR_VARIABLE GIT_ERROR
OUTPUT_STRIP_TRAILING_WHITESPACE )
SET( "${PREFIX}_HASH" "${${PREFIX}_HASH}" PARENT_SCOPE )
SET( "${PREFIX}_HASH_SHORT" "${${PREFIX}_HASH_SHORT}" PARENT_SCOPE )
SET( "${PREFIX}_BRANCHES" "${${PREFIX}_BRANCHES}" PARENT_SCOPE )
ENDFUNCTION( GIT_TREE_INFO )
ENDIF( GIT_FOUND )

290
cmake/FindLapack.cmake Normal file
View File

@ -0,0 +1,290 @@
# - FindLapack.cmake
# Find LAPACK/BLAS (and compatible) numerical libraries
#
# This module will define the following values:
# LAPACK_LIBRARY
# BLAS_LIBRARY
#
# 0) check if BLAS_LIBRARY and LAPACK_LIBRARY have already been set on command line, if so: take these values.
# 1) search ENV MKL
# 2) search MKL in usual paths
# 3) search ENV ATLAS
# 4) search generic lapack/blas using CMake-provided FindLAPACK.cmake
# if BLA_VENDOR is set, try to use that vendor's LAPACK implementation
# 5) if build is on cray use hardcoded path
# 6) give up
# Copyright (C) 2009-2010 Matthias Troyer <troyer@comp-phys.org>
# Copyright (C) 2009-2010 Synge Todo <wistaria@comp-phys.org>
# Copyright (C) 2009-2010 Bela Bauer
# Copyright (C) 2009-2010 Brigitte Surer
# Copyright (C) 2009-2010 Lukas Gamper
# Copyright (C) 2009-2010 Ryo IGARASHI <rigarash@hosi.phys.s.u-tokyo.ac.jp>
# Copyright (C) 2010 Emanuel Gull <gull@phys.columbia.edu>
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
SET(MKL_PATHS "/usr/local/lib /usr/lib")
#IF(NOT QMC_BUILD_STATIC)
IF(BLAS_LIBRARY AND LAPACK_LIBRARY)
SET(LAPACK_LIBRARY_INIT 1)
SET(BLAS_LIBRARY_INIT 1)
ENDIF(BLAS_LIBRARY AND LAPACK_LIBRARY)
IF($ENV{MKL} MATCHES "mkl")
MESSAGE(STATUS "Using intel/mkl library: $ENV{MKL}")
#look for the path where the mkl is installed
STRING(REGEX MATCHALL "[-][L]([^ ;])+" MKL_PATH_WITH_PREFIX "$ENV{MKL}")
STRING(REGEX REPLACE "[-][L]" "" MKL_PATHS ${MKL_PATH_WITH_PREFIX})
ENDIF($ENV{MKL} MATCHES "mkl")
SET(MKL_PATHS
$ENV{MKL_HOME}/lib/em${QMC_BITS}t
$ENV{MKL_HOME}/lib/${QMC_BITS}
$ENV{MKL_HOME}/lib
${MKL_PATHS}
)
# MESSAGE(STATUS "Looking for intel/mkl library in ${MKL_PATHS}")
STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" MKL_VERSION "$ENV{MKL_HOME}")
SET(LINK_LAPACK_DEFAULT 1)
IF(${MKL_VERSION} MATCHES "10\\.0\\.[0-2]")
SET(LINK_LAPACK_DEFAULT 0)
ENDIF(${MKL_VERSION} MATCHES "10\\.0\\.[0-2]")
IF(NOT LAPACK_LIBRARY_INIT)
IF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
IF(LINK_LAPACK_DEFAULT)
FIND_LIBRARY(LAPACK_LIBRARY NAMES mkl_lapack PATHS ${MKL_PATHS})
FIND_LIBRARY(BLAS_LIBRARY NAMES mkl PATHS ${MKL_PATHS})
ELSE(LINK_LAPACK_DEFAULT)
FIND_LIBRARY(LAPACK_LIBRARY STATIC NAMES mkl_lapack PATHS ${MKL_PATHS})
FIND_LIBRARY(BLAS_LIBRARY NAMES mkl_em64t PATHS ${MKL_PATHS})
MESSAGE("-- mkl 10.0.[0-2] warning for EM64T")
MESSAGE("-- Replace libmkl_lapack.so in CMakeCache.txt by libmkl_lapack.a")
ENDIF(LINK_LAPACK_DEFAULT)
ELSE(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
FIND_LIBRARY(LAPACK_LIBRARY
NAMES mkl_lapack
PATHS ${MKL_PATHS}
)
FIND_LIBRARY(BLAS_LIBRARY
NAMES mkl
PATHS ${MKL_PATHS}
)
ENDIF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
FIND_LIBRARY(INTEL_GUIDE_LIBRARY
NAMES guide
PATHS ${MKL_PATHS}
)
MARK_AS_ADVANCED(INTEL_GUIDE_LIBRARY)
IF(NOT INTEL_GUIDE_LIBRARY MATCHES "NOTFOUND")
SET(REQUIRE_PTHREAD TRUE)
FIND_LIBRARY(PTHREAD_LIBRARY NAMES pthread)
ENDIF(NOT INTEL_GUIDE_LIBRARY MATCHES "NOTFOUND")
IF(NOT BLAS_guide_LIBRARY MATCHES "NOTFOUND")
SET(REQUIRE_PTHREAD TRUE)
FIND_LIBRARY(PTHREAD_LIBRARY NAMES pthread)
ENDIF(NOT BLAS_guide_LIBRARY MATCHES "NOTFOUND")
IF(LAPACK_LIBRARY MATCHES "mkl")
MESSAGE(STATUS "Found intel/mkl library")
SET(LAPACK_LIBRARY_INIT 1)
SET(BLAS_LIBRARY_INIT 1)
SET(HAVE_MKL 1) # CACHE BOOL "HAVE_MKL is set to 1")
SET(MKL_INC_PATHS $ENV{MKL_HOME}/include ${MKL_PATHS})
FIND_PATH(MKL_INCLUDE_DIR mkl.h ${MKL_INC_PATHS})
INCLUDE_DIRECTORIES(${MKL_INCLUDE_DIR})
ENDIF(LAPACK_LIBRARY MATCHES "mkl")
ENDIF(NOT LAPACK_LIBRARY_INIT)
IF(NOT HAVE_MKL)
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -framework vecLib")
SET(LAPACK_LIBRARY_INIT 1)
SET(MAC_VECLIB 1 CACHE BOOL "use Mac Framework")
SET(LAPACK_LIBRARY "")
MESSAGE(STATUS "Using Framework on Darwin.")
## check goto library: does not work so well
#FIND_LIBRARY(BLAS_LIBRARY NAMES goto
# PATHS
# $ENV{GOTOBLAS_HOME}
# /usr/lib
# /usr/local/lib
# /sw/lib
# )
SET(BLAS_LIBRARY "")
SET(BLAS_LIBRARY_INIT 1)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
ENDIF(NOT HAVE_MKL)
IF($ENV{ATLAS} MATCHES "atlas")
IF($ENV{ATLAS} MATCHES "lapack")
SET(LAPACK_LIBRARY_INIT 1)
ENDIF($ENV{ATLAS} MATCHES "lapack")
SET(BLAS_LIBRARY $ENV{ATLAS})
SET(BLAS_LIBRARY_INIT 1)
ENDIF($ENV{ATLAS} MATCHES "atlas")
IF($ENV{LAPACK} MATCHES "lapack")
SET(LAPACK_LIBRARY $ENV{LAPACK})
SET(LAPACK_LIBRARY_INIT 1)
ENDIF($ENV{LAPACK} MATCHES "lapack")
#IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# SET(LAPACK_LIBRARY $ENV{LAPACK})
# SET(LAPACK_LIBRARY_INIT 1)
#ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
IF(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
SET(ELIB essl)
IF(ENABLE_OMP)
SET(ELIB esslsmp)
ENDIF(ENABLE_OMP)
IF(NOT LAPACK_LIBRARY_INIT)
SET(LLIB lapack-SP4_${QMC_BITS} lapack)
FIND_LIBRARY(LAPACK_LIBRARY
NAMES ${LLIB}
PATHS /usr/apps/math/lapack/LAPACK
lib
)
FIND_LIBRARY(BLAS_LIBRARY ${ELIB}
/usr/lib
)
ENDIF(NOT LAPACK_LIBRARY_INIT)
SET(LAPACK_LIBRARY_INIT 1)
SET(BLAS_LIBRARY_INIT 1)
MESSAGE(STATUS "Found lapack/blas on AIX system")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
# for clapack on Windows
IF(NOT LAPACK_LIBRARY_INIT)
if(WIN32 AND NOT UNIX)
set(TRIAL_PATHS "$ENV{HOMEDRIVE}$ENV{HOMEPATH}/opt/lib")
find_library(LAPACK_LIBRARY lapack ${TRIAL_PATHS})
find_library(BLAS_LIBRARY blas ${TRIAL_PATHS})
if(LAPACK_LIBRARY AND BLAS_LIBRARY)
SET(LAPACK_LIBRARY_INIT 1)
SET(BLAS_LIBRARY_INIT 1)
set(LAPACK_DEFINITIONS "-DBOOST_NUMERIC_BINDINGS_USE_CLAPACK=1" CACHE STRING "Lapack definitions")
MARK_AS_ADVANCED(LAPACK_DEFINITIONS)
MESSAGE(STATUS "Found Lapack: ${LAPACK_LIBRARY} ${BLAS_LIBRARY}")
endif(LAPACK_LIBRARY AND BLAS_LIBRARY)
endif(WIN32 AND NOT UNIX)
ENDIF(NOT LAPACK_LIBRARY_INIT)
#IF(NOT LAPACK_LIBRARY_INIT)
# FIND_LIBRARY(LAPACK_LIBRARY NAMES lapack lapack_gnu
# PATHS /usr/apps/math/lapack
# /usr/lib
# /opt/lib
# /usr/local/lib
# /sw/lib
# )
# IF(LAPACK_LIBRARY)
# MESSAGE(STATUS "Found netlib lapack library")
# SET(LAPACK_LIBRARY_INIT 1)
# ENDIF(LAPACK_LIBRARY)
#ENDIF(NOT LAPACK_LIBRARY_INIT)
#IF(NOT BLAS_LIBRARY_INIT)
# FIND_LIBRARY(BLAS_LIBRARY NAMES goto blas blas_gnu
# PATHS
# $ENV{GOTOBLAS_HOME}
# /usr/apps/math/lapack
# /usr/lib
# /opt/lib
# /usr/local/lib
# /sw/lib
# )
# IF(BLAS_LIBRARY)
# MESSAGE(STATUS "Found netlib blas")
# SET(BLAS_LIBRARY_INIT 1)
# ENDIF(BLAS_LIBRARY)
#ENDIF(NOT BLAS_LIBRARY_INIT)
# Use CMake provided LAPACK/BLAS detection code
# Fortran compiler is needed
IF(NOT BLAS_LIBRARY_INIT AND NOT LAPACK_LIBRARY_INIT)
enable_language(Fortran)
message(STATUS "Falling back to CMake provied LAPACK/BLAS detection.")
find_package(BLAS)
if(BLAS_FOUND)
SET(BLAS_LIBRARY_INIT 1)
SET(BLAS_LIBRARY ${BLAS_LIBRARIES})
find_package(LAPACK)
if(LAPACK_FOUND)
SET(LAPACK_LIBRARY_INIT 1)
SET(LAPACK_LIBRARY ${LAPACK_LIBRARIES})
endif(LAPACK_FOUND)
endif(BLAS_FOUND)
ENDIF(NOT BLAS_LIBRARY_INIT AND NOT LAPACK_LIBRARY_INIT)
### BRANDT
### MOVED BECAUSE OF SCOPE PROBLEM
### PROBABLY SHOULD BE FIXED
MARK_AS_ADVANCED(
LAPACK_LIBRARY
BLAS_LIBRARY
)
IF(USE_SCALAPACK)
SET(PNPATHS
${MKL_PATHS}
${BLACS_HOME}/lib
${SCALAPACK_HOME}/lib
/usr/lib
/opt/lib
/usr/local/lib
/sw/lib
)
IF(INTEL_MKL)
FIND_LIBRARY(BLACSLIB mkl_blacs_${PLAT}_lp${QMC_BITS} PATHS ${PNPATHS})
FIND_LIBRARY(SCALAPACKLIB mkl_scalapack PATHS ${PNPATHS})
ENDIF(INTEL_MKL)
IF(NOT SCALAPACKLIB)
FIND_LIBRARY(BLACSLIB blacs_MPI-${PLAT}-{BLACSDBGLVL} PATHS ${PNPATHS})
FIND_LIBRARY(BLACSCINIT blacsCinit_MPI-${PLAT}-{BLACSDBGLVL} PATHS ${PNPATHS})
FIND_LIBRARY(SCALAPACKLIB scalapack PATHS ${PNPATHS})
ENDIF(NOT SCALAPACKLIB)
IF(BLACSLIB AND SCALAPACKLIB)
SET(FOUND_SCALAPACK 1 CACHE BOOL "Found scalapack library")
ELSE(BLACSLIB AND SCALAPACKLIB)
SET(FOUND_SCALAPACK 0 CACHE BOOL "Mising scalapack library")
ENDIF(BLACSLIB AND SCALAPACKLIB)
MARK_AS_ADVANCED(
BLACSCINIT
BLACSLIB
SCALAPACKLIB
FOUND_SCALAPACK
)
ENDIF(USE_SCALAPACK)
IF(LAPACK_LIBRARY_INIT)
SET(LAPACK_FOUND TRUE)
ENDIF(LAPACK_LIBRARY_INIT)
IF(ALPS_BUILD_ON_CRAY)
MARK_AS_ADVANCED(
BLAS_FOUND
LAPACK_FOUND
)
SET(BLAS_FOUND TRUE)
SET(LAPACK_FOUND TRUE)
ENDIF(ALPS_BUILD_ON_CRAY)

23
cmake/FindMathJax.cmake Normal file
View File

@ -0,0 +1,23 @@
# Copyright Olivier Parcollet 2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# This module looks for mathjax.
# It sets up : MATHJAX_PATH
#
SET(TRIAL_PATHS
$ENV{MATHJAX_ROOT}
${MATHJAX_ROOT}
$ENV{HOME}/MathJax
/usr/share/javascript/mathjax
/opt/local/share/javascript/mathjax
)
FIND_PATH(MATHJAX_PATH MathJax.js ${TRIAL_PATHS} DOC "Root Path of MathJax")
mark_as_advanced(MATHJAX_PATH)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MATHJAX DEFAULT_MSG MATHJAX_PATH)

178
cmake/FindPython.cmake Normal file
View File

@ -0,0 +1,178 @@
# Copyright Olivier Parcollet 2012
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# Python settings :
#
# This module checks that :
# - the python interpreter is working and version >= 2.6.5
# - it has modules : distutils, numpy
#
# This module defines the variables
# - PYTHON_INTERPRETER : name of the python interpreter
# - PYTHON_INCLUDE_DIRS : include for compilation
# - PYTHON_NUMPY_INCLUDE_DIR : include for compilation with numpy
# - PYTHON_LIBRARY : link flags
# - PYTHON_SITE_PKG : path to the standard packages of the python interpreter
# - PYTHON_EXTRA_LIBS : libraries which must be linked in when embedding
# - PYTHON_LINK_FOR_SHARED : linking flags needed when building a shared lib for external modules
set(PYTHON_MINIMAL_VERSION 2.6.5)
MESSAGE( STATUS "-------- Python detection -------------")
# IF PYTHON_INTERPRETER is not defined, try to find a python
if (NOT PYTHON_INTERPRETER )
find_program(PYTHON_INTERPRETER python PATHS $ENV{PATH})
endif (NOT PYTHON_INTERPRETER)
if (NOT PYTHON_INTERPRETER)
MESSAGE(FATAL_ERROR "No python interpreter found")
endif(NOT PYTHON_INTERPRETER)
MESSAGE (STATUS "Python interpreter ${PYTHON_INTERPRETER}")
#
# The function EXEC_PYTHON_SCRIPT executes the_script in python interpreter
# and set the variable of output_var_name in the calling scope
#
FUNCTION ( EXEC_PYTHON_SCRIPT the_script output_var_name)
EXECUTE_PROCESS(COMMAND ${PYTHON_INTERPRETER} -c "${the_script}"
OUTPUT_VARIABLE res RESULT_VARIABLE returncode OUTPUT_STRIP_TRAILING_WHITESPACE)
IF (NOT returncode EQUAL 0)
MESSAGE(FATAL_ERROR "The script : ${the_script} \n did not run properly in the Python interpreter. Check your python installation.")
ENDIF (NOT returncode EQUAL 0)
SET( ${output_var_name} ${res} PARENT_SCOPE)
ENDFUNCTION (EXEC_PYTHON_SCRIPT)
#
# Check the interpreter and its version
#
EXEC_PYTHON_SCRIPT ("import sys, string; print sys.version.split()[0]" PYTHON_VERSION)
STRING(COMPARE GREATER ${PYTHON_MINIMAL_VERSION} ${PYTHON_VERSION} PYTHON_VERSION_NOT_OK)
IF (PYTHON_VERSION_NOT_OK)
MESSAGE(FATAL_ERROR "Python intepreter version is ${PYTHON_VERSION} . It should be >= ${PYTHON_MINIMAL_VERSION}")
ENDIF (PYTHON_VERSION_NOT_OK)
EXEC_PYTHON_SCRIPT ("import distutils " nulle) # check that distutils is there...
EXEC_PYTHON_SCRIPT ("import numpy" nulle) # check that numpy is there...
EXEC_PYTHON_SCRIPT ("import h5py" nulle) # check that h5py is there...
EXEC_PYTHON_SCRIPT ("import scipy" nulle) # check that scipy is there...
MESSAGE(STATUS "Python interpreter and modules are ok : version ${PYTHON_VERSION}" )
#
# Check for Python include path
#
EXEC_PYTHON_SCRIPT ("import distutils ; from distutils.sysconfig import * ; print distutils.sysconfig.get_python_inc()" PYTHON_INCLUDE_DIRS )
message(STATUS "PYTHON_INCLUDE_DIRS = ${PYTHON_INCLUDE_DIRS}" )
mark_as_advanced(PYTHON_INCLUDE_DIRS)
FIND_PATH(TEST_PYTHON_INCLUDE patchlevel.h PATHS ${PYTHON_INCLUDE_DIRS} NO_DEFAULT_PATH)
if (NOT TEST_PYTHON_INCLUDE)
message (ERROR "The Python herader files have not been found. Please check that you installed the Python headers and not only the interpreter.")
endif (NOT TEST_PYTHON_INCLUDE)
mark_as_advanced(TEST_PYTHON_INCLUDE)
#
# include files for numpy
#
EXEC_PYTHON_SCRIPT ("import numpy;print numpy.get_include()" PYTHON_NUMPY_INCLUDE_DIR)
MESSAGE(STATUS "PYTHON_NUMPY_INCLUDE_DIR = ${PYTHON_NUMPY_INCLUDE_DIR}" )
mark_as_advanced(PYTHON_NUMPY_INCLUDE_DIR)
#
# include files for numpy
#
EXEC_PYTHON_SCRIPT ("import numpy;print numpy.version.version" PYTHON_NUMPY_VERSION)
MESSAGE(STATUS "PYTHON_NUMPY_VERSION = ${PYTHON_NUMPY_VERSION}" )
mark_as_advanced(PYTHON_NUMPY_VERSION)
#
# Check for site packages
#
EXEC_PYTHON_SCRIPT ("from distutils.sysconfig import * ;print get_python_lib(0,0)"
PYTHON_SITE_PKG)
MESSAGE(STATUS "PYTHON_SITE_PKG = ${PYTHON_SITE_PKG}" )
mark_as_advanced(PYTHON_SITE_PKG)
#
# Check for Python library path
#
#EXEC_PYTHON_SCRIPT ("import string; from distutils.sysconfig import * ;print string.join(get_config_vars('VERSION'))" PYTHON_VERSION_MAJOR_MINOR)
EXEC_PYTHON_SCRIPT ("import string; from distutils.sysconfig import *; print '%s/config' % get_python_lib(0,1)" PYTHON_LIBRARY_BASE_PATH)
EXEC_PYTHON_SCRIPT ("import string; from distutils.sysconfig import *; print 'libpython%s' % string.join(get_config_vars('VERSION'))" PYTHON_LIBRARY_BASE_FILE)
IF(BUILD_SHARED_LIBS)
FIND_FILE(PYTHON_LIBRARY NAMES "${PYTHON_LIBRARY_BASE_FILE}.so" PATHS ${PYTHON_LIBRARY_BASE_PATH})
IF(NOT PYTHON_LIBRARY)
FIND_FILE(PYTHON_LIBRARY NAMES "${PYTHON_LIBRARY_BASE_FILE}.a" PATHS ${PYTHON_LIBRARY_BASE_PATH})
ENDIF(NOT PYTHON_LIBRARY)
ELSE(BUILD_SHARED_LIBS)
FIND_FILE(PYTHON_LIBRARY NAMES "${PYTHON_LIBRARY_BASE_FILE}.a" PATHS ${PYTHON_LIBRARY_BASE_PATH})
ENDIF(BUILD_SHARED_LIBS)
MESSAGE(STATUS "PYTHON_LIBRARY = ${PYTHON_LIBRARY}" )
mark_as_advanced(PYTHON_LIBRARY)
#
# Cython
#
EXEC_PYTHON_SCRIPT("from Cython.Compiler import Version as V;print V.version.split('.')[1]" PYTHON_CYTHON_VERSION )
MESSAGE(STATUS "Found cython 0.${PYTHON_CYTHON_VERSION}.xxx")
# check version here
#
# libraries which must be linked in when embedding
#
EXEC_PYTHON_SCRIPT ("from distutils.sysconfig import * ;print (str(get_config_var('LOCALMODLIBS')) + ' ' + str(get_config_var('LIBS'))).strip()"
PYTHON_EXTRA_LIBS)
MESSAGE(STATUS "PYTHON_EXTRA_LIBS =${PYTHON_EXTRA_LIBS}" )
mark_as_advanced(PYTHON_EXTRA_LIBS)
#
# Looking for ipython ... (optional)
# not very useful... in static case, we should not allow ipython anyway I guess...
EXECUTE_PROCESS(COMMAND ${PYTHON_INTERPRETER} -c "try :\n import IPython\n print 1\nexcept:\n print 0" OUTPUT_VARIABLE TRIQS_IPYTHON_DETECTED RESULT_VARIABLE returncode OUTPUT_STRIP_TRAILING_WHITESPACE)
if (TRIQS_IPYTHON_DETECTED)
MESSAGE(STATUS "IPython found")
else (TRIQS_IPYTHON_DETECTED)
MESSAGE(STATUS "IPython NOT FOUND ")
endif (TRIQS_IPYTHON_DETECTED)
#
# linking flags needed when embedding (building a shared lib)
# To BE RETESTED
#
#EXEC_PYTHON_SCRIPT ("from distutils.sysconfig import *;print get_config_var('LINKFORSHARED')"
# PYTHON_LINK_FOR_SHARED)
#MESSAGE(STATUS "PYTHON_LINK_FOR_SHARED = ${PYTHON_LINK_FOR_SHARED}" )
#mark_as_advanced(PYTHON_LINK_FOR_SHARED)
# Correction on Mac
#IF(APPLE)
# SET (PYTHON_LINK_FOR_SHARED -u _PyMac_Error -framework Python)
# SET (PYTHON_LINK_MODULE -bundle -undefined dynamic_lookup)
#ELSE(APPLE)
# SET (PYTHON_LINK_MODULE -shared)
#ENDIF(APPLE)
set (PYTHONLIBS_FOUND TRUE) #${PYTHON_FOUND})
# used in BOOST ONLY !!
FUNCTION(PYTHON_ADD_MODULE _NAME )
OPTION(PYTHON_ENABLE_MODULE_${_NAME} "Add module ${_NAME}" TRUE)
OPTION(PYTHON_MODULE_${_NAME}_BUILD_SHARED "Add module ${_NAME} shared" ${BUILD_SHARED_LIBS})
IF(PYTHON_ENABLE_MODULE_${_NAME})
IF(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
SET(PY_MODULE_TYPE MODULE)
ELSE(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
SET(PY_MODULE_TYPE STATIC)
SET_PROPERTY(GLOBAL APPEND PROPERTY PY_STATIC_MODULES_LIST ${_NAME})
ENDIF(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
SET_PROPERTY(GLOBAL APPEND PROPERTY PY_MODULES_LIST ${_NAME})
ADD_LIBRARY(${_NAME} ${PY_MODULE_TYPE} ${ARGN})
# TARGET_LINK_LIBRARIES(${_NAME} ${PYTHON_LIBRARIES})
ENDIF(PYTHON_ENABLE_MODULE_${_NAME})
ENDFUNCTION(PYTHON_ADD_MODULE)
MESSAGE( STATUS "--------------------------------------------")

58
cmake/FindTRIQS.cmake Normal file
View File

@ -0,0 +1,58 @@
# Copyright Olivier Parcollet 2013
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# This module looks for triqs
# It sets up :
# HERE MAKE THE LIST !
#
find_package(PackageHandleStandardArgs)
SET(TRIAL_PATHS
$ENV{TRIQS_PATH}/include/triqs
${TRIQS_PATH}/include/triqs
/usr/include/triqs
/usr/local/include/triqs
/opt/local/include/triqs
/sw/include/triqs
)
FIND_PATH(TRIQS_INCLUDE_DIR triqs_config.h ${TRIAL_PATHS} DOC "Include triqs")
SET(TRIAL_LIBRARY_PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
$ENV{TRIQS_PATH}/lib
${TRIQS_PATH}/lib
)
SET(TRIQS_LIBRARIES "TRIQS_LIBRARIES-NOTFOUND" CACHE STRING "TRIQS library")
# Try to detect the lib
FIND_LIBRARY(TRIQS_LIBRARIES triqs ${TRIAL_LIBRARY_PATHS} DOC "TRIQS library")
SET(TRIAL_PATHS
$ENV{TRIQS_PATH}/share/triqs/cmake
${TRIQS_PATH}/share/triqs/cmake
/usr/share/triqs/cmake
/usr/local/share/triqs/cmake
/opt/local/share/triqs/cmake
/sw/share/triqs/cmake
)
FIND_PATH(TRIQS_CONFIG_FILE TRIQSConfig.cmake ${TRIAL_PATHS} DOC "TRIQS configuration file")
mark_as_advanced(TRIQS_INCLUDE_DIR)
mark_as_advanced(TRIQS_LIBRARIES)
if (NOT TRIQS_CONFIG_FILE)
MESSAGE(FATAL_ERROR " ${TRIQS_PATH} $ENV{TRIQS_PATH}")
MESSAGE(FATAL_ERROR " Can not find the TRIQS config file")
endif()
# include prepare variables
include(${TRIQS_CONFIG_FILE}/TRIQSConfig.cmake )
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TRIQS DEFAULT_MSG TRIQS_LIBRARIES TRIQS_INCLUDE_DIR)

View File

@ -0,0 +1,44 @@
# runs python_with_DMFT script > output
# and compares output with script.output
# Example:
# add_triqs_test_script(ExampleTest)
# where ExampleTest.py is the script and ExampleTest.output is the expected output
#
macro(add_test_C_simple testname )
enable_testing()
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output)
file( COPY ${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
add_test(${testname}
${CMAKE_COMMAND}
-Dname=${testname}${ARGN}
-Dcmd=${CMAKE_CURRENT_BINARY_DIR}/${testname}${ARGN}
-Dreference=${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output
-P ${TRIQS_SOURCE_DIR}/cmake/run_test.cmake
)
else (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output)
add_test(${testname}${ARGN} ${testname}${ARGN} )
endif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output)
endmacro(add_test_C_simple)
macro(add_test_C_hdf testname h5diff_options)
set(h5diff_objects ${ARGN}) # grab additionnal arguments !
enable_testing()
add_test(${testname}
${CMAKE_COMMAND}
-Dname=${testname}${ARGN}
-Dcmd=${CMAKE_CURRENT_BINARY_DIR}/${testname}${ARGN}
-DoutputName=${testname}.output.h5
-Dreference=${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output.h5
-DH5_DIFF_EXECUTABLE=${HDF5_DIFF_EXECUTABLE}
-DH5_DIFF_OPTIONS=${h5diff_options}
-DH5_DIFF_OBJECTS=${h5diff_objects}
-P ${TRIQS_SOURCE_DIR}/cmake/run_test.cmake
)
endmacro(add_test_C_hdf)

View File

@ -0,0 +1,55 @@
SET(RUN_TEST ${CMAKE_BINARY_DIR}/run_pytriqs_for_test.sh )
#if (TRIQS_BUILD_STATIC)
# FILE(WRITE ${RUN_TEST} "PYTHONPATH=${CMAKE_BINARY_DIR}:$PYTHONPATH ${PYTHON_INTERPRETER} $1")
# #FILE(WRITE ${RUN_TEST} "PYTHONPATH=${CMAKE_BINARY_DIR}:$PYTHONPATH ${CMAKE_BINARY_DIR}/bin/pytriqs $1")
# execute_process( COMMAND chmod u+x ${RUN_TEST} )
#endif (TRIQS_BUILD_STATIC)
SET(ExecutableNameForTest ${RUN_TEST})
# runs pytriqs script > output
# and compares output with script.output
# Example:
# add_triqs_test_script(ExampleTest)
# where ExampleTest.py is the script and ExampleTest.output is the expected output
#
macro(add_triqs_test_txt testname )
enable_testing()
add_test(${testname}
${CMAKE_COMMAND}
-Dname=${testname}
-Dcmd=${ExecutableNameForTest}
-Dinput=${CMAKE_CURRENT_SOURCE_DIR}/${testname}.py
-Dreference=${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output
-P ${TRIQS_SOURCE_DIR}/cmake/run_test.cmake
)
endmacro(add_triqs_test_txt)
# - runs python_with_DMFT script
# - compares the file named testname_output.h5
# with the file testname.output.h5 of the source directory
# The comparison with made with h5diff_options
# all remainings arguments are the objects to which to restrict the comparison (default = no restriction)
# Example :
# add_triqs_test_hdf(ExampleTestH5 "-r" )
# where ExampleTestH5.py produces to be compared with ExampleTestH5_output.h5 with option "-r" and for all objects
#
macro(add_triqs_test_hdf testname h5diff_options)
set(h5diff_objects ${ARGN}) # grab additionnal arguments !
enable_testing()
add_test(${testname}
${CMAKE_COMMAND}
-Dname=${testname}
-Dcmd=${ExecutableNameForTest}
-Dinput=${CMAKE_CURRENT_SOURCE_DIR}/${testname}.py
-DoutputName=${testname}.output.h5
-Dreference=${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output.h5
-DH5_DIFF_EXECUTABLE=${HDF5_DIFF_EXECUTABLE}
-DH5_DIFF_OPTIONS=${h5diff_options}
-DH5_DIFF_OBJECTS=${h5diff_objects}
-P ${TRIQS_SOURCE_DIR}/cmake/run_test.cmake
)
endmacro(add_triqs_test_hdf)

View File

@ -0,0 +1,15 @@
# add_all_subdirectories_with_cmakelist : include all subdirectory to current path
# which contains a CMakeLists.txt file...
# rational : automatize inclusion when projects are splitted & merged ....
macro (add_all_subdirectories_with_cmakelist)
SET( print_decal_sub_dir "${print_decal_sub_dir} ")
FILE(GLOB ALLSUBS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} */CMakeLists.txt)
foreach ( f ${ALLSUBS})
get_filename_component(d ${f} PATH)
#MESSAGE(STATUS "${print_decal_sub_dir}## Including subdirectory : ${d}")
add_subdirectory(${d})
endforeach ( f ${ALLSUBS})
endmacro (add_all_subdirectories_with_cmakelist)

View File

@ -0,0 +1,101 @@
# runs python_with_DMFT script > output
# and compares output with script.output
# Example:
# triqs_add_triqs_test_script(ExampleTest)
# where ExampleTest.py is the script and ExampleTest.output is the expected output
#
macro(triqs_add_test_C_simple testname )
enable_testing()
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output)
file( COPY ${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
add_test(${testname}
${CMAKE_COMMAND}
-Dname=${testname}${ARGN}
-Dcmd=${CMAKE_CURRENT_BINARY_DIR}/${testname}${ARGN}
-Dreference=${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output
-P @CMAKE_INSTALL_PREFIX@/share/triqs/cmake/run_test.cmake
)
else (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output)
add_test(${testname}${ARGN} ${testname}${ARGN} )
endif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output)
endmacro(triqs_add_test_C_simple)
macro(triqs_add_test_C_hdf testname h5diff_options)
set(h5diff_objects ${ARGN}) # grab additionnal arguments !
enable_testing()
add_test(${testname}
${CMAKE_COMMAND}
-Dname=${testname}${ARGN}
-Dcmd=${CMAKE_CURRENT_BINARY_DIR}/${testname}${ARGN}
-DoutputName=${testname}.output.h5
-Dreference=${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output.h5
-DH5_DIFF_EXECUTABLE=${TRIQS_HDF5_DIFF_EXECUTABLE}
-DH5_DIFF_OPTIONS=${h5diff_options}
-DH5_DIFF_OBJECTS=${h5diff_objects}
-P @CMAKE_INSTALL_PREFIX@/share/triqs/cmake/run_test.cmake
)
endmacro(triqs_add_test_C_hdf)
SET(RUN_TEST ${CMAKE_BINARY_DIR}/run_pytriqs_for_test.sh )
#if (TRIQS_BUILD_STATIC)
# FILE(WRITE ${RUN_TEST} "PYTHONPATH=${CMAKE_BINARY_DIR}:$PYTHONPATH ${PYTHON_INTERPRETER} $1")
# #FILE(WRITE ${RUN_TEST} "PYTHONPATH=${CMAKE_BINARY_DIR}:$PYTHONPATH ${CMAKE_BINARY_DIR}/bin/pytriqs $1")
# execute_process( COMMAND chmod u+x ${RUN_TEST} )
#endif (TRIQS_BUILD_STATIC)
SET(ExecutableNameForTest ${RUN_TEST})
# runs pytriqs script > output
# and compares output with script.output
# Example:
# triqs_add_triqs_test_script(ExampleTest)
# where ExampleTest.py is the script and ExampleTest.output is the expected output
#
macro(triqs_add_triqs_test_txt testname )
enable_testing()
add_test(${testname}
${CMAKE_COMMAND}
-Dname=${testname}
-Dcmd=${ExecutableNameForTest}
-Dinput=${CMAKE_CURRENT_SOURCE_DIR}/${testname}.py
-Dreference=${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output
-P @CMAKE_INSTALL_PREFIX@/share/triqs/cmake/run_test.cmake
)
endmacro(triqs_add_triqs_test_txt)
# - runs python_with_DMFT script
# - compares the file named testname_output.h5
# with the file testname.output.h5 of the source directory
# The comparison with made with h5diff_options
# all remainings arguments are the objects to which to restrict the comparison (default = no restriction)
# Example :
# triqs_add_triqs_test_hdf(ExampleTestH5 "-r" )
# where ExampleTestH5.py produces to be compared with ExampleTestH5_output.h5 with option "-r" and for all objects
#
macro(triqs_add_triqs_test_hdf testname h5diff_options)
set(h5diff_objects ${ARGN}) # grab additionnal arguments !
enable_testing()
add_test(${testname}
${CMAKE_COMMAND}
-Dname=${testname}
-Dcmd=${ExecutableNameForTest}
-Dinput=${CMAKE_CURRENT_SOURCE_DIR}/${testname}.py
-DoutputName=${testname}.output.h5
-Dreference=${CMAKE_CURRENT_SOURCE_DIR}/${testname}.output.h5
-DH5_DIFF_EXECUTABLE=${TRIQS_HDF5_DIFF_EXECUTABLE}
-DH5_DIFF_OPTIONS=${h5diff_options}
-DH5_DIFF_OBJECTS=${h5diff_objects}
-P @CMAKE_INSTALL_PREFIX@/share/triqs/cmake/run_test.cmake
)
endmacro(triqs_add_triqs_test_hdf)

101
cmake/TRIQSConfig.cmake.in Normal file
View File

@ -0,0 +1,101 @@
# version
set(TRIQS_VERSION @TRIQS_VERSION@)
set(TRIQS_GIT_HASH @TRIQS_GIT_HASH@)
#definitions
set(TRIQS_CXX_DEFINITIONS @TRIQS_CXX_DEFINITIONS@)
# Includes
set(TRIQS_INCLUDE @CMAKE_INSTALL_PREFIX@/include)
set(TRIQS_INCLUDE_BOOST @BOOST_INCLUDE_DIR@)
set(TRIQS_INCLUDE_MPI @TRIQS_INCLUDE_MPI@)
set(TRIQS_INCLUDE_PYTHON @TRIQS_INCLUDE_PYTHON@)
set(TRIQS_INCLUDE_HDF5 @TRIQS_INCLUDE_HDF5@)
set(TRIQS_INCLUDE_FFTW @TRIQS_INCLUDE_FFTW@)
set(TRIQS_INCLUDE_GMP @TRIQS_INCLUDE_GMP@)
set(TRIQS_INCLUDE_GSL @GSL_INCLUDE_DIR@)
# Libraries
set(TRIQS_LIBRARY -L@CMAKE_INSTALL_PREFIX@/lib -ltriqs)
set(TRIQS_LIBRARY_BOOST @BOOST_LIBRARY@)
set(TRIQS_LIBRARY_MPI @TRIQS_LIBRARY_MPI@)
set(TRIQS_LIBRARY_PYTHON @TRIQS_LIBRARY_PYTHON@)
set(TRIQS_LIBRARY_HDF5 @TRIQS_LIBRARY_HDF5@)
set(TRIQS_LIBRARY_LAPACK @TRIQS_LIBRARY_LAPACK@)
set(TRIQS_LIBRARY_FFTW @TRIQS_LIBRARY_FFTW@)
set(TRIQS_LIBRARY_GMP @TRIQS_LIBRARY_GMP@)
set(TRIQS_LIBRARY_GSL @GSL_LIBRARIES@)
# Misc
set(TRIQS_HDF5_DIFF_EXECUTABLE @TRIQS_HDF5_DIFF_EXECUTABLE@)
# for people who want to quickly add everything TRIQS has detected...
set(TRIQS_LIBRARY_ALL ${TRIQS_LIBRARY} ${TRIQS_LIBRARY_BOOST} ${TRIQS_LIBRARY_PYTHON} ${TRIQS_LIBRARY_MPI} ${TRIQS_LIBRARY_HDF5} ${TRIQS_LIBRARY_LAPACK} ${TRIQS_LIBRARY_FFTW} ${TRIQS_LIBRARY_GMP} ${TRIQS_LIBRARY_GSL} )
set(TRIQS_INCLUDE_ALL ${TRIQS_INCLUDE} ${TRIQS_INCLUDE_BOOST} ${TRIQS_INCLUDE_PYTHON} ${TRIQS_INCLUDE_MPI} ${TRIQS_INCLUDE_HDF5} ${TRIQS_INCLUDE_LAPACK} ${TRIQS_INCLUDE_FFTW} ${TRIQS_INCLUDE_GMP} ${TRIQS_INCLUDE_GSL} )
list (REMOVE_DUPLICATES TRIQS_INCLUDE_ALL)
# Python specific stuff
set (TRIQS_PYTHON_INTERPRETER @PYTHON_INTERPRETER@)
# Fix the rpath
set(CMAKE_INSTALL_RPATH "@CMAKE_INSTALL_PREFIX@/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
message(STATUS "TRIQS : Adding C++11 compilation flags -std=c++11 ")
add_definitions( -std=c++0x)
# Check compiler
if (NOT CMAKE_CXX_COMPILER STREQUAL "@CMAKE_CXX_COMPILER@" )
message(FATAL_ERROR "For your own safety, you should use the same compiler as the one used to compile TRIQS !")
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ ")
message(STATUS "TRIQS : Adding C++11 compilation flags for Os X: -stdlib=libc++ ")
else ()
message( WARNING "${line_of_star}You are on Os X but your are not using clang. This is NOT recommended...${line_of_star}")
endif ()
endif( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# This function add the target to build a python module
#
# NickName =
# ModuleName = the python name of the module
# ModuleDest = path in the pytriqs tree [ FOR INSTALLATION ONLY] IMPROVE MAKE THIS OPTIONAL (for test)
macro (triqs_cython_module NickName ModuleName)
message(STATUS "TRIQS : Preparing cython module ${NickName} with the interpreter ${TRIQS_PYTHON_INTERPRETER} ")
get_filename_component(CYTHON_EXECUTABLE_PATH ${TRIQS_PYTHON_INTERPRETER} PATH)
set(CYTHON_EXECUTABLE ${CYTHON_EXECUTABLE_PATH}/cython CACHE STRING "Path to the cython executable")
set(cython_src ${CMAKE_CURRENT_SOURCE_DIR}/${ModuleName}.pyx )
FILE(GLOB all_pyx_src RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.pyx *.pxd )
set(cython_wrap ${CMAKE_CURRENT_BINARY_DIR}/wrap_${NickName}_by_cython.cpp)
add_custom_command (OUTPUT ${cython_wrap} DEPENDS ${all_pyx_src} COMMAND ${CYTHON_EXECUTABLE} ${cython_src} -I ${CMAKE_CURRENT_SOURCE_DIR}/ -I@CMAKE_INSTALL_PREFIX@/include/pytriqs/ -I@CMAKE_INSTALL_PREFIX@/include/ -X embedsignature=True --cplus -o ${cython_wrap} )
add_custom_target(cython_${NickName} ALL DEPENDS ${cython_wrap})
add_library(${ModuleName} MODULE ${cython_wrap} )
set_target_properties(${ModuleName} PROPERTIES PREFIX "") #eliminate the lib in front of the module name
target_link_libraries(${ModuleName} ${TRIQS_LINK_LIBS} triqs)
if (${ARGN} MATCHES "")
install (TARGETS ${ModuleName} DESTINATION ${TRIQS_PYTHON_LIB_DEST}/${ARGN} )
endif (${ARGN} MATCHES "")
set_property (GLOBAL APPEND PROPERTY DEPENDANCE_TO_ADD triqs_${NickName} )
endmacro (triqs_cython_module)
# Also duplicate from the FindTriqsMacro.... ? Include ?
macro (triqs_add_all_subdirectories_with_cmakelist)
SET( print_decal_sub_dir "${print_decal_sub_dir} ")
FILE(GLOB ALLSUBS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} */CMakeLists.txt)
foreach ( f ${ALLSUBS})
get_filename_component(d ${f} PATH)
#MESSAGE(STATUS "${print_decal_sub_dir}## Including subdirectory : ${d}")
add_subdirectory(${d})
endforeach ( f ${ALLSUBS})
endmacro (triqs_add_all_subdirectories_with_cmakelist)

4
cmake/postinst.in Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
echo "Compiling the .py files into .pyc"
@ALPS_PYTHON_INTERPRETER@ -mcompileall /usr/@TRIQS_PYTHON_LIB_DEST@ 2>1 > /dev/null

4
cmake/prerm.in Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
find /usr/@TRIQS_PYTHON_LIB_DEST@ -name "*.pyc" -exec rm {} \;
#find /usr/@TRIQS_PYTHON_LIB_DEST@ -name "*.pyc" -exec ls -l {} \;

63
cmake/run_test.cmake Normal file
View File

@ -0,0 +1,63 @@
set (output_new ${CMAKE_CURRENT_BINARY_DIR}/${name}_output)
# hum, only a recent version of hdf5 1.8.7 ?
#SET(H5_DIFF_EXCLUDE --exclude-path=revisions --exclude-path=log_type --exclude-path=state_type)
if (H5_DIFF_EXECUTABLE)
separate_arguments(H5_DIFF_OPTIONS)
separate_arguments(H5_DIFF_OBJECTS)
set (COM ${H5_DIFF_EXECUTABLE} ${H5_DIFF_EXCLUDE} ${H5_DIFF_OPTIONS} ${outputName} ${reference} ${H5_DIFF_OBJECTS})
else(H5_DIFF_EXECUTABLE)
set (COM ${CMAKE_COMMAND} -E compare_files ${output_new} ${reference})
endif (H5_DIFF_EXECUTABLE)
message(" command for the test ${cmd} ${input}")
if (input)
execute_process(
COMMAND ${cmd}
RESULT_VARIABLE not_successful
INPUT_FILE ${input}
OUTPUT_FILE ${output_new}
ERROR_FILE ${output_new}.err
ERROR_VARIABLE err
TIMEOUT 600
)
else()
execute_process(
COMMAND ${cmd}
RESULT_VARIABLE not_successful
OUTPUT_FILE ${output_new}
ERROR_FILE ${output_new}.err
ERROR_VARIABLE err
TIMEOUT 600
)
endif()
if(not_successful)
message(SEND_ERROR "error runing test '${name}': ${err}; command ${cmd} : shell output: ${not_successful}!")
endif(not_successful)
MESSAGE( "About to compare with ${COM}")
if (NOT H5_DIFF_EXECUTABLE)
# Little fix to turn -0 into 0 (--0 is not replaced)
FILE(READ ${output_new} temp)
STRING(REGEX REPLACE "([^-])-0([^.])" "\\10\\2" temp_after "${temp}")
FILE(WRITE ${output_new} ${temp_after})
endif()
execute_process(
COMMAND ${COM}
RESULT_VARIABLE not_successful
OUTPUT_VARIABLE out
ERROR_VARIABLE err
TIMEOUT 600
)
if(not_successful)
message(SEND_ERROR "output does not match for '${name}': ${err}; ${out}; shell output: ${not_successful}!")
endif(not_successful)
#endif(output)
#file(REMOVE ${output_new})

View File

@ -0,0 +1,64 @@
## Useless, use run_test and suppress this
set (output_new ${CMAKE_CURRENT_BINARY_DIR}/${name}_output)
if (H5_DIFF_EXECUTABLE)
separate_arguments(H5_DIFF_OPTIONS)
separate_arguments(H5_DIFF_OBJECTS)
set (COM ${H5_DIFF_EXECUTABLE} ${H5_DIFF_EXCLUDE} ${H5_DIFF_OPTIONS} ${outputName} ${reference} ${H5_DIFF_OBJECTS})
else(H5_DIFF_EXECUTABLE)
set (COM ${CMAKE_COMMAND} -E compare_files ${output_new} ${reference})
endif (H5_DIFF_EXECUTABLE)
message(" command for the test ${cmd} ${input}")
if (input)
execute_process(
COMMAND ${cmd}
RESULT_VARIABLE not_successful
INPUT_FILE ${input}
OUTPUT_FILE ${output_new}
ERROR_FILE ${output_new}.err
ERROR_VARIABLE err
TIMEOUT 600
)
else()
execute_process(
COMMAND ${cmd}
RESULT_VARIABLE not_successful
OUTPUT_FILE ${output_new}
ERROR_FILE ${output_new}.err
ERROR_VARIABLE err
TIMEOUT 600
)
endif()
if(not_successful)
message(SEND_ERROR "error runing test '${name}': ${err}; command ${cmd} : shell output: ${not_successful}!")
endif(not_successful)
MESSAGE( "About to compare with ${COM}")
if (NOT H5_DIFF_EXECUTABLE)
# Little fix to turn -0 into 0 (--0 is not replaced)
FILE(READ ${output_new} temp)
STRING(REGEX REPLACE "([^-])-0([^.])" "\\10\\2" temp_after "${temp}")
FILE(WRITE ${output_new} ${temp_after})
endif()
execute_process(
COMMAND ${COM}
RESULT_VARIABLE not_successful
OUTPUT_VARIABLE out
ERROR_VARIABLE err
TIMEOUT 600
)
if(not_successful)
message(SEND_ERROR "output does not match for '${name}': ${err}; ${out}; shell output: ${not_successful}!")
endif(not_successful)
endif(output)
#file(REMOVE ${output_new})

18
cmake/triqs_config.h.in Normal file
View File

@ -0,0 +1,18 @@
// DO NOT EDIT : generated by cmake
#cmakedefine TRIQS_WITH_PYTHON_SUPPORT
#cmakedefine TRIQS_NUMPY_VERSION_LT_17
#cmakedefine BOOST_PP_VARIADICS
#cmakedefine TRIQS_BIND_FORTRAN_LOWERCASE
#cmakedefine TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
#cmakedefine BOOST_MATH_DISABLE_STD_FPCLASSIFY
#define TRIQS_GIT_HASH @GIT_HASH@
#define TRIQS_HOSTNAME @TRIQS_HOSTNAME@
#define TRIQS_COMPILEDBY @TRIQS_COMPILEDBY@

114
doc/CMakeLists.txt Normal file
View File

@ -0,0 +1,114 @@
# Should we use MathJax....
find_package(MathJax)
if (MATHJAX_PATH)
message(STATUS "Detected MathJax at ${MATHJAX_PATH}")
else()
message(STATUS "MathJax not found automatically")
option(Sphinx_Math_Generator_MathJax " " OFF)
if (Sphinx_Math_Generator_MathJax)
set(SPHINX_MATH_GENERATOR "mathjax")
set(MATHJAX_PATH "MathJax" CACHE STRING "Path to the MathJax directory")
else (Sphinx_Math_Generator_MathJax)
set(SPHINX_MATH_GENERATOR "pngmath")
endif (Sphinx_Math_Generator_MathJax)
endif()
# the local extensions....
file(COPY ../foreignlibs/breathe ../foreignlibs/doxylink ../foreignlibs/mpl ../foreignlibs/autocompile DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
# The compiler flags for autocompile
set(TRIQS_LIBRARY_ALL ${TRIQS_LIBRARY_BOOST} ${TRIQS_LIBRARY_PYTHON} ${TRIQS_LIBRARY_MPI} ${TRIQS_LIBRARY_HDF5} ${TRIQS_LIBRARY_LAPACK} ${TRIQS_LIBRARY_FFTW} ${TRIQS_LIBRARY_GMP} ${TRIQS_LIBRARY_GSL} )
set(TRIQS_INCLUDE_ALL ${TRIQS_INCLUDE_BOOST} ${TRIQS_INCLUDE_PYTHON} ${TRIQS_INCLUDE_MPI} ${TRIQS_INCLUDE_HDF5} ${TRIQS_INCLUDE_LAPACK} ${TRIQS_INCLUDE_FFTW} ${TRIQS_INCLUDE_GMP} ${TRIQS_INCLUDE_GSL} )
set( link_libs " ${TRIQS_LIBRARY_ALL}")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
list (REMOVE_DUPLICATES link_libs)
endif( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
string(REPLACE "boost_for_triqs" " " TMP "${link_libs}")
string(REPLACE "debug" " " TMP "${TMP}")
string(REPLACE "optimized" " " TMP "${TMP}")
if(BOOST_SOURCE_DIR)
set( link_boost_for_triqs "-lboost_for_triqs")
EXECUTE_PROCESS(COMMAND sh -c "ln -sf ${CMAKE_BINARY_DIR}/foreignlibs/boost/libboost_for_triqs.so ${CMAKE_CURRENT_BINARY_DIR}")
else(BOOST_SOURCE_DIR)
set( link_boost_for_triqs " ")
endif(BOOST_SOURCE_DIR)
set(DOC_AUTOCOMPILE_INCLUDE ${BOOST_SOURCE_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/foreignlibs ${TRIQS_INCLUDE_ALL} )
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(DOC_AUTOCOMPILE_LINK "-L ${CMAKE_BINARY_DIR}/foreignlibs/boost ${link_boost_for_triqs} -L ${CMAKE_BINARY_DIR}/triqs -ltriqs ${TMP} ")
set(DOC_AUTOCOMPILE_DEFINITIONS -std=c++0x -DBOOST_PP_VARIADICS=1 -stdlib=libc++ -I/System/Library/Frameworks/vecLib.framework/Versions/A/Headers)
else()
set(DOC_AUTOCOMPILE_LINK "-L ${CMAKE_BINARY_DIR}/foreignlibs/boost ${link_boost_for_triqs} -L ${CMAKE_BINARY_DIR}/triqs -ltriqs ${TMP} -Wl,-rpath=${CMAKE_CURRENT_BINARY_DIR} ")
set(DOC_AUTOCOMPILE_DEFINITIONS -std=c++0x -DBOOST_PP_VARIADICS=1 )
endif()
set(DOC_AUTOCOMPILE_LD_LIBRARY_PATH " ${CMAKE_BINARY_DIR}/foreignlibs/boost/:${CMAKE_BINARY_DIR}/triqs ")
# to find the triqs_config.h
set(DOC_AUTOCOMPILE_DEFINITIONS ${DOC_AUTOCOMPILE_DEFINITIONS} -DTRIQS_BUILDING_LIBRARY -I ${CMAKE_BINARY_DIR}/Config )
# debug
#message( " Link libs ${DOC_AUTOCOMPILE_LINK}")
EXECUTE_PROCESS(COMMAND sh -c "ln -sf ${CMAKE_BINARY_DIR}/triqs/libtriqs.so ${CMAKE_CURRENT_BINARY_DIR}")
# Dive and find the doxygen sources
add_subdirectory(reference/c++)
# Build the doxygen
set(DOXYGEN_HTML_OUTPUT ./html/doxy_triqs)
find_package(Doxygen REQUIRED)
# debug
get_property(DOXYGEN_SOURCES GLOBAL PROPERTY DOXYGEN_SOURCES)
string(REPLACE ";" " " DOXYGEN_SOURCES_LIST "${DOXYGEN_SOURCES}")
#message(STATUS "Doxygen sources are ${DOXYGEN_SOURCES}")
# Prepare the Doxyfile
configure_file(${TRIQS_SOURCE_DIR}/cmake/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
# Generate the conf.py
FILE(GLOB_RECURSE SOURCES *.rst)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/conf.py)
EXECUTE_PROCESS(COMMAND sh -c "mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/html")
set(DOC_SOURCE ${CMAKE_CURRENT_SOURCE_DIR})
include(${TRIQS_SOURCE_DIR}/cmake/BuildSphinx.cmake)
# Set dependencies
GET_PROPERTY(PYTHON_DYNAMIC_MODULES_LIST GLOBAL PROPERTY PYTHON_DYNAMIC_MODULES_LIST)
foreach (mod ${PYTHON_DYNAMIC_MODULES_LIST})
add_dependencies(docs_sphinx ${mod})
endforeach (mod ${PYTHON_DYNAMIC_MODULES_LIST})
set(doxy_top ${CMAKE_CURRENT_BINARY_DIR}/doxy.log)
add_custom_command (OUTPUT ${doxy_top} DEPENDS ${DOXYGEN_SOURCES} COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile > ${doxy_top} )
add_custom_target(docs_doxy ALL DEPENDS ${doxy_top})
add_dependencies(docs_sphinx docs_doxy) # we must first have doxygen process the sources to link to them
add_dependencies(docs_sphinx triqs boost_for_triqs ) # add also mpi ?
# Install
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ COMPONENT documentation DESTINATION share/doc/triqs/user_manual
FILES_MATCHING
PATTERN "*.html"
PATTERN "*.png"
PATTERN "*.js"
PATTERN "_*"
PATTERN "*.png"
PATTERN "*.gif"
PATTERN "*.xsl"
PATTERN "*.css"
PATTERN "*.pdf"
PATTERN "*.py"
PATTERN "*.txt"
PATTERN "*.bib"
PATTERN ".svn" EXCLUDE
PATTERN "CVS" EXCLUDE
)
# PDF documentation
if (Build_PDF_Documentation)
add_dependencies(docs_sphinx_pdf_cpp triqs boost_for_triqs ) # add also mpi ?
install(FILES ${sphinx_top_pdf} DESTINATION share/doc/triqs/)
endif()

193
doc/_templates/index.html vendored Normal file
View File

@ -0,0 +1,193 @@
{% extends "layout.html" %}
{% block footer %}
{{ super() }}
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36559097-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
{% endblock %}
{% set title = 'Home' %}
{% block body %}
<h1>User manual</h1>
<p style="margin-top:10px"> <strong> TRIQS basic components:</strong> </p>
<table class="contentstable" align="center">
<tr valign="top"><td width="50%">
<p class="biglink">
<a class="biglink" href="{{ pathto('introduction/introduction') }}">
Introduction</a><br>
<span class="linkdescr">
Why {{project}} and what does it provide?
</span></p>
<p class="biglink">
<a class="biglink" href="{{ pathto('green/green') }}">
Green's functions</a><br>
<span class="linkdescr">
Learn how to use local Green's functions.
</span></p>
<p class="biglink">
<a class="biglink" href="{{ pathto('data_analysis/contents') }}">
Manage and analyze data </a><br>
<span class="linkdescr">
Archiving in HDF5, plotting, fitting, scripting...
</span></p>
</td><td width="50%">
<p class="biglink">
<a class="biglink" href="{{ pathto('installation/install') }}">
Installation</a><br>
<span class="linkdescr">
Quickly install {{project}} to your system.
</span></p>
<p class="biglink">
<a class="biglink" href="{{ pathto('lattice/lattice') }}">
Bravais lattices and related tools</a><br>
<span class="linkdescr">
See how to use simple lattices in {{project}}.
</span></p>
</td></tr></table>
<p style="margin-top:10px"> <strong>Extension modules:</strong> </p>
<table class="contentstable" align="center">
<tr valign="top">
<td width="50%">
<p class="biglink">
<a class="biglink" href="{{ pathto('solvers/solvers') }}">
Quantum impurity solvers & DMFT</a><br>
<span class="linkdescr">
Use quantum impurity solvers with {{project}}.
</span>
</p>
</td>
<td width="50%">
<p class="biglink">
<a class="biglink" href="{{ pathto('wien2k/wien2k') }}">
Wien2TRIQS</a><br>
<span class="linkdescr">
Use {{project}} in realistic calculations.
</span>
</p>
</td>
</tr>
</table>
<p style="margin-top:10px"> <strong>C++ Libraries:</strong> </p>
<table class="contentstable" align="center">
<tr valign="top">
<td width="50%">
<p class="biglink">
<a class="biglink" href="{{ pathto('reference/c++/learn/intro') }}">
Develop with TRIQS </a><br>
<span class="linkdescr">
A guide to the development of projects using TRIQS.
</span>
</p>
</td>
<td width="50%">
<p class="biglink">
<a class="biglink" href="{{ pathto('reference/c++/arrays/contents') }}">
Array library </a><br>
<span class="linkdescr">
C++ multi-dimensional arrays.
</span>
</p>
</td>
</tr>
<tr valign="top">
<td width="50%">
<p class="biglink">
<a class="biglink" href="{{ pathto('reference/c++/mctools/intro') }}">
Monte-Carlo Tools </a><br>
<span class="linkdescr">
Quickly write Monte-Carlo codes.
</span>
</p>
</td>
<td width="50%">
<p class="biglink">
<a class="biglink" href="{{ pathto('reference/c++/det_manip/det_manip') }}">
Fast update of matrices </a><br>
<span class="linkdescr">
A simple class for fast update of determinant and inverse ...
</span>
</p>
</td>
</tr>
<tr valign="top">
<td width="50%">
<p class="biglink">
<a class="biglink" href="{{ pathto('reference/c++/utility') }}">
Utility </a><br>
<span class="linkdescr">
Exceptions, macros, etc...
</span>
</p>
</td>
</tr>
</table>
<p style="margin-top:10px"> <strong>More about the {{project}} project:</strong> </p>
<table class="contentstable" align="center">
<tr valign="top">
<td width="50%">
<p class="biglink">
<a class="biglink" href="{{ pathto('faq/faq') }}">
Frequently asked questions</a><br>
<span class="linkdescr">
Find answers to the most common questions.
</span>
</p>
<p class="biglink">
<a class="biglink" href="{{ pathto('legal/legal') }}">
License, citations and disclaimer</a><br>
<span class="linkdescr">
Under what license is TRIQS? How to cite TRIQS.
</span>
</p>
</td>
<td width="50%">
<p class="biglink">
<a class="biglink" href="{{ pathto('license/collaboration') }}">
The TRIQS collaboration</a><br>
<span class="linkdescr">
Who's behind {{project}}? Find the list of contributors here!
</span>
</p>
</td>
</tr>
</table>
{% endblock %}

19
doc/_templates/layout.html vendored Normal file
View File

@ -0,0 +1,19 @@
{% extends "!layout.html" %}
{% block extrahead %}
{{ super() }}
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36559097-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
{% endblock %}

245
doc/conf.py.in Normal file
View File

@ -0,0 +1,245 @@
# -*- coding: utf-8 -*-
#
# TRIQS documentation build configuration file, created by
# sphinx-quickstart on Tue Sep 21 10:50:39 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable (module imports are okay, they're removed automatically).
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
# If your extensions are in another directory, add it here. If the directory
# is relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
#sys.path.append(os.path.abspath('.'))
# General configuration
# ---------------------
sys.path +=["@CMAKE_BINARY_DIR@/doc/breathe",
"@CMAKE_BINARY_DIR@/doc/mpl","@CMAKE_BINARY_DIR@/doc/autocompile",
"@CMAKE_BINARY_DIR@/doc/sandbox","@CMAKE_BINARY_DIR@/doc"]
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
#extensions = ['sphinx.ext.autodoc','sphinx.ext.pngmath']
extensions = ['sphinx.ext.autodoc','sphinx.ext.@SPHINX_MATH_GENERATOR@','breathe','doxylink']
# adding support for matplotlib plots
extensions += [
'matplotlib.sphinxext.only_directives',
'plot_directive',
# 'matplotlib.sphinxext.ipython_directive',
# 'ipython_console_highlighting',
# 'inheritance_diagram',
'numpydoc']
extensions += ['autocompile','autorun']
##options for autocompile module: c++ execution
autocompile_opts = dict(compiler = "@CMAKE_CXX_COMPILER@",
link = "@DOC_AUTOCOMPILE_LINK@".replace(';',' '),
ld_library_path = "@DOC_AUTOCOMPILE_LD_LIBRARY_PATH@".replace(';',' '),
include =''.join([ " -I%s"%arg for arg in "@DOC_AUTOCOMPILE_INCLUDE@".split(';')] ),
definitions =''.join([ " %s"%arg for arg in "@DOC_AUTOCOMPILE_DEFINITIONS@".split(';')] )
)
##options for autorun module: python execution
autorun_languages = {}
autorun_languages['python'] = 'python -'
autorun_languages['python_prefix_chars'] = 0
autorun_languages['python_show_source'] = True
autoclass_content = "both"
#pngmath_dvipng_args = ['-gamma 1.2', '-D 150', '-bg Transparent']
mathjax_path = "@MATHJAX_PATH@/MathJax.js?config=default"
# Add any paths that contain templates here, relative to this directory.
templates_path = ['@TRIQS_SOURCE_DIR@/doc/_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8'
# The master toctree document.
master_doc = 'contents'
# General information about the project.
project = u'TRIQS'
copyright = u'2011, The TRIQS collaboration'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '1.0'
# The full version, including alpha/beta/rc tags.
release = '1.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of documents that shouldn't be included in the build.
#unused_docs = []
# List of directories, relative to source directory, that shouldn't be searched
# for source files.
exclude_trees = ['build','html']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# Options for breathe extension
# -----------------------------
breathe_projects = {
"mc_tools":"@CMAKE_CURRENT_BINARY_DIR@/xml/",
"arrays":"@CMAKE_CURRENT_BINARY_DIR@/xml/",
}
breathe_default_project = "mc_tools"
# Options for doxylink extension
# -----------------------------
doxylink = { 'doxy' : ('@CMAKE_CURRENT_BINARY_DIR@/doxy.tag', 'doxy_triqs') }
# Options for HTML output
# -----------------------
# The style sheet to use for HTML and HTML Help pages. A file of that name
# must exist either in Sphinx' static/ path, or in one of the custom paths
# given in html_static_path.
#html_style = 'default.css'
html_theme_path = ["@TRIQS_SOURCE_DIR@/doc/themes/"]
html_theme = "agogo"
#html_theme = "default"
#html_theme_options = { "pagewidth": "80em", "documentwidth" : "60em" }
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = '@TRIQS_SOURCE_DIR@/Doc/misc/python-powered-w-200x80.png'
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
#html_static_path = ['@TRIQS_SOURCE_DIR@/doc/_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
html_additional_pages = { 'index':'index.html' }
# If false, no module index is generated.
#html_use_modindex = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, the reST sources are included in the HTML build as _sources/<name>.
#html_copy_source = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = ''
# Output file base name for HTML help builder.
htmlhelp_basename = 'TRIQSdoc'
# Options for LaTeX output
# ------------------------
# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, document class [howto/manual]).
latex_documents = [
('contents', 'TRIQS.tex', ur'TRIQS Documentation',
ur'2011, The TRIQS collaboration', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_use_modindex = True

14
doc/contents.rst Normal file
View File

@ -0,0 +1,14 @@
Table of contents
=================
.. toctree::
:maxdepth: 3
overview
installation/install
tutorials/contents
reference/python/contents
reference/c++/contents
..
reference/applications/contents

21
doc/faq/faq.rst Normal file
View File

@ -0,0 +1,21 @@
.. index:: FAQ
Frequently asked questions
===========================
Documentation
-------------
.. toctree::
:maxdepth: 1
typeerrorunicode
Installation
------------
.. toctree::
:maxdepth: 1
relativedirforboost

View File

@ -0,0 +1,7 @@
Cannot find source file "archive_exception.cpp"
===============================================
If you get this message when you call cmake, it is probably because you gave a
*relative* path for the boost sources ``BOOST_SOURCE_DIR`` (like
``../../../boost_1_47``). You must use an absolute path for
``BOOST_SOURCE_DIR``, like ``/path/to/boost_1_47``.

View File

@ -0,0 +1,7 @@
TypeError: coercing to Unicode: need string or buffer, dict found
-----------------------------------------------------------------
If this appears when the documentation is produced, just delete the
.matplotlib directory in your home and start again. The reason for
the bug is that different versions of matplotlib produce different
formats for font caches that are not compatible

View File

@ -0,0 +1,73 @@
.. index:: Ubuntu
.. _Ubuntu :
.. highlight:: bash
Installation on Ubuntu (12.04 LTS)
####################################################
TRIQS can be installed on Ubuntu 12.04 LTS.
NB : Ubuntu 12.10: there is a bug in Ubuntu 12.10 (hdf5 compiled without hdf5 support).
On Ubuntu 12.10, you have to recompile hdf5. The problem has been reported and will be fixed in 13.04.
#. Install the following packages which are necessary to build TRIQS and use it::
sudo apt-get install cmake git g++ libgfortran3 gfortran openmpi-bin openmpi-common \
openmpi-checkpoint libopenmpi-dev libblas-dev liblapack-dev libfftw3-dev libgmp-dev \
hdf5-tools libhdf5-serial-dev python-h5py libboost1.48-all-dev python-dev \
python-numpy python-scipy python-virtualenv python-matplotlib doxygen\
python-tornado python-zmq
#. Download the code::
git clone git://github.com/TRIQS/TRIQS.git path_to_triqs_sources
#. Create a build directory (different from the TRIQS source directory nor a subdirectory thereof) ::
mkdir triqs_build && cd triqs_build
#. Configure ::
cmake path_to_triqs_sources -DCMAKE_INSTALL_PREFIX=path_to_install_directory
NB: the install directory is optional and defaults to `triqs_build/INSTALL_DIR`. It is
however usually a good idea to have an install directory outside `triqs_build` (after
a successful installation `triqs_build` can be deleted). The cmake call should end with::
-- Build files have been written to: *path_to_triqs_build*
OPTIONAL: To install the documentation, install Sphinx and doxygen: ::
sudo easy_install -U Sphinx
sudo apt-get install doxygen
and add::
-DBuild_Documentation=ON
to the above cmake command.
#. Build TRIQS, test it and install it with (N being the number of cores of your machine) ::
make -jN && make test && make -jN install
NB: the tests SingleSite and CDMFT-v2 take longer than the other ones (30s to 1 min).
#. If you use Wien2TRIQS, please complete the installation as described :ref:`here <wien2k_inst>`.
#. You can now :ref:`start ... <get_started>`
#. Optionally, you may be interested in:
* How to *simply* upgrade the ipython notebook with :ref:`virtualenv <virtualenv>` to the latest version?
* How to use the nice :ref:`clang <clang>` C++ compiler?
* How to use :ref:`Intel <icc>` C++ compiler?
.. warning:: For the branch 1.0, you need the latest version of Cython (>=.17, downloadable on Cython.org). If Cython is not found, specify the location of the executable with the option -DCYTHON_EXECUTABLE.

View File

@ -0,0 +1,16 @@
Changelog between releases
=======================================
v0.9 -> current
------------------
* Now use to C++11.
v0.8 -> v0.9
-------------
* To be written

View File

@ -0,0 +1,47 @@
.. index:: clang
.. _clang:
.. highlight:: bash
Using clang compiler
==========================
clang++ compiler is **highly recommended** for anyone developing in C++ since :
* It has very nice and useful error messages, much nicer than intel or gcc.
* It implements most of the new C++11 standard.
clang/llvm is now the standard compiler on OS X, but it is open source
and works very well on linux too.
Version
---------
* TRIQS compiles on clang, version 3.0 and later.
* Recommended version is 3.1 (latest stable).
Get and install clang
------------------------
If you have precompiled version in the `LLVM dowload page <http://llvm.org/releases/download.html>`_,
use it. E.g. on Ubuntu 12.04 LTS ::
wget http://llvm.org/releases/3.1/clang+llvm-3.1-x86_64-linux-ubuntu_12.04.tar.gz
tar xzf clang+llvm-3.1-x86_64-linux-ubuntu_12.04
sudo mv clang+llvm-3.1-x86_64-linux-ubuntu_12.04 /opt/clang
# add /opt/clang/bin to your path
# use clang++...
Otherwise, it is in fact quite easy to compile clang from source, just follow the
`instructions <http://clang.llvm.org/get_started.html#build>`_.
Usage
--------------
In the current version, when compiling with clang, say (provided clang++ is your path of course) ::
CXX=clang++ cmake path_to_TRIQS_source_directory .... others options ...

View File

@ -0,0 +1,68 @@
.. index:: dependencies
.. _dependencies:
A complete list of dependencies
==================================
TRIQS is built upon several python and C++ libraries, which, if not present already in your system, can be freely downloaded and installed.
All the libraries and tools used by TRIQS are listed in the table :
================== ================ ================================================================================
Libraries/tools Version Comment
================== ================ ================================================================================
mpi e.g., openmpi Parallelism
Since standard linux distributions (and macports on OS X)
now provides openmpi, even on laptops, we avoid the unnecessary complication
of maintaining a non parallel version of TRIQS
fftw >= 3.2 Fourier transform
boost >= 1.49 C++ librairies
hdf5 >= 1.8.0 File storage system. Important: the *serial* version must be installed
python* >= 2.6.5
scipy* python mathematical library
numpy* python scientific library
h5py* python interface to hdf5 library
sphinx* >= 1.0.1 python documentation tools (to compile documentation)
pyparsing* Tool for sphinx (to compile documentation)
matplotlib* >= 0.99 python 2D plotting library
cython >=0.17 [DEVELOPERS ONLY]
================== ================ ================================================================================
\* designates the libraries included in the Enthought python distribution.
C++11
--------
The current version of TRIQS use the new C++11 standard, and therefore require a recent C++ compiler.
Tested compilers include :
* g++ 4.6.3, 4.7
* clang++ 3.1
* icc 13.0
Note that older compilers will *never* be supported for current and future version of TRIQS.
Older releases may accept older compilers.
F90
-------
For the Wien2TRIQS interface only.
Tested compilers include :
* ifort
* gfortran
Boost
--------------------------
The boost library is often upgraded, and it is rare to have the correct version in your distribution. TRIQS installation process offers two choices :
* Recommended choice: As explained in the :ref:`page above <installation>`, you can download simply the latest *sources* and TRIQS will do all the job for you by compiling the pieces of boost that are needed in a little boost_for_triqs library.
* OR you can include and link with an installed boost if the version if high enough as discussed in :ref:`install_options`.

View File

@ -0,0 +1,34 @@
.. _install_scheme:
.. _get_started:
.. highlight:: bash
Getting started
====================
* After the installation, provided that the tests have passed successfully,
TRIQS has been installed using the standard UNIX scheme:
* executables in :file:`path_to_install_directory/bin`.
* python modules in :file:`path_to_install_directory/lib/pytriqs`.
* documentation in :file:`path_to_install_directory/share`.
* C++ libraries in :file:`path_to_install_directory/include` and :file:`path_to_install_directory/lib/triqs`.
* Add ``path_to_install_directory/bin`` to your path...
* Just launch ::
ipytriqs my_script.py
Or to get the notebook ::
ipytriqs_notebook
* You can now proceed to the tutorial ....

View File

@ -0,0 +1,49 @@
.. index:: installation steps
.. highlight:: bash
.. _installation:
Installation
============
* TRIQS is hosted on **GitHub**, where you can :
* Download `the current version <https://github.com/TRIQS/TRIQS>`_ (recommended) ::
git clone git://github.com/TRIQS/TRIQS.git path_to_triqs_sources
NB : this version is normally never broken (developments are done elsewhere).
* Download `an older release <https://github.com/TRIQS/TRIQS/tags>`_, which may require less recent versions of compilers, libs...
* Use the GitHub *Issues* tracker for any problem, questions.
*Please do NOT contact the developers directly by email*
Complete installation instructions for standard systems
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. toctree::
:maxdepth: 1
Ubuntu
linux
install_on_osx_lion
Details
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. toctree::
:maxdepth: 1
wien2k_inst
dependencies
python
clang
intel
install_options
get_started
changelog

View File

@ -0,0 +1,113 @@
.. index:: install_on_osx_lion
.. _install_on_osx_lion:
.. highlight:: bash
Installation on Mac OS X [Mountain Lion]
==============================================
This installation guide may work for older versions of Mac OS X. However, previous versions of Mac OS X are not supported.
NB: The installation of TRIQS under previous versions of OS X requires installing clang (via Xcode) or gcc 4.7 (via MacPorts).
On Mountain Lion, clang (llvm) replaces gcc 4.2 as the default C++ compiler.
We strongly recommend the following installation procedure, which provides a clean way to set up all dependencies, so that all
of them are compatible with each other. Only the installation via homebrew is supported for the Mac.
Installation of the dependencies
________________________________
1. Install `homebrew <http://mxcl.github.io/homebrew/>`_.
Run ``brew doctor`` and resolve potential conflicts before continuing.
2. Install XCode (directly from the Mac store). In Preferences/Downloads, install "Command Line tools".
3. Install several packages which are needed: ::
brew install cmake
brew install gfortran
brew install --enable-cxx hdf5
brew install gsl
brew install fftw
brew install open-mpi
brew install zmq
brew install python
brew install doxygen
4. Now install virtualenv: ::
pip install virtualenv
virtualenv mypython
Using virtualenv provides a clean way to set up a different python environment for each user.
The first line in the instructions above installs the package and the second creates the virtual
environment, which is created in ``$HOME/mypython``.
Make sure to permanently add (prepend) ``$HOME/mypython/bin`` to your path by adding ::
export PATH = $HOME/mypython/bin:$PATH
to your ``.bashrc file`` (assuming bash). Within a new shell, check that
which python
which pip
which easy_install
yield the ones located in ``$HOME/mypython``.
5. Install the required python packages: ::
pip install numpy
pip install h5py
pip install scipy
pip install git+https://github.com/matplotlib/matplotlib.git#egg=matplotlib-dev
pip install tornado
pip install pyzmq
pip install ipython
pip install cython
6. If you wish to compile the documentation locally, install sphinx, its dependencies and mathjax: ::
pip install sphinx
easy_install pyparsing==1.5.7
git clone git://github.com/mathjax/MathJax.git MathJax
NB : you need pyparsing <=1.5.7 since apparently v.2.0 works only for python 3.
7. Download the latest `sources of boost <http://www.boost.org/users/download/>`_ and untar them into a directory ``BOOST_SRC``.
TRIQS installation
__________________
#. Download the TRIQS sources: ::
git clone git@github.com:TRIQS/TRIQS.git TRIQS_src
#. Generate a Makefile using cmake: ::
cmake TRIQS_src -DBOOST_SOURCE_DIR=BOOST_SRC
#. Compile TRIQS, its tests and install it into INSTALL_DIR (default) (N is the number of cores of your mac): ::
make -jN && make test && make install
#. If you use Wien2TRIQS, please complete the installation as described :ref:`here <wien2k_inst>`.
Possible issues:
________________
If you encounter the following error: ::
/usr/local/include/ft2build.h:56:38: error: freetype/config/ftheader.h: No such file or directory
in the installation of matplotlib, you need to pass the proper include path. Locate the freetype directory
with the header file and pass the include path through ``CPPFLAGS``: ::
CPPFLAGS=-I/usr/X11/include/freetype2/ pip install git+https://github.com/matplotlib/matplotlib.git#egg=matplotlib-dev

View File

@ -0,0 +1,106 @@
.. index:: install_options
.. highlight:: bash
.. _install_options:
Customizing installation : cmake options
----------------------------------------------------
Specifying the compiler or compile/link flags
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To specify the compiler with cmake one may use the CXX, CXXFLAGS variables, e.g. ::
CXX=clang++ CXXFLAGS cmake path_to_TRIQS_source_directory .....
Customize the installation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can then customize the installation options using the :program:`ccmake` program::
ccmake .
This opens an interface with your main installation options shown ::
BUILD_SHARED_LIBS ON
Build_CTHyb ON
Build_Documentation OFF
Build_HubbardI ON
Build_Triqs_General_Tools_Test ON
Build_Wien2k ON
CMAKE_INSTALL_PREFIX /home/parcolle/BUILD2/Triqs_dynamic/INSTALL_DIR
Install_dev OFF
LAPACK_LIBS /usr/lib/liblapack.so;/usr/lib/libblas.so;/usr/lib/libpthread.so;/usr/lib/libblas.so
PYTHON_INTERPRETER /usr/bin/python
You can for instance change the following options:
* ``CMAKE_INSTALL_PREFIX``: This is the directory :file:`path_to_TRIQS_install_directory` where you want to install TRIQS.
* ``Build_CTHyb``: Build the continuous-time hybridization impurity solver.
* ``Build_HubbardI``: Build a simple HubbardI solver.
* ``Build_Wien2k``: Build the interface to **WIEN2K**.
* ``Build_Documentation``: Get the documentation locally in :file:`path_to_TRIQS_install_directory/share/doc`.
You may change all other installation options (like locations of libraries, the choice of compilers, etc.) in the advanced mode, by typing 't' after having opened the *ccmake* interface.
After having corrected your options you may build, test and install TRIQS as described in :ref:`installation`.
.. _install_without_boost:
Installation with your own version of boost [-DBOOST_INSTALL_DIR=...]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If you have a sufficiently recent version of boost already installed in your system you may
link TRIQS with it instead of compiling a new version of boost from sources.
In this case, the cmake instruction is ::
cmake path_to_TRIQS_source_directory -DBOOST_INSTALL_DIR=root_path_to_Boost_installation ....
The cmake option `DBOOST_INSTALL_DIR` is the path to the **boost** libraries.
The default value is :
* BOOST_INSTALL_DIR : /usr
So if boost is at the right place, you can just say::
cmake path_to_TRIQS_source_directory
**Obviously, you should not specify `DBOOST_SOURCE_DIR` in this case!**
.. _static_dyn :
Static versus dynamic linking [-DBUILD_SHARED_LIBS=OFF]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TRIQS can be compiled in two different ways:
* **dynamic linking** [default] :
This is the standard python procedure and the default choice.
All the C++ codes are compiled in shared libraries and loaded dynamically at runtime by the python interpreter.
With this technique however, you have to properly set the PYTHONPATH environment variable to the TRIQS installation directory in order
for python to be able to find the module. To avoid errors, TRIQS provides a
tiny script :file:`path_to_TRIQS_install_directory/bin/pytriqs` that sets up this variable for you and launch the python interpreter.
* **static linking** :
An alternative is to compile a new interpreter statically.
Here the C++ modules are linked with libpython2.x.a to create a *new python interpreter* :file:`path_to_TRIQS_install_directory/bin/pytriqs`
that contains these modules as *built-in* modules.
Though it is not as standard and extensible as the dynamic linking, this technique has several advantages :
* It avoids opening dynamic libs, which simplifies code profiling for example.
* It may be more stable on some cluster machines (the boost.mpi modules in this case is also linked statically).
In any case, both the scripts and the way to call them remain the same in both cases::
pytriqs myscript.py
The choice is made with the cmake option ::
-DBUILD_SHARED_LIBS=OFF/ON

View File

@ -0,0 +1,54 @@
.. index:: icc
.. _icc:
.. highlight:: bash
Using Intel icc compiler
==========================
While less user friendly than clang, Intel compilers are usually recommended on some machines
because of optimisation.
Version
---------
The current version of TRIQS compiles only on Intel C++ version 13.0
(because of the lack of C++11 support in previous versions).
NB: previous releases (<= v0.9 compiles on icc >= 11).
Usage
-------------
To compile TRIQS, you will need :
* a new and patched version of boost 1.51 (because of a stupid C++11 issue in one file...).
PROVIDE IT WITH THE LINK ...
* to pass the option to the compiler ::
-DBOOST_MATH_DISABLE_STD_FPCLASSIFY
e.g. in configuring::
CXX=icc CXXFLAGS="-DBOOST_MATH_DISABLE_STD_FPCLASSIFY" cmake path_to_triqs_sources ......
.. warning:: Do it or tests will fail and computations will be WRONG
To be written : link to the ticket.
Caveats
--------------
* icc does not provide its own implementation of the standard library
(given the price, it is quite disappointing).
So it uses gcc's standard lib.
It must use gcc 4.6 or 4.7.
* Linking with mkl is always a mess....
TO BE WRITTEN ...

View File

@ -0,0 +1,24 @@
.. index:: ipython
ipython and the ipython notebook
--------------------------------
`ipython <http://ipython.scipy.org>`_ is a more user-friendly version of python with an enhanced interactive shell, which is specially useful
in conjunction with matplotlib.
If :program:`ipython` is installed on your machine, it will be automatically detected by the TRIQS installation process.
A second script named `ipytriqs` will be generated along `pytriqs`, where the standard python shell is replaced by the ipython one.
IPython notebook
^^^^^^^^^^^^^^^^
TRIQS is compatible with the great new IPython notebook (ipython 0.12), which is a notebook-style web interface to IPython and can be started withe command ipython notebook.
If you wish to install the notebook:
* The simplest is to use an Enthought distribution or Ubuntu 12.10.
* Use the shell ipytriqs_notebook in the directory you want to work.
* NB : example of notebooks are provided in the notebook sudirectory.

View File

@ -0,0 +1,51 @@
.. index:: Linux
.. _Linux:
.. highlight:: bash
Installation on a generic Linux distribution
#######################################################
TRIQS has been installed successfully on several distributions.
#. Download the code (this is for the current development version) ::
git clone git://github.com/TRIQS/TRIQS.git path_to_triqs_sources
#. Download the `sources of boost <http://ipht.cea.fr/triqs/download/boost_src.tar.bz2>`_ and untar them into ``path_to_boost_sources``.
**Don't compile boost**.
#. Create a build directory (different from the TRIQS source directory nor a subdirectory thereof) ::
mkdir triqs_build && cd triqs_build
#. Configure ::
cmake path_to_triqs_sources -DBOOST_SOURCE_DIR=path_to_boost_sources \
-DCMAKE_INSTALL_PREFIX=path_to_install_directory
[NB : the install directory is optional, the default value is `triqs_build/INSTALL_DIR`]
Successful run of cmake will finish with ::
-- Build files have been written to: *path_to_triqs_build*
#. Build TRIQS, test it and install it with (N being the number of cores of your machine) ::
make -jN && make test && make -jN install
[NB : the tests SingleSite and CDMFT-v2 take longer than the other ones (30s to 1 min) ].
#. If you use Wien2TRIQS, please complete the installation as described :ref:`here <wien2k_inst>`.
#. You can now :ref:`start ... <get_started>`
#. Optionally, you can be interested in :
* How to *simply* upgrade the ipython notebook with :ref:`virtualenv <virtualenv>` to the latest version ?
* How to use the nice :ref:`clang <clang>` C++ compiler ?
* How to use :ref:`Intel <icc>` C++ compiler ?

View File

@ -0,0 +1,66 @@
.. _python_install:
Python and the scientific python tools
====================================================
On some machines, not all the necessary scientific python tools are present
(e.g. old distribution, computation centers, etc....), or not in the right version.
There is a way to efficiently solve this issue (other than recompiling your own python, and
all the libs, which is painful) and specially **avoiding any upgrade on your system** (which
is crucial on cluster machines e.g.).
.. _virtualenv:
.. highlight:: bash
Using virtualenv to install/upgrade some python packages locally
----------------------------------------------------------------------------
In the frequent cases where only one or two packages are missing, there is a simple solution
called virtualenv.
Principle
^^^^^^^^^^^^
virtualenv is a python package that allow you to install in your home a simple copy (or mirror)
or python, and install and upgrade some packages for you, without touching the systems.
.. warning:: This works as long as the other dependencies of the packages on e.g. C++ libraries are satisfied.
Usage
^^^^^^^^
* First install virtualenv, or ask the system manager to do it.
On ubuntu ::
sudo apt-get install python-virtualenv
* To create a new python in your home, do e.g. ::
virtualenv ~/.my_python --system-site-packages
This create in ~/.my_python a clone of the python of the system, with its packages.
You can then use it with ::
~/.my_python/bin/python
* To make this your default python, just add in your ~/.bash_aliases (or bashrc) ::
source $HOME/.my_python/bin/activate
Then (reopen your terminal ...) ::
which python
should return typically::
/home/ME/.my_python/bin/python
* You can install any python package for this local python installation, e.g. ::
easy_install --upgrade ipython
and you have the latest ipython notebook....

View File

@ -0,0 +1,27 @@
.. index:: wien2k_inst
.. _wien2k_inst:
Complete the installation of Wien2TRIQS (all platforms)
-------------------------------------------------------------
If you choose to install the Wien2TRIQS interface to the Wien2K package for doing DMFT calculations of
realistic systems, you need take the last steps manually since Wien2k installation is not standard on all machines.
During TRIQS installation several files will be will be put into ::
path_to_TRIQS_install_directory/share/triqs/Wien2k_SRC_files/SRC_templates
Those files are::
* :file:`case.cf_f_mm2` and :file:`case.cf_p_cubic` containing matrices for the complex->cubic transformation of the local angular basis
* :file:`case.indmftpr` is a template for the input file needed by the :program:`dmftproj` program. This program constructs a set of localized orbitals representing correlated states.
These files then have to be copied manually to :file:`path_to_Wien2k/SRC_templates`, where :file:`path_to_Wien2k` is the path to Wien2K main directory.
When building the Wien2k extension module, TRIQS will compile :program:`dmftproj` and install it into :file:`path_to_TRIQS_install_directory/bin`.
In addition, :file:`path_to_Wien2k/SRC_templates` also contains :program:`run_triqs` and :program:`runsp_triqs` scripts for running Wien2k+DMFT fully self-consistent calculations. These files should be copied to :file:`path_to_Wien2k`.
You will also need to insert manually a correct call of :file:`pytriqs` into these scripts using an appropriate for your system MPI wrapper (mpirun, mpprun...), if needed. Search for *pytriqs* within the scripts to locate the appropriate place for inserting the :file:`pytriqs` call.
Finally, you will have to change the calls to :program:`python_with_DMFT` to :program:`pytriqs` in the Wien2k :file:`path_to_Wien2k/run*` files.

View File

@ -0,0 +1,71 @@
.. index:: TRIQS collaboration
.. _collaboration:
The TRIQS collaboration
========================
TRIQS core
----------
Basic components and python libraries
.....................................
**Main developers**: M. Ferrero, O. Parcollet
**Contributors**: L. Boehnke (Legendre Green's functions)
C++ ``triqs::arrays`` library
.............................
**Developer**: O. Parcollet
Quantum impurity solvers
-------------------------
Continuous-time quantum Monte Carlo
...................................
The CTQMC algorithm implemented in TRIQS is based on a hybridization expansion
of the partition function as described in references [#ctqmc1]_ and [#ctqmc2]_.
The computation of the imaginary-time Green's function has been improved with
the use of Legendre polynomials following reference [#ctqmc3]_.
**Main developers**: M. Ferrero, O. Parcollet
**Contributors**: L. Boehnke (measures in Legendre basis)
**Related papers**:
.. [#ctqmc1] `P. Werner, A. Comanac, L. de Medici, M. Troyer, and A. J. Millis, Phys. Rev. Lett. 97, 076405 (2006) <http://link.aps.org/doi/10.1103/PhysRevLett.97.076405>`_ (:download:`bibtex file <ctqmc2.bib>`)
.. [#ctqmc2] `P. Werner and A. J. Millis, Phys. Rev. B 74, 155107 (2006) <http://link.aps.org/doi/10.1103/PhysRevB.74.155107>`_ (:download:`bibtex file <ctqmc3.bib>`)
.. [#ctqmc3] `L. Boehnke, H. Hafermann, M. Ferrero, F. Lechermann, and O. Parcollet, Phys. Rev. B 84, 075145 (2011) <http://link.aps.org/doi/10.1103/PhysRevB.84.075145>`_ (:download:`bibtex file <ctqmc1.bib>`)
Hubbard I
..........
**Main developer**: L. Pourovskii
Wien2TRIQS
-----------------
The developement of an interface between the Wien2k electronic structure
package and TRIQS has been motivated by a scientific collaboration between the
research groups of Antoine Georges, Silke Biermann (Ecole Polytechnique),
Olivier Parcollet (CEA Saclay). A first step has been the definition of the
framework and the construction of the projective Wannier functions as input for
the DMFT calculations [#wien2k1]_. This has been followed by the introduction
of full charge self-consistency [#wien2k2]_, necessary for total energy
calculations.
**Developers**: M. Aichhorn, L. Pourovskii, V. Vildosola, C. Martins
**Related papers**:
.. [#wien2k1] `M. Aichhorn, L. Pourovskii, V. Vildosola, M. Ferrero, O. Parcollet, T. Miyake, A. Georges, and S. Biermann, Phys. Rev. B 80, 085101 (2009) <http://link.aps.org/doi/10.1103/PhysRevB.80.085101>`_ (:download:`bibtex file <wien2k1.bib>`)
.. [#wien2k2] `M. Aichhorn, L. Pourovskii, and A. Georges, Phys. Rev. B 84, 054529 (2011) <http://link.aps.org/doi/10.1103/PhysRevB.84.054529>`_ (:download:`bibtex file <wien2k2.bib>`)

14
doc/license/ctqmc1.bib Normal file
View File

@ -0,0 +1,14 @@
@Article{triqs_ctqmc_solver_boehnke,
volume = {84},
month = {Aug},
numpages = {13},
author = {Boehnke, Lewin and Hafermann, Hartmut and Ferrero, Michel and Lechermann, Frank and Parcollet, Olivier},
year = {2011},
url = {http://link.aps.org/doi/10.1103/PhysRevB.84.075145},
doi = {10.1103/PhysRevB.84.075145},
issue = {7},
title = {Orthogonal polynomial representation of imaginary-time Green's functions},
publisher = {American Physical Society},
pages = {075145},
journal = {Phys. Rev. B}
}

14
doc/license/ctqmc2.bib Normal file
View File

@ -0,0 +1,14 @@
@Article{triqs_ctqmc_solver_werner1,
volume = {97},
month = {Aug},
numpages = {4},
author = {Werner, Philipp and Comanac, Armin and de' Medici, Luca and Troyer, Matthias and Millis, Andrew J.},
year = {2006},
url = {http://link.aps.org/doi/10.1103/PhysRevLett.97.076405},
doi = {10.1103/PhysRevLett.97.076405},
issue = {7},
title = {Continuous-Time Solver for Quantum Impurity Models},
publisher = {American Physical Society},
pages = {076405},
journal = {Phys. Rev. Lett.}
}

14
doc/license/ctqmc3.bib Normal file
View File

@ -0,0 +1,14 @@
@Article{triqs_ctqmc_solver_werner2,
volume = {74},
month = {Oct},
numpages = {13},
author = {Werner, Philipp and Millis, Andrew J.},
year = {2006},
url = {http://link.aps.org/doi/10.1103/PhysRevB.74.155107},
doi = {10.1103/PhysRevB.74.155107},
issue = {15},
title = {Hybridization expansion impurity solver: General formulation and application to Kondo lattice and two-orbital models},
publisher = {American Physical Society},
pages = {155107},
journal = {Phys. Rev. B}
}

View File

@ -0,0 +1,93 @@
--------------------------------------------------------------------------------
THE TRIQS PROJECT BASIC COMPONENTS (Green's functions, HDF archives, ...)
--------------------------------------------------------------------------------
@Article{triqs_project,
author = {}
year = {}
}
--------------------------------------------------------------------------------
EXTENSION MODULES: Hybridization Quantum Monte Carlo
--------------------------------------------------------------------------------
@Article{triqs_ctqmc_solver_boehnke,
volume = {84},
month = {Aug},
numpages = {13},
author = {Boehnke, Lewin and Hafermann, Hartmut and Ferrero, Michel and Lechermann, Frank and Parcollet, Olivier},
year = {2011},
url = {http://link.aps.org/doi/10.1103/PhysRevB.84.075145},
doi = {10.1103/PhysRevB.84.075145},
issue = {7},
title = {Orthogonal polynomial representation of imaginary-time Green's functions},
publisher = {American Physical Society},
pages = {075145},
journal = {Phys. Rev. B}
}
@Article{triqs_ctqmc_solver_werner1,
volume = {97},
month = {Aug},
numpages = {4},
author = {Werner, Philipp and Comanac, Armin and de' Medici, Luca and Troyer, Matthias and Millis, Andrew J.},
year = {2006},
url = {http://link.aps.org/doi/10.1103/PhysRevLett.97.076405},
doi = {10.1103/PhysRevLett.97.076405},
issue = {7},
title = {Continuous-Time Solver for Quantum Impurity Models},
publisher = {American Physical Society},
pages = {076405},
journal = {Phys. Rev. Lett.}
}
@Article{triqs_ctqmc_solver_werner2,
volume = {74},
month = {Oct},
numpages = {13},
author = {Werner, Philipp and Millis, Andrew J.},
year = {2006},
url = {http://link.aps.org/doi/10.1103/PhysRevB.74.155107},
doi = {10.1103/PhysRevB.74.155107},
issue = {15},
title = {Hybridization expansion impurity solver: General formulation and application to Kondo lattice and two-orbital models},
publisher = {American Physical Society},
pages = {155107},
journal = {Phys. Rev. B}
}
--------------------------------------------------------------------------------
EXTENSION MODULES: Wien2K interface
--------------------------------------------------------------------------------
@Article{triqs_wien2k_interface,
volume = {80},
month = {Aug},
numpages = {15},
author = {Aichhorn, Markus and Pourovskii, Leonid and Vildosola, Veronica and Ferrero, Michel and Parcollet, Olivier
and Miyake, Takashi and Georges, Antoine and Biermann, Silke},
year = {2009},
url = {http://link.aps.org/doi/10.1103/PhysRevB.80.085101},
doi = {10.1103/PhysRevB.80.085101},
issue = {8},
title = {Dynamical mean-field theory within an augmented plane-wave framework:
Assessing electronic correlations in the iron pnictide LaFeAsO},
publisher = {American Physical Society},
pages = {085101},
journal = {Phys. Rev. B}
}
@Article{triqs_wien2k_full_charge_SC,
doi = {10.1103/PhysRevB.84.054529},
month = {Aug},
issue = {5},
author = {Aichhorn, Markus and Pourovskii, Leonid and Georges, Antoine},
year = {2011},
url = {http://link.aps.org/doi/10.1103/PhysRevB.84.054529},
publisher = {American Physical Society},
title = {Importance of electronic correlations for structural and magnetic properties of the iron pnictide superconductor LaFeAsO},
pages = {054529},
journal = {Phys. Rev. B},
volume = {84},
numpages = {7}
}

View File

@ -0,0 +1,3 @@
.. _CITATIONS:
.. literalinclude:: CITATIONS.bib

View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -0,0 +1,6 @@
.. _GPL:
GNU Public License
------------------
.. literalinclude:: COPYING.txt

View File

@ -0,0 +1,6 @@
.. _License:
License
-------
.. literalinclude:: License.txt

View File

@ -0,0 +1,23 @@
/*******************************************************************************
*
* TRIQS: a Toolbox for Research in Interacting Quantum Systems
*
* Copyright (C) 2011 by M. Ferrero, O. Parcollet
*
* TRIQS is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* TRIQS. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/

View File

@ -0,0 +1,44 @@
.. index:: disclaimer
.. role:: red
.. _legal:
License, Citations and Disclaimer
==========================================
License
---------
TRIQS is published under the GNU Public License, :ref:`GNU Public License <GPL>`, version 3 (also provided as the
LICENSE.txt and COPYING.txt files in the source directory).
Citations
-----------
TRIQS is a part of our scientific work. As such, like any other kind of publication,
we expect you to cite it if you use it, according to the standard rules of the academic world.
To help you, we provide in :ref:`CITATION.bib <CITATIONS>` a digest of the papers relevant for the various TRIQS modules.
If you find TRIQS useful, giving proper reference and citation is indeed a simple way to help convincing funding
sources that such projects are useful for our community and should be supported.
Disclaimer
-------------------
The program is provided `as is`, i.e. WITHOUT ANY WARRANTY of any kind, as stated in the license.
In particular, its authors and contributors will take no responsability for any possible bugs
or any improper use of these programs,
including those resulting in incorrect scientific publications.
Moreover, we emphasize that TRIQS is a **toolbox**, which means that you need to learn how to use the tools properly.
In particular,
* using TRIQS correctly requires **a solid knowledge of the quantum many-body problem**,
its technical concepts, and their physical interpretation.
* TRIQS has **no safety net**.
We do not provide exhaustive checks of parameters passed to various objects and functions
to ensure that they are reasonable and physically meaningful.

15
doc/license/wien2k1.bib Normal file
View File

@ -0,0 +1,15 @@
@Article{triqs_wien2k_interface,
volume = {80},
month = {Aug},
numpages = {15},
author = {Aichhorn, Markus and Pourovskii, Leonid and Vildosola, Veronica and Ferrero, Michel and Parcollet, Olivier and Miyake, Takashi and Georges, Ant
oine and Biermann, Silke},
year = {2009},
url = {http://link.aps.org/doi/10.1103/PhysRevB.80.085101},
doi = {10.1103/PhysRevB.80.085101},
issue = {8},
title = {Dynamical mean-field theory within an augmented plane-wave framework: Assessing electronic correlations in the iron pnictide LaFeAsO},
publisher = {American Physical Society},
pages = {085101},
journal = {Phys. Rev. B}
}

14
doc/license/wien2k2.bib Normal file
View File

@ -0,0 +1,14 @@
@Article{triqs_wien2k_full_charge_SC,
doi = {10.1103/PhysRevB.84.054529},
month = {Aug},
issue = {5},
author = {Aichhorn, Markus and Pourovskii, Leonid and Georges, Antoine},
year = {2011},
url = {http://link.aps.org/doi/10.1103/PhysRevB.84.054529},
publisher = {American Physical Society},
title = {Importance of electronic correlations for structural and magnetic properties of the iron pnictide superconductor LaFeAsO},
pages = {054529},
journal = {Phys. Rev. B},
volume = {84},
numpages = {7}
}

209
doc/overview.rst Normal file
View File

@ -0,0 +1,209 @@
TRIQS in a nutshell
===================
TRIQS is a toolbox containing **ready-to-use applications**, **python modules** as well as **C++ libraries** aimed at physicists in the field of quantum interacting systems.
Applications
------------
Interface to Wien2k for LDA+DMFT calculation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TRIQS allows you to turn band-structure calculations obtained from the Wien2k package to inputs to full-fledged LDA+DMFT calculations in a few lines!
[example here]
To learn more, see <link>
Solvers for impurity models
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TRIQS comes with powerful numerical solvers for quantum impurity models.
[example here]
To learn more, see <link>
Python modules
--------------
Green's functions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
With TRIQS, the manipulation of Green's functions is made easy: construction of Green's functions in frequency and time domains (imaginary and real), Fourier transforms, visualization, tail computation...
.. runblock:: python
# Import the Green's functions
from pytriqs.gf.local import GfImFreq, iOmega_n, inverse
# Create the Matsubara-frequency Green's function and initialize it
gw = GfImFreq(indices = [1], beta = 50, n_points = 1000, name = "imp")
gw <<= inverse( iOmega_n + 0.5 )
# Create an imaginary-time Green's function and plot it
gt = GFBloc_ImTime(Indices = [1], Beta = 50)
gt <<= InverseFourier(gw)
#from pytriqs.plot.mpl_interface import oplot
#oplot(g, '-o', x_window = (0,10))
print gt(0.5)
To learn more, see <link>
Lattice tools
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
With TRIQS, build a tight-binding model on any lattice in a few lines, and extract its density of states, dispersion...
[example here]
.. runblock:: python
print 2+2 # this will give output
To learn more, see <link>
C++ libraries
-------------
Monte-Carlo library
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Set up a Monte-Carlo simulation in a few lines: you write the configuration, moves and measures, while TRIQS takes care of the Metropolis algorithm and parallelization of the code.
.. compileblock::
#include <iostream>
#include <triqs/utility/callbacks.hpp>
#include <triqs/mc_tools/mc_generic.hpp>
// the configuration: a spin, the inverse temperature, the external field
struct configuration {
int spin; double beta, h;
configuration(double beta_, double h_) : spin(-1), beta(beta_), h(h_) {}
};
// a move: flip the spin
struct flip {
configuration & config;
flip(configuration & config_) : config(config_) {}
double attempt() { return std::exp(-2*config.spin*config.h*config.beta); }
double accept() { config.spin*= -1; return 1.0; }
void reject() {}
};
// a measurement: the magnetization
struct compute_m {
configuration & config;
double Z, M;
compute_m(configuration & config_) : config(config_), Z(0), M(0) {}
void accumulate(double sign) { Z += sign; M += sign * config.spin; }
void collect_results(boost::mpi::communicator const &c) {
double sum_Z, sum_M;
boost::mpi::reduce(c, Z, sum_Z, std::plus<double>(), 0);
boost::mpi::reduce(c, M, sum_M, std::plus<double>(), 0);
if (c.rank() == 0) {
std::cout << "Magnetization: " << sum_M / sum_Z << std::endl << std::endl;
}
}
};
int main(int argc, char* argv[]) {
// initialize mpi
boost::mpi::environment env(argc, argv);
boost::mpi::communicator world;
// greeting
if (world.rank() == 0) std::cout << "Isolated spin" << std::endl;
// prepare the MC parameters
int N_Cycles = 500000;
int Length_Cycle = 10;
int N_Warmup_Cycles = 1000;
std::string Random_Name = "";
int Random_Seed = 374982 + world.rank() * 273894;
int Verbosity = (world.rank() == 0 ? 2 : 0);
// construct a Monte Carlo loop
triqs::mc_tools::mc_generic<double> SpinMC(N_Cycles, Length_Cycle, N_Warmup_Cycles,
Random_Name, Random_Seed, Verbosity);
// parameters of the model
double beta = 0.3;
double field = 0.5;
// construct configuration
configuration config(beta, field);
// add moves and measures
SpinMC.add_move(flip(config), "flip move");
SpinMC.add_measure(compute_m(config), "magnetization measure");
// Run and collect results
SpinMC.start(1.0, triqs::utility::clock_callback(600));
SpinMC.collect_results(world);
return 0;
}
To learn more, see <link>
Array library
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Create, manipulate and store powerful multi-dimensional arrays:
.. highlight:: c
.. compileblock::
#include <triqs/arrays.hpp>
using triqs::arrays::array;
int main(){
array<double,1> A(20);
}
To learn more, see <link>
Expression library: CLEF
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Write mathematical expressions in a seamless and computationally efficient way:
.. compileblock::
#include <triqs/clef.hpp>
int main () {
triqs::clef::placeholder <1> x_;
auto e1 = cos(2*x_+1);
auto e2 = abs(2*x_-1);
auto e3 = floor(2*x_-1);
auto e4 = pow(2*x_+1,2);
}
To learn more, see <link>

View File

@ -0,0 +1,3 @@
add_all_subdirectories_with_cmakelist()

View File

@ -0,0 +1,86 @@
# Copyright Olivier Parcollet 2010
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
FILE(GLOB_RECURSE SOURCES *.rst)
# The compiler flags for autocompile
SET( link_libs "${LAPACK_LIBS} ${BOOST_LIBRARY} ${ALPS_EXTRA_LIBRARIES}")
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
list (REMOVE_DUPLICATES link_libs)
ENDIF( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
string(REPLACE "boost_for_triqs" " " TMP "${link_libs}")
string(REPLACE "debug" " " TMP "${TMP}")
string(REPLACE "optimized" " " TMP "${TMP}")
if(BOOST_SOURCE_DIR)
SET( link_boost_for_triqs "-lboost_for_triqs")
EXECUTE_PROCESS(COMMAND sh -c "ln -sf ${CMAKE_BINARY_DIR}/foreignlibs/boost/libboost_for_triqs.so ${CMAKE_CURRENT_BINARY_DIR}")
else(BOOST_SOURCE_DIR)
SET( link_boost_for_triqs " ")
endif(BOOST_SOURCE_DIR)
SET(DOC_AUTOCOMPILE_INCLUDE ${BOOST_SOURCE_DIR} ${CMAKE_SOURCE_DIR} ${ALPS_INCLUDE_DIRS} ${ALPS_EXTRA_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/foreignlibs )
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
SET(DOC_AUTOCOMPILE_LINK "-L ${CMAKE_BINARY_DIR}/foreignlibs/boost ${link_boost_for_triqs} -L ${CMAKE_BINARY_DIR}/triqs -ltriqs -L ${CMAKE_BINARY_DIR}/triqs -ltriqs_utility ${TMP} ")
SET(DOC_AUTOCOMPILE_DEFINITIONS -std=c++0x -DBOOST_PP_VARIADICS=1 -stdlib=libc++ -I/System/Library/Frameworks/vecLib.framework/Versions/A/Headers)
else()
SET(DOC_AUTOCOMPILE_LINK "-L ${CMAKE_BINARY_DIR}/foreignlibs/boost ${link_boost_for_triqs} -L ${CMAKE_BINARY_DIR}/triqs -ltriqs -L ${CMAKE_BINARY_DIR}/triqs -ltriqs_utility ${TMP} -Wl,-rpath=${CMAKE_CURRENT_BINARY_DIR} ")
SET(DOC_AUTOCOMPILE_DEFINITIONS -std=c++0x -DBOOST_PP_VARIADICS=1 )
endif()
SET(DOC_AUTOCOMPILE_LD_LIBRARY_PATH " ${CMAKE_BINARY_DIR}/foreignlibs/boost/:${CMAKE_BINARY_DIR}/triqs ")
EXECUTE_PROCESS(COMMAND sh -c "ln -sf ${CMAKE_BINARY_DIR}/triqs/libtriqs.so ${CMAKE_CURRENT_BINARY_DIR}")
EXECUTE_PROCESS(COMMAND sh -c "ln -sf ${CMAKE_BINARY_DIR}/triqs/libtriqs_utility.so ${CMAKE_CURRENT_BINARY_DIR}")
# generating the conf.py
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/conf.py)
EXECUTE_PROCESS(COMMAND sh -c "mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/html")
SET(DOC_SOURCE ${CMAKE_CURRENT_SOURCE_DIR})
SET(DOC_EXT "_cpp")
include(${TRIQS_SOURCE_DIR}/cmake/BuildSphinx.cmake)
add_all_subdirectories_with_cmakelist()
# Build the doxygen
SET(DOXYGEN_HTML_OUTPUT ./html/doxy_triqs)
find_package(Doxygen REQUIRED)
get_property(DOXYGEN_SOURCES GLOBAL PROPERTY DOXYGEN_SOURCES)
string(REPLACE ";" " " DOXYGEN_SOURCES_LIST "${DOXYGEN_SOURCES}")
message(STATUS "Doxygen sources are ${DOXYGEN_SOURCES}")
# Prepare the Doxyfile
configure_file(${TRIQS_SOURCE_DIR}/cmake/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
SET(doxy_top ${CMAKE_CURRENT_BINARY_DIR}/doxy.log)
add_custom_command (OUTPUT ${doxy_top} DEPENDS ${DOXYGEN_SOURCES} COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile > ${doxy_top} )
add_custom_target(docs_doxy ALL DEPENDS ${doxy_top})
add_dependencies(docs_sphinx_cpp docs_doxy) # we must first have doxygen process the sources to link to them
add_dependencies(docs_sphinx_cpp triqs boost_for_triqs ) # add also mpi ?
if (Build_PDF_Documentation)
# not needed, no link to doxygen in the pdf ...
#add_dependencies(docs_sphinx_pdf_cpp docs_doxy) # we must first have doxygen process the sources to link to them
add_dependencies(docs_sphinx_pdf_cpp triqs boost_for_triqs ) # add also mpi ?
install(FILES ${sphinx_top_pdf} DESTINATION share/doc/triqs/developer_manual/)
endif()
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ COMPONENT documentation DESTINATION share/doc/triqs/developer_manual
FILES_MATCHING
PATTERN "*.html"
PATTERN "*.png"
PATTERN "*.js"
PATTERN "_*"
PATTERN "*.png"
PATTERN "*.gif"
PATTERN "*.xsl"
PATTERN "*.css"
PATTERN "*.pdf"
PATTERN "*.py"
PATTERN "*.txt"
PATTERN "*.bib"
PATTERN ".svn" EXCLUDE
PATTERN "CVS" EXCLUDE
)

View File

@ -0,0 +1,10 @@
# Doxygen sources
set_property(GLOBAL APPEND PROPERTY DOXYGEN_SOURCES
${TRIQS_SOURCE_DIR}/triqs/arrays/h5/simple_read_write.hpp
${TRIQS_SOURCE_DIR}/triqs/arrays/h5/array_proxy.hpp
${TRIQS_SOURCE_DIR}/triqs/arrays/h5/array_stack.hpp
${TRIQS_SOURCE_DIR}/triqs/arrays/array.hpp
${TRIQS_SOURCE_DIR}/triqs/arrays/matrix.hpp
${TRIQS_SOURCE_DIR}/triqs/arrays/vector.hpp
)

View File

@ -0,0 +1,39 @@
The central concept : HasImmutableArrayInterface
=======================================================
The central concept used by the library (both in the colloquial and in the technical acceptance of the word)
is the notion of **Immutable Array Interface**.
This is just a formal definition of what has an object has to implement ("which concept it has to model")
to look like an array.
Basically, the answer is simple, an array is a (discrete) map between a domain of indices into an algebra
(typically R, ou C). Therefore it has to defined :
* a domain of indices, which can be enumerated, e.g. cartesian products of integer ranges.
* an evaluation method [] so that a[ I ] has a `value_type` type for any index I in the domain.
The precise concept if defined at :ref:`HasImmutableArrayInterface` concept.
Examples :
* a matrix has a domain of range(0,n1) x range(0,n2).
* a general array has a domain of dimension rank and values in R, C, other arrays...
* a triangular matrix has a more complex domain...
* any algebraic expression of arrays, matrices are like this (and those one are certainly NOT mutable objects !).
* What is then a (partial) view/slice of an array ?
Simply another map on the same data.
* Do you want to see a 4 indices arrays as a matrix of double indices ?
Simply change the map...
* Why is this concept useful ?
Because if you program another object of your own, which models it,
it is guaranteed to interact properly with arrays....

View File

@ -0,0 +1,252 @@
Concepts
=============================================================
BoostSerializable
-------------------------------------------------
* define serialize for boost serialize library
Printable
-------------------------------------------------
====================================================== ===========================================================
Elements Comment
====================================================== ===========================================================
std::ostream & operator << (std::ostream & out, ...) Printing
====================================================== ===========================================================
Domain
-------------------------------------------------
* **Purpose** : The domain of definition of the array, i.e. the possible value of the indices.
* **Refines** : BoostSerializable, Printable
* **Definition** :
+------------------------------------------------------------------+-------------------------------------------------------+
| Elements | Comment |
+==================================================================+=======================================================+
| static const unsigned int rank | rank |
+------------------------------------------------------------------+-------------------------------------------------------+
| index_value_type | type of the multi-index |
+------------------------------------------------------------------+-------------------------------------------------------+
| default constructor, copy construction | |
+------------------------------------------------------------------+-------------------------------------------------------+
| operator = | |
+------------------------------------------------------------------+-------------------------------------------------------+
| operator ==, != | |
+------------------------------------------------------------------+-------------------------------------------------------+
| size_t number_of_elements() const | number of elements |
+------------------------------------------------------------------+-------------------------------------------------------+
| generator | type of the IndexGenerator that generates the indices |
+------------------------------------------------------------------+-------------------------------------------------------+
| begin() const/ end() const | a generator at start/end |
+------------------------------------------------------------------+-------------------------------------------------------+
* **Examples** :
Typically, this is is a multi-index for an array, matrix, ...., e.g.
* Cuboid<rank> : standard hyperrectangular arrays. This is little more than the tuple of the lengths.
* triangle, .... ?
.. _HasImmutableArrayInterface:
HasImmutableArrayInterface
-------------------------------------------------
* **Purpose** : The most abstract definition of something that behaves like an immutable array.
* it has a domain (hence a rank).
* it can be evaluated on any value of the indices in the domain
* By combining the generator of the domain with the evaluation, it is therefore easy to
iterate on the values of such an object.
* NB : It does not need to be stored in memory. A formal expression, e.g. model this concept.
* **Definition** ([A|B] denotes that the return type maybe A or B).
================================================================================================== =============================================================
Elements Comment
================================================================================================== =============================================================
value_type Type of the element of the array
domain_type Type of the domain.
[domain_type const & | domain_type] domain() const Access to the domain.
[ value_type | value_type const &] operator[] (domain_type::index_value_type const &) const Evaluation.
================================================================================================== =============================================================
* **Examples** :
* array, array_view, matrix, matrix_view, vector, vector_view (all implemented as Indexmap_Storage_Pair)
* array expressions (in which case the returns are not const & since they are computed, not stored).
IndexGenerator
-------------------------------------------------
* **Purpose** : Generate the indices of a domain.
* **Definition** :
============================================================== ==================================================================================================
Elements Comment
============================================================== ==================================================================================================
domain_type Type of the domain whose indices are generated.
default contruction, copy construction
construction from (domain_type const &, bool atend=false)
IndexGenerator & operator=(const IndexGenerator & )
operator ++
operator =
operator ==, !=
domain_type::index_value_type const & operator * () const Access to the value of the multi-index
bool at_end() const True iif the generator has reached the last value
============================================================== ==================================================================================================
* **Examples** :
* cuboid_index_generator
IndexMap
-------------------------------------------------
* **Purpose** :
* Store the mapping of the index domain to a linear array.
* It is basically a function : indices --> 1d position, the bijection between the indices
of an element and its position in the memory block.
* **Refines** : BoostSerializable, Printable
* **Definition** :
======================================================================== ==================================================================================================
Elements Comment
======================================================================== ==================================================================================================
* domain_type The type of the domain.
* domain_type const & domain() const The domain.
* default constructor, copy construction Cpy is a true copy.
* can be constructed from domain_type const &
* size_t operator[] (domain_type::index_value_type const & key ) const The mapping itself.
* iterator A type modeling IndexMapIterator, which is the optimal memory traversal.
NB : the order of indices is chosen for optimal traversal of memory, it
does not need to be "natural".
cuboid_map also provides a natural_iterator for that purpose.
======================================================================== ==================================================================================================
* The type also has to define two free functions and to specialize a template :
========================================================== ==================================================================================================
Elements Comment
========================================================== ==================================================================================================
* bool compatible_for_assignment (M1, M2) Returns whether an array/matrix/vector with map M1 can be equated to a array/matrix/vector with
map M2
* bool raw_copy_possible (M1, M2) Is the assignment of an array/matrix/vector with map M2 into an array/matrix/vector with map M1
doable with raw copy
* struct indexmap_iterator_adapter< It, I > Metafunction :
- I is the IndexMap class
- It any similar IndexMapIterator which returns (in ::type) the IndexMapIterator on I
with the same order traversal as It.
Example : It is a IndexMapIterator on I1 stored in C order, I is in Fortran order,
the result will be an IndexMapIterator on I that presents the data of I in C order
This is used in copying array with different indexmaps.
========================================================== ==================================================================================================
* **Examples** :
* cuboid_map<IterationOrder> : a map of the cuboid indices in a fixed order in memory.
IndexMapIterator
-------------------------------------------------
* **Purpose** :
* A basic iterator on an IndexMap which can be dereferenced into the shift of successive elements compared to the start of the memory block.
* These iterators are kept as simple as possible, so that it is easy to implement new indices maps and their iterators.
* NB : In particular, they are *not* necessary STL-compliant. The array_iterator class will
take such an iterator and a Storage and produce a true, STL compliant iterator on the array (iterator_adapter).
* **Definition** :
========================================================== ==================================================================================================
Elements Comment
========================================================== ==================================================================================================
indexmap_type The index_map on which the iterator is iterating
domain_type Type of the domain whose indices are generated.
default contruction, copy construction
construction from (domain_type const &, bool atend=false)
IndexMapIterator & operator=(const IndexMapIterator & )
IndexMapIterator & operator ++
operator ==, !=
std::ptrdiff_t operator*() const Dereference as a shift from the beginning of the array
domain_type::index_value_type const & indices () const Access to the value of the multi-index at the iterator position
bool at_end() const True iif the generator has reached the last value (in practice quicker that it = XX.end()).
========================================================== ==================================================================================================
* **Example(s)** :
* cuboid_map_iterator
Storage
-------------------------------------------------
* **Purpose** :
* The storage of the array in memory, e.g. plain C++ array, a numpy, etc...
* A Storage keeps the reference to the memory block where the array is stored.
* NB : This memory block can be typically shared between various arrays and views,
so the Storage is just a reference. The memory is deallocated only
when all storages referencing it has been destroyed.
* **Refines** : BoostSerializable
* **Definition** :
====================================================== ==================================================================================================
Elements Comment
====================================================== ==================================================================================================
value_type Type of the element stored, e.g. int, const int, double, const double, ...
default construction Makes a storage of size 0
copy construction a shallow copy (another reference to the same data).
the copy construction is possible from another storage of the same value_type
up to the const qualifier.
The construction of a storage with value_type=T from a storage with value_type const T
is forbidden at compile time.
void operator = (const STO &) A shallow copy of the reference to the data.
clone() const Create a clone of the data.
const_clone() const Create a clone of the data with const value_type (e.g. int--> const int).
void raw_copy_from(const STO & X) Copy all the data from X to * this. Behaviour undefined if sizes do not match.
size_t size() const Number of elements in the storage
value_type & operator[](size_t p) const Access to the data. Behaviour is undefined if empty()==true.
====================================================== ==================================================================================================
StorageOrder concept
-------------------------------------------------
* **Purpose** :
* Store the order of indices in memory.
* Can be fixed at compile time, or dynamically (not implemented).
* **Refines** : BoostSerializable
* **Definition** :
====================================================== ==================================================================================================
Elements Comment
====================================================== ==================================================================================================
size_t index_number(size_t i)
static unsigned int rank
default construction
copy construction
bool is_Fortran() const Is it Fortran-style ordering ?
bool is_C() const Is it C-style ordering ?
====================================================== ==================================================================================================
* The type also has to define the == operator :
========================================================== ==================================================================================================
Elements Comment
========================================================== ==================================================================================================
Operator == Defined between any of the ordering.
========================================================== ==================================================================================================

View File

@ -0,0 +1,11 @@
Concepts, implementation, design ...
***************************************
.. highlight:: c
.. toctree::
:maxdepth: 1
:numbered:
concepts

View File

@ -0,0 +1,60 @@
.. _cuboid_formula:
Cuboid formula
======================
* **Notations** :
* R = rank
* index : (i0,...,i_{R-1})
* Lengths : (L0, ... , L_{R-1})
* Strides : (S0, ... , S_{R-1})
* position = start_shift + \sum_{j=0}^{R-1} i_j S_j
* **Strides for compact cuboid** :
If :math:`\sigma(i)` is the i-th index in memory (0 the first, R-1 the last one), we have
.. math::
:nowrap:
\begin{align*}
S_{\sigma(0)} &= 1\\
S_{\sigma(1)} &= L_{\sigma(0)} S_{\sigma(0)} = L_{\sigma(0)}\\
S_{\sigma(i)} &= L_{\sigma(i-1)} S_{\sigma(i-1)} = \prod_{j=i-1}^{0} L_{\sigma(j)}
\end{align*}
* **Slicing the cuboid** :
* Argument of the slice : (R0, R1, ..., R_{R-1}), with R_i = range : (start,end,step)
for the moment, if R_i = E_i, a number, consider it as a special range of length 1.
* new index (k0,...., k_{R-1}).
i_u = R_u.start + k_u * R_u.step
* Compute the new strides : Sn_j
.. math::
:nowrap:
\def\offset{\text{offset}}
\begin{align*}
position &= \offset + \sum_{j=0}^{R-1} i_j S_j \\
&= \offset + \sum_{j=0}^{R-1} (k_j* R_j.step + R_j.start) S_j \\
&= (\offset + \sum_{j=0}^{R-1} (k_j* R_j.step + R_j.start) S_j ) + \sum_{j=0}^{R-1} k_j (S_j * R_j.start)
\\
\offset_\text{new} &= \offset + \sum_{j=0}^{R-1} (k_j* R_j.step + R_j.start) S_j \\
&= position( R_j.start) \\
Sn_j &= S_j * R_j.start
\end{align*}
* Now : for the cases R_i = E_i, just drop the index.

View File

@ -0,0 +1,52 @@
.. _DesignSlicing:
Slicing
=============================================================
In this section, IM denotes some IndexMaps.
* We refer here to any partial view of the arrays as "slicing", i.e. subarrays, true slices, etc...
A slicing is any (meta)-function that take an indexmap and return another one.
* It is a meta-function that computes the type of the resulting indexmap
* It is a function that computes the resulting indexmap.
* The array/matrix/vector classes and their views, when called with the () operator, will :
* forward all the arguments and their types to IndexMaps::slice, to compute the new indexmap IM2.
* If IM2 is of dimension 0, return a value_type & or const & (it is a simple number, not an array).
* Otherwise : return a new view, made of IM2 and the same data as for the original object.
* Possible slices are defined by the IndexMap type.
Slicing an class C with IndexMap I1 produces a class C2_view, with IndexMap I2,
i.e. a new sliced IndexMap on the same data.
* **Examples** :
* array and array_view can be sliced :
``
array<T,2> A(10,10); : defines an array
A(1,2) : element access.
A ( 1, range(0,2) ) : 1d slice
A( range(0,10,2), range(0,10,2)) : a 2d slice viewing every each elements with even coordinates.
``
* matrix, matrix_view when sliced, return vector_view or matrix_view.
* One can be much more general : e.g. slicing the diagonal of a matrix, etc...
* Implementation is entirely done in the IndexMaps classes, by specializing 2 templates
(basically by writing the function IM1-> IM2).
The rest is done by indexmap_storage_pair class, which will compute the correct view class
depending on the view class and IM2 (view_from_tag_I_S template).
::
//In namespace IndexMaps::result_of
template<typename IM, typename ArgsTuple>
struct slice< IM, ArgsTuple> { typedef IM2 type; };
//In namespace IndexMaps :
template<typename IM, typename ArgsTuple>
typename result_of::slice<IM,ArgsTuple>::type slice(IM const &, ArgsTuple args);

View File

@ -0,0 +1,62 @@
.. _Design:
Strategy
=============================================================
All the classes are a combination of a system of indices (called IndexMap I in the following)
and a physical storage S in the computer (a block of memory), denoted as an IndexMap_Storage_Pair (I,S).
* I models the IndexMap concept [REF below].
* It is the bijection between the a set of indices and the position in the memory block. It can be though as a coordinate system on the (linear) memory block.
* Various types of indices are possible (only the first is implemented now).
* cuboid (the standard hypercubic array, the only one currently implemented)
* triangular arrays
* band matrix
* multi-indices, with indices made of pair<int,int> e.g.
* S models the Storage concept [REF].
* It is a handle to the memory block containing the actual data.
* It can be e.g.:
* a C++ shared pointer to a memory block.
* a reference to a numpy array.
This design has several consequences :
* **Interoperability** : classes are widely interoperable, e.g. one can add a array and a matrix (if dimensions are ok of course).
one can also add a python numpy and a C++ array without any further coding.
* It is straighforward to construct a matrix_view<T> from an array<T,2>, since it is the same couple <I,S>,
just interpreted differently.
* It is easy to view a array<T,4> as a matrix by gathering indices (properly ordered in memory) :
one just has to provide a new IndexMap I2 to see the same data.
[ --> very useful for vertex computation in many body...]
* Slicing, or partial view is very natural : it is just a function on indexmaps : I--> I2,
independantly of any storage.
Quick guide through the implementation
=============================================================
The implementation is divided into basically 4 parts :
* Storages : implements two storages shared_block and numpy
* IndexMaps : implements cuboid index map, its domain and iterators
* impl/indexmap_storage_pair.hpp : the basic implementation class for all user class.
It is basically just a couple of an indexmap and a storage, with shallow copy.
It also forward the slices to the indexmap and construct the correct views.
* upper level :
* user class : array, array_view, matrix, matrix_view, vector, vector_view
* expression.hpp : boost proto expression
* numpy_interface.hpp : helper to get numpy into array
* lapack/blas interface
* hdf5 support.

View File

@ -0,0 +1,24 @@
.. highlight:: c
FAQ
======
How do I iterate on my array ?
-----------------------------------
There are different way to iterate on the element of an array, recommended in this order from the most simple/efficient to the most complex/slow :
* To assign data into an array, the simplest and efficient way is to use
automatic assignment with lazy expressions, Cf :ref:`Lazy`.
* For a more general case, where one does not simply assign a value to the array element,
use a *foreach* construct, Cf :ref:`Foreach`.
* You can use STL algorithms, since arrays have STL compliant iterators.
The performance may be lower than *foreach* loops (never better anyhow).
* Of course, one can still use a simple for loop, but this is not recommended in general
since it is more error prone and less optimal.

View File

@ -0,0 +1,27 @@
.. highlight:: c
The HDF5 interface
######################
The array classes (`array`, `matrix`, `vector`) have a simple interface to the HDF5 files.
A simple example
------------------
Reference
------------
.. toctree::
:maxdepth: 1
h5_rw
h5_stack
h5_proxy
h5_complex
You can also get the :doxy:`full C++ documentation<triqs::arrays::h5>` for these classes and functions.

View File

@ -0,0 +1,39 @@
.. highlight:: c
MPI and serialization
##########################################
Serialization
============================
The `value classes` and the views are compatible with Boost Serialization library.
MPI
============================
The `value classes` (array, matrix, vector) can be bcasted, reduced,
with the boost.mpi library, e.g. :
.. compileblock::
#include <triqs/arrays.hpp>
#include <boost/mpi.hpp>
using triqs::arrays::array;using triqs::clef::placeholder;
int main() {
boost::mpi::environment env;//argc, argv);
boost::mpi::communicator world;
array<long,2> A (2,2), B(2,2),C(2,2);
placeholder<0> i_; placeholder<1> j_;
A(i_,j_) << (1+world.rank())*(10*i_+ j_);
if (world.rank() ==0) std::cout<<" A = "<<A<<std::endl;
boost::mpi::reduce (world, A,C, std::plus<array<long,2> >(),0);
int s= world.size();
if (world.rank() ==0) std::cout<<" C = "<<C<< " should be "<< array<long,2>( (s*(s+1)/2) * A) <<std::endl;
}

View File

@ -0,0 +1,78 @@
.. highlight:: c
Interface with Python numpy arrays
===================================================================
The array, matrix, vector and their views are fully interoperable with the numpy array objects in python.
From Python to C++
--------------------------
Value and view classes can be constructed from a PyObject * (the opaque type of python object).
They follow their respective semantic :
* `value classes` (array, matrix, vector) **always** make copies.
Hence they can be constructed from a python object X which is not an array, but
out of which numpy can make an array of the correct type.
* `view classes` **never** make copies, they present views of the numpy array.
If this is not possible (e.g. the python object is not a numpy, but a list, the type are not exactly the same)
they throw an exception (`triqs::runtime_error`), with an explanation of the problem.
From C++ to Python
----------------------
Value and view classes have a to_python method with the following synopsis ::
PyObject * to_python() const
which return a **new** reference to the numpy array.
To be more precise, two cases must be distinguished.
* array_view constructed from a PyObject * .
In this case, the array_view's storage is the numpy array, and it keeps a
(owned) reference to the python array all along its existence.
This means that Python can not destroy the array as long as the view exists.
The to_python method simply returns a new reference to this numpy array.
* array or an array_view which was *not* constructed from a PyObject* .
In this case, the storage has been allocated by C++, for example because the array
was created in a C++ routine. There is no natural numpy array to return.
The library returns a new numpy array which *owns* the C++ data,
so the usage of the class is completely transparent.
Python will *automatically* release the memory allocated by the C++ routine
when the array in no longer needed.
Cython
------------
TRIQS main tool for interacing python/C++ code is Cython.
We provide in pytriqs/pxd the cython interface arrays.pxd for the array classes.
Examples
-----------------
Split in several files. --> also the theory above.
Put here the array_cython example
- a routine that take a view
- a routine that take an array (beware to the copy).
- a wrapped class.
- a function that returns a new array from C++. Check references....
.. code-block:: python
import numpy,_testarray
a=numpy.array([[1.0,2],[3,4]])
_testarray.f(a)

View File

@ -0,0 +1,2 @@
.. highlight:: c

View File

@ -0,0 +1,67 @@
.. highlight:: c
.. _STL:
Iterators and STL
##################################################################
Standard iterators are provided that model the boost Mutable_ForwardIterator and ForwardIterator concepts
(and hence are STL compliant).
The iterator implements also two additional methods :
* it can be casted to a bool : it is true iif the iteration is not at end.
* it.indices() : returns const & to the indices at the point of the iteration.
Examples::
array<long,2> A (2,3);
for (auto it = A.begin(); it; ++it) *it =it.indices()[0] + 10 *it.indices()[1];
Some examples of usage :
.. compileblock::
#include <triqs/arrays.hpp>
#include <vector>
#include <map>
#include <algorithm>
using triqs::arrays::array; using triqs::arrays::matrix; using triqs::clef::placeholder;
int main(){
// For example, one can make a vector of arrays ... ::
array<long,2> A (2,3);
std::vector<array<long,2> > VV;
VV.push_back(A);
// ... or a map ::
std::map<int, array<long,2> > MAP;
MAP[1] = A;
// We can put a std::vector in an array ... ::
// --> should make a direct constructor for this.. + factory in the reverse direction...
std::vector<int> V (10,2);
array<int,1 > B(V.size()), C(V.size());
std::copy(V.begin(),V.end(),B.begin());
// ... or in reverse ::
B*=2;
std::copy(B.begin(),B.end(),V.begin());
// ... or use other algorithms of std::
std::cout<<" max(B) "<< * std::max_element(B.begin(),B.end())<<std::endl;
// or replace
placeholder<0> i_;
B(i_) << 3*i_ ;
std::cout<<" B "<< B << std::endl;
std::replace_if (B.begin(), B.end(), [](int i) { return i>21;}, 0);
std::cout<<" B "<< B << std::endl;
}

View File

@ -0,0 +1,114 @@
.. highlight:: c
Operations : array and matrix/vector algebras
=======================================================
Operations
------------
Arrays and matrices can be combined in formal algebraic expressions, which models the :ref:`HasImmutableArrayInterface` concept.
This algebraic expressions can therefore be used as RHS of assignment (SEE) or in array/matrix contructors.
For example ;
.. compileblock::
#include <triqs/arrays.hpp>
using triqs::arrays::array;
int main() {
array<long,2> A (2,2), B(2,2), C;
C= A + 2*B;
array<long,2> D = A+ 2*B;
array<double,2> F = 0.5 * A; // Type promotion is automatic
}
Arrays vs matrices
----------------------
Because their multiplication is not the same, arrays and matrices algebras can not be mixed.
Mixing them in expression would therefore be meaningless and it is therefore not allowed ::
array<long,2> A;
matrix<long,2> M;
M + A; // --> ERROR. Rejected by the compiler.
However, you can always make a matrix_view from a array of rank 2 ::
A + make_matrix_view(M); //--> OK.
.. note::
Making view is cheap, it only copies the index systems. Nevertheless
this can still cause severe overhead in very intense loops.
Compound operators (+=, -=, *=, /=)
-------------------------------------------
The `value classes` and the `view classes` behaves similarly.
We will illustrate it on the `array` class, it is the same for `matrix` and `vector`.
* **Syntax**
The syntax is natural ::
template<typename RHS> array & operator += (const RHS & X);
template<typename RHS> array & operator -= (const RHS & X);
template<typename RHS> array & operator *= (const Scalar & S);
template<typename RHS> array & operator /= (const Scalar & S);
* **Behaviour**
- Similar to assignment, but it makes the operation
- For matrices, scalar is correctly interpreted as a scalar matrix.
Performance
---------------------------------------------
The performance of such compact writing is as good as "hand-written" code or even better.
Indeed, the operations are implemented with the `expression templates` technique.
The principle is that the result of A+B is **NOT** an array, but a more complex type which stores
the expression using the naturally recursive structure of templates.
Expressions models :ref:`HasImmutableArrayInterface` concept.
They behave like an immutable array : they have a domain, they can be evaluated.
Hence they can used *anywhere* an object modeling this concept is accepted, e.g. :
* array, matrix contruction
* operator =, +=, -=, ...
When an array in assigned (or constructed from) such expression, it fills itself
by evaluating the expression.
This technique allows the elimination of temporaries, so that the clear and readable code::
Z= A + 2*B + C/2;
is in fact rewritten by the compiler into ::
for (i,j,...) indices of A, B :
C(i,j) = A(i,j) + 2* B(i,j) + C(i,j)/2
instead of making a chain of temporaries (C/2, 2*B, 2*B + C/2...) that "ordinary" object-oriented programming would produce.
As a result, the produced code is as fast as if you were writing the loop yourself,
but with several advantages :
* It is more **compact** and **readable** : you don't have to write the loop, and the indices range are computed automatically.
* It is much better for **optimization** :
* What you want is to tell the compiler/library to compute this expression, not *how* to do it optimally on a given machine.
* For example, since the traversal order of indices is decided at compile time, the library can traverse the data
in an optimal way, allowing machine-dependent optimization.
* The library can perform easy optimisations behind the scene when possible, e.g. for vector it can use blas.
Note that expressions are lazy objects. It does nothing when constructed, it just "record" the mathematical expression ::
auto e = A + 2*B; // expression, purely formal, no computation is done
cout<< e <<endl ; // prints the expression
cout<< e(1,2) <<endl ; // evaluates just at a point
cout<< e.domain() <<endl ; // just computes its domain
array<long,2> D(e); // now really makes the computation and store the result in D.
D = 2*A +B; // reassign D to the evaluation of the expression.

View File

@ -0,0 +1,360 @@
.. highlight:: c
array and array_view
============================
array and array_view are the class for standard d-dimensional cuboid array
and the corresponding view.
Template parameters
----------------------------
* The class has four template parameters (same for array_view).
.. code-block:: c
array<ValueType, // The type of the element of the array
Rank, // int : the rank of the array
IndexOrderTag=Tag::C, // The ordering in memory : can be Tag::C, Tag::Fortran or a permutation
StorageTag=Tag::shared_block // The storage : Tag::shared_block or Tag::numpy
>
============================ ========================== =======================================
Template parameter Access in the class Meaning
============================ ========================== =======================================
ValueType value_type The type of the element of the array
Rank rank The rank of the array *[int]*
IndexOrderTag indexmap_type The ordering in memory : can be Tag::C, Tag::Fortran or a permutation
StorageTag storage_type The storage : Tag::shared_block or Tag::numpy
============================ ========================== =======================================
* Various IndexOrderTag are possible :
================= ====================================================================================================
IndexOrderTag Meaning
================= ====================================================================================================
Tag::C C-style order *[default]*
Tag::Fortran Fortran-style order
P - P is a permutation
- Determined by a permutation P at compile time. Explain here the permutation, the convention.
================= ====================================================================================================
* Two possible storages :
================== ============================================================================
StorageTag Meaning
================== ============================================================================
Tag::shared_block a (shared_ptr on a) C++ block *[default]*
Tag::numpy stored in a numpy array, in which case the array is also a numpy array
and read numpy, be returned as numpy, sliced into a numpy, etc...
================== ============================================================================
.. _array_constructors:
Constructors
-----------------
Intentionally, array and array_view have only a few constructors :
========================================== ===========================================================================================
Constructors of array Comments
========================================== ===========================================================================================
array() - empty array of size 0
array(size_t, ...., size_t) - from the dimensions
array(cuboid_domain<rank> const &) - a new array with the corresponding cuboid
array(const array &) - copy construction
array(const T & X) - Type T models the :ref:`HasImmutableArrayInterface` concept.
- X must have the appropriate domain (checked at compile time).
- Enabled iif has_immutable_array_interface<T>::value == true.
- Constructs a new array of domain X.domain() and fills it with evaluation of X.
========================================== ===========================================================================================
====================================================================== =======================================================================================
Constructors of array_view Comments
====================================================================== =======================================================================================
array_view(indexmap_type const & I, S_type const &) from a couple of indexmap I and storage of type S_type
array_view(const T & X) T is any type such that X.indexmap() and X.storage(). Models ISP ...
====================================================================== =======================================================================================
array_view are typically constructed by slicing (Cf below).
* Examples ::
array<int,2> A(10,2);
array<int,2,Tag::Fortran> Af (2,2);
//Higher dim, custom order :
array<long, 3, Permutations::permutation<2,1,0> > A0 (2,3,4);
array<long, 3, Permutations::permutation<0,1,2> > A1 (2,3,4);
array<long, 3, Permutations::permutation<1,0,2> > A2 (2,3,4);
array<long, 3 > A3 (2,3,4);
array<long, 3, Tag::Fortran > A4 (2,3,4);
Access to data, domain, simple evaluation, ...
--------------------------------------------------------
array, array_view, matrix, matrix_view, vector, vector_view model HasImmutableArrayInterface.
Assignment & Copy
--------------------
Every classes comes in two flavors: C and C_view (with C = array, matrix, vector, etc...).
These two flavors differ in the way they handle their data in construction, copy construction, assignement.
Basically, C owns its data, while C_view if only a view.
array, matrix, vector
^^^^^^^^^^^^^^^^^^^^^^^^
They own their data. In many aspects, they are similar to like std::vector.
* The data are contiguous in memory.
* Constructors and copy constructors all create a new memory block. If needed, they
make a *true* copy of the data.
* The assignment operator may create a new Storage if size do not match.
* As a result, /pointers to the data/ and reference to the storage are invalid after assignment.
* They can be resized, again invalidating all references.
array_view, matrix_view, vector_view
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
These classes do not own their data, but only present a view of them.
* The data may not be contiguous in memory (e.g. if the view is the result of a slice).
* Constructors only make another view of the data.
* They *never* copy data, so they are quite quick.
In particular, copy constructor makes shallow copy (i.e. return another view).
* The assignement operator just copy data into the view. Behaviour is undefined if the
size of the view is too small (define the macro ARRAY_CHECK for dynamical debugging checks).
* Pointers to data taken from the views are still valid after assignement.
* Views can be not be resized.
.. warning:: **Memory management**
Views carry a reference to the memory block they view,
which guarantees that memory will not be
dellocated before the destruction of the view.
Indeed, the Storage types implement incorporated a reference counting mechanism,
either using boost::shared_ptr for the C++ arrays, or using the python references
for the numpy storage.
The memory block will be dellocated when its array and all array_view
pointing to it or to a portion of it will be destroyed, and only at that moment.
Examples::
array<int,Matrix> *A = new array<int,Matrix> (Matrix(2,3)); // create an array A
array_view<int, Matrix> B(*A); // making a view
delete A; // A is gone...
cout<<B<<endl; // ok, but B (and the data) is still alive
Operator =
------------
array, matrix, vector
^^^^^^^^^^^^^^^^^^^^^^^^
//.. cpp:member::
template<typename RHS> array & operator=(const RHS & X);
* RHS models HasImmutableArrayInterface.
* array is first resized to have a domain X.domain(), and then filled
with the evaluation of X (e.g. a copy if X is an array, computing the value if X is an expression).
array_view, matrix_view, vector_view
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//.. cpp:function::
template<typename RHS> array_view & operator=(const RHS & X);
* RHS models HasImmutableArrayInterface [ or less ? : RHS can be evaluated in the domain_type::value_type, no domain needed.].
* Dimension of the view must match or behaviour is undefined.
Iterators and interaction with STL containers and algorithms
----------------------------------------------------------------
STL compliant iterators, hence STL algorithms work...
Examples::
array<long,2> A (2,3);
// first print the index generator
for (array<long,2>::indexmap_type::domain_type::generator it = A.indexmap().domain().begin(); !it.at_end(); ++it)
cout<<" "<<*it<<endl;
//A(i,j) = i + 10*j
for (array<long,2>::iterator it = A.begin(); !it.at_end(); ++it)
{ *it =it.indices().get<0>() + 10 *it.indices().get<1>() ; }
int u=0;
for (array<long,2>::iterator it = A.begin(); !it.at_end(); ++it,++u) { *it =u; }
array<long,2> A (2,3);
std::vector<array<long,2> > VV; VV.push_back(A);
map<string, array<long,2> > MAP; MAP["1"] = A;
// Trying to put a vector in an array
std::vector<int> V (10);
array<int,1 > B(V.size()), C(V.size());
for (unsigned int i =0; i<10; ++i) V[i] = 10+i;
std::copy(V.begin(),V.end(),B.begin());
std::copy(B.begin(),B.end(),V.begin());
cout<<" Number of elements <25 : "<< std::count_if(B.begin(), B.end(),te)<<endl;
cout<<" max(B) "<< *std::max_element(B.begin(),B.end())<<endl;
std::replace_if (B.begin(), B.end(), te, 0);
std::swap(B,C);
Slicing (or partial view)
-------------------------------------------------
Slicing or partial view consists in presenting a view of a sub-part of the array, e.g.
Examples::
array<long,2> A (2,3);
array_view<long,1> SL( A(range(0,2),0));
array_view<long,1> SL2( A(1,range(0,2)));
It is the standard way to produce a view.
NB :
* we use here the python convention: range(0,3) is 0:3, i.e. 0,1,2 NOT 0,1,2,3.
* Todo : in fact we should wrap the range to python::slice for interoperability with python.
Serialization
-------------------------------------------------
* Boost.serialization
* Boost.mpi
Examples::
array<long,2> A (2,2), B(2,2),C(2,2);
boost::mpi::reduce (world, A,C, std::plus<array<long,2> >(),0);
* HDF5 (ALPS), eg.
Examples::
array<long,2> A (2,3),B,vc;
array<long,2,Tag::Fortran> Af,Bf,vf;
alps::hdf5::oarchive ar1("data.h5");
ar1 << alps::make_pvp("Tableau", A);
ar1 << alps::make_pvp("Tableau2", Af);
ar1 << alps::make_pvp("Tableau_view", A(range(),range(1,3)));
alps::hdf5::iarchive ar2("data.h5");
ar2 >> alps::make_pvp("Tableau", B);
ar2 >> alps::make_pvp("Tableau", Bf);
ar2 >> alps::make_pvp("Tableau_view", vc);
ar2 >> alps::make_pvp("TableauC",C);
blas/lapack interface
-------------------------------------------------
* matrix, vector and their views are interfaced with blas/lapack, via boost::numerics::bindings.
* If needed (for a view), a temporary (and silent) copy is made to reorganize the
data before calling blas/lapack (impl: cache class).
Of course, performance is altered, but code is simple...
Examples::
namespace blas = boost::numeric::bindings::blas;
namespace lapack = boost::numeric::bindings::lapack;
triqs_arrays::vector<std::complex<double> > V(5),V2(5);
triqs_arrays::vector <double> V3(2);
triqs_arrays::matrix<double,'F' > M1(2,2), M2(2,2), M3(2,2);
blas::axpy(2.0,V,V2);
blas::gemm(1.0,M1, M2, 1.0, M3);
blas::ger(1.0,V3,V3,M2);
// invert
triqs_arrays::vector <int> ipiv(2);
lapack::getrf(M1, ipiv);
lapack::getri(M1, ipiv);
Transparent use of python arrays
-------------------------------------------------
* If the storage is Tag::numpy, the memory block is allocated/viewed through the numpy interface.
* One can mix arrays with any storage in expression (they have the same concepts).
* boost python converters are enable for those arrays into numpy and their views [impl :broken for views].
Expression
-------------------------------------------------
Simple expressions are made using boost.proto.
Examples ::
array<long,2> A (2,2), B(2,2),C;
C= A + 2*B;
array<long,2> D( A+ 2*B);
// or even in C++0x :
auto e = A + 2*B; // expression, purely formal
array<long,2> D(e); // really makes the computation
cout<< e <<endl ; // prints the expression
cout<< e(1,2) <<endl ; // evaluates just at a point
cout<< e.domain() <<endl ; // just computes the domain
array<long,2> A (2,2), B(2,2),C(2,2);
C= A + 2*B;
C= std::plus<array<long,2> >()(A,B);
C = A + Transpose(B); // Transpose(X) returns a lazy object that models HasImmutableArrayInterface.
C = A + Transpose(B + B); // X can also be an expression...
C = Transpose(B); //
array<double,2> F( 0.5 * A); // Type promotion is automatic
// non square
array<long,2> R(2,3),Rt(3,2);
cout<<" R = "<< array<long,2>(Transpose(R)) <<endl;
// mapping any function
C = map_expr(&sqr,A);
cout<<" C = "<< map_expr(&sqr,A,"SQR")<<" = "<<C<<endl;
// matmul as expression Oi are 'C' or 'F'
matrix<double,O1> M1(2,2); matrix<double,O2> M2(2,2); matrix<double,O3> M3;
// The central instruction : note that matmul returns a lazy object
// that has ImmutableArray interface, and defines a specialized version assignment
// As a result this is equivalent to some matmul_with_lapack(M1,M2,M3) : there is NO intermediate copy.
M3 = matmul(M1,M2);
See expression.hpp.
At the moment, only +,-, * and / by scalar are implemented.
An expression models HasImmutableArrayInterface, i.e. :
* It has a domain (computed from the expression)
* It can be evaluated.
It is then easy to mix them with other objects,
that model the same concept. See e.g. expr2.cpp (map_expr) for examples.
* *Multiplication* :
not decided, since it is not the same for array or matrices.
Two choices :
* Do not add \* for array, matrices (use matmul e.g.) and allow mixing array, matrix
e.g. add an array<int,2> and a matrix <int>
* Add the \*, but then do different expression for array and matrix/vector,
then one can not mix them.
In that case, it is however trivial to say e.g. M + matrix_view<int>(A) if A is an array.

View File

@ -0,0 +1,139 @@
.. highlight:: c
array and array_view : declaration & construction
====================================================================================================================
array and array_view :
* are the standard d-dimensional cuboid array and the corresponding view.
* allow **custom memory ordering** at compile time.
* model the :ref:`HasImmutableArrayInterface` concept.
Template parameters
----------------------------
* The classes have three template parameters.
.. code-block:: c
template <typename ValueType, int Rank, typename Opt= Option::Default > class array_view;
template <typename ValueType, int Rank, typename Opt= Option::Default > class array;
============================ ================================== ========================== ====================================================================
Template parameter Accepted type Access in the class Meaning
============================ ================================== ========================== ====================================================================
ValueType normally a scalar, but any default value_type The type of the element of the array
constructible type (?).
Rank int rank The rank of the array
Opt Option::options< ...> opt_type Compile time options, see below.
============================ ================================== ========================== ====================================================================
Options template parameters are described :ref:`here <option_template>`.
.. _array_constructors:
Constructors of array
---------------------------
========================================== ===========================================================================================
Constructors of array Comments
========================================== ===========================================================================================
array() - Empty array of size 0
array(const array &) - Copy constructor
array(array &&) - Move constructor
array(size_t, ...., size_t) - From the dimensions [number of parameters checked at compile time].
Does **NOT** initialize the array elements to 0 ! (see compile time option)
Use my_array() =0 to do it explicitely.
array(cuboid_domain<rank> const &) - New array with the corresponding domain
array(PyObject * X) - Construct a new array from the Python object X.
NB : X is a borrowed reference, array does affect its counting reference.
- it takes a **copy** of the data of X (or of numpy(X)) into C++.
- X is first transformed into a numpy by the python numpy lib itself
(as if you call numpy.array(X)) if X is not a numpy array or an array of the wrong type
(e.g. you construct an array<double,2> from a numpy of int....), and
copied into the array.
array(const T & X) - Type T models the :ref:`HasImmutableArrayInterface` concept.
- X must have the appropriate domain (checked at compile time).
- Constructs a new array of domain X.domain() and fills it with evaluation of X.
========================================== ===========================================================================================
.. warning::
The constructor from the dimensions does **NOT** initialize the matrix to 0
(because it may not be optimal).
If needed, do it explicitely by (a if the array) `a()=0`;
- LAYOUT
Examples
------------
.. compileblock::
#include <triqs/arrays.hpp>
using triqs::arrays::array; using triqs::arrays::matrix;
using triqs::arrays::vector; using triqs::arrays::permutation;
int main(){
// A 3d array of long, C ordering, no option
array<long, 3> A3(1,2,3);
// A 2d array of double, C ordering, with explicit Bound Checking
array<double, 2> B(1,2);
// a matrix of long
matrix<long> M(2,2);
// a vector of double
vector<double> V(10);
// arrays with custom TraversalOrder
// C-style
array<long, 3, 0, permutation(2,1,0)> A0(2,3,4);
array<long, 3, 0> A0b; // same type but empty
// Fortran-style
array<long, 3, TRAVERSAL_ORDER_FORTRAN> A4 (2,3,4);
array<long, 3, 0, permutation(0,1,2)> A1b(); //same type but empty
// custom : (i,j,k) : index j is fastest, then k, then i
array<long, 3, 0, permutation(1,0,2)> A2(2,3,4);
}
Constructors of array_views
----------------------------------------------
Automatic construction
^^^^^^^^^^^^^^^^^^^^^^^^^^^
array_view are normally automatically constructed by making (partial) views, ref:`Slicing`, e.g. ::
array<int,2> A(2,2);
A(range(),2) ; // --> this makes a view...
A() ; // --> this makes a view over the full array
Explicit construction
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To explicitly make a view of an array, use make_view or the ()::
array<int,2> A(2,2);
make_view(A); //-> a view...
make_view(A) = 13 ; // to assign e.g.
A() = 13; // same thing...
====================================================================== =====================================================================================================
Constructors of array_view Comments
====================================================================== =====================================================================================================
array_view(const array_view &) - Copy construction (shallow copy)
array_view(const T & X) - `[Advanced]` T is any type such that X.indexmap() and X.storage() can be used to construct a view.
array_view(indexmap_type const & I, S_type const &) - `[Advanced]` From a couple of indexmap I and storage of type S_type.
====================================================================== =====================================================================================================

View File

@ -0,0 +1,66 @@
.. highlight:: c
Assignment
=========================
The `value classes` and the `view classes` have a quite general assignment operator.
We will illustrate it on the `array` class, it is the same for `matrix` and `vector`.
* **Syntax** : the syntax is the same in both cases::
template<typename RHS> array & operator=(const RHS & X);
template<typename RHS> array_view & operator=(const RHS & X);
* **What can be RHS ?**
RHS can be ... anything that models the HasImmutableArrayInterface concept !
e.g. : array, array_view, matrix, matrix_view,
but also formal expression (See , e.g. A+B), or any custom object of your choice.
* **Behaviour**
================= ======================================================================= ======================================================================================
Topic value class : array, matrix, vector view: array_view, matrix_view, vector_view
================= ======================================================================= ======================================================================================
RHS ... - RHS models the concept `HasImmutableArrayInterface`. - RHS models HasImmutableArrayInterface
[or less ? : RHS can be evaluated in the domain_type::value_type, no domain needed.].
Effect - array is resized to have a domain X.domain() - View's domain must match X's domain or behaviour is undefined.
- array is filled with the evaluation of X. - array is filled with the evaluation of X.
================= ======================================================================= ======================================================================================
* By evaluation of X, we mean :
- a copy if X is an array.
- computing the value if X is an expression.
* **Optimisation** `[advanced]`
In some case, we know that optimisation is possible.
If the RHS class derives from `Tag::has_special_assign`, then the instruction ::
A = rhs;
will be rewritten by compiler as ::
rhs.assign_invoke(A);
An example is the matmul class, which stores the ref. to the objects to be multiplied.
If A and B are matrices, writing ::
C = matmul(A,B); // (1)
is rewritten as ::
matmul(A,B).assign_invoke(C);
which is then itself rewritten into (without all the messy details) ::
call_lapack( A, B, C); // (2)
The point is that :
* the user code is (1), very simple and readable
* but the compiler compiles (2), which eliminates temporaries...

View File

@ -0,0 +1,103 @@
Basic classes : array, matrix and vector and their views
=================================================================
* The library provides several interoperable forms of arrays :
* array : general (rectangular) `N`-dimensionnal array; models :ref:`HasImmutableArrayInterface` concept.
* matrix : models the :ref:`MutableMatrix` concept.
* vector : models the :ref:`MutableVector` concept.
and the corresponding view classes : array_view, matrix_view, vector_view.
* All these classes contains basically two things :
* a *storage*, i.e. a (shared) pointer to the data in memory.
* an *indexmap*, i.e. an object that encode the index systems and can map it to the memory.
* They differ by their behaviour :
* array, matrix, vector are *values* with value semantics, while the X_view classes
are views, with reference semantics, see below.
* array form an array algebra, where operation are done element-wise, while matrix and vector
for the usual algebra and vector space of linear algebra.
* These classes are largely interoperable, as explained below : it is easy and quick to take a
matrix_view of an array, or vice versa.
* The classes haves similar template parameters :
.. code-block:: c
typedef unsigned long long ull_t;
template <typename ValueType, int Rank, ull_t OptionsFlags=0, ull_t TraversalOrder=0 > class array;
template <typename ValueType, int Rank, ull_t OptionsFlags=0, ull_t TraversalOrder=0 > class array_view;
template <typename ValueType, ull_t OptionsFlags=0, ull_t TraversalOrder=0 > class matrix;
template <typename ValueType, ull_t OptionsFlags=0, ull_t TraversalOrder=0 > class matrix_view;
template <typename ValueType, ull_t OptionsFlags=0> class vector;
template <typename ValueType, ull_t OptionsFlags=0> class vector_view;
where triqs::ull_t is the type defined by :
.. code-block:: c
typedef unsigned long long ull_t;
Template parameters
----------------------------
============================ ================================== ========================== ====================================================================
Template parameter Accepted type Access in the class Meaning
============================ ================================== ========================== ====================================================================
ValueType normally a scalar, but any default value_type The type of the element of the array
constructible type (?).
Rank int rank The rank of the array
OptionsFlags unsigned long long Compile time options, see below.
TraversalOrder unsigned long long Compile time options, see below.
============================ ================================== ========================== ====================================================================
* Rank is only present for array, since matrix have rank 2 and vector rank 1.
* OptionFlags is a series of flags determining various options at compile time.
The possible flags are accessible via a constexpr ull_t in triqs::arrays or a macro :
======================== =======================================
Macro constexpr equivalent
======================== =======================================
BOUND_CHECK triqs::arrays::BoundCheck
TRAVERSAL_ORDER_C triqs::arrays::TraversalOrderC
TRAVERSAL_ORDER_FORTRAN triqs::arrays::TraversalOrderFortran
DEFAULT_INIT triqs::arrays::DefaultInit
======================== =======================================
Defaults can be modified with the macros :
* `TRIQS_ARRAYS_ENFORCE_BOUNDCHECK` : enforce BoundCheck by default (slows down codes ! Use only for debugging purposes).
* `TRIQS_ARRAYS_ENFORCE_INIT_DEFAULT` : init all arrays by default [ NOT IMPLEMENTED]
* TraversalOrder is a coding of the optimal ordering of indices, given by a permutation
evaluated at **compile time**.
The traversal of the arrays (iterators, foreach loop) will be written and optimised for this
order.
The default (0) is understood as regular C-style ordering (slowest index first).
Note that an array can use any index ordering in memory, and that decision is take at run time
(this is necessary for interfacing with python numpy arrays, see below).
The code will be correct for any order, but optimised for the TraversalOrder.
For a few very specials operations (e.g. regrouping of indices), the indices ordering in memory and TraversalOrder
must coincide. This will be explicitely said below. By default, it is not necessary.
The permutation P encodes the position of the index : P[0] is the fastest index, P[rank - 1] the slowest index
(see examples below).
TraversalOrder is not present for vector since there is only one possibility in 1d.
* Examples will be given in the next paragraph, with constructors.

View File

@ -0,0 +1,21 @@
Interoperability
---------------------------------------------------
* These classes are largely similar, and are interoperable.
* One can construct a matrix_view from a array, e.g. (providing the rank of the array is 2, of course...).
* Why several classes then ? The reason is that their algebra (i.e. their behaviour under operations) differ.
For example, a matrix<T> is not really a array<T,2> :
the multiplication for a matrix is the matrix multiplication, while it is element wise for the array.
The expression template implements two different algebras, one for arrays, one for matrices and vectors.
TODO : write the example and code the make_matrix_view function....
Example::
array<double,3> A; matrix<double> M;
auto res = matrix_view<double> ( A(0,range(),range()) ) + M;

View File

@ -0,0 +1,88 @@
.. highlight:: c
Linear algebra
===============================================
Several standard linear algebra operations are provided for the matrix and vector.
Note however that matrix and vector are not the main purpose of this library,
hence the linear algebra support is less extended than other purely matrix library,
like e.g. Eigen.
The computation are done when possible by calling lapack and blas.
In some important cases (like matrix product), a slow but generic version is also
provided for type that lapack do not treat (e.g. matrix of int, matrix of custom objects)
but be aware that these are not optimized for performance and should be used only in
non critical part of the codes.
matrix product
--------------------
The * operator map the matrix x matrix and matrix x vector product.
Example : matrix * matrix and * vector ...
.. compileblock::
#include <triqs/arrays.hpp>
using triqs::arrays::matrix; using triqs::clef::placeholder;
int main() {
// declare an init 2 matrices
placeholder<0> i_; placeholder<1> j_;
matrix<double> A (2,2), B(2,2), C;
A(i_,j_) << i_ + j_ ; B(i_,j_) << 2*i_ + j_ ;
// Making the product
C= A*B;
// Note that the * returns a lazy object
// that has ImmutableArray concept, and defines a specialized version assignment.
// compiler rewrites this as something like matmul_with_lapack (A,B,C);
// There are no temporary here.
std::cout<< " C = " << C<< std::endl;
std::cout<< " A*B = " << A*B << std::endl; // NB A*B does not return a matrix, but
// a lazy expression which is not evaluated until needed.
}
For types that lapack do not use, a generic version of the matrix product is provided.
(same syntax, the dispatch is made at compile time depending of the type of the matrices).
NB :
* The **generic** version of the product will be used if
both matrices do not have the same type.
**Is this reasonnable ??**.
* Is the matrix's slowest index is not contiguous, blas/lapack can not be called directly.
So a temporary copy will be made to reorganize the matrix before calling blas/lapack.
Code is therefore (normally !) always correct, but this can produce a serious performance hit.
Matrix inversion
----------------------
The inverse function return a lazy inverse of any object which has ImmutableMatrix concept
and can therefore be mixed with any other matrix expression.
Example : TO BE WRITTEN
LU decomposition
----------------------
Done. doc to be written
Diagonalization
-------------------
Done. doc to be written
SVD decomposition
-------------------
To be done
Interface with Eigen
------------------------
To be implemented. Only possible for when order is known at compile time.

View File

@ -0,0 +1,25 @@
.. highlight:: c
Operator() : summary
==================================
* To summarize the previous items, here is the list of possible call of array, matrix, vector and their view.
If A is an array, and Args ... the arguments, the return type of the call ::
A( Args ... args)
is summarized in the following table.
=========================================== ========================================================
Arguments Returns
=========================================== ========================================================
None a complete view of the array
One at least Args is clef expression a clef expression
Args is a set of Range, Ellipsis, size_t a view class representing the partial view
=========================================== ========================================================
* Example ::
// write here an example with several variant

View File

@ -0,0 +1,33 @@
Why several classes ?
=================================================================
The library provides several interoperable forms of arrays : array, matrix and vector.
.. note:: Why several classes ?
Because their algebra differ, e.g. a matrix<T> is not really a array<T,2> :
the multiplication for a matrix is the matrix multiplication, while it is element wise for the array.
Interoperability
---------------------------------------------------
* These classes are largely similar, and are interoperable.
* One can construct a matrix_view from a array, e.g. (providing the rank of the array is 2, of course...).
* Why several classes then ? The reason is that their algebra (i.e. their behaviour under operations) differ.
For example, a matrix<T> is not really a array<T,2> :
the multiplication for a matrix is the matrix multiplication, while it is element wise for the array.
The expression template implements two different algebras, one for arrays, one for matrices and vectors.
TODO : write the example and code the make_matrix_view function....
Example::
array<double,3> A; matrix<double> M;
auto res = matrix_view<double> ( A(0,range(),range()) ) + M;

View File

@ -0,0 +1,91 @@
.. highlight:: c
Compound assignment operators : +=, -=, *=, /=
=============================================================
The `value classes` and the `view classes` have a quite general assignment operator (=),
and corresponding compound operators (+=, -=).
We will illustrate it on the `array` class, it is the same for `matrix` and `vector`.
Assignment operator (=)
-------------------------------------------------
The `value classes` and the `view classes` have a quite general assignment operator.
* **Syntax** : the syntax is the same in both cases::
template<typename RHS> array & operator=(const RHS & X);
template<typename RHS> array_view & operator=(const RHS & X);
* **What can be RHS ?**
RHS can be ... anything that models the HasImmutableArrayInterface concept !
e.g. : array, array_view, matrix, matrix_view,
but also formal expression (See , e.g. A+B), or any custom object of your choice.
* **Behaviour**
================= ======================================================================= ======================================================================================
Topic value class : array, matrix, vector view: array_view, matrix_view, vector_view
================= ======================================================================= ======================================================================================
RHS ... - RHS models the concept `HasImmutableArrayInterface`. - RHS models HasImmutableArrayInterface
[or less ? : RHS can be evaluated in the domain_type::value_type, no domain needed.].
Effect - array is resized to have a domain X.domain() - View's domain must match X's domain or behaviour is undefined.
- array is filled with the evaluation of X. - array is filled with the evaluation of X.
================= ======================================================================= ======================================================================================
* By evaluation of X, we mean :
- a copy if X is an array.
- computing the value if X is an expression.
* **Optimisation** `[advanced]`
In some case, we know that optimisation is possible.
If the RHS class derives from `Tag::has_special_assign`, then the instruction ::
A = rhs;
will be rewritten by compiler as ::
rhs.assign_invoke(A);
An example is the matmul class, which stores the ref. to the objects to be multiplied.
If A and B are matrices, writing ::
C = matmul(A,B); // (1)
is rewritten as ::
matmul(A,B).assign_invoke(C);
which is then itself rewritten into (without all the messy details) ::
call_lapack( A, B, C); // (2)
The point is that :
* the user code is (1), very simple and readable
* but the compiler compiles (2), which eliminates temporaries...
Compound operators (+=, -=, * =, /=)
-------------------------------------------------
* **Syntax**
The syntax is natural ::
template<typename RHS> array & operator += (const RHS & X);
template<typename RHS> array & operator -= (const RHS & X);
template<typename RHS> array & operator *= (const Scalar & S);
template<typename RHS> array & operator /= (const Scalar & S);
* **Behaviour**
- Domain must match.
- X is evaluated and added term by term.
To be written : special operators.

View File

@ -0,0 +1,21 @@
.. highlight:: c
Compound operators (+=, -=, *=, /=)
======================================
The `value classes` and the `view classes` behaves similarly.
We will illustrate it on the `array` class, it is the same for `matrix` and `vector`.
* **Syntax**
The syntax is natural ::
template<typename RHS> array & operator += (const RHS & X);
template<typename RHS> array & operator -= (const RHS & X);
template<typename RHS> array & operator *= (const Scalar & S);
template<typename RHS> array & operator /= (const Scalar & S);
* **Behaviour**
- Domain must match.
- X is evaluated and added term by term.

View File

@ -0,0 +1,117 @@
.. highlight:: c
Value classes and their constructors
==============================================================================
* The value classes array, matrix and vector have very similar constructors.
We will therefore describe only for the array, and mention the difference for matrix and vector below.
* As mentioned earlier, they are *values*,
so all these constructors make a **copy** of the data, except of course the move constructor.
Constructors of array
---------------------------
========================================== ===========================================================================================
Constructors of array Comments
========================================== ===========================================================================================
array() Empty array of size 0
------------------------------------------ -------------------------------------------------------------------------------------------
array(size_t, ...., size_t) From the lengths of the array dimensions, with Rank arguments (checked at compile time).
Does **NOT** initialize the array elements to 0 ! (see compile time option)
------------------------------------------ -------------------------------------------------------------------------------------------
array(const array &) Copy construction
------------------------------------------ -------------------------------------------------------------------------------------------
array(array &&) Move construction
------------------------------------------ -------------------------------------------------------------------------------------------
array(const T & X) Type T models the :ref:`HasImmutableArrayInterface` concept.
- X must have the appropriate domain (checked at compile time).
- Constructs a new array of domain X.domain() and fills it with evaluation of X.
------------------------------------------ -------------------------------------------------------------------------------------------
array(shape_t const &) New array with the corresponding shape (as returned by the function shape. See example
in section XXX).
------------------------------------------ -------------------------------------------------------------------------------------------
array(PyObject * X) Construct a new array from the Python object X.
NB : X is a borrowed reference, array does affect its counting reference.
- it takes a **copy** of the data of X (or of numpy(X)) into C++.
- X is first transformed into a numpy by the python numpy lib itself
(as if you call numpy.array(X)) if X is not a numpy array or an array of the wrong type
(e.g. you construct an array<double,2> from a numpy of int....), and
copied into the array.
========================================== ===========================================================================================
.. warning::
The constructor from the dimensions does **NOT** initialize the array to 0
(because it may not be optimal).
If needed, do it explicitely by (a if the array) `a()=0`;, see section ?.
Constructors of matrix
---------------------------
* matrix have similar constructors
========================================== ===========================================================================================
Constructors of matrix Comments
========================================== ===========================================================================================
matrix() empty matrix of size 0
matrix(size_t, size_t) from the dimensions. Does NOT initialize the elements of matrix to 0 !
matrix(const matrix &) copy construction
matrix(matrix &&) move construction
matrix (PyObject * X) Construct a new matrix from the Python object X.
matrix(const T & X) Type T models the :ref:`HasImmutableArrayInterface` concept. Same as array.
========================================== ===========================================================================================
Constructors of vector
---------------------------
========================================== ===========================================================================================
Constructors of vector Comments
========================================== ===========================================================================================
vector() empty vector of size 0
vector(size_t) from the dimensions. Does NOT initialize the elements of vector to 0 !
vector(const vector &) copy construction
vector(vector &&) move construction
vector (PyObject * X) Construct a new vector from the Python object X.
vector(const T & X) Type T models the :ref:`HasImmutableArrayInterface` concept. Same as array.
========================================== ===========================================================================================
Examples
------------
.. compileblock::
#include <triqs/arrays.hpp>
using triqs::arrays::array; using triqs::arrays::matrix;
using triqs::arrays::vector; using triqs::arrays::permutation;
int main(){
// A 3d array of long, C ordering, no option
array<long, 3> A3(1,2,3);
// A 2d array of double, C ordering, with explicit Bound Checking
array<double, 2> B(1,2);
// a matrix of long
matrix<long> M(2,2);
// a vector of double
vector<double> V(10);
// arrays with custom TraversalOrder
// C-style
array<long, 3, 0, permutation(2,1,0)> A0(2,3,4);
array<long, 3, 0> A0b; // same type but empty
// Fortran-style
array<long, 3, TRAVERSAL_ORDER_FORTRAN> A4 (2,3,4);
array<long, 3, 0, permutation(0,1,2)> A1b; //same type but empty
// custom : (i,j,k) : index j is fastest, then k, then i
array<long, 3, 0, permutation(1,0,2)> A2(2,3,4);
}

View File

@ -0,0 +1,36 @@
Array library
*******************************************
.. highlight:: c
.. toctree::
:maxdepth: 1
:numbered:
cookbook
introduction.rst
view_or_not_view
basic_classes
construct
views
move_swap
shape
element_acces
slicing
lazy
call
debug
assignment
algebras
blas_lapack
mapped_fnt
H5
Interop_Python
IO
foreach
STL
map
group_indices
FAQ
Design/contents.rst

View File

@ -0,0 +1,20 @@
Array library
****************
.. warning::
This library is still beta. Beware of bugs !
The documentation of the array library is divided into three parts.
.. highlight:: c
.. toctree::
:maxdepth: 1
introduction.rst
CookBook/contents.rst
UserManual/contents.rst
Design/contents.rst

View File

@ -0,0 +1,220 @@
Basic
============
.. highlight:: c
Declaring and printing an array
-------------------------------
.. compileblock::
#include <triqs/arrays.hpp>
using triqs::arrays::array;
int main(){
array<double,1> A(20);
std::cout << "A = "<<A << std::endl; // arrays are not init by default: this is random
A() = 2; // assign 2 to a complete view of A.
std::cout <<"A = "<< A << std::endl;
A(4) = 5;
std::cout <<"A = "<< A << std::endl;
}
Simple operations
-------------------
.. compileblock::
#include <triqs/arrays.hpp>
using triqs::arrays::array;
int main(){
array<double,1> A(10),B(10);
A()=2;B()=3;
array<double,1> C = A+B;
std::cout << "C = "<<C << std::endl;
}
Simple functions
-------------------
.. compileblock::
#include <triqs/arrays.hpp>
using triqs::arrays::array;
int main(){
array<double,1> A(10),B(10);
A()=2;B()=3;
///.....
}
HDF5 Archiving
-------------------
Archiving an array into an HDF5 file is easy:
.. compileblock::
#include <triqs/arrays.hpp>
using triqs::arrays::array;
int main(){
array<double,2> A(2,2); A() = 3; // declare and init
H5::H5File file("store_A.h5",H5F_ACC_TRUNC); // open the file
h5_write(file,"A",A); // write the array as 'A' into the file
array<double,2> B; // read the file into B
h5_read (file, "A",B);
std::cout << "B = "<<B<<std::endl;
}
Views: ranges and slices
-------------------------
One can easily take a slice of an array to view and modify only part of the underlying data.
.. compileblock::
#include <triqs/arrays/array.hpp>
using triqs::arrays::array; using triqs::arrays::array_view; using triqs::arrays::range;
int main(){
array<double,2> A(3,3); A() = 2.5;
std::cout << A <<std::endl;
array_view<double,1> B = A(1,range()); //select the first line of the matrix
std::cout <<"B = "<< B << std::endl;
B(0) = 1;
std::cout <<"A = "<< A << std::endl;
}
Matrices and vectors
-------------------------
Arrays must be distinguished from vectors and matrices, which have an algebra of their own.
.. compileblock::
#include <triqs/arrays.hpp>
using triqs::arrays::array; using triqs::arrays::matrix; using triqs::arrays::vector;
int main(){
array<double,2> A(2,2), B(2,2),C;
A() = 3; B() = 1; C = A*B;
std::cout << "A*B = "<< C << std::endl;
matrix<double> D(2,2),E(2,2),F;
E() = 3; E() = 1; F = D*E;
std::cout << "C*D = "<< F << std::endl;
vector<double> u(2),v(2),w;
u()=1;v()=2; w = u+v;
std::cout <<"u+v = "<< w << std::endl;
}
Defining through a lazy expression
-----------------------------------
.. compileblock::
#include <triqs/arrays.hpp>
using triqs::arrays::array; namespace tql=triqs::clef;
int main(){
tql::placeholder<0> i_; tql::placeholder<1> j_;
array<double,2> A(2,2);
A(i_,j_) << i_ + j_ ;
std::cout << "A = "<<A << std::endl;
}
Linear algebra
---------------
.. compileblock::
#include <triqs/arrays.hpp>
#include <triqs/arrays/linalg/inverse.hpp>
#include <triqs/arrays/linalg/determinant.hpp>
using triqs::arrays::array; using triqs::arrays::matrix; using triqs::clef::placeholder;
int main(){
placeholder<0> i_;
placeholder<1> j_;
matrix<double> A(2,2);
A(i_,j_) << i_+j_;
matrix<double> B = inverse(A);
double C = determinant(A);
std::cout << "A^(-1) = "<< B << std::endl;
std::cout << "det(A) = " <<C <<std::endl;
}
Map and fold
-------------
.. compileblock::
#include <triqs/arrays.hpp>
#include <triqs/arrays/functional/map.hpp>
using triqs::arrays::array;
double f(int i) { return i*10;}
int main() {
auto F = triqs::arrays::map(std::function<double(int)>(f));
array<int,2> A(2,2); A() =2;
array<double,2> B,C;
A() =2;
B = F(A);
C = F(2*A); // works also with expressions of course
std::cout << "A = "<<A<<std::endl;
std::cout << "F(A) = "<<B<<std::endl;
std::cout << "F(2*A) = "<<C<<std::endl;
}
Bound checking
---------------
By default, there is no bound checking:
.. compileblock::
#include <triqs/arrays.hpp>
using triqs::arrays::array;
int main(){
array<double,2> A(2,2); A() = 3;
std::cout << A(0,3) << std::endl;
}
But one can add bound-checking by adding a preprocessor command:
.. compileblock::
#define TRIQS_ARRAYS_ENFORCE_BOUNDCHECK
#include <triqs/arrays.hpp>
using triqs::arrays::array;
int main(){
try {
array<double,2> A(2,2); A() = 3;
std::cout << A(0,3) << std::endl;
}
//catch (triqs::arrays::key_error & e) { std::cout<< e.what()<< std::endl;}
catch (std::exception & e) { std::cout<< e.what()<< std::endl;} // or like this : triqs::arrays::key_error derives from std::exception
}

View File

@ -0,0 +1,12 @@
Arrays cookbook : learn through simple examples...
**********************************************************************************
.. highlight:: c
.. toctree::
:maxdepth: 2
:numbered:
basic
intermediate

View File

@ -0,0 +1,6 @@
Intermediate
===============
.. highlight:: c

View File

@ -0,0 +1,40 @@
.. highlight:: python
.. _Debug:
Bound checking and debug macros
===================================
To be fast, by default, no check are made on the indices while accessing elements or slicing.
However, checks can be activated in two ways :
* Adding the `BOUND_CHECK` option
* Defining the debug macro TRIQS_ARRAYS_ENFORCE_BOUNDCHECK, which switches the default option to `BOUND_CHECK`
for all arrays, matrices and vectors.
In both cases, if the indices are not within the domain of defintion, an exception triqs::arrays::key_error
will be thrown. It's .what() returns the file and line where the exception occurs, with the stack of all in C++,
e.g. :
.. compileblock::
#define TRIQS_ARRAYS_ENFORCE_BOUNDCHECK
#include <triqs/arrays.hpp>
using triqs::arrays::array;
int main(){
try {
array<double,2> A(2,2); A() = 3;
std::cout << A(0,3) << std::endl;
}
//catch (triqs::arrays::key_error & e) { std::cout<< e.what()<< std::endl;}
catch (std::exception & e) { std::cout<< e.what()<< std::endl;} // or like this : triqs::arrays::key_error derives from std::exception
}
.. note:: Bound Checking is not necessarly used for debugging. You may used it for a given array, catching exception.
Beware however that bound checking comes with some performance penalty.

View File

@ -0,0 +1,27 @@
.. highlight:: c
.. _ElementAccess:
Element access
==================================
The elements of the arrays can be naturally accessed using the ( ) operator.
If A is an array<T,R> and i,j,k, its indices
A(i,j,k) is the element (i,j,k) of the array.
.. compileblock::
#include <triqs/arrays.hpp>
namespace tqa=triqs::arrays;
int main(){
tqa::array<double,2> A(2,3);
A() = 0; // assign 0 to a complete view of A.
A(0,0) = 5;
A(1,1) = 2* A(0,0);
std::cout <<"A = "<< A << std::endl;
}

View File

@ -0,0 +1,19 @@
FILE(GLOB TestList RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
enable_testing()
include_directories( ${CMAKE_CURRENT_BINARY_DIR})
find_package(TestCSimple)
SET( link_libs ${LAPACK_LIBS} ${BOOST_LIBRARY} ${ALPS_EXTRA_LIBRARIES})
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
list (REMOVE_DUPLICATES link_libs)
ENDIF( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
link_libraries( ${link_libs} triqs ) # adding triqs for the stack_trace fun used in exceptions...
FOREACH( TestName1 ${TestList} )
STRING(REPLACE ".cpp" "" TestName ${TestName1})
add_executable( ${TestName} ${CMAKE_CURRENT_SOURCE_DIR}/${TestName}.cpp )
add_test_C_simple( ${TestName} )
ENDFOREACH( TestName1 ${TestList} )

View File

@ -0,0 +1,20 @@
#include <triqs/arrays/array.hpp>
#include <triqs/arrays/h5/simple_read_write.hpp>
namespace tqa=triqs::arrays; namespace h5=tqa::h5;
int main() {
tqa::array<long,2> A(2,2),B; A() = 3; // declare some array and init it
h5::H5File file("ess.h5",H5F_ACC_TRUNC); // open the file ess.h5
h5::write(file,"A",A); // write A in the file as 'A'
file.createGroup("G"); // create a subgroup G (Cf hdf5 doc, C++ API)
h5::write(file,"G/A",A); // write A as G/A
h5::Group G = file.openGroup("G"); // another way to do it : open the group and write G/A2
h5::write(G, "A2",A);
h5::read (file, "A",B); // Read from the file. NB : B is automatically resized
}

Some files were not shown because too many files have changed in this diff Show More