diff --git a/CMakeLists.txt b/CMakeLists.txt index 929aa9b8..c71b0e28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,9 +37,12 @@ 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}) +# option ALLOW_COMPILATION_IN_SOURCES for brew... +if (NOT ALLOW_COMPILATION_IN_SOURCES) + if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) + message(FATAL_ERROR "On site compilation is not recommended. Use -DALLOW_COMPILATION_IN_SOURCES to overrule this message") + endif (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) +endif() # nasty policy for escaping in string.... cmake_policy(SET CMP0011 OLD) @@ -86,8 +89,7 @@ endif() # ################################# # 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) +option(PythonSupport "Build with Python support" ON) if (PythonSupport) set(TRIQS_WITH_PYTHON_SUPPORT 1) # for the triqs_config.h file configuration @@ -99,7 +101,7 @@ if (PythonSupport) 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}) @@ -153,7 +155,7 @@ message( STATUS "-------- Boost detection -------------") # we take the installed one. set (BOOST_SOURCE_DIR_ENV $ENV{BOOST_SOURCE_DIR}) if (NOT BOOST_SOURCE_DIR AND BOOST_SOURCE_DIR_ENV) - set (BOOST_SOURCE_DIR ${BOOST_SOURCE_DIR_ENV}) + set (BOOST_SOURCE_DIR ${BOOST_SOURCE_DIR_ENV}) endif() if(BOOST_SOURCE_DIR) if(NOT IS_ABSOLUTE ${BOOST_SOURCE_DIR}) @@ -228,7 +230,7 @@ endif (PythonSupport) 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) + set(TRIQS_CXX_DEFINITIONS ${TRIQS_CXX_DEFINITIONS} -fpic) endif (CMAKE_SIZEOF_VOID_P EQUAL 8) # ################################# @@ -249,7 +251,7 @@ set(LAPACK_LIBS ${LAPACK_LIBRARY} ${BLAS_LIBRARY} ${LAPACK_LINKER_FLAGS} CACHE S set(TRIQS_LIBRARY_LAPACK ${LAPACK_LIBS}) if(MAC_VECLIB) - set(TRIQS_LIBRARY_LAPACK "-framework vecLib ${TRIQS_LIBRARY_LAPACK}") + set(TRIQS_LIBRARY_LAPACK "-framework vecLib ${TRIQS_LIBRARY_LAPACK}") endif(MAC_VECLIB) message(STATUS "Lapack libraries : ${TRIQS_LIBRARY_LAPACK}") link_libraries(${TRIQS_LIBRARY_LAPACK}) @@ -303,7 +305,7 @@ set(TRIQS_INCLUDE_FFTW ${FFTW_INCLUDE_DIR}) # 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 ) + set(TRIQS_CXX_DEFINITIONS ${TRIQS_CXX_DEFINITIONS} -pthread ) endif( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # @@ -432,10 +434,10 @@ endif() #------------------------ if (Build_Documentation) -message( STATUS "-------- Prepare documentation -------------") + message( STATUS "-------- Prepare documentation -------------") add_subdirectory (${TRIQS_SOURCE_DIR}/doc ) #add_dependencies(docs_sphinx py_sources) -message( STATUS "----------------------------------------") + message( STATUS "----------------------------------------") endif (Build_Documentation) #------------------------ diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 750944f0..7f9b2e04 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -95,6 +95,7 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ COMPONENT documentation DEST FILES_MATCHING PATTERN "*.html" PATTERN "*.png" + PATTERN "*.jpg" PATTERN "*.js" PATTERN "_*" PATTERN "*.png" diff --git a/doc/_static/logo_erc.jpg b/doc/_static/logo_erc.jpg new file mode 100644 index 00000000..b7181ee0 Binary files /dev/null and b/doc/_static/logo_erc.jpg differ diff --git a/doc/_templates/sideb.html b/doc/_templates/sideb.html index e727887d..ead3b1e2 100644 --- a/doc/_templates/sideb.html +++ b/doc/_templates/sideb.html @@ -1,7 +1,9 @@

- CEA - Ecole Polytechnique - CNRS + CEA + Ecole Polytechnique +
+ CNRS +ERC

TRIQS applications

diff --git a/doc/about.rst b/doc/about.rst index cc3c0179..ee043a97 100644 --- a/doc/about.rst +++ b/doc/about.rst @@ -1,33 +1,41 @@ -Authors -======= +Authors & contributors +========================= + +The TRIQS library is currrently developed by O. Parcollet (IPhT, CEA-Saclay) and M. Ferrero (CPHT, Ecole Polytechique). + +It is supported by ERC under Grant Number XXX. + +We acknowledge contributions from an increasing number of colleagues : + +A. Antipov, T. Ayral, H. Hafermann, I. Krivenko, L. Messio. -The TRIQS library is developped by bla bla bla bla bla.... -as described in reference [#triqs]_. License ======= -The matrix solver is published under the `GNU General Public License, version 3 +TRIQS is published under the `GNU General Public License, version 3 `_. +Note that it *implies* that applications using TRIQS must also be GPL. + Quotation ========= -This application is a part of our scientific work and we would appreciate if +TRIQS is a part of our scientific work and we would appreciate if projects using it will include a citation to the following paper. In order to help you, we provide a BibTeX entry. .. [#triqs] `AUTHORS, JOURNAL, YEAR `_ (:download:`bibtex file `) -If you find the application useful, giving proper reference and citation is +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 +As stated by the License, 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. diff --git a/doc/index.rst b/doc/index.rst index 46314d03..02818fe9 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -1,5 +1,5 @@ .. _welcome: - + Welcome ======= @@ -11,8 +11,34 @@ Welcome have changed too. So go look at our :ref:`changelog page ` to find out how to upgrade to 1.0. -TRIQS is a scientific project providing a set of libraries to develop new tools -for the study of interacting quantum systems. The libraries exist at two +TRIQS is a scientific project providing a set of C++ and Python libraries to develop new tools +for the study of interacting quantum systems. + +The goal of this toolkit is to provide condensed matter physicists with +high quality, high level, efficient and simple to use libraries in C++ and Python, +and to promote the use of modern programming techniques and practices in our field. + +TRIQS is free software (GPL). + +TRIQS applications +----------------------- + +Several :ref:`full-fledged applications ` have been written using +TRIQS and are also maintained by the TRIQS collaboration. They allow for example to +solve a generic quantum impurity model or to run a complete LDA+DMFT +calculation. + +Since 2005, the TRIQS library and applications have allowed to address +questions as diverse as: + +* Momentum-selective aspects on cuprate superconductors (with various cluster DMFT) +* Degree of correlation in iron-based superconductors (within an LDA+DMFT approach) +* Fermionic Mott transition and exploration of Sarma phase in cold-atoms + +C++ & Python +----------------------------- + +The libraries exist at two complementary levels: on the one hand, C++ libraries allow to quickly develop performant low-level codes; on the other hand python libraries implement the most common many-body objects, like Green's functions, that can be manipulated @@ -24,15 +50,4 @@ quantum impurity solver) while the manipulation of the results, preparation of the inputs or interface with other programs can be done at the very user-friendly python level. -Some :ref:`full-fledged applications ` have been written using -TRIQS and are maintained by the TRIQS collaboration. They allow for example to -solve a generic quantum impurity model or to run a complete LDA+DMFT -calculation. - -Since 2005, the TRIQS library and applications have allowed to address -questions as diverse as: - -* Momentum-selective aspects on cuprate superconductors (with various cluster DMFT) -* Degree of correlation in iron-based superconductors (within an LDA+DMFT approach) -* Fermionic Mott transition and exploration of Sarma phase in cold-atoms diff --git a/doc/install.rst b/doc/install.rst index 92fa726b..3400b807 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -6,7 +6,10 @@ Installation ============ - + +This page describes the installation of TRIQS itself. The installation of the applications based on TRIQS +is described in their respective documentation. + Prerequisite ------------ @@ -62,7 +65,7 @@ Installation steps * c++ headers in ``path_to_install_directory/include/triqs``. - * shared items in ``path_to_install_directory/share/triqs``. + * shared items (e.g. the documentation) in ``path_to_install_directory/share/triqs``. Further reading diff --git a/doc/installation/osx_lion.rst b/doc/installation/osx_lion.rst index 900d6e60..2ccddb90 100644 --- a/doc/installation/osx_lion.rst +++ b/doc/installation/osx_lion.rst @@ -35,10 +35,13 @@ Installation of the dependencies brew install zmq brew install python brew install doxygen - - #AFTER THE FIX IN BOOST AND BREW : IN PROGRESS - #brew install boost --without-single --with-mpi --with-c++11 + #brew formula has been repaired. Temporary using our own + #until this is back in the master. + #When 1.55 is out, the regular brew formula should work again ... + ### brew install boost --without-single --with-mpi --with-c++11 + brew install http://ipht.cea.fr/triqs/boost.rb --without-single --with-mpi --with-c++11 -v + 4. Now install virtualenv: :: pip install virtualenv @@ -66,6 +69,7 @@ yield the ones located in ``$HOME/mypython``. pip install scipy pip install mpi4py pip install matplotlib + # seems useless now... #pip install git+https://github.com/matplotlib/matplotlib.git#egg=matplotlib-dev pip install tornado pip install pyzmq diff --git a/doc/installation/requirements.rst b/doc/installation/requirements.rst index ac2face7..8e46b1de 100644 --- a/doc/installation/requirements.rst +++ b/doc/installation/requirements.rst @@ -14,9 +14,9 @@ libraries and tools used by TRIQS are described below. C++ compilers ------------- -TRIQS is written in C++, i.e. in the **C++11** standard as defined by the ISO. +TRIQS is written in C++, i.e. in the **C++11** standard as defined by the ISO standardization committee. A recent compiler is therefore mandatory. -There are 3 categories of C++ compilers. +There are 3 categories of C++ compilers: * Standard compliant C++ compilers @@ -31,8 +31,8 @@ There are 3 categories of C++ compilers. * g++ 4.6.3 to 4.8.0 TRIQS can be built with these compilers but because they lack full C++11 support, - TRIQS may be slower (some optimisations are disabled in the library - and they may not be supported in later release). + TRIQS may be slower (some optimisations are disabled in the library). + These compilers may not be supported in later releases. * C++98 compilers diff --git a/packaging/os_x/boost.rb b/packaging/os_x/boost.rb new file mode 100644 index 00000000..a479f99c --- /dev/null +++ b/packaging/os_x/boost.rb @@ -0,0 +1,175 @@ +require 'formula' + +class UniversalPython < Requirement + satisfy(:build_env => false) { archs_for_command("python").universal? } + + def message; <<-EOS.undent + A universal build was requested, but Python is not a universal build + + Boost compiles against the Python it finds in the path; if this Python + is not a universal build then linking will likely fail. + EOS + end +end + +class Boost < Formula + homepage 'http://www.boost.org' + url 'http://downloads.sourceforge.net/project/boost/boost/1.54.0/boost_1_54_0.tar.bz2' + sha1 '230782c7219882d0fab5f1effbe86edb85238bf4' + + head 'http://svn.boost.org/svn/boost/trunk' + + bottle do + cellar :any + sha1 '767a67f4400e5273db3443e10a6e07704b4cbd0f' => :mountain_lion + sha1 '5f487b4a1d131722dd673d7ee2de418adf3b5322' => :lion + sha1 'cedd9bd34e6dbebc073beeb12fb3aa7a3cb5ecb6' => :snow_leopard + end + + env :userpaths + + option :universal + option 'with-icu', 'Build regexp engine with icu support' + option 'with-c++11', 'Compile using Clang, std=c++11 and stdlib=libc++' if MacOS.version >= :lion + option 'without-single', 'Disable building single-threading variant' + option 'without-static', 'Disable building static library variant' + + depends_on :python => :recommended + depends_on UniversalPython if build.universal? and build.with? "python" + depends_on "icu4c" if build.with? 'icu' + depends_on :mpi => [:cc, :cxx, :optional] + + fails_with :llvm do + build 2335 + cause "Dropped arguments to functions when linking with boost" + end + + def patches + # upstream backported patches for 1.54.0: http://www.boost.org/patches + [ + 'http://www.boost.org/patches/1_54_0/001-coroutine.patch', + 'http://www.boost.org/patches/1_54_0/002-date-time.patch', + 'http://www.boost.org/patches/1_54_0/003-log.patch', + 'http://www.boost.org/patches/1_54_0/004-thread.patch', + 'http://ipht.cea.fr/triqs/boost_1_54_0_mpi_python.patch' + ] unless build.head? + end + + def pour_bottle? + # Don't use the bottle if there is a Homebrew python installed as users + # will probably want to link against that instead. + not Formula.factory('python').installed? + end + + def install + # https://svn.boost.org/trac/boost/ticket/8841 + if build.with? 'mpi' and !build.without? 'single' + onoe <<-EOS.undent + Building MPI support for both single and multi-threaded flavors + is not supported. Please use '--with-mpi' together with + '--disable-single'. + EOS + exit -1 + end + + # Adjust the name the libs are installed under to include the path to the + # Homebrew lib directory so executables will work when installed to a + # non-/usr/local location. + # + # otool -L `which mkvmerge` + # /usr/local/bin/mkvmerge: + # libboost_regex-mt.dylib (compatibility version 0.0.0, current version 0.0.0) + # libboost_filesystem-mt.dylib (compatibility version 0.0.0, current version 0.0.0) + # libboost_system-mt.dylib (compatibility version 0.0.0, current version 0.0.0) + # + # becomes: + # + # /usr/local/bin/mkvmerge: + # /usr/local/lib/libboost_regex-mt.dylib (compatibility version 0.0.0, current version 0.0.0) + # /usr/local/lib/libboost_filesystem-mt.dylib (compatibility version 0.0.0, current version 0.0.0) + # /usr/local/lib/libboost_system-mt.dylib (compatibility version 0.0.0, current version 0.0.0) + inreplace 'tools/build/v2/tools/darwin.jam', '-install_name "', "-install_name \"#{HOMEBREW_PREFIX}/lib/" + + # boost will try to use cc, even if we'd rather it use, say, gcc-4.2 + inreplace 'tools/build/v2/engine/build.sh', 'BOOST_JAM_CC=cc', "BOOST_JAM_CC=#{ENV.cc}" + inreplace 'tools/build/v2/engine/build.jam', 'toolset darwin cc', "toolset darwin #{ENV.cc}" + + # Force boost to compile using the appropriate GCC version + open("user-config.jam", "a") do |file| + file.write "using darwin : : #{ENV.cxx} ;\n" + file.write "using mpi ;\n" if build.with? 'mpi' + end + + # we specify libdir too because the script is apparently broken + bargs = ["--prefix=#{prefix}", "--libdir=#{lib}"] + + bargs << "--with-toolset=clang" if build.with? "c++11" + + if build.with? 'icu' + icu4c_prefix = Formula.factory('icu4c').opt_prefix + bargs << "--with-icu=#{icu4c_prefix}" + else + bargs << '--without-icu' + end + + # The context library is implemented as x86_64 ASM, so it + # won't build on PPC or 32-bit builds + # see https://github.com/mxcl/homebrew/issues/17646 + if Hardware::CPU.type == :ppc || Hardware::CPU.bits == 32 || build.universal? + bargs << "--without-libraries=context" + # The coroutine library depends on the context library. + bargs << "--without-libraries=coroutine" + end + + # Boost.Log cannot be built using Apple GCC at the moment. Disabled + # on such systems. + bargs << "--without-libraries=log" if MacOS.version <= :snow_leopard + + args = ["--prefix=#{prefix}", + "--libdir=#{lib}", + "-d2", + "-j#{ENV.make_jobs}", + "--layout=tagged", + "--user-config=user-config.jam", + "install"] + + if build.include? 'without-single' + args << "threading=multi" + else + args << "threading=multi,single" + end + + if build.include? 'without-static' + args << "link=shared" + else + args << "link=shared,static" + end + + if MacOS.version >= :lion and build.with? 'c++11' + args << "toolset=clang" << "cxxflags=-std=c++11" + args << "cxxflags=-stdlib=libc++" << "cxxflags=-fPIC" + args << "cxxflags=-arch #{Hardware::CPU.arch_64_bit}" if MacOS.prefer_64_bit? or build.universal? + args << "cxxflags=-arch #{Hardware::CPU.arch_32_bit}" if !MacOS.prefer_64_bit? or build.universal? + args << "linkflags=-stdlib=libc++" + args << "linkflags=-arch #{Hardware::CPU.arch_64_bit}" if MacOS.prefer_64_bit? or build.universal? + args << "linkflags=-arch #{Hardware::CPU.arch_32_bit}" if !MacOS.prefer_64_bit? or build.universal? + end + + args << "address-model=32_64" << "architecture=x86" << "pch=off" if build.universal? + args << "--without-python" if build.without? 'python' + + system "./bootstrap.sh", *bargs + system "./b2", *args + + # Need to move the mpi.so at the right place and add the __init__.py file that boost does do itself... + if build.with? 'mpi' and !build.without? 'python' + python_dir = `/usr/local/bin/python -c "from distutils.sysconfig import * ;import sys; sys.stdout.write (get_python_lib(0,0))"` + "/boost" + system "mkdir -p "+ python_dir + system "cd %s && mv -f /usr/local/Cellar/boost/1.54.0/lib/mpi.so . && rm -f /usr/local/lib/mpi.so"% python_dir + open(python_dir + "/__init__.py", "w") do |file| + file.write "import mpi \n" + end + end + + end +end diff --git a/packaging/os_x/triqs.rb b/packaging/os_x/triqs.rb new file mode 100644 index 00000000..2e8c0083 --- /dev/null +++ b/packaging/os_x/triqs.rb @@ -0,0 +1,32 @@ +require 'formula' + +class Triqs < Formula + homepage 'ipht.cea.fr/triqs/' + head 'https://github.com/tomaok/TRIQS.git' ##Thomas'temporary fork where on-site compilation NOT required + #url 'https://github.com/TRIQS/TRIQS/archive/master.zip' ##once the on-site compilation requirement has been removed + #sha1 '' + + depends_on 'cmake' => :build + depends_on 'gfortran' + depends_on 'hdf5' + depends_on 'open-mpi' + depends_on 'fftw' + depends_on 'gmp' + depends_on 'gsl' + depends_on 'python' + depends_on 'doxygen' + depends_on 'zmq' + depends_on 'boost' + + def install + args=["-DPYTHON_INTERPRETER=/usr/local/bin/python", "-DALLOW_COMPILATION_IN_SOURCES" , "-DCMAKE_INSTALL_PREFIX=/usr/local"] + system "cmake", ".", *args + system "make -j8 " # if this fails, try separate make/make install steps + system "make test" + system "make -j8 install" # if this fails, try separate make/make install steps + end + + #def test + # system "pytriqs" + #end +end diff --git a/packaging/os_x/triqs_cthyb_matrix.rb b/packaging/os_x/triqs_cthyb_matrix.rb new file mode 100644 index 00000000..ecfca09b --- /dev/null +++ b/packaging/os_x/triqs_cthyb_matrix.rb @@ -0,0 +1,19 @@ +require 'formula' + +class Triqs_cthyb_matrix < Formula + homepage 'ipht.cea.fr/triqs/XXX' + head 'https://github.com/TRIQS/cthyb_matrix.git' + url 'https://github.com/TRIQS/cthyb_matrix/XXXXX.tar.gz' + #sha1 '' + + depends_on 'triqs' + + def install + args=["-DTRIQS_PATH=/usr/local/"] + system "cmake", ".", *args + system "make -j8 " # if this fails, try separate make/make install steps + system "make test" + system "make -j8 install" # if this fails, try separate make/make install steps + end + +end