unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#32691: OpenMolcas
@ 2018-09-11  4:23 Eric Brown
  2018-09-14  9:27 ` Ludovic Courtès
  2023-08-27  8:53 ` bug#32691: Progress Andreas Enge
  0 siblings, 2 replies; 10+ messages in thread
From: Eric Brown @ 2018-09-11  4:23 UTC (permalink / raw)
  To: 32691

[-- Attachment #1: Type: text/plain, Size: 430 bytes --]

Dear Guix:

I am pleased to submit a patch that adds OpenMolcas to Guix. Also
included in this submission is a new variable called `openblas-ilp64'
which OpenMolcas needs to compile and run.

I would like to point out that I have already submitted the
openblas-ilp64 patch to the list for approval, and I am aware that this
submission may need to be revised to include just the program of
immediate interest.

Best regards,
Eric


[-- Attachment #2: 0001-gnu-Add-openmolcas-and-openblas-ilp64.patch --]
[-- Type: text/x-diff, Size: 14769 bytes --]

From 784cb74747adcc513b75b16b9247bd3dc9a484a3 Mon Sep 17 00:00:00 2001
From: Eric Brown <brown@fastmail.com>
Date: Mon, 10 Sep 2018 23:12:51 -0500
Subject: [PATCH] gnu: Add openmolcas and openblas-ilp64.

* gnu/packages/chemistry.scm (openmolcas): New variable.
* gnu/packages/maths.scm (openblas-ilp64): New variable.
---
 gnu/packages/chemistry.scm                    |  55 ++++++++
 gnu/packages/maths.scm                        |  71 ++++++++++
 .../openmolcas-pymolcas-openblas.patch        | 131 ++++++++++++++++++
 3 files changed, 257 insertions(+)
 create mode 100644 gnu/packages/patches/openmolcas-pymolcas-openblas.patch

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 03120aaee..b4064ee8c 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Konrad Hinsen <konrad.hinsen@fastmail.net>
 ;;; Copyright © 2018 Kei Kebreau <kkebreau@posteo.net>
+;;; Copyright © 2018 Eric Brown <brown@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -26,12 +27,16 @@
   #:use-module (gnu packages boost)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages gcc)
+  #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages gv)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages qt)
+  #:use-module (gnu packages tex)
   #:use-module (gnu packages xml)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
@@ -322,3 +327,53 @@ chemical data.  It's a collaborative project allowing anyone to search, convert,
 analyze, or store data from molecular modeling, chemistry, solid-state
 materials, biochemistry, or related areas.")
     (license license:gpl2)))
+
+(define-public openmolcas
+  (package
+    (name "openmolcas")
+    (version "18.09")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://gitlab.com/Molcas/OpenMolcas"
+                                  "/-/archive/v" version "/OpenMolcas-v"
+                                  version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1krrkff5b4zp9ii1m9v3zzw8d99k72fcwwv3rif8cp10cpxi1wxl"))
+              (patches (search-patches "openmolcas-pymolcas-openblas.patch"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:out-of-source? #t
+       #:tests? #f
+       #:build-type "Release"
+       #:parallel-build? #t
+       #:configure-flags
+       (list "-DLINALG=OpenBLAS"
+             (string-append "-DOPENBLASROOT="
+                            (assoc-ref %build-inputs "blas"))
+             (string-append "-DLINALG_LIBRARIES="
+                            (assoc-ref %build-inputs "blas")
+                            "/lib/libopenblas_ilp64.so"))))
+    (native-inputs
+     `(("fortran" ,gfortran)
+       ("gcc" ,gcc)
+       ("ghostscript" ,ghostscript)
+       ("hdf5" ,hdf5)
+       ("blas" ,openblas-ilp64)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python)
+       ("python-pyparsing" ,python-pyparsing)
+       ("python-six" ,python-six)
+       ("texlive" ,texlive)))
+    (inputs
+     `())
+    (home-page "https://gitlab.com/Molcas/OpenMolcas")
+    (synopsis "Multi-reference electronic structure theory program")
+    (description "OpenMolcas is a quantum chemistry software package developed
+by scientists and intended to be used by scientists. It includes programs to
+apply many different electronic structure methods to chemical systems, but its
+key feature is the multiconfigurational approach, with methods like CASSCF and
+CASPT2.")
+    (license license:lgpl2.1)))
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 01bd03c60..5f1dfec8a 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -27,6 +27,7 @@
 ;;; Copyright © 2018 Nadya Voronova <voronovank@gmail.com>
 ;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
 ;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2018 Eric Brown <brown@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2909,6 +2910,76 @@ parts of it.")
      "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
     (license license:bsd-3)))
 
+(define-public openblas-ilp64
+  (package
+    (name "openblas-ilp64")
+    (version "0.3.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://sourceforge/openblas/v" version "/OpenBLAS%20"
+                           version "%20version.tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "0b20km2jv7m6qiylrlvhq2vnmkmilb633mr8rhqmgbn1wqrp58jq"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       ;; DYNAMIC_ARCH is only supported on x86.  When it is disabled and no
+       ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
+       ;; we need to disable substitutions.
+       #:substitutable?
+        ,(let ((system (or (%current-target-system) (%current-system))))
+           (or (string-prefix? "x86_64" system)
+               (string-prefix? "i686" system)
+               (string-prefix? "mips" system)
+               (string-prefix? "aarch64" system)))
+       #:make-flags
+       (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
+             "SHELL=bash"
+             ;; Build the library for all supported CPUs.  This allows
+             ;; switching CPU targets at runtime with the environment variable
+             ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
+             ;; Unfortunately, this is not supported on non-x86 architectures,
+             ;; where it leads to failed builds.
+             ,@(let ((system (or (%current-target-system) (%current-system))))
+                 (cond
+                  ((or (string-prefix? "x86_64" system)
+                       (string-prefix? "i686" system))
+                   '("DYNAMIC_ARCH=1" "INTERFACE64=1" "LIBNAMESUFFIX=ilp64"))
+                  ;; On MIPS we force the "SICORTEX" TARGET, as for the other
+                  ;; two available MIPS targets special extended instructions
+                  ;; for Loongson cores are used.
+                  ((string-prefix? "mips" system)
+                   '("TARGET=SICORTEX" "INTERFACE64=1" "LIBNAMESUFFIX=ilp64"))
+                  ;; On aarch64 force the generic 'armv8-a' target
+                  ((string-prefix? "aarch64" system)
+                   '("TARGET=ARMV8" "INTERFACE64=1" "LIBNAMESUFFIX=ilp64"))
+                  (else '("INTERFACE64=1" "LIBNAMESUFFIX=ilp64")))))
+       ;; no configure script
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-before 'build 'set-extralib
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Get libgfortran found when building in utest.
+             (setenv "FEXTRALIB"
+                     (string-append "-L" (assoc-ref inputs "fortran-lib")
+                                    "/lib"))
+             #t)))))
+    (inputs
+     `(("fortran-lib" ,gfortran "lib")))
+    (native-inputs
+     `(("cunit" ,cunit)
+       ("fortran" ,gfortran)
+       ("perl" ,perl)))
+    (home-page "http://www.openblas.net/")
+    (synopsis "Optimized BLAS library based on GotoBLAS (ILP64 version)")
+    (description
+     "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version. (ILP64 version)")
+    (license license:bsd-3)))
+
 (define* (make-blis implementation #:optional substitutable?)
   "Return a BLIS package with the given IMPLEMENTATION (see config/ in the
 source tree for a list of implementations.)
diff --git a/gnu/packages/patches/openmolcas-pymolcas-openblas.patch b/gnu/packages/patches/openmolcas-pymolcas-openblas.patch
new file mode 100644
index 000000000..2c7feade6
--- /dev/null
+++ b/gnu/packages/patches/openmolcas-pymolcas-openblas.patch
@@ -0,0 +1,131 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a4071fd..53d8df5 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1338,42 +1338,43 @@ if (LINALG STREQUAL "OpenBLAS")
+         endif ()
+ 
+         # search for the OpenBLAS library
+-        find_library (LIBOPENBLAS
+-                NAMES openblas
+-                PATHS ${OPENBLASROOT}
+-                PATH_SUFFIXES lib
+-                NO_DEFAULT_PATH)
+-
+-        if (NOT LIBOPENBLAS)
+-                message (FATAL_ERROR
+-                        "OpenBLAS library not found, please check that "
+-                        "the OPENBLASROOT variable is set and points to "
+-                        "a valid OpenBLAS installation directory."
+-                        )
+-        endif ()
+-
+-        # here we check if LIBOPENBLAS has changed after it was processed
+-        # succesfully, if not we do not need to rerun anything here.
+-        if (NOT LIBOPENBLAS STREQUAL LIBOPENBLAS_LAST)
+-                # check if the OpenBLAS library contains LAPACK functionality
+-                message ("-- Checking OpenBLAS for LAPACK functionality...")
+-                include(CheckFortranFunctionExists)
+-                set (CMAKE_REQUIRED_LIBRARIES ${LIBOPENBLAS})
+-                unset (OPENBLAS_WITH_LAPACK CACHE)
+-                check_fortran_function_exists("dsyev" OPENBLAS_WITH_LAPACK)
+-                if (NOT OPENBLAS_WITH_LAPACK)
+-                        unset (LIBOPENBLAS CACHE)
+-                        message (FATAL_ERROR
+-                                "LAPACK functionality missing from OpenBLAS library, "
+-                                "please build OpenBLAS with NO_LAPACK=0 defined."
+-                                )
+-                endif ()
+-                # save the last location to check if it changed between configurations
+-                set (LIBOPENBLAS_LAST ${LIBOPENBLAS} CACHE INTERNAL "last value." FORCE)
+-        endif ()
+-
+-        add_definitions (-D_OPENBLAS_)
+-        set (LINALG_LIBRARIES ${LIBOPENBLAS})
++#        find_library (LIBOPENBLAS
++#                NAMES openblas
++#                PATHS ${OPENBLASROOT}
++#                PATH_SUFFIXES lib
++#                NO_DEFAULT_PATH)
++#
++#        if (NOT LIBOPENBLAS)
++#                message (FATAL_ERROR
++#                        "OpenBLAS library not found, please check that "
++#                        "the OPENBLASROOT variable is set and points to "
++#                        "a valid OpenBLAS installation directory."
++#                        )
++#        endif ()
++#
++#        # here we check if LIBOPENBLAS has changed after it was processed
++#        # succesfully, if not we do not need to rerun anything here.
++#        if (NOT LIBOPENBLAS STREQUAL LIBOPENBLAS_LAST)
++#                # check if the OpenBLAS library contains LAPACK functionality
++#                message ("-- Checking OpenBLAS for LAPACK functionality...")
++#                include(CheckFortranFunctionExists)
++#                set (CMAKE_REQUIRED_LIBRARIES ${LIBOPENBLAS})
++#                unset (OPENBLAS_WITH_LAPACK CACHE)
++#                check_fortran_function_exists("dsyev" OPENBLAS_WITH_LAPACK)
++#                if (NOT OPENBLAS_WITH_LAPACK)
++#                        unset (LIBOPENBLAS CACHE)
++#                        message (FATAL_ERROR
++#                                "LAPACK functionality missing from OpenBLAS library, "
++#                                "please build OpenBLAS with NO_LAPACK=0 defined."
++#                                )
++#                endif ()
++#                # save the last location to check if it changed between configurations
++#                set (LIBOPENBLAS_LAST ${LIBOPENBLAS} CACHE INTERNAL "last value." FORCE)
++#        endif ()
++#
++        add_definitions (-D_OPENBLAS_)
++#        set (LINALG_LIBRARIES ${LIBOPENBLAS})
++         set (LINALG_LIBRARIES ${LINALG_LIBRARIES})
+ else ()
+         mark_as_advanced(FORCE OPENBLASROOT)
+ endif ()
+@@ -3167,11 +3168,11 @@ install (PROGRAMS
+ if (DEFINED PYMOLCAS_TARGET)
+         install (PROGRAMS
+                 ${PYMOLCAS_TARGET}
+-                DESTINATION ${CMAKE_INSTALL_PREFIX}/sbin
++                DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+                 RENAME pymolcas
+                 )
+ 
+-        install (CODE "execute_process(COMMAND ${OPENMOLCAS_DIR}/sbin/install_pymolcas.sh ${PYMOLCAS_TARGET})")
++#        install (CODE "execute_process(COMMAND ${OPENMOLCAS_DIR}/sbin/install_pymolcas.sh ${PYMOLCAS_TARGET})")
+ endif ()
+ 
+ if (DEFINED EXTRA_DIR)
+@@ -3188,9 +3189,9 @@ if (DEFINED EXTRA_DIR)
+                 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+                 )
+ 
+-        install (CODE "execute_process(COMMAND ${OPENMOLCAS_DIR}/sbin/install_driver.sh ${MOLCAS_DRIVER})")
++#        install (CODE "execute_process(COMMAND ${OPENMOLCAS_DIR}/sbin/install_driver.sh ${MOLCAS_DRIVER})")
+ endif ()
+ 
+-if (IS_DIRECTORY "$ENV{HOME}/.Molcas")
+-        install (CODE "execute_process(COMMAND sh \"-c\" \"cd ${CMAKE_INSTALL_PREFIX}; echo `pwd` > $HOME/.Molcas/molcas 2> /dev/null\")")
+-endif ()
++#if (IS_DIRECTORY "$ENV{HOME}/.Molcas")
++#        install (CODE "execute_process(COMMAND sh \"-c\" \"cd ${CMAKE_INSTALL_PREFIX}; echo `pwd` > $HOME/.Molcas/molcas 2> /dev/null\")")
++#endif ()
+diff --git a/Tools/pymolcas/CMakeLists.txt b/Tools/pymolcas/CMakeLists.txt
+index 0d576fa..f9ba6d7 100644
+--- a/Tools/pymolcas/CMakeLists.txt
++++ b/Tools/pymolcas/CMakeLists.txt
+@@ -52,9 +52,9 @@ if (PYTHONINTERP_FOUND)
+                         DEPENDS ${PYMOLCAS_TARGET}
+                         )
+ 
+-                add_custom_command (TARGET pymolcas
+-                        POST_BUILD
+-                        COMMAND ${OPENMOLCAS_DIR}/sbin/install_pymolcas.sh ${PYMOLCAS_TARGET}
+-                )
++#                add_custom_command (TARGET pymolcas
++#                        POST_BUILD
++#                        COMMAND ${OPENMOLCAS_DIR}/sbin/install_pymolcas.sh ${PYMOLCAS_TARGET}
++#                )
+ 
+         endif ()
+
-- 
2.18.0


[-- Attachment #3: 0001-gnu-Add-openmolcas-and-openblas-ilp64.patch --]
[-- Type: text/x-diff, Size: 14769 bytes --]

From 784cb74747adcc513b75b16b9247bd3dc9a484a3 Mon Sep 17 00:00:00 2001
From: Eric Brown <brown@fastmail.com>
Date: Mon, 10 Sep 2018 23:12:51 -0500
Subject: [PATCH] gnu: Add openmolcas and openblas-ilp64.

* gnu/packages/chemistry.scm (openmolcas): New variable.
* gnu/packages/maths.scm (openblas-ilp64): New variable.
---
 gnu/packages/chemistry.scm                    |  55 ++++++++
 gnu/packages/maths.scm                        |  71 ++++++++++
 .../openmolcas-pymolcas-openblas.patch        | 131 ++++++++++++++++++
 3 files changed, 257 insertions(+)
 create mode 100644 gnu/packages/patches/openmolcas-pymolcas-openblas.patch

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 03120aaee..b4064ee8c 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Konrad Hinsen <konrad.hinsen@fastmail.net>
 ;;; Copyright © 2018 Kei Kebreau <kkebreau@posteo.net>
+;;; Copyright © 2018 Eric Brown <brown@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -26,12 +27,16 @@
   #:use-module (gnu packages boost)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages gcc)
+  #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages gv)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages qt)
+  #:use-module (gnu packages tex)
   #:use-module (gnu packages xml)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
@@ -322,3 +327,53 @@ chemical data.  It's a collaborative project allowing anyone to search, convert,
 analyze, or store data from molecular modeling, chemistry, solid-state
 materials, biochemistry, or related areas.")
     (license license:gpl2)))
+
+(define-public openmolcas
+  (package
+    (name "openmolcas")
+    (version "18.09")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://gitlab.com/Molcas/OpenMolcas"
+                                  "/-/archive/v" version "/OpenMolcas-v"
+                                  version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1krrkff5b4zp9ii1m9v3zzw8d99k72fcwwv3rif8cp10cpxi1wxl"))
+              (patches (search-patches "openmolcas-pymolcas-openblas.patch"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:out-of-source? #t
+       #:tests? #f
+       #:build-type "Release"
+       #:parallel-build? #t
+       #:configure-flags
+       (list "-DLINALG=OpenBLAS"
+             (string-append "-DOPENBLASROOT="
+                            (assoc-ref %build-inputs "blas"))
+             (string-append "-DLINALG_LIBRARIES="
+                            (assoc-ref %build-inputs "blas")
+                            "/lib/libopenblas_ilp64.so"))))
+    (native-inputs
+     `(("fortran" ,gfortran)
+       ("gcc" ,gcc)
+       ("ghostscript" ,ghostscript)
+       ("hdf5" ,hdf5)
+       ("blas" ,openblas-ilp64)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python)
+       ("python-pyparsing" ,python-pyparsing)
+       ("python-six" ,python-six)
+       ("texlive" ,texlive)))
+    (inputs
+     `())
+    (home-page "https://gitlab.com/Molcas/OpenMolcas")
+    (synopsis "Multi-reference electronic structure theory program")
+    (description "OpenMolcas is a quantum chemistry software package developed
+by scientists and intended to be used by scientists. It includes programs to
+apply many different electronic structure methods to chemical systems, but its
+key feature is the multiconfigurational approach, with methods like CASSCF and
+CASPT2.")
+    (license license:lgpl2.1)))
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 01bd03c60..5f1dfec8a 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -27,6 +27,7 @@
 ;;; Copyright © 2018 Nadya Voronova <voronovank@gmail.com>
 ;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
 ;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2018 Eric Brown <brown@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2909,6 +2910,76 @@ parts of it.")
      "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
     (license license:bsd-3)))
 
+(define-public openblas-ilp64
+  (package
+    (name "openblas-ilp64")
+    (version "0.3.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://sourceforge/openblas/v" version "/OpenBLAS%20"
+                           version "%20version.tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "0b20km2jv7m6qiylrlvhq2vnmkmilb633mr8rhqmgbn1wqrp58jq"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       ;; DYNAMIC_ARCH is only supported on x86.  When it is disabled and no
+       ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
+       ;; we need to disable substitutions.
+       #:substitutable?
+        ,(let ((system (or (%current-target-system) (%current-system))))
+           (or (string-prefix? "x86_64" system)
+               (string-prefix? "i686" system)
+               (string-prefix? "mips" system)
+               (string-prefix? "aarch64" system)))
+       #:make-flags
+       (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
+             "SHELL=bash"
+             ;; Build the library for all supported CPUs.  This allows
+             ;; switching CPU targets at runtime with the environment variable
+             ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
+             ;; Unfortunately, this is not supported on non-x86 architectures,
+             ;; where it leads to failed builds.
+             ,@(let ((system (or (%current-target-system) (%current-system))))
+                 (cond
+                  ((or (string-prefix? "x86_64" system)
+                       (string-prefix? "i686" system))
+                   '("DYNAMIC_ARCH=1" "INTERFACE64=1" "LIBNAMESUFFIX=ilp64"))
+                  ;; On MIPS we force the "SICORTEX" TARGET, as for the other
+                  ;; two available MIPS targets special extended instructions
+                  ;; for Loongson cores are used.
+                  ((string-prefix? "mips" system)
+                   '("TARGET=SICORTEX" "INTERFACE64=1" "LIBNAMESUFFIX=ilp64"))
+                  ;; On aarch64 force the generic 'armv8-a' target
+                  ((string-prefix? "aarch64" system)
+                   '("TARGET=ARMV8" "INTERFACE64=1" "LIBNAMESUFFIX=ilp64"))
+                  (else '("INTERFACE64=1" "LIBNAMESUFFIX=ilp64")))))
+       ;; no configure script
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-before 'build 'set-extralib
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Get libgfortran found when building in utest.
+             (setenv "FEXTRALIB"
+                     (string-append "-L" (assoc-ref inputs "fortran-lib")
+                                    "/lib"))
+             #t)))))
+    (inputs
+     `(("fortran-lib" ,gfortran "lib")))
+    (native-inputs
+     `(("cunit" ,cunit)
+       ("fortran" ,gfortran)
+       ("perl" ,perl)))
+    (home-page "http://www.openblas.net/")
+    (synopsis "Optimized BLAS library based on GotoBLAS (ILP64 version)")
+    (description
+     "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version. (ILP64 version)")
+    (license license:bsd-3)))
+
 (define* (make-blis implementation #:optional substitutable?)
   "Return a BLIS package with the given IMPLEMENTATION (see config/ in the
 source tree for a list of implementations.)
diff --git a/gnu/packages/patches/openmolcas-pymolcas-openblas.patch b/gnu/packages/patches/openmolcas-pymolcas-openblas.patch
new file mode 100644
index 000000000..2c7feade6
--- /dev/null
+++ b/gnu/packages/patches/openmolcas-pymolcas-openblas.patch
@@ -0,0 +1,131 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a4071fd..53d8df5 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1338,42 +1338,43 @@ if (LINALG STREQUAL "OpenBLAS")
+         endif ()
+ 
+         # search for the OpenBLAS library
+-        find_library (LIBOPENBLAS
+-                NAMES openblas
+-                PATHS ${OPENBLASROOT}
+-                PATH_SUFFIXES lib
+-                NO_DEFAULT_PATH)
+-
+-        if (NOT LIBOPENBLAS)
+-                message (FATAL_ERROR
+-                        "OpenBLAS library not found, please check that "
+-                        "the OPENBLASROOT variable is set and points to "
+-                        "a valid OpenBLAS installation directory."
+-                        )
+-        endif ()
+-
+-        # here we check if LIBOPENBLAS has changed after it was processed
+-        # succesfully, if not we do not need to rerun anything here.
+-        if (NOT LIBOPENBLAS STREQUAL LIBOPENBLAS_LAST)
+-                # check if the OpenBLAS library contains LAPACK functionality
+-                message ("-- Checking OpenBLAS for LAPACK functionality...")
+-                include(CheckFortranFunctionExists)
+-                set (CMAKE_REQUIRED_LIBRARIES ${LIBOPENBLAS})
+-                unset (OPENBLAS_WITH_LAPACK CACHE)
+-                check_fortran_function_exists("dsyev" OPENBLAS_WITH_LAPACK)
+-                if (NOT OPENBLAS_WITH_LAPACK)
+-                        unset (LIBOPENBLAS CACHE)
+-                        message (FATAL_ERROR
+-                                "LAPACK functionality missing from OpenBLAS library, "
+-                                "please build OpenBLAS with NO_LAPACK=0 defined."
+-                                )
+-                endif ()
+-                # save the last location to check if it changed between configurations
+-                set (LIBOPENBLAS_LAST ${LIBOPENBLAS} CACHE INTERNAL "last value." FORCE)
+-        endif ()
+-
+-        add_definitions (-D_OPENBLAS_)
+-        set (LINALG_LIBRARIES ${LIBOPENBLAS})
++#        find_library (LIBOPENBLAS
++#                NAMES openblas
++#                PATHS ${OPENBLASROOT}
++#                PATH_SUFFIXES lib
++#                NO_DEFAULT_PATH)
++#
++#        if (NOT LIBOPENBLAS)
++#                message (FATAL_ERROR
++#                        "OpenBLAS library not found, please check that "
++#                        "the OPENBLASROOT variable is set and points to "
++#                        "a valid OpenBLAS installation directory."
++#                        )
++#        endif ()
++#
++#        # here we check if LIBOPENBLAS has changed after it was processed
++#        # succesfully, if not we do not need to rerun anything here.
++#        if (NOT LIBOPENBLAS STREQUAL LIBOPENBLAS_LAST)
++#                # check if the OpenBLAS library contains LAPACK functionality
++#                message ("-- Checking OpenBLAS for LAPACK functionality...")
++#                include(CheckFortranFunctionExists)
++#                set (CMAKE_REQUIRED_LIBRARIES ${LIBOPENBLAS})
++#                unset (OPENBLAS_WITH_LAPACK CACHE)
++#                check_fortran_function_exists("dsyev" OPENBLAS_WITH_LAPACK)
++#                if (NOT OPENBLAS_WITH_LAPACK)
++#                        unset (LIBOPENBLAS CACHE)
++#                        message (FATAL_ERROR
++#                                "LAPACK functionality missing from OpenBLAS library, "
++#                                "please build OpenBLAS with NO_LAPACK=0 defined."
++#                                )
++#                endif ()
++#                # save the last location to check if it changed between configurations
++#                set (LIBOPENBLAS_LAST ${LIBOPENBLAS} CACHE INTERNAL "last value." FORCE)
++#        endif ()
++#
++        add_definitions (-D_OPENBLAS_)
++#        set (LINALG_LIBRARIES ${LIBOPENBLAS})
++         set (LINALG_LIBRARIES ${LINALG_LIBRARIES})
+ else ()
+         mark_as_advanced(FORCE OPENBLASROOT)
+ endif ()
+@@ -3167,11 +3168,11 @@ install (PROGRAMS
+ if (DEFINED PYMOLCAS_TARGET)
+         install (PROGRAMS
+                 ${PYMOLCAS_TARGET}
+-                DESTINATION ${CMAKE_INSTALL_PREFIX}/sbin
++                DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+                 RENAME pymolcas
+                 )
+ 
+-        install (CODE "execute_process(COMMAND ${OPENMOLCAS_DIR}/sbin/install_pymolcas.sh ${PYMOLCAS_TARGET})")
++#        install (CODE "execute_process(COMMAND ${OPENMOLCAS_DIR}/sbin/install_pymolcas.sh ${PYMOLCAS_TARGET})")
+ endif ()
+ 
+ if (DEFINED EXTRA_DIR)
+@@ -3188,9 +3189,9 @@ if (DEFINED EXTRA_DIR)
+                 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+                 )
+ 
+-        install (CODE "execute_process(COMMAND ${OPENMOLCAS_DIR}/sbin/install_driver.sh ${MOLCAS_DRIVER})")
++#        install (CODE "execute_process(COMMAND ${OPENMOLCAS_DIR}/sbin/install_driver.sh ${MOLCAS_DRIVER})")
+ endif ()
+ 
+-if (IS_DIRECTORY "$ENV{HOME}/.Molcas")
+-        install (CODE "execute_process(COMMAND sh \"-c\" \"cd ${CMAKE_INSTALL_PREFIX}; echo `pwd` > $HOME/.Molcas/molcas 2> /dev/null\")")
+-endif ()
++#if (IS_DIRECTORY "$ENV{HOME}/.Molcas")
++#        install (CODE "execute_process(COMMAND sh \"-c\" \"cd ${CMAKE_INSTALL_PREFIX}; echo `pwd` > $HOME/.Molcas/molcas 2> /dev/null\")")
++#endif ()
+diff --git a/Tools/pymolcas/CMakeLists.txt b/Tools/pymolcas/CMakeLists.txt
+index 0d576fa..f9ba6d7 100644
+--- a/Tools/pymolcas/CMakeLists.txt
++++ b/Tools/pymolcas/CMakeLists.txt
+@@ -52,9 +52,9 @@ if (PYTHONINTERP_FOUND)
+                         DEPENDS ${PYMOLCAS_TARGET}
+                         )
+ 
+-                add_custom_command (TARGET pymolcas
+-                        POST_BUILD
+-                        COMMAND ${OPENMOLCAS_DIR}/sbin/install_pymolcas.sh ${PYMOLCAS_TARGET}
+-                )
++#                add_custom_command (TARGET pymolcas
++#                        POST_BUILD
++#                        COMMAND ${OPENMOLCAS_DIR}/sbin/install_pymolcas.sh ${PYMOLCAS_TARGET}
++#                )
+ 
+         endif ()
+
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#32691: OpenMolcas
  2018-09-11  4:23 bug#32691: OpenMolcas Eric Brown
@ 2018-09-14  9:27 ` Ludovic Courtès
  2018-09-14 14:55   ` Eric Brown
  2023-08-27  8:53 ` bug#32691: Progress Andreas Enge
  1 sibling, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2018-09-14  9:27 UTC (permalink / raw)
  To: Eric Brown; +Cc: 32691

[-- Attachment #1: Type: text/plain, Size: 940 bytes --]

Hi Eric,

Eric Brown <brown@fastmail.com> skribis:

> I am pleased to submit a patch that adds OpenMolcas to Guix. Also
> included in this submission is a new variable called `openblas-ilp64'
> which OpenMolcas needs to compile and run.

Here’s a revision of the patch with several modifications: I added
comments in the patch (though they don’t explain the Python-related
changes for instance; could you add a line about these?), stripped
unnecessary additions from the patch, added it to gnu/local.mk, fixed
an issue reported by ‘guix lint’ in the description.

However, could you explain why we have #:tests? #f ?  In general
disabling tests should be accompanied with a comment explaining the
reason (lack of a test suite, or “unsolvable” test failures.)  If there
are test failures, we’d rather investigate than disable the tests.

Could you send an updated patch?

Thanks in advance!

Ludo’.


[-- Attachment #2: the patch --]
[-- Type: text/x-patch, Size: 8810 bytes --]

From c001d557e1cb23042c092c23d7612ad6197fac3c Mon Sep 17 00:00:00 2001
From: Eric Brown <brown@fastmail.com>
Date: Mon, 10 Sep 2018 23:12:51 -0500
Subject: [PATCH] gnu: Add openmolcas.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* gnu/packages/chemistry.scm (openmolcas): New variable.
* gnu/packages/patches/openmolcas-pymolcas-openblas.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
 gnu/local.mk                                  |  1 +
 gnu/packages/chemistry.scm                    | 52 +++++++++++
 .../openmolcas-pymolcas-openblas.patch        | 89 +++++++++++++++++++
 3 files changed, 142 insertions(+)
 create mode 100644 gnu/packages/patches/openmolcas-pymolcas-openblas.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 7b230cb6f..0974ce068 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1006,6 +1006,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/opencascade-oce-glibc-2.26.patch		\
   %D%/packages/patches/openfoam-4.1-cleanup.patch			\
   %D%/packages/patches/openldap-CVE-2017-9287.patch		\
+  %D%/packages/patches/openmolcas-pymolcas-openblas.patch	\
   %D%/packages/patches/openocd-nrf52.patch			\
   %D%/packages/patches/opensmtpd-fix-crash.patch		\
   %D%/packages/patches/openssl-runpath.patch			\
diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 03120aaee..58151afce 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Konrad Hinsen <konrad.hinsen@fastmail.net>
 ;;; Copyright © 2018 Kei Kebreau <kkebreau@posteo.net>
+;;; Copyright © 2018 Eric Brown <brown@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -26,12 +27,16 @@
   #:use-module (gnu packages boost)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages gcc)
+  #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages gv)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages qt)
+  #:use-module (gnu packages tex)
   #:use-module (gnu packages xml)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
@@ -322,3 +327,50 @@ chemical data.  It's a collaborative project allowing anyone to search, convert,
 analyze, or store data from molecular modeling, chemistry, solid-state
 materials, biochemistry, or related areas.")
     (license license:gpl2)))
+
+(define-public openmolcas
+  (package
+    (name "openmolcas")
+    (version "18.09")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://gitlab.com/Molcas/OpenMolcas"
+                                  "/-/archive/v" version "/OpenMolcas-v"
+                                  version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1krrkff5b4zp9ii1m9v3zzw8d99k72fcwwv3rif8cp10cpxi1wxl"))
+              (patches (search-patches "openmolcas-pymolcas-openblas.patch"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:out-of-source? #t
+       #:tests? #f
+       #:build-type "Release"
+       #:configure-flags
+       (list "-DLINALG=OpenBLAS"
+             (string-append "-DOPENBLASROOT="
+                            (assoc-ref %build-inputs "blas"))
+             (string-append "-DLINALG_LIBRARIES="
+                            (assoc-ref %build-inputs "blas")
+                            "/lib/libopenblas_ilp64.so"))))
+    (native-inputs
+     `(("fortran" ,gfortran)
+       ("ghostscript" ,ghostscript)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python)
+       ("python-pyparsing" ,python-pyparsing)
+       ("python-six" ,python-six)
+       ("texlive" ,texlive)))
+    (inputs
+     `(("hdf5" ,hdf5)
+       ("blas" ,openblas-ilp64)))
+    (home-page "https://gitlab.com/Molcas/OpenMolcas")
+    (synopsis "Multi-reference electronic structure theory program")
+    (description "OpenMolcas is a quantum chemistry software package developed
+by scientists and intended to be used by scientists.  It includes programs to
+apply many different electronic structure methods to chemical systems, but its
+key feature is the multiconfigurational approach, with methods like CASSCF and
+CASPT2.")
+    (license license:lgpl2.1)))
diff --git a/gnu/packages/patches/openmolcas-pymolcas-openblas.patch b/gnu/packages/patches/openmolcas-pymolcas-openblas.patch
new file mode 100644
index 000000000..b18c62e05
--- /dev/null
+++ b/gnu/packages/patches/openmolcas-pymolcas-openblas.patch
@@ -0,0 +1,89 @@
+Allow bulds with openblas-ilp64.
+Remove assumptions about $HOME.
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a4071fd..53d8df5 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1338,42 +1338,8 @@ if (LINALG STREQUAL "OpenBLAS")
+         endif ()
+ 
+         # search for the OpenBLAS library
+-        find_library (LIBOPENBLAS
+-                NAMES openblas
+-                PATHS ${OPENBLASROOT}
+-                PATH_SUFFIXES lib
+-                NO_DEFAULT_PATH)
+-
+-        if (NOT LIBOPENBLAS)
+-                message (FATAL_ERROR
+-                        "OpenBLAS library not found, please check that "
+-                        "the OPENBLASROOT variable is set and points to "
+-                        "a valid OpenBLAS installation directory."
+-                        )
+-        endif ()
+-
+-        # here we check if LIBOPENBLAS has changed after it was processed
+-        # succesfully, if not we do not need to rerun anything here.
+-        if (NOT LIBOPENBLAS STREQUAL LIBOPENBLAS_LAST)
+-                # check if the OpenBLAS library contains LAPACK functionality
+-                message ("-- Checking OpenBLAS for LAPACK functionality...")
+-                include(CheckFortranFunctionExists)
+-                set (CMAKE_REQUIRED_LIBRARIES ${LIBOPENBLAS})
+-                unset (OPENBLAS_WITH_LAPACK CACHE)
+-                check_fortran_function_exists("dsyev" OPENBLAS_WITH_LAPACK)
+-                if (NOT OPENBLAS_WITH_LAPACK)
+-                        unset (LIBOPENBLAS CACHE)
+-                        message (FATAL_ERROR
+-                                "LAPACK functionality missing from OpenBLAS library, "
+-                                "please build OpenBLAS with NO_LAPACK=0 defined."
+-                                )
+-                endif ()
+-                # save the last location to check if it changed between configurations
+-                set (LIBOPENBLAS_LAST ${LIBOPENBLAS} CACHE INTERNAL "last value." FORCE)
+-        endif ()
+-
+         add_definitions (-D_OPENBLAS_)
+-        set (LINALG_LIBRARIES ${LIBOPENBLAS})
++        set (LINALG_LIBRARIES ${LINALG_LIBRARIES})
+ else ()
+         mark_as_advanced(FORCE OPENBLASROOT)
+ endif ()
+@@ -3167,11 +3168,10 @@ install (PROGRAMS
+ if (DEFINED PYMOLCAS_TARGET)
+         install (PROGRAMS
+                 ${PYMOLCAS_TARGET}
+-                DESTINATION ${CMAKE_INSTALL_PREFIX}/sbin
++                DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+                 RENAME pymolcas
+                 )
+ 
+-        install (CODE "execute_process(COMMAND ${OPENMOLCAS_DIR}/sbin/install_pymolcas.sh ${PYMOLCAS_TARGET})")
+ endif ()
+ 
+ if (DEFINED EXTRA_DIR)
+@@ -3188,9 +3189,5 @@ if (DEFINED EXTRA_DIR)
+                 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+                 )
+ 
+-        install (CODE "execute_process(COMMAND ${OPENMOLCAS_DIR}/sbin/install_driver.sh ${MOLCAS_DRIVER})")
+ endif ()
+ 
+-if (IS_DIRECTORY "$ENV{HOME}/.Molcas")
+-        install (CODE "execute_process(COMMAND sh \"-c\" \"cd ${CMAKE_INSTALL_PREFIX}; echo `pwd` > $HOME/.Molcas/molcas 2> /dev/null\")")
+-endif ()
+diff --git a/Tools/pymolcas/CMakeLists.txt b/Tools/pymolcas/CMakeLists.txt
+index 0d576fa..f9ba6d7 100644
+--- a/Tools/pymolcas/CMakeLists.txt
++++ b/Tools/pymolcas/CMakeLists.txt
+@@ -52,9 +52,5 @@ if (PYTHONINTERP_FOUND)
+                         DEPENDS ${PYMOLCAS_TARGET}
+                         )
+ 
+-                add_custom_command (TARGET pymolcas
+-                        POST_BUILD
+-                        COMMAND ${OPENMOLCAS_DIR}/sbin/install_pymolcas.sh ${PYMOLCAS_TARGET}
+-                )
+ 
+         endif ()
+
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#32691: OpenMolcas
  2018-09-14  9:27 ` Ludovic Courtès
@ 2018-09-14 14:55   ` Eric Brown
  2018-09-17 20:58     ` Ludovic Courtès
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Brown @ 2018-09-14 14:55 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 32691

[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]

ludo@gnu.org (Ludovic Courtès) writes:

> Here’s a revision of the patch with several modifications: I added
> comments in the patch (though they don’t explain the Python-related
> changes for instance; could you add a line about these?), stripped
> unnecessary additions from the patch, added it to gnu/local.mk, fixed
> an issue reported by ‘guix lint’ in the description.
>
> However, could you explain why we have #:tests? #f ?  In general
> disabling tests should be accompanied with a comment explaining the
> reason (lack of a test suite, or “unsolvable” test failures.)  If there
> are test failures, we’d rather investigate than disable the tests.
>
> Could you send an updated patch?
>

Hi Ludo':

Thank you for your fixes! I've attached a revised patch. I'm well beyond
my comfort zone, so I hope it applies cleanly and works.

The default location of pymolcas is a little sketchy, being placed in
the first writable location in PATH, and I believe will not be fixed
upstream:

https://gitlab.com/Molcas/OpenMolcas/issues/70

I have added comments to the chemistry.scm file.

I have removed the out-of-source build statement and re-enabled tests,
simply by omitting those flags.

Best regards,
Eric


[-- Attachment #2: openmolcas-v2.patch --]
[-- Type: text/x-diff, Size: 9044 bytes --]

From 315c2a58310f2af32cdbd59c97a10911c390ddd3 Mon Sep 17 00:00:00 2001
From: Eric Brown <brown@fastmail.com>
Date: Fri, 14 Sep 2018 09:27:35 -0500
Subject: [PATCH] gnu: Add openmolcas and openblas-ilp64.

* gnu/packages/chemistry.scm (openmolcas): New variable.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/chemistry.scm                    | 56 ++++++++++++
 .../openmolcas-pymolcas-openblas.patch        | 89 +++++++++++++++++++
 3 files changed, 146 insertions(+)
 create mode 100644 gnu/packages/patches/openmolcas-pymolcas-openblas.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 7b230cb6f..0974ce068 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1006,6 +1006,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/opencascade-oce-glibc-2.26.patch		\
   %D%/packages/patches/openfoam-4.1-cleanup.patch			\
   %D%/packages/patches/openldap-CVE-2017-9287.patch		\
+  %D%/packages/patches/openmolcas-pymolcas-openblas.patch	\
   %D%/packages/patches/openocd-nrf52.patch			\
   %D%/packages/patches/opensmtpd-fix-crash.patch		\
   %D%/packages/patches/openssl-runpath.patch			\
diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 03120aaee..d5461b08f 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Konrad Hinsen <konrad.hinsen@fastmail.net>
 ;;; Copyright © 2018 Kei Kebreau <kkebreau@posteo.net>
+;;; Copyright © 2018 Eric Brown <brown@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -26,12 +27,16 @@
   #:use-module (gnu packages boost)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages gcc)
+  #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages gv)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages qt)
+  #:use-module (gnu packages tex)
   #:use-module (gnu packages xml)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
@@ -322,3 +327,54 @@ chemical data.  It's a collaborative project allowing anyone to search, convert,
 analyze, or store data from molecular modeling, chemistry, solid-state
 materials, biochemistry, or related areas.")
     (license license:gpl2)))
+
+(define-public openmolcas
+  (package
+    (name "openmolcas")
+    (version "18.09")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://gitlab.com/Molcas/OpenMolcas"
+                                  "/-/archive/v" version "/OpenMolcas-v"
+                                  version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1krrkff5b4zp9ii1m9v3zzw8d99k72fcwwv3rif8cp10cpxi1wxl"))
+              (patches
+               ;; by default, pymolcas is installed in the first writable
+               ;; directory in the user's PATH. This patch places it in the
+               ;; bin directory alongside the other OpenMolcas binaries.
+               ;; The default search for the OpenBLAS library is obviated and
+               ;; the path is supplied as an argument to CMake.
+               (search-patches "openmolcas-pymolcas-openblas.patch"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:build-type "Release"
+       #:configure-flags
+       (list "-DLINALG=OpenBLAS"
+             (string-append "-DOPENBLASROOT="
+                            (assoc-ref %build-inputs "blas"))
+             (string-append "-DLINALG_LIBRARIES="
+                            (assoc-ref %build-inputs "blas")
+                            "/lib/libopenblas_ilp64.so"))))
+    (native-inputs
+     `(("fortran" ,gfortran)
+       ("ghostscript" ,ghostscript)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python)
+       ("python-pyparsing" ,python-pyparsing)
+       ("python-six" ,python-six)
+       ("texlive" ,texlive)))
+    (inputs
+     `(("hdf5" ,hdf5)
+       ("blas" ,openblas-ilp64)))
+    (home-page "https://gitlab.com/Molcas/OpenMolcas")
+    (synopsis "Multi-reference electronic structure theory program")
+    (description "OpenMolcas is a quantum chemistry software package developed
+by scientists and intended to be used by scientists.  It includes programs to
+apply many different electronic structure methods to chemical systems, but its
+key feature is the multiconfigurational approach, with methods like CASSCF and
+CASPT2.")
+    (license license:lgpl2.1)))
diff --git a/gnu/packages/patches/openmolcas-pymolcas-openblas.patch b/gnu/packages/patches/openmolcas-pymolcas-openblas.patch
new file mode 100644
index 000000000..b18c62e05
--- /dev/null
+++ b/gnu/packages/patches/openmolcas-pymolcas-openblas.patch
@@ -0,1 +1,89 @@
+Allow bulds with openblas-ilp64.
+Remove assumptions about $HOME.
+
+diff --git OpenMolcas-v18.09/CMakeLists.txt OpenMolcas-v18.09/CMakeLists.txt
+index a4071fd..53d8df5 100644
+--- OpenMolcas-v18.09/CMakeLists.txt
++++ OpenMolcas-v18.09/CMakeLists.txt
+@@ -1338,42 +1338,8 @@ if (LINALG STREQUAL "OpenBLAS")
+         endif ()
+ 
+         # search for the OpenBLAS library
+-        find_library (LIBOPENBLAS
+-                NAMES openblas
+-                PATHS ${OPENBLASROOT}
+-                PATH_SUFFIXES lib
+-                NO_DEFAULT_PATH)
+-
+-        if (NOT LIBOPENBLAS)
+-                message (FATAL_ERROR
+-                        "OpenBLAS library not found, please check that "
+-                        "the OPENBLASROOT variable is set and points to "
+-                        "a valid OpenBLAS installation directory."
+-                        )
+-        endif ()
+-
+-        # here we check if LIBOPENBLAS has changed after it was processed
+-        # succesfully, if not we do not need to rerun anything here.
+-        if (NOT LIBOPENBLAS STREQUAL LIBOPENBLAS_LAST)
+-                # check if the OpenBLAS library contains LAPACK functionality
+-                message ("-- Checking OpenBLAS for LAPACK functionality...")
+-                include(CheckFortranFunctionExists)
+-                set (CMAKE_REQUIRED_LIBRARIES ${LIBOPENBLAS})
+-                unset (OPENBLAS_WITH_LAPACK CACHE)
+-                check_fortran_function_exists("dsyev" OPENBLAS_WITH_LAPACK)
+-                if (NOT OPENBLAS_WITH_LAPACK)
+-                        unset (LIBOPENBLAS CACHE)
+-                        message (FATAL_ERROR
+-                                "LAPACK functionality missing from OpenBLAS library, "
+-                                "please build OpenBLAS with NO_LAPACK=0 defined."
+-                                )
+-                endif ()
+-                # save the last location to check if it changed between configurations
+-                set (LIBOPENBLAS_LAST ${LIBOPENBLAS} CACHE INTERNAL "last value." FORCE)
+-        endif ()
+-
+         add_definitions (-D_OPENBLAS_)
+-        set (LINALG_LIBRARIES ${LIBOPENBLAS})
++        set (LINALG_LIBRARIES ${LINALG_LIBRARIES})
+ else ()
+         mark_as_advanced(FORCE OPENBLASROOT)
+ endif ()
+@@ -3167,11 +3168,10 @@ install (PROGRAMS
+ if (DEFINED PYMOLCAS_TARGET)
+         install (PROGRAMS
+                 ${PYMOLCAS_TARGET}
+-                DESTINATION ${CMAKE_INSTALL_PREFIX}/sbin
++                DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+                 RENAME pymolcas
+                 )
+ 
+-        install (CODE "execute_process(COMMAND ${OPENMOLCAS_DIR}/sbin/install_pymolcas.sh ${PYMOLCAS_TARGET})")
+ endif ()
+ 
+ if (DEFINED EXTRA_DIR)
+@@ -3188,9 +3189,5 @@ if (DEFINED EXTRA_DIR)
+                 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+                 )
+ 
+-        install (CODE "execute_process(COMMAND ${OPENMOLCAS_DIR}/sbin/install_driver.sh ${MOLCAS_DRIVER})")
+ endif ()
+ 
+-if (IS_DIRECTORY "$ENV{HOME}/.Molcas")
+-        install (CODE "execute_process(COMMAND sh \"-c\" \"cd ${CMAKE_INSTALL_PREFIX}; echo `pwd` > $HOME/.Molcas/molcas 2> /dev/null\")")
+-endif ()
+diff --git OpenMolcas-v18.09/Tools/pymolcas/CMakeLists.txt OpenMolcas-v18.09/Tools/pymolcas/CMakeLists.txt
+index 0d576fa..f9ba6d7 100644
+--- OpenMolcas-v18.09/Tools/pymolcas/CMakeLists.txt
++++ OpenMolcas-v18.09/Tools/pymolcas/CMakeLists.txt
+@@ -52,9 +52,5 @@ if (PYTHONINTERP_FOUND)
+                         DEPENDS ${PYMOLCAS_TARGET}
+                         )
+ 
+-                add_custom_command (TARGET pymolcas
+-                        POST_BUILD
+-                        COMMAND ${OPENMOLCAS_DIR}/sbin/install_pymolcas.sh ${PYMOLCAS_TARGET}
+-                )
+ 
+         endif ()
+
-- 
2.19.0


[-- Attachment #3: openmolcas-v2.patch --]
[-- Type: text/x-diff, Size: 9044 bytes --]

From 315c2a58310f2af32cdbd59c97a10911c390ddd3 Mon Sep 17 00:00:00 2001
From: Eric Brown <brown@fastmail.com>
Date: Fri, 14 Sep 2018 09:27:35 -0500
Subject: [PATCH] gnu: Add openmolcas and openblas-ilp64.

* gnu/packages/chemistry.scm (openmolcas): New variable.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/chemistry.scm                    | 56 ++++++++++++
 .../openmolcas-pymolcas-openblas.patch        | 89 +++++++++++++++++++
 3 files changed, 146 insertions(+)
 create mode 100644 gnu/packages/patches/openmolcas-pymolcas-openblas.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 7b230cb6f..0974ce068 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1006,6 +1006,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/opencascade-oce-glibc-2.26.patch		\
   %D%/packages/patches/openfoam-4.1-cleanup.patch			\
   %D%/packages/patches/openldap-CVE-2017-9287.patch		\
+  %D%/packages/patches/openmolcas-pymolcas-openblas.patch	\
   %D%/packages/patches/openocd-nrf52.patch			\
   %D%/packages/patches/opensmtpd-fix-crash.patch		\
   %D%/packages/patches/openssl-runpath.patch			\
diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 03120aaee..d5461b08f 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Konrad Hinsen <konrad.hinsen@fastmail.net>
 ;;; Copyright © 2018 Kei Kebreau <kkebreau@posteo.net>
+;;; Copyright © 2018 Eric Brown <brown@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -26,12 +27,16 @@
   #:use-module (gnu packages boost)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages gcc)
+  #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages gv)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages qt)
+  #:use-module (gnu packages tex)
   #:use-module (gnu packages xml)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
@@ -322,3 +327,54 @@ chemical data.  It's a collaborative project allowing anyone to search, convert,
 analyze, or store data from molecular modeling, chemistry, solid-state
 materials, biochemistry, or related areas.")
     (license license:gpl2)))
+
+(define-public openmolcas
+  (package
+    (name "openmolcas")
+    (version "18.09")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://gitlab.com/Molcas/OpenMolcas"
+                                  "/-/archive/v" version "/OpenMolcas-v"
+                                  version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1krrkff5b4zp9ii1m9v3zzw8d99k72fcwwv3rif8cp10cpxi1wxl"))
+              (patches
+               ;; by default, pymolcas is installed in the first writable
+               ;; directory in the user's PATH. This patch places it in the
+               ;; bin directory alongside the other OpenMolcas binaries.
+               ;; The default search for the OpenBLAS library is obviated and
+               ;; the path is supplied as an argument to CMake.
+               (search-patches "openmolcas-pymolcas-openblas.patch"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:build-type "Release"
+       #:configure-flags
+       (list "-DLINALG=OpenBLAS"
+             (string-append "-DOPENBLASROOT="
+                            (assoc-ref %build-inputs "blas"))
+             (string-append "-DLINALG_LIBRARIES="
+                            (assoc-ref %build-inputs "blas")
+                            "/lib/libopenblas_ilp64.so"))))
+    (native-inputs
+     `(("fortran" ,gfortran)
+       ("ghostscript" ,ghostscript)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python)
+       ("python-pyparsing" ,python-pyparsing)
+       ("python-six" ,python-six)
+       ("texlive" ,texlive)))
+    (inputs
+     `(("hdf5" ,hdf5)
+       ("blas" ,openblas-ilp64)))
+    (home-page "https://gitlab.com/Molcas/OpenMolcas")
+    (synopsis "Multi-reference electronic structure theory program")
+    (description "OpenMolcas is a quantum chemistry software package developed
+by scientists and intended to be used by scientists.  It includes programs to
+apply many different electronic structure methods to chemical systems, but its
+key feature is the multiconfigurational approach, with methods like CASSCF and
+CASPT2.")
+    (license license:lgpl2.1)))
diff --git a/gnu/packages/patches/openmolcas-pymolcas-openblas.patch b/gnu/packages/patches/openmolcas-pymolcas-openblas.patch
new file mode 100644
index 000000000..b18c62e05
--- /dev/null
+++ b/gnu/packages/patches/openmolcas-pymolcas-openblas.patch
@@ -0,1 +1,89 @@
+Allow bulds with openblas-ilp64.
+Remove assumptions about $HOME.
+
+diff --git OpenMolcas-v18.09/CMakeLists.txt OpenMolcas-v18.09/CMakeLists.txt
+index a4071fd..53d8df5 100644
+--- OpenMolcas-v18.09/CMakeLists.txt
++++ OpenMolcas-v18.09/CMakeLists.txt
+@@ -1338,42 +1338,8 @@ if (LINALG STREQUAL "OpenBLAS")
+         endif ()
+ 
+         # search for the OpenBLAS library
+-        find_library (LIBOPENBLAS
+-                NAMES openblas
+-                PATHS ${OPENBLASROOT}
+-                PATH_SUFFIXES lib
+-                NO_DEFAULT_PATH)
+-
+-        if (NOT LIBOPENBLAS)
+-                message (FATAL_ERROR
+-                        "OpenBLAS library not found, please check that "
+-                        "the OPENBLASROOT variable is set and points to "
+-                        "a valid OpenBLAS installation directory."
+-                        )
+-        endif ()
+-
+-        # here we check if LIBOPENBLAS has changed after it was processed
+-        # succesfully, if not we do not need to rerun anything here.
+-        if (NOT LIBOPENBLAS STREQUAL LIBOPENBLAS_LAST)
+-                # check if the OpenBLAS library contains LAPACK functionality
+-                message ("-- Checking OpenBLAS for LAPACK functionality...")
+-                include(CheckFortranFunctionExists)
+-                set (CMAKE_REQUIRED_LIBRARIES ${LIBOPENBLAS})
+-                unset (OPENBLAS_WITH_LAPACK CACHE)
+-                check_fortran_function_exists("dsyev" OPENBLAS_WITH_LAPACK)
+-                if (NOT OPENBLAS_WITH_LAPACK)
+-                        unset (LIBOPENBLAS CACHE)
+-                        message (FATAL_ERROR
+-                                "LAPACK functionality missing from OpenBLAS library, "
+-                                "please build OpenBLAS with NO_LAPACK=0 defined."
+-                                )
+-                endif ()
+-                # save the last location to check if it changed between configurations
+-                set (LIBOPENBLAS_LAST ${LIBOPENBLAS} CACHE INTERNAL "last value." FORCE)
+-        endif ()
+-
+         add_definitions (-D_OPENBLAS_)
+-        set (LINALG_LIBRARIES ${LIBOPENBLAS})
++        set (LINALG_LIBRARIES ${LINALG_LIBRARIES})
+ else ()
+         mark_as_advanced(FORCE OPENBLASROOT)
+ endif ()
+@@ -3167,11 +3168,10 @@ install (PROGRAMS
+ if (DEFINED PYMOLCAS_TARGET)
+         install (PROGRAMS
+                 ${PYMOLCAS_TARGET}
+-                DESTINATION ${CMAKE_INSTALL_PREFIX}/sbin
++                DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+                 RENAME pymolcas
+                 )
+ 
+-        install (CODE "execute_process(COMMAND ${OPENMOLCAS_DIR}/sbin/install_pymolcas.sh ${PYMOLCAS_TARGET})")
+ endif ()
+ 
+ if (DEFINED EXTRA_DIR)
+@@ -3188,9 +3189,5 @@ if (DEFINED EXTRA_DIR)
+                 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+                 )
+ 
+-        install (CODE "execute_process(COMMAND ${OPENMOLCAS_DIR}/sbin/install_driver.sh ${MOLCAS_DRIVER})")
+ endif ()
+ 
+-if (IS_DIRECTORY "$ENV{HOME}/.Molcas")
+-        install (CODE "execute_process(COMMAND sh \"-c\" \"cd ${CMAKE_INSTALL_PREFIX}; echo `pwd` > $HOME/.Molcas/molcas 2> /dev/null\")")
+-endif ()
+diff --git OpenMolcas-v18.09/Tools/pymolcas/CMakeLists.txt OpenMolcas-v18.09/Tools/pymolcas/CMakeLists.txt
+index 0d576fa..f9ba6d7 100644
+--- OpenMolcas-v18.09/Tools/pymolcas/CMakeLists.txt
++++ OpenMolcas-v18.09/Tools/pymolcas/CMakeLists.txt
+@@ -52,9 +52,5 @@ if (PYTHONINTERP_FOUND)
+                         DEPENDS ${PYMOLCAS_TARGET}
+                         )
+ 
+-                add_custom_command (TARGET pymolcas
+-                        POST_BUILD
+-                        COMMAND ${OPENMOLCAS_DIR}/sbin/install_pymolcas.sh ${PYMOLCAS_TARGET}
+-                )
+ 
+         endif ()
+
-- 
2.19.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#32691: OpenMolcas
  2018-09-14 14:55   ` Eric Brown
@ 2018-09-17 20:58     ` Ludovic Courtès
  2018-09-20  0:13       ` Eric Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2018-09-17 20:58 UTC (permalink / raw)
  To: Eric Brown; +Cc: 32691

[-- Attachment #1: Type: text/plain, Size: 2796 bytes --]

Hi Eric,

We’re almost there!  :-)

Eric Brown <brown@fastmail.com> skribis:

> Thank you for your fixes! I've attached a revised patch. I'm well beyond
> my comfort zone, so I hope it applies cleanly and works.
>
> The default location of pymolcas is a little sketchy, being placed in
> the first writable location in PATH, and I believe will not be fixed
> upstream:
>
> https://gitlab.com/Molcas/OpenMolcas/issues/70
>
> I have added comments to the chemistry.scm file.

I made small changes (moved comments about the patch at the top of the
patch; switch to ‘texlive-union’, which is much smaller than ‘texlive’),
leading to the attached patch.

It’s all good, except that the file layout really doesn’t match the
usual conventions:

--8<---------------cut here---------------start------------->8---
$ find /gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09
/gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09
/gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09/basis_library
/gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09/basis_library/TZ
/gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09/basis_library/AUG-PC-4

[...]

/gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09/sbin
/gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09/sbin/help_basis
/gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09/sbin/help_doc
/gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09/lib
/gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09/lib/libmolcas.a
/gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09/bin
/gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09/bin/ffpt.exe
/gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09/bin/loprop.exe

[...]

/gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09/data/quater.prgm
/gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09/data/rasscf.prgm
/gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09/.molcasversion
/gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09/molcas.rte
/gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09/CONTRIBUTORS.md
/gnu/store/6cj9n2rwsxwk582xqz2hxzlk520ghvm9-openmolcas-18.09/LICENSE
--8<---------------cut here---------------end--------------->8---

Ideally basis_library/ and data/ would go under share/openmolcas, while
CONTRIBUTORS.md and LICENSE would go to share/doc/openmolcas.  Also, it
would be nice to remove the ‘.exe’ extension.

Do you think you could easily fiddle with CMake to fix these and/or
report it upstream?  I could apply the patch as is but I think users may
not be pleased by this.  WDYT?

Thank you for your time, and sorry for the extra round trip!

Ludo’.


[-- Attachment #2: the patch --]
[-- Type: text/x-patch, Size: 9140 bytes --]

From b4caef67aaae349e0aa77fc22517872ff8ca79cb Mon Sep 17 00:00:00 2001
From: Eric Brown <brown@fastmail.com>
Date: Fri, 14 Sep 2018 09:27:35 -0500
Subject: [PATCH] gnu: Add openmolcas.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* gnu/packages/chemistry.scm (openmolcas): New variable.
* gnu/packages/patches/openmolcas-pymolcas-openblas.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
 gnu/local.mk                                  |  1 +
 gnu/packages/chemistry.scm                    | 51 ++++++++++
 .../openmolcas-pymolcas-openblas.patch        | 92 +++++++++++++++++++
 3 files changed, 144 insertions(+)
 create mode 100644 gnu/packages/patches/openmolcas-pymolcas-openblas.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index d37a193ad..4c5a1fbd4 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1006,6 +1006,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/opencascade-oce-glibc-2.26.patch		\
   %D%/packages/patches/openfoam-4.1-cleanup.patch			\
   %D%/packages/patches/openldap-CVE-2017-9287.patch		\
+  %D%/packages/patches/openmolcas-pymolcas-openblas.patch	\
   %D%/packages/patches/openocd-nrf52.patch			\
   %D%/packages/patches/opensmtpd-fix-crash.patch		\
   %D%/packages/patches/openssl-runpath.patch			\
diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 03120aaee..bdb17c30d 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Konrad Hinsen <konrad.hinsen@fastmail.net>
 ;;; Copyright © 2018 Kei Kebreau <kkebreau@posteo.net>
+;;; Copyright © 2018 Eric Brown <brown@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -26,12 +27,16 @@
   #:use-module (gnu packages boost)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages gcc)
+  #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages gv)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages qt)
+  #:use-module (gnu packages tex)
   #:use-module (gnu packages xml)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
@@ -322,3 +327,49 @@ chemical data.  It's a collaborative project allowing anyone to search, convert,
 analyze, or store data from molecular modeling, chemistry, solid-state
 materials, biochemistry, or related areas.")
     (license license:gpl2)))
+
+(define-public openmolcas
+  (package
+    (name "openmolcas")
+    (version "18.09")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://gitlab.com/Molcas/OpenMolcas"
+                                  "/-/archive/v" version "/OpenMolcas-v"
+                                  version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1krrkff5b4zp9ii1m9v3zzw8d99k72fcwwv3rif8cp10cpxi1wxl"))
+              (patches
+               (search-patches "openmolcas-pymolcas-openblas.patch"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:build-type "Release"
+       #:configure-flags
+       (list "-DLINALG=OpenBLAS"
+             (string-append "-DOPENBLASROOT="
+                            (assoc-ref %build-inputs "blas"))
+             (string-append "-DLINALG_LIBRARIES="
+                            (assoc-ref %build-inputs "blas")
+                            "/lib/libopenblas_ilp64.so"))))
+    (native-inputs
+     `(("fortran" ,gfortran)
+       ("ghostscript" ,ghostscript)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python)
+       ("python-pyparsing" ,python-pyparsing)
+       ("python-six" ,python-six)
+       ("texlive" ,(texlive-union))))
+    (inputs
+     `(("hdf5" ,hdf5)
+       ("blas" ,openblas-ilp64)))
+    (home-page "https://gitlab.com/Molcas/OpenMolcas")
+    (synopsis "Multi-reference electronic structure theory program")
+    (description "OpenMolcas is a quantum chemistry software package developed
+by scientists and intended to be used by scientists.  It includes programs to
+apply many different electronic structure methods to chemical systems, but its
+key feature is the multiconfigurational approach, with methods like CASSCF and
+CASPT2.")
+    (license license:lgpl2.1)))
diff --git a/gnu/packages/patches/openmolcas-pymolcas-openblas.patch b/gnu/packages/patches/openmolcas-pymolcas-openblas.patch
new file mode 100644
index 000000000..84f348721
--- /dev/null
+++ b/gnu/packages/patches/openmolcas-pymolcas-openblas.patch
@@ -0,0 +1,92 @@
+By default, pymolcas is installed in the first writable directory in the
+user's PATH.  This patch places it in the bin/ directory alongside the other
+OpenMolcas binaries.
+
+The default search for the OpenBLAS library is obviated and the directory name
+is supplied as an argument to CMake.
+
+diff --git OpenMolcas-v18.09/CMakeLists.txt OpenMolcas-v18.09/CMakeLists.txt
+index a4071fd..53d8df5 100644
+--- OpenMolcas-v18.09/CMakeLists.txt
++++ OpenMolcas-v18.09/CMakeLists.txt
+@@ -1338,42 +1338,8 @@ if (LINALG STREQUAL "OpenBLAS")
+         endif ()
+ 
+         # search for the OpenBLAS library
+-        find_library (LIBOPENBLAS
+-                NAMES openblas
+-                PATHS ${OPENBLASROOT}
+-                PATH_SUFFIXES lib
+-                NO_DEFAULT_PATH)
+-
+-        if (NOT LIBOPENBLAS)
+-                message (FATAL_ERROR
+-                        "OpenBLAS library not found, please check that "
+-                        "the OPENBLASROOT variable is set and points to "
+-                        "a valid OpenBLAS installation directory."
+-                        )
+-        endif ()
+-
+-        # here we check if LIBOPENBLAS has changed after it was processed
+-        # succesfully, if not we do not need to rerun anything here.
+-        if (NOT LIBOPENBLAS STREQUAL LIBOPENBLAS_LAST)
+-                # check if the OpenBLAS library contains LAPACK functionality
+-                message ("-- Checking OpenBLAS for LAPACK functionality...")
+-                include(CheckFortranFunctionExists)
+-                set (CMAKE_REQUIRED_LIBRARIES ${LIBOPENBLAS})
+-                unset (OPENBLAS_WITH_LAPACK CACHE)
+-                check_fortran_function_exists("dsyev" OPENBLAS_WITH_LAPACK)
+-                if (NOT OPENBLAS_WITH_LAPACK)
+-                        unset (LIBOPENBLAS CACHE)
+-                        message (FATAL_ERROR
+-                                "LAPACK functionality missing from OpenBLAS library, "
+-                                "please build OpenBLAS with NO_LAPACK=0 defined."
+-                                )
+-                endif ()
+-                # save the last location to check if it changed between configurations
+-                set (LIBOPENBLAS_LAST ${LIBOPENBLAS} CACHE INTERNAL "last value." FORCE)
+-        endif ()
+-
+         add_definitions (-D_OPENBLAS_)
+-        set (LINALG_LIBRARIES ${LIBOPENBLAS})
++        set (LINALG_LIBRARIES ${LINALG_LIBRARIES})
+ else ()
+         mark_as_advanced(FORCE OPENBLASROOT)
+ endif ()
+@@ -3167,11 +3168,10 @@ install (PROGRAMS
+ if (DEFINED PYMOLCAS_TARGET)
+         install (PROGRAMS
+                 ${PYMOLCAS_TARGET}
+-                DESTINATION ${CMAKE_INSTALL_PREFIX}/sbin
++                DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+                 RENAME pymolcas
+                 )
+ 
+-        install (CODE "execute_process(COMMAND ${OPENMOLCAS_DIR}/sbin/install_pymolcas.sh ${PYMOLCAS_TARGET})")
+ endif ()
+ 
+ if (DEFINED EXTRA_DIR)
+@@ -3188,9 +3189,5 @@ if (DEFINED EXTRA_DIR)
+                 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+                 )
+ 
+-        install (CODE "execute_process(COMMAND ${OPENMOLCAS_DIR}/sbin/install_driver.sh ${MOLCAS_DRIVER})")
+ endif ()
+ 
+-if (IS_DIRECTORY "$ENV{HOME}/.Molcas")
+-        install (CODE "execute_process(COMMAND sh \"-c\" \"cd ${CMAKE_INSTALL_PREFIX}; echo `pwd` > $HOME/.Molcas/molcas 2> /dev/null\")")
+-endif ()
+diff --git OpenMolcas-v18.09/Tools/pymolcas/CMakeLists.txt OpenMolcas-v18.09/Tools/pymolcas/CMakeLists.txt
+index 0d576fa..f9ba6d7 100644
+--- OpenMolcas-v18.09/Tools/pymolcas/CMakeLists.txt
++++ OpenMolcas-v18.09/Tools/pymolcas/CMakeLists.txt
+@@ -52,9 +52,5 @@ if (PYTHONINTERP_FOUND)
+                         DEPENDS ${PYMOLCAS_TARGET}
+                         )
+ 
+-                add_custom_command (TARGET pymolcas
+-                        POST_BUILD
+-                        COMMAND ${OPENMOLCAS_DIR}/sbin/install_pymolcas.sh ${PYMOLCAS_TARGET}
+-                )
+ 
+         endif ()
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#32691: OpenMolcas
  2018-09-17 20:58     ` Ludovic Courtès
@ 2018-09-20  0:13       ` Eric Brown
  2018-09-21 11:22         ` Ludovic Courtès
  2021-09-13  8:01         ` Sarah Morgensen
  0 siblings, 2 replies; 10+ messages in thread
From: Eric Brown @ 2018-09-20  0:13 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 32691

ludo@gnu.org (Ludovic Courtès) writes:

> Hi Eric,
>
> We’re almost there!  :-)
>
> I made small changes (moved comments about the patch at the top of the
> patch; switch to ‘texlive-union’, which is much smaller than ‘texlive’),
> leading to the attached patch.
>
> It’s all good, except that the file layout really doesn’t match the
> usual conventions:
>
> [...]
>
> Ideally basis_library/ and data/ would go under share/openmolcas, while
> CONTRIBUTORS.md and LICENSE would go to share/doc/openmolcas.  Also, it
> would be nice to remove the ‘.exe’ extension.
>
> Do you think you could easily fiddle with CMake to fix these and/or
> report it upstream?  I could apply the patch as is but I think users may
> not be pleased by this.  WDYT?
>
> Thank you for your time, and sorry for the extra round trip!

Hi Ludo',

Thank you again. Indeed, "/" gets littered with some files that out to
go into share. This has been noted in discussions upstream.

Though we've put a bunch of work into this, I think it would be good to
pause and see if we can make some of these changes upstream, as you
suggest.

(Also I need some time to brush up on CMake -- perhaps I can contribute
some of these changes myself.)

Warm regards,
Eric

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#32691: OpenMolcas
  2018-09-20  0:13       ` Eric Brown
@ 2018-09-21 11:22         ` Ludovic Courtès
  2021-09-13  8:01         ` Sarah Morgensen
  1 sibling, 0 replies; 10+ messages in thread
From: Ludovic Courtès @ 2018-09-21 11:22 UTC (permalink / raw)
  To: Eric Brown; +Cc: 32691

Hi Eric,

Eric Brown <brown@fastmail.com> skribis:

> ludo@gnu.org (Ludovic Courtès) writes:

[...]

>> Ideally basis_library/ and data/ would go under share/openmolcas, while
>> CONTRIBUTORS.md and LICENSE would go to share/doc/openmolcas.  Also, it
>> would be nice to remove the ‘.exe’ extension.
>>
>> Do you think you could easily fiddle with CMake to fix these and/or
>> report it upstream?  I could apply the patch as is but I think users may
>> not be pleased by this.  WDYT?
>>
>> Thank you for your time, and sorry for the extra round trip!
>
> Hi Ludo',
>
> Thank you again. Indeed, "/" gets littered with some files that out to
> go into share. This has been noted in discussions upstream.
>
> Though we've put a bunch of work into this, I think it would be good to
> pause and see if we can make some of these changes upstream, as you
> suggest.

Sounds good, let us know how it goes.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#32691: OpenMolcas
  2018-09-20  0:13       ` Eric Brown
  2018-09-21 11:22         ` Ludovic Courtès
@ 2021-09-13  8:01         ` Sarah Morgensen
  2021-09-13 12:53           ` Eric Brown
  1 sibling, 1 reply; 10+ messages in thread
From: Sarah Morgensen @ 2021-09-13  8:01 UTC (permalink / raw)
  To: Eric Brown; +Cc: 32691

Hello Eric,

Eric Brown <brown@fastmail.com> writes:

> ludo@gnu.org (Ludovic Courtès) writes:
>
>> Hi Eric,
>>
>> We’re almost there!  :-)
>>
>> I made small changes (moved comments about the patch at the top of the
>> patch; switch to ‘texlive-union’, which is much smaller than ‘texlive’),
>> leading to the attached patch.
>>
>> It’s all good, except that the file layout really doesn’t match the
>> usual conventions:
>>
>> [...]
>>
>> Ideally basis_library/ and data/ would go under share/openmolcas, while
>> CONTRIBUTORS.md and LICENSE would go to share/doc/openmolcas.  Also, it
>> would be nice to remove the ‘.exe’ extension.
>>
>> Do you think you could easily fiddle with CMake to fix these and/or
>> report it upstream?  I could apply the patch as is but I think users may
>> not be pleased by this.  WDYT?
>>
>> Thank you for your time, and sorry for the extra round trip!
>
> Hi Ludo',
>
> Thank you again. Indeed, "/" gets littered with some files that out to
> go into share. This has been noted in discussions upstream.
>
> Though we've put a bunch of work into this, I think it would be good to
> pause and see if we can make some of these changes upstream, as you
> suggest.
>
> (Also I need some time to brush up on CMake -- perhaps I can contribute
> some of these changes myself.)
>
> Warm regards,
> Eric

Thanks for all your work on this package.  Did you ever make further
progress on this?  Are you still interested in working on getting
OpenMolcas in Guix?

--
Sarah




^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#32691: OpenMolcas
  2021-09-13  8:01         ` Sarah Morgensen
@ 2021-09-13 12:53           ` Eric Brown
  2021-09-25  1:15             ` Sarah Morgensen
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Brown @ 2021-09-13 12:53 UTC (permalink / raw)
  To: Sarah Morgensen; +Cc: Eric Brown, 32691

> On Sep 13, 2021, at 3:01 AM, Sarah Morgensen <iskarian@mgsn.dev> wrote:
> 
> 
> Thanks for all your work on this package.  Did you ever make further
> progress on this?  Are you still interested in working on getting
> OpenMolcas in Guix?
> 
> —
> Sarah

Hi Sarah,

I have made a new port from scratch, which I am testing currently.  It can be found here:

(channel
 (name 'ecbrown-guix)
 (url "https://ericcbrown.com/ecbrown/ecbrown-guix.git")
 (introduction
  (make-channel-introduction
   "72e02daa4cf59a5e591387e299729f2509128b58"
   (openpgp-fingerprint
    "AA5F 523D FD6D 0478 8505 6A7D C1D5 F8F0 85BF 4CF3"))))

I would appreciate any help that you might provide!

Best regards,
Eric







^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#32691: OpenMolcas
  2021-09-13 12:53           ` Eric Brown
@ 2021-09-25  1:15             ` Sarah Morgensen
  0 siblings, 0 replies; 10+ messages in thread
From: Sarah Morgensen @ 2021-09-25  1:15 UTC (permalink / raw)
  To: Eric Brown; +Cc: 32691

Hi Eric,

Eric Brown <ecbrown@ericcbrown.com> writes:

>> On Sep 13, 2021, at 3:01 AM, Sarah Morgensen <iskarian@mgsn.dev> wrote:
>> 
>> 
>> Thanks for all your work on this package.  Did you ever make further
>> progress on this?  Are you still interested in working on getting
>> OpenMolcas in Guix?
>> 
>> —
>> Sarah
>
> Hi Sarah,
>
> I have made a new port from scratch, which I am testing currently.  It can be found here:
>
> (channel
>  (name 'ecbrown-guix)
>  (url "https://ericcbrown.com/ecbrown/ecbrown-guix.git")
>  (introduction
>   (make-channel-introduction
>    "72e02daa4cf59a5e591387e299729f2509128b58"
>    (openpgp-fingerprint
>     "AA5F 523D FD6D 0478 8505 6A7D C1D5 F8F0 85BF 4CF3"))))
>
> I would appreciate any help that you might provide!
>
> Best regards,
> Eric

I'm glad to see that you've continued to work on this!

I took a look at your definition and the package it builds, and I'll
start with two things:

Syntactically, you can do something like this in your extra phase:

  (let* ((out (assoc-ref outputs "out"))
         (share (string-append out "/share/openmolcas")))

  (mkdir-p share)
  (for-each
    (lambda (file)
      (rename-file file (string-append share "/" file)))
    '("LICENSE" "data" ...))

and to symlink (like you allude to in the phase name):

  (symlink target name)

Looking at the actual package, it looks like there are several ".exe"
executables (which are actually ELF and runnable on Linux?) along with
matching ".prgm" files which (it looks like) are required to load and
run the executables.  Are these part of OpenMolcas itself, or are they
examples or something?  It would be best if we can avoid putting
architecture-specific files (that is, executables) in "/share".

Finally, rather than propagating python inputs, we can probably use the
'wrap' phase from python-build-system.  Adding that is a bit more
complex, but you can look at the 'nncp' package for an example of how
this is done (it uses gnu-build-system, but takes phases from
go-build-system).

Okay, that was three things, but what can you do? :)

--
Sarah




^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#32691: Progress
  2018-09-11  4:23 bug#32691: OpenMolcas Eric Brown
  2018-09-14  9:27 ` Ludovic Courtès
@ 2023-08-27  8:53 ` Andreas Enge
  1 sibling, 0 replies; 10+ messages in thread
From: Andreas Enge @ 2023-08-27  8:53 UTC (permalink / raw)
  To: 32691

Hello,

has there been any progress on this? Is there a way forward, or should
we close the issue?

Andreas





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-08-27  8:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-11  4:23 bug#32691: OpenMolcas Eric Brown
2018-09-14  9:27 ` Ludovic Courtès
2018-09-14 14:55   ` Eric Brown
2018-09-17 20:58     ` Ludovic Courtès
2018-09-20  0:13       ` Eric Brown
2018-09-21 11:22         ` Ludovic Courtès
2021-09-13  8:01         ` Sarah Morgensen
2021-09-13 12:53           ` Eric Brown
2021-09-25  1:15             ` Sarah Morgensen
2023-08-27  8:53 ` bug#32691: Progress Andreas Enge

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).