{% set version = "1.8.7" %}

package:
    name: chemps2-multiout
    version: {{ version }}

source:
    git_url: git@github.com:SebWouters/CheMPS2.git      # [linux]
    git_url: https://github.com/SebWouters/CheMPS2.git  # [osx]
    git_tag: v{{ version }}  # v1.8.7 + 0  971c111

build:
    number: 0                                           # [linux]
    number: 0                                           # [osx]
    binary_relocation: true
    skip: true                                          # [win]

requirements:
    build:
        - cmake >=3.1
        - {{ compiler('c') }}
        - {{ compiler('cxx') }}
    host:
        - cython
        - hdf5 {{ hdf5 }}
        - mkl-devel {{ mkl }}                           # [blas_impl == 'mkl']
        - nomkl                                         # [blas_impl != 'mkl']
        - openblas-devel {{ openblas }}                 # [blas_impl == 'openblas']
        - numpy
        - python {{ python }}
        - zlib {{ zlib }}

outputs:
    - name: chemps2
      build:
          requires_features:                                                            # conda 4.4+ internally
              blas: {{ blas_impl }}
          features:                                                                     # conda <=4.3 and 4.4 user access
              - nomkl                                   # [ blas_impl != 'mkl'] 
          ignore_run_exports:
              # not using hdf5's fortran interface
              - libgfortran-ng
          run_exports:
              - {{ pin_subpackage('chemps2', max_pin='x.x.x') }}
      requirements:
          build:
              - cmake >=3.1
              - {{ compiler('c') }}
              - {{ compiler('cxx') }}
          host:
              - hdf5 {{ hdf5 }}
              - mkl-devel {{ mkl }}                     # [blas_impl == 'mkl']
              - nomkl                                   # [blas_impl != 'mkl']
              - openblas-devel {{ openblas }}           # [blas_impl == 'openblas']
              - zlib {{ zlib }}
          run:
              - intel-openmp
      files:
          - bin/chemps2
          - include/chemps2
          - lib/libchemps2*
          - share/cmake/CheMPS2
      test:
          requires:
              - nomkl                                   # [blas_impl != 'mkl']
          commands:
              # Verify library and executable
              - test -f $PREFIX/bin/chemps2
              - test -f $PREFIX/lib/libchemps2$SHLIB_EXT
              # Inspect linkage
              - ldd -r -u $PREFIX/lib/libchemps2.so && return 0  # [linux]
              - ldd -v $PREFIX/lib/libchemps2.so                 # [linux]
              - otool -L $PREFIX/lib/libchemps2.dylib            # [osx]
              - conda-inspect linkages chemps2 --show-files
      about:
          home: http://sebwouters.github.io/CheMPS2
          dev_url: http://github.com/SebWouters/CheMPS2
          doc_url: http://sebwouters.github.io/CheMPS2/index.html
          doc_source_url: https://github.com/SebWouters/CheMPS2/tree/master/sphinx
          license: GPL-2.0+
          license_url: https://opensource.org/licenses/GPL-2.0
          license_family: GPL
          summary: "S. Wouters' spin-adapted implementation of DMRG for ab initio quantum chemistry"
          description: >
            CheMPS2 is a scientific library which contains a spin-adapted implementation of the density matrix renormalization group (DMRG) for ab initio quantum chemistry. This wavefunction method allows to obtain numerical accuracy in active spaces beyond the capabilities of full configuration interaction (FCI), and allows to extract the 2-, 3-, and 4-particle reduced density matrices (2-, 3- and 4-RDM) of the active space.

            For general active spaces up to 40 electrons in 40 orbitals can be handled with DMRG, and for one-dimensional active spaces up to 100 electrons in 100 orbitals. The 2-RDM of these active spaces can also be easily extracted, while the 3- and 4-RDM are limited to about 28 orbitals.

            When the active space size becomes prohibitively expensive for FCI, DMRG can be used to replace the FCI solver in the complete active space self consistent field (CASSCF) method and the corresponding complete active space second order perturbation theory (CASPT2). The corresponding methods are called DMRG-SCF and DMRG-CASPT2, respectively. For DMRG-SCF the active space 2-RDM is required, and for DMRG-CASPT2 the active space 4-RDM.

            CheMPS2 is designed for high-performance computers, with a hybrid parallelization for mixed distributed and shared memory architectures, realized with the Message Passing Interface (MPI) and the Open Multi-Processing (OpenMP) API.

            The CheMPS2 library can be interfaced with quantum chemistry codes which can handle R(O)HF calculations and molecular orbital matrix elements. This has been done for psi4 and pyscf, as described in the user manual. Usage of the library is illustrated in the c++ and python tests.

            The CheMPS2 binary allows to perform DMRG-SCF and DMRG-CASPT2 calculations based on input files. Molecular orbital matrix elements should then be provided in FCIDUMP format. Usage of the binary is illustrated in the binary example.

    - name: pychemps2
      build:
          requires_features:                                                            # conda 4.4+ internally
              blas: {{ blas_impl }}
          features:                                                                     # conda <=4.3 and 4.4 user access
              - nomkl                                   # [ blas_impl != 'mkl'] 
      requirements:
          build:
              - {{ compiler('c') }}
              - {{ compiler('cxx') }}
          host:
              - {{ pin_subpackage('chemps2', max_pin='x.x.x') }}   #exact=True) }}
              - cython
              - numpy
              - nomkl                                   # [blas_impl != 'mkl']
              - python {{ python }}
          run:
              - {{ pin_subpackage('chemps2', max_pin='x.x.x') }}   #exact=True) }}
              #- {{ pin_subpackage('chemps2', exact=True) }}
              - {{ pin_compatible('numpy') }}
              - {{ pin_compatible('python', max_pin='x.x') }}
      files:
          - lib{{ PYMOD_INSTALL_LIBDIR }}/PyCheMPS2*
      test:
          requires:
              - nomkl                                   # [blas_impl != 'mkl']
          source_files:
              - PyCheMPS2/tests/
              - tests/matrixelements/
          commands:
              - export PLPSP=$PREFIX/lib{{ PYMOD_INSTALL_LIBDIR }}
              # Verify library
              - test -f ${PLPSP}/PyCheMPS2.so                               # [py27]
              - test -f ${PLPSP}/PyCheMPS2.cpython-35m-x86_64-linux-gnu.so  # [py35 and linux]
              - test -f ${PLPSP}/PyCheMPS2.cpython-35m-darwin.so            # [py35 and osx]
              - test -f ${PLPSP}/PyCheMPS2.cpython-36m-x86_64-linux-gnu.so  # [py36 and linux]
              - test -f ${PLPSP}/PyCheMPS2.cpython-36m-darwin.so            # [py36 and osx]
              # Inspect linkage
              - ldd -r -u $PLPSP/PyCheMPS2*.so && return 0                  # [linux]
              - ldd -v $PLPSP/PyCheMPS2*.so                                 # [linux]
              - otool -L $PLPSP/PyCheMPS2*.so                               # [osx]
              - conda-inspect linkages pychemps2 --show-files
              # Actually test
              - cd PyCheMPS2/tests/
              - $PYTHON test1.py
      about:
          home: http://sebwouters.github.io/CheMPS2
          dev_url: http://github.com/SebWouters/CheMPS2
          doc_url: http://sebwouters.github.io/CheMPS2/index.html
          doc_source_url: https://github.com/SebWouters/CheMPS2/tree/master/sphinx
          license: GPL-2.0+
          license_url: https://opensource.org/licenses/GPL-2.0
          license_family: GPL
          summary: "python interface to S. Wouters' spin-adapted implementation of DMRG for ab initio quantum chemistry"
          description: >
            CheMPS2 is a scientific library which contains a spin-adapted implementation of the density matrix renormalization group (DMRG) for ab initio quantum chemistry. This wavefunction method allows to obtain numerical accuracy in active spaces beyond the capabilities of full configuration interaction (FCI), and allows to extract the 2-, 3-, and 4-particle reduced density matrices (2-, 3- and 4-RDM) of the active space.

            For general active spaces up to 40 electrons in 40 orbitals can be handled with DMRG, and for one-dimensional active spaces up to 100 electrons in 100 orbitals. The 2-RDM of these active spaces can also be easily extracted, while the 3- and 4-RDM are limited to about 28 orbitals.

            When the active space size becomes prohibitively expensive for FCI, DMRG can be used to replace the FCI solver in the complete active space self consistent field (CASSCF) method and the corresponding complete active space second order perturbation theory (CASPT2). The corresponding methods are called DMRG-SCF and DMRG-CASPT2, respectively. For DMRG-SCF the active space 2-RDM is required, and for DMRG-CASPT2 the active space 4-RDM.

            CheMPS2 is designed for high-performance computers, with a hybrid parallelization for mixed distributed and shared memory architectures, realized with the Message Passing Interface (MPI) and the Open Multi-Processing (OpenMP) API.

            The CheMPS2 library can be interfaced with quantum chemistry codes which can handle R(O)HF calculations and molecular orbital matrix elements. This has been done for psi4 and pyscf, as described in the user manual. Usage of the library is illustrated in the c++ and python tests.

            The CheMPS2 binary allows to perform DMRG-SCF and DMRG-CASPT2 calculations based on input files. Molecular orbital matrix elements should then be provided in FCIDUMP format. Usage of the binary is illustrated in the binary example.
