Hi Eric,

Eric Brown <br...@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’.

>From c001d557e1cb23042c092c23d7612ad6197fac3c Mon Sep 17 00:00:00 2001
From: Eric Brown <br...@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 <l...@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.hin...@fastmail.net>
 ;;; Copyright © 2018 Kei Kebreau <kkebr...@posteo.net>
+;;; Copyright © 2018 Eric Brown <br...@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

Reply via email to