Blob Blame History Raw
# Copyright (c) 2013, 2014, 2015 Dave Love, Liverpool University
# The licence for this file is as for the package itself.

# fixme: look at shipping the example/benchmark data (~ 40MB)

# Maybe build with -march=native
%bcond_with native

%if 0%{?el6}
%ifarch ppc64
%bcond_with mpich
%else
%bcond_without mpich
%endif
%else
%bcond_without mpich
%endif

Name:		dl_poly
Version:	1.9.20140324
Release:	14%{?dist}
Summary:	General purpose classical molecular dynamics (MD) simulation
License:	BSD
URL:		http://www.ccp5.ac.uk/DL_POLY_CLASSIC/
# NB, the numbers in this URL change when it's updated, but the version doesn't
Source0:	http://ccpforge.cse.rl.ac.uk/gf/download/frsrelease/255/4726/dl_class_1.9.tar.gz
Source1:	dl_poly-makefile
Source2:	dl_poly.desktop
# The current version won't build on EPEL or Fedora without backing out
# this change made against an older tarball.
Patch1:		dl_poly-java.patch
# Default to the serial executable
Patch2:		dl_poly-javaexec.patch
BuildRequires:	gcc-gfortran, makedepf90, java-devel
BuildRequires:	openmpi-devel, desktop-file-utils
%if %{with mpich}
BuildRequires:	mpich-devel
%endif
Requires:	%{name}-common = %{version}-%{release}
BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)

%global base_description \
DL_POLY Classic is a general purpose molecular dynamics simulation\
package developed at Daresbury Laboratory by W. Smith, T.R. Forester\
and I.T. Todorov.  It is based on the package DL_POLY_2, which was\
originally developed by the Computational Chemistry Group, (CCG) at\
Daresbury Laboratory under the auspices of the Engineering and\
Physical Sciences Research Council (EPSRC) for (CCP5), the EPSRC's\
Collaborative Computational Project for the Computer Simulation of\
Condensed Phases.\
\
DL_POLY Classic can be executed as a serial or a parallel application.\
The code achieves parallelisation using the Replicated Data strategy\
which is suitable for homogeneous, distributed-memory, parallel\
computers.  The code is useful for simulations of up to 30,000 atoms\
with good parallel performance on up to 100 processors, though in some\
circumstances it can exceed or fail to reach these limits.\
\
Reference: I.T. Todorov, W. Smith, K. Trachenko & M.T. Dove,\
Journal of Materials Chemistry, (2006) 16, 1911-1918

%description
%{base_description}

This is a serial version.

%package common
Summary: General purpose classical molecular dynamics (MD) simulation - common files
BuildArch: noarch

%description common
Common files for %name.
This package contains, principally the "utility" source and data files.

%package doc
Summary: Documentation for %name and %{name}-gui
BuildArch: noarch

%description doc
Documentation for %{name} and %{name}-gui.

%package openmpi
Summary: General purpose classical molecular dynamics (MD) simulation - openmpi version
Requires: openmpi%{_isa}, %{name}-common = %{version}-%{release}

%description openmpi
%{base_description}

This is a parallel version using openmpi.

%if %{with mpich}
%package mpich
Summary: General purpose classical molecular dynamics (MD) simulation - mpich version
Requires: mpich%{_isa}, %{name}-common = %{version}-%{release}

%description mpich
%{base_description}

This is a parallel version using mpich.
%endif

%package gui
Summary: GUI for %name
Requires: java, jpackage-utils
BuildArch: noarch

%description gui
This package provides the Java-based graphical user interface for %name.

%prep
%setup -q -n dl_class_1.9
rm java/GUI.jar
cp %{SOURCE1} source/Makefile

%patch1 -p1
%patch2 -p1

%build
%if %{with native}
%global native NATIVE=-march=native
%else
%global native NATIVE=
%endif

%global dobuild \
mkdir $MPI_COMPILER;\
make %{?_smp_mflags} build PAR=1 FFLAGS="-c %{optflags}" %{native};\
mv ../execute/DLPOLY.X $MPI_COMPILER/%{name}$MPI_SUFFIX

cd source
makedepf90 *.f >>Makefile
mkdir single
make %{?_smp_mflags} build PAR=0 %{native}
mv ../execute/DLPOLY.X single/%{name}

%{_openmpi_load}
%{dobuild}
%{_openmpi_unload}

%if %{with mpich}
%{_mpich_load}
%{dobuild}
%{_mpich_unload}
%endif

cd ../java
sh build
cat <<+ >%{name}_gui
#!/bin/sh
exec java -jar %{_javadir}/DL_POLY_GUI.jar
+
cd ..
cat <<+ >README.running
Use the environment modules command
  module load <mpi>-%{_arch}
to put the %{name}_<mpi> parallel executable on your path,
where <mpi> may be openmpi or mpich.  In a batch job You may
need to source /etc/profile.d/modules.sh or /etc/profile.d/modules.csh
first.
The serial version is available directly as %{name}.
+

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_javadir} $RPM_BUILD_ROOT%_datadir/%name
mkdir -p $RPM_BUILD_ROOT%{_bindir}
install source/single/%{name} $RPM_BUILD_ROOT%{_bindir}/%{name}
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/openmpi/bin
install source/openmpi*/%{name}_* $RPM_BUILD_ROOT%{_libdir}/openmpi/bin
%if %{with mpich}
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/mpich/bin
install source/mpich*/%{name}_* $RPM_BUILD_ROOT%{_libdir}/mpich/bin
%endif
cp data/README README.data
chmod 644 utility/dl2xyz
cp -a utility $RPM_BUILD_ROOT%{_datadir}/%{name}
install -m 644 java/GUI.jar $RPM_BUILD_ROOT%{_javadir}/DL_POLY_GUI.jar
install -m 755 java/%{name}_gui $RPM_BUILD_ROOT%{_bindir}
chmod 644 LICENCE.pdf manual/JavaGUI.pdf
desktop-file-install --dir=${RPM_BUILD_ROOT}%{_datadir}/applications %{SOURCE2}

%clean
rm -rf $RPM_BUILD_ROOT

%check
# would depend on shipping the data files per fixme above

%files
%{_bindir}/%{name}

%files common
%doc README.data README LICENCE.pdf
%{_datadir}/%{name}

%files doc
%doc manual/USRMAN.pdf manual/JavaGUI.pdf

%files gui
%{_javadir}/DL_POLY_GUI.jar
%{_bindir}/%{name}_gui
%doc README LICENCE.pdf
%{_datadir}/applications/*

%files openmpi
%{_libdir}/openmpi/bin/*

%if %{with mpich}
%files mpich
%{_libdir}/mpich/bin/*
%endif


%changelog
* Sat Aug 15 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.9.20140324-14
- Rebuild for MPI provides

* Mon Jul 27 2015 Sandro Mani <manisandro@gmail.com> - 1.9.20140324-13
- Rebuild for RPM MPI Requires Provides Change

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.20140324-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Wed Mar 18 2015 Dave Love <d.love@liverpool.ac.uk> - 1.9.20140324-11
- Rebuild for mpich change

* Sun Feb 22 2015 Dave Love <d.love@liverpool.ac.uk> - 1.9.20140324-10
- Drop java minimum version (for ppc64 el6)

* Fri Feb 20 2015 Dave Love <d.love@liverpool.ac.uk> - 1.9.20140324-9
- Specify permissions for installed .jar

* Thu Feb 19 2015 Dave Love <d.love@liverpool.ac.uk> - 1.9.20140324-8
- Conditionalize out mpich on ppc64 el6

* Wed Feb 11 2015 Dave Love <d.love@liverpool.ac.uk> - 1.9.20140324-7
- Remove _isa on -common and java requires

* Tue Feb 10 2015 Dave Love <d.love@liverpool.ac.uk> - 1.9.20140324-6
- Add _isa suffix to requires
- Use %%global, not %%define

* Fri Feb  6 2015 Dave Love <d.love@liverpool.ac.uk> - 1.9.20140324-5
  From review:
- Remove bundled .jar
- Change buildroot to the preferred form
- Add desktop file
- Zap %%defattr
- Use %%optflags (sigh)

* Thu Dec 11 2014 Dave Love <d.love@liverpool.ac.uk> - 1.9.20140324-4
- Drop EPEL5 for now

* Fri Nov 21 2014 Dave Love <d.love@liverpool.ac.uk> - 1.9.20140324-3
- Adjust for mpich3 on EPEL6

* Sun Jul 27 2014 Dave Love <d.love@liverpool.ac.uk> - 1.9.20140324-2
- Add doc package
- Add jpackage-utils dependency for gui
- Remove Group tags

* Thu Jun  5 2014 Dave Love <d.love@liverpool.ac.uk> - 1.9.20140324-1
- Build serial and mpich packages as well as openmpi, for Fedora
- Make common and gui packages
- Use updated tarball (which has the same version number)

* Fri Oct 11 2013 Dave Love <d.love@liverpool.ac.uk> - 1.9-1
- Initial packaging