gromacs/gromacs.spec
2023-08-07 11:19:23 +08:00

304 lines
11 KiB
RPMSpec

%global with_opencl 0
%global simd None
%ifarch x86_64
%global simd SSE2
%endif
%ifarch aarch64
%global simd ARM_NEON_ASIMD
%endif
Name: gromacs
Version: 2019.3
Release: 4
Summary: Fast, Free and Flexible Molecular Dynamics
License: GPLv2+ and ASL-2.0 and BSL-1.0 and MIT and LGPL-2.1
URL: http://www.gromacs.org
Source0: https://ftp.gromacs.org/gromacs/%{name}-%{version}.tar.gz
Source1: https://ftp.gromacs.org/pub/manual/manual-%{version}.pdf
Source2: https://ftp.gromacs.org/regressiontests/regressiontests-%{version}.tar.gz
Patch0: gromacs-dssp-path.patch
Patch1: gromacs-issue-2366.patch
Patch2: gromacs-gcc11.patch
BuildRequires: gcc-c++ cmake3 >= 3.4.3 openblas-devel fftw-devel gsl-devel hwloc
BuildRequires: hwloc-devel libX11-devel lmfit-devel >= 6.0 environment-modules
BuildRequires: chrpath
%if %{with_opencl}
BuildRequires: ocl-icd-devel opencl-headers
Recommends: gromacs-opencl = %{version}-%{release}
%endif
BuildRequires: tng-devel bash-completion
%define compdir %(pkg-config --variable=completionsdir bash-completion)
%if "%{compdir}" == ""
%define compdir "/etc/bash_completion.d"
%endif
Requires: gromacs-common = %{version}-%{release} gromacs-libs = %{version}-%{release}
Obsoletes: gromacs-ngmx < 5.0.4-1
Obsoletes: gromacs-csh < 2016.1-2
Obsoletes: gromacs-zsh < 2016.1-2
%description
GROMACS is a versatile and extremely well optimized package to perform
molecular dynamics computer simulations and subsequent trajectory analysis.
It is developed for bio-molecules like proteins, but the extremely high
performance means it is used also in several other field like polymer chemistry
and solid state physics.
This package provides single and double precision binaries.
The documentation is in the package gromacs-common.
mdrun has been compiled with thread parallellization, so it runs in parallel
on shared memory systems. If you want to run on a cluster, you probably want
to install one of the MPI parallellized packages.
N.B. All binaries have names starting with g_, for example mdrun has been
renamed to g_mdrun.
%package common
Summary: GROMACS shared data and documentation
BuildArch: noarch
Provides: gromacs-bash = %{version}-%{release}
Obsoletes: gromacs-bash < 5.0.4-1
%description common
GROMACS is a versatile and extremely well optimized package to perform
molecular dynamics computer simulations and subsequent trajectory analysis.
It is developed for bio-molecules like proteins, but the extremely high
performance means it is used also in several other field like polymer chemistry
and solid state physics.
This package includes architecture independent data and HTML documentation.
%if %{with_opencl}
%package opencl
Summary: GROMACS OpenCL kernels
%description opencl
GROMACS is a versatile and extremely well optimized package to perform
molecular dynamics computer simulations and subsequent trajectory analysis.
It is developed for bio-molecules like proteins, but the extremely high
performance means it is used also in several other field like polymer chemistry
and solid state physics.
This package includes the OpenCL kernels.
%endif
%package doc
Summary: GROMACS manual
BuildArch: noarch
Obsoletes: gromacs-common < 5.0.5-2
%description doc
GROMACS is a versatile and extremely well optimized package to perform
molecular dynamics computer simulations and subsequent trajectory analysis.
It is developed for bio-molecules like proteins, but the extremely high
performance means it is used also in several other field like polymer chemistry
and solid state physics.
This package the manual in PDF format.
%package devel
Summary: GROMACS header files and development libraries
Requires: gromacs-libs = %{version}-%{release}
Obsoletes: gromacs-mpich-devel < 2016-0.1.20160318gitbec9c87
Obsoletes: gromacs-openmpi-devel < 2016-0.1.20160318gitbec9c87
%description devel
GROMACS is a versatile and extremely well optimized package to perform
molecular dynamics computer simulations and subsequent trajectory analysis.
It is developed for bio-molecules like proteins, but the extremely high
performance means it is used also in several other field like polymer chemistry
and solid state physics.
This package contains header files and development libraries for the GROMACS
molecular dynamics software. You need it if you want to write your own analysis
programs.
%package libs
Summary: GROMACS shared libraries
%description libs
GROMACS is a versatile and extremely well optimized package to perform
molecular dynamics computer simulations and subsequent trajectory analysis.
It is developed for bio-molecules like proteins, but the extremely high
performance means it is used also in several other field like polymer chemistry
and solid state physics.
This package contains libraries needed for operation of GROMACS.
%package openmpi
Summary: GROMACS Open MPI binaries and libraries
Requires: gromacs-common = %{version}-%{release}
%if %{with_opencl}
Recommends: gromacs-opencl = %{version}-%{release}
%endif
Obsoletes: gromacs-openmpi-libs < 2016-0.1.20160318gitbec9c87
BuildRequires: openmpi-devel
%description openmpi
GROMACS is a versatile and extremely well optimized package to perform
molecular dynamics computer simulations and subsequent trajectory analysis.
It is developed for bio-molecules like proteins, but the extremely high
performance means it is used also in several other field like polymer chemistry
and solid state physics.
mdrun has been compiled with thread parallellization (for running on
a single node) and with Open MPI (for running on multiple nodes).
This package single and double precision binaries and libraries.
%package mpich
Summary: GROMACS MPICH binaries and libraries
Requires: gromacs-common = %{version}-%{release}
%if %{with_opencl}
Recommends: gromacs-opencl = %{version}-%{release}
%endif
Obsoletes: gromacs-mpich-libs < 2016-0.1.20160318gitbec9c87
BuildRequires: mpich-devel
%description mpich
GROMACS is a versatile and extremely well optimized package to perform
molecular dynamics computer simulations and subsequent trajectory analysis.
It is developed for bio-molecules like proteins, but the extremely high
performance means it is used also in several other field like polymer chemistry
and solid state physics.
mdrun has been compiled with thread parallellization (for running on
a single node) and with MPICH (for running on multiple nodes).
This package single and double precision binaries and libraries.
%prep
%setup -q %{?SOURCE2:-a 2} -n gromacs-%{version}%{?_rc}
%patch0 -p1
%patch1 -p1
%patch2 -p1
install -Dpm644 %{SOURCE1} ./serial/docs/manual/gromacs.pdf
rm -r src/external/{fftpack,tng_io,lmfit}
sed -i 's/set(_timeout [0-9]*)/set(_timeout 900)/' src/testutils/TestMacros.cmake
%build
%global defopts \\\
-DBUILD_TESTING:BOOL=ON \\\
-DCMAKE_SKIP_RPATH:BOOL=ON \\\
-DCMAKE_SKIP_BUILD_RPATH:BOOL=ON \\\
-DGMX_BLAS_USER=openblas \\\
-DGMX_BUILD_UNITTESTS:BOOL=ON \\\
-DGMX_EXTERNAL_LMFIT:BOOL=ON \\\
-DGMX_USE_LMFIT=external \\\
-DGMX_EXTERNAL_TNG:BOOL=ON \\\
-DGMX_EXTERNAL_TINYXML2:BOOL=OFF \\\
-DGMX_LAPACK_USER=openblas \\\
-DGMX_USE_RDTSCP=OFF \\\
-DGMX_SIMD=%{simd}
%if %{with_opencl}
%global single -DGMX_GPU:BOOL=ON -DGMX_USE_OPENCL:BOOL=ON
%endif
%global double -DGMX_DOUBLE:BOOL=ON
%global mpi -DGMX_BUILD_MDRUN_ONLY:BOOL=ON -DGMX_MPI:BOOL=ON -DGMX_THREAD_MPI:BOOL=OFF -DGMX_DEFAULT_SUFFIX:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=OFF
. /etc/profile.d/modules.sh
for p in '' _d ; do
for mpi in '' mpich openmpi ; do
test -n "${mpi}" && module load mpi/${mpi}-%{_arch}
mkdir -p ${mpi:-serial}${p}
pushd ${mpi:-serial}${p}
test -z "${mpi}" && cp -al ../regressiontests* tests/
%{cmake3} %{defopts} \
$(test -n "${mpi}" && echo %{mpi} -DGMX_BINARY_SUFFIX=${MPI_SUFFIX}${p} -DGMX_LIBS_SUFFIX=${MPI_SUFFIX}${p} -DCMAKE_INSTALL_BINDIR=${MPI_BIN} || echo -DGMX_X11=ON) \
$(test -n "$p" && echo %{double} || echo %{?single}) \
..
%make_build
popd
test -n "${mpi}" && module unload mpi/${mpi}-%{_arch}
done
done
%install
. /etc/profile.d/modules.sh
for p in '' _d ; do
for mpi in '' mpich openmpi ; do
test -n "${mpi}" && module load mpi/${mpi}-%{_arch}
%make_install -C ${mpi:-serial}${p}
test -n "${mpi}" && module unload mpi/${mpi}-%{_arch}
done
done
mkdir -p %{buildroot}%{_docdir}/gromacs
install -pm 644 AUTHORS COPYING README %{buildroot}%{_docdir}/gromacs
install -cpm 644 serial/docs/manual/gromacs.pdf %{buildroot}%{_docdir}/gromacs/manual.pdf
pushd %{buildroot}
rm ./%{_bindir}/GMXRC*
for bin in demux.pl xplor2gmx.pl; do
mv ./%{_bindir}/$bin ./%{_bindir}/g_${bin}
done
mkdir -p ./%{compdir}
for bin in gmx{,_d}; do
cat ./%{_bindir}/gmx-completion{,-$bin}.bash > ./%{compdir}/${bin}
rm ./%{_bindir}/gmx-completion-${bin}.bash
done
rm ./%{_bindir}/gmx-completion.bash ./%{_libdir}/*mpi*/bin/gmx-completion-*mpi*.bash
%ldconfig_scriptlets libs
chrpath -d %{buildroot}/%{_libdir}/mpich/bin/mdrun_mpich
chrpath -d %{buildroot}/%{_libdir}/mpich/bin/mdrun_mpich_d
chrpath -d %{buildroot}/%{_libdir}/openmpi/bin/mdrun_openmpi
chrpath -d %{buildroot}/%{_libdir}/openmpi/bin/mdrun_openmpi_d
mkdir -p %{buildroot}/etc/ld.so.conf.d
echo "%{_libdir}/mpich/lib" > %{buildroot}/etc/ld.so.conf.d/%{name}-mpich-%{_arch}.conf
echo "%{_libdir}/openmpi/lib" > %{buildroot}/etc/ld.so.conf.d/%{name}-openmpi-%{_arch}.conf
%post openmpi
/sbin/ldconfig
%post mpich
/sbin/ldconfig
%postun openmpi
/sbin/ldconfig
%postun mpich
/sbin/ldconfig
%check
export OMPI_ALLOW_RUN_AS_ROOT=1
. /etc/profile.d/modules.sh
for p in '' _d ; do
for mpi in '' mpich openmpi ; do
test -n "${mpi}" && module load mpi/${mpi}-%{_arch}
test -n "${mpi}" && xLD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{buildroot}${MPI_LIB} || xLD_LIBRARY_PATH=%{buildroot}%{_libdir}
LD_LIBRARY_PATH="${xLD_LIBRARY_PATH}" make -C ${mpi:-serial}${p} VERBOSE=1 %{?_smp_mflags} check
test -n "${mpi}" && module unload mpi/${mpi}-%{_arch}
done
done
%files
%{_bindir}/gmx*
%{_bindir}/g_*
%files common
%{_docdir}/gromacs
%exclude %{_docdir}/gromacs/manual.pdf
%{compdir}/gmx*
%{_mandir}/man1/gmx*.1*
%{_datadir}/%{name}
%exclude %{_datadir}/%{name}/template
%if %{with_opencl}
%exclude %{_datadir}/%{name}/opencl
%files opencl
%doc docs/OpenCLTODOList.txt
%{_datadir}/%{name}/opencl
%endif
%files doc
%{_docdir}/gromacs/manual.pdf
%files libs
%{_libdir}/libgromacs*.so.*
%files devel
%{_includedir}/%{name}
%{_libdir}/libgromacs*.so
%{_libdir}/pkgconfig/libgromacs*.pc
%{_datadir}/%{name}/template
%{_datadir}/cmake/gromacs*
%files openmpi
%{_libdir}/openmpi/bin/mdrun_openmpi*
%config(noreplace) /etc/ld.so.conf.d/%{name}-openmpi-%{_arch}.conf
%files mpich
%{_libdir}/mpich/bin/mdrun_mpich*
%config(noreplace) /etc/ld.so.conf.d/%{name}-mpich-%{_arch}.conf
%changelog
* Mon Aug 07 2023 chenchen <chen_aka_jan@163.com> - 2019.3-4
- fix build error due to gcc upgrade to gcc 12.3.4
- add variable OMPI_ALLOW_RUN_AS_ROOT=1 for fix test error
* Mon Dec 05 2022 Ge Wang <wangge20@h-partners.com> - 2019.3-3
- Remove runpath
* Mon Nov 21 2022 wangkai <wangkai385@h-partners.com> - 2019.3-2
- Change source url
* Fri May 7 2021 baizhonggui <baizhonggui@huawei.com> - 2019.3-1
- package init