Blob Blame History Raw
# Release subversion from tag
%global tagsubver 180813
# Suffix
%global tagsuffix 1752

Name:           OpenMolcas
Version:        18.0
Release:        6.o%{tagsubver}.%{tagsuffix}%{?dist}
Summary:        A multiconfigurational quantum chemistry software package
License:        LGPLv2
URL:            https://gitlab.com/Molcas/OpenMolcas

%global gittag v%{version}.o%{tagsubver}-%{tagsuffix}
Source0:        https://gitlab.com/Molcas/%{name}/-/archive/%{gittag}/%{name}-%{gittag}.tar.gz

# Fedora patches
Patch0:         OpenMolcas-fedora2.patch
# Use right kind of integers
Patch1:         OpenMolcas-int8.patch
# Read python modules from system directory
Patch2:         OpenMolcas-pymodule.patch

BuildRequires:  cmake
BuildRequires:  hdf5-devel
BuildRequires:  gcc-gfortran
#BuildRequires:  CheMPS2-devel
BuildRequires:  openblas-devel
BuildRequires:  python2-devel

# Required by runtime
%if 0%{?rhel} == 7
Requires:       pyparsing
%else
Requires:       python2-pyparsing
%endif

%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.

OpenMolcas is not a fork or reimplementation of Molcas, it is a large
part of the Molcas codebase that has been released as free and
open-source software (FOSS) under the Lesser GNU Public License
(LGPL). Some parts of Molcas remain under a different license by
decision of their authors (or impossibility to reach them), and are
therefore not included in OpenMolcas.

%prep
%setup -q -n %{name}-%{gittag}
%patch0 -p1 -b .fedora
%patch1 -p1 -b .int8
%patch2 -p1 -b .pymodule

# Name of OpenBLAS library to use is
%if 0%{?__isa_bits} == 64
sed -i 's|@OPENBLAS_LIBRARY@|openblaso64|g' CMakeLists.txt
%else
sed -i 's|@OPENBLAS_LIBRARY@|openblaso|g' CMakeLists.txt
%endif

# Location python modules are installed
sed -i 's|@MOLCAS_PYTHON@|%{_libdir}/%{name}/python|g' Tools/pymolcas/pymolcas.py

%build
mkdir objdir
cd objdir

export CC=gcc
export FC=gfortran

export CFLAGS="%{optflags} -fopenmp -std=gnu99"
export FFLAGS="%{optflags} -cpp -fopenmp -fdefault-integer-8"

%cmake .. -DCMAKE_INSTALL_PREFIX:PATH=%{_libdir}/%{name}/ -DLINALG=OpenBLAS -DOPENMP=ON
%{make_build} VERBOSE=1

%install
cd objdir
%{make_install}
cd ..

mkdir -p %{buildroot}%{_sysconfdir}/profile.d
cat > %{buildroot}%{_sysconfdir}/profile.d/%{name}.sh <<EOF
# OpenMolcas root is
export MOLCAS=%{_libdir}/%{name}
export PATH=\${PATH}:\${MOLCAS}/bin:\${MOLCAS}/sbin
EOF
cat > %{buildroot}%{_sysconfdir}/profile.d/%{name}.csh <<EOF
# OpenMolcas root is
setenv MOLCAS %{_libdir}/%{name}
export PATH \${PATH}:\${MOLCAS}/bin:\${MOLCAS}/sbin
EOF

# Install the wrapper and its requirements
mkdir -p %{buildroot}%{_libdir}/%{name}/python
for f in tee molcas_aux emil_grammar simpleeval abstract_flow emil_parse python_parse check_test molcas_wrapper; do
    cp -p Tools/pymolcas/${f}.py %{buildroot}%{_libdir}/%{name}/python
done
mkdir -p %{buildroot}%{_bindir}
cp -p Tools/pymolcas/pymolcas.py %{buildroot}%{_bindir}/pymolcas

%files
%license LICENSE
%doc CONTRIBUTORS.md
%{_sysconfdir}/profile.d/%{name}.*
%{_libdir}/%{name}
%{_bindir}/pymolcas

%changelog
* Tue Sep 18 2018 Susi Lehtola <jussilehtola@fedoraproject.org> - 18.0-6.o180813.1752
- Fix pyparsing requirement on EPEL7.

* Wed Sep 12 2018 Susi Lehtola <jussilehtola@fedoraproject.org> - 18.0-5.o180813.1752
- Add missing python modules and wrapper.

* Fri Aug 31 2018 Dave Love <loveshack@fedoraproject.org> - 18.0-4.o180813.1752
- Fix build on EPEL

* Fri Aug 24 2018 Susi Lehtola <jussilehtola@fedoraproject.org> - 18.0-3.o180813.1752
- Fix build on non-64-bit architectures.

* Fri Aug 24 2018 Susi Lehtola <jussilehtola@fedoraproject.org> - 18.0-2.o180813.1752
- Review fixes.

* Thu Aug 16 2018 Susi Lehtola <jussilehtola@fedoraproject.org> - 18.0-1.o180813.1752
- Initial release.