Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > c31f0e50272e9f75d9621476549592dc > files > 8

cp2k-2.3-5.20130310svn12754.fc18.src.rpm

%define svn 1
%define snapshot 20130310

Name: cp2k
Version: 2.3
Release: 5.%{?snapshot}svn12754%{?dist}
Group: Applications/Engineering
Summary: A molecular dynamics engine capable of classical and Car-Parrinello simulations
License: GPLv2+
URL: http://cp2k.org/
%if %{svn}
# run cp2k-snapshot.sh to produce this
Source0: cp2k-%{version}-%{snapshot}.tar.xz
%else
Source0: http://downloads.sourceforge.net/project/cp2k/cp2k-%{version}.tar.bz2
%endif
# custom openmpi arch file
# also works for mpich2 and possibly others
# only assumption for mpi library: fortran compiler is named mpif90
Source1: Linux-gfortran-openmpi.popt
Source2: Linux-gfortran.ssmp
Source3: Linux-i686-gfortran.sopt
Source4: cp2k-snapshot.sh
# patch to:
# use rpm optflags
# link with atlas instead of vanilla blas/lapack
# link with libint
# use external makedepf90
# skip compilation during regtests
Patch0: %{name}-rpm.patch
# fix crashes in fftw on i686
Patch1: %{name}-fftw_unaligned.patch
BuildRequires: atlas-devel
# for regtests
BuildRequires: bc
BuildRequires: fftw-devel
BuildRequires: gcc-gfortran
BuildRequires: libint-devel >= 1.1.4
BuildRequires: makedepf90
BuildRequires: /bin/hostname
Requires: %{name}-common = %{version}-%{release}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%global cp2k_desc_base \
CP2K is a freely available (GPL) program, written in Fortran 95, to\
perform atomistic and molecular simulations of solid state, liquid,\
molecular and biological systems. It provides a general framework for\
different methods such as e.g. density functional theory (DFT) using a\
mixed Gaussian and plane waves approach (GPW), and classical pair and\
many-body potentials.

%description
%{cp2k_desc_base}

This package contains the single process version.

%package smp
Group: Applications/Engineering
Summary: Molecular simulations software - OpenMP version
Requires: %{name}-common = %{version}-%{release}

%description smp
%{cp2k_desc_base}

This package contains the multi-threaded version (using OpenMP).

%package openmpi
Group: Applications/Engineering
Summary: Molecular simulations software - openmpi version
BuildRequires:  openmpi-devel
BuildRequires:  blacs-openmpi-devel
BuildRequires:  scalapack-openmpi-devel
Requires: %{name}-common = %{version}-%{release}
Requires: blacs-openmpi
Requires: scalapack-openmpi

%description openmpi
%{cp2k_desc_base}

This package contains the multi-threaded version (using OpenMPI).

%package mpich
Group: Applications/Engineering
Summary: Molecular simulations software - mpich version
BuildRequires:  mpich-devel
BuildRequires:  blacs-mpich-devel
BuildRequires:  scalapack-mpich-devel
Requires: %{name}-common = %{version}-%{release}
Requires: blacs-mpich
Requires: scalapack-mpich
Provides: %{name}-mpich2 = %{version}-%{release}
Obsoletes: %{name}-mpich2 < 2.3-4

%description mpich
%{cp2k_desc_base}

This package contains the multi-threaded version (using mpich).

%package common
Group: Applications/Engineering
Summary: Molecular simulations software - common files

%description common
%{cp2k_desc_base}

This package contains the documentation and the manual.

%prep
%setup -q
cp -p %{SOURCE1} arch/
cp -p %{SOURCE1} arch/Linux-gfortran-mpich.popt
cp -p %{SOURCE2} arch/Linux-i686-gfortran.ssmp
cp -p %{SOURCE2} arch/Linux-x86-64-gfortran.ssmp
cp -p %{SOURCE3} arch/
%patch0 -p1 -b .r
%patch1 -p1 -b .fftw_unaligned
rm -r tools/makedepf90
chmod -x src/harris_{functional,{env,energy}_types}.F
%ifarch i686
sed -i 's/-D__FFTW3/-D__FFTW3 -D__FFTW3_UNALIGNED/g' arch/Linux-i686-gfortran* arch/Linux-gfortran-{mpich,openmpi}.popt
%endif

%build
export FORT_C_NAME=gfortran
pushd makefiles
    %{_openmpi_load}
        make OPTFLAGS="%{optflags} -L%{_libdir}/atlas" %{?_smp_mflags} ARCH="Linux-gfortran-openmpi" VERSION=popt
    %{_openmpi_unload}
    %{_mpich_load}
        make OPTFLAGS="%{optflags} -L%{_libdir}/atlas" %{?_smp_mflags} ARCH="Linux-gfortran-mpich" VERSION=popt
    %{_mpich_unload}

    make OPTFLAGS="%{optflags} -L%{_libdir}/atlas" %{?_smp_mflags} sopt ssmp
popd

%install
rm -rf %{buildroot}
export FORT_C_NAME=gfortran
install -d %{buildroot}%{_bindir}
%{_openmpi_load}
    mkdir -p %{buildroot}%{_libdir}/openmpi%{?_opt_cc_suffix}/bin/
    install -pm755 exe/Linux-gfortran-openmpi/cp2k.popt %{buildroot}%{_libdir}/openmpi%{?_opt_cc_suffix}/bin/cp2k.popt_openmpi
%{_openmpi_unload}
%{_mpich_load}
    mkdir -p %{buildroot}%{_libdir}/mpich%{?_opt_cc_suffix}/bin/
    install -pm755 exe/Linux-gfortran-mpich/cp2k.popt %{buildroot}%{_libdir}/mpich%{?_opt_cc_suffix}/bin/cp2k.popt_mpich
%{_mpich_unload}
install -pm755 exe/`tools/get_arch_code`/cp2k.sopt %{buildroot}%{_bindir}
install -pm755 exe/`tools/get_arch_code`/cp2k.ssmp %{buildroot}%{_bindir}

%clean
rm -rf %{buildroot}

%if 1
%check
export FORT_C_NAME=gfortran
cat > tests/fedora.config << __EOF__
export LC_ALL=C
export FORT_C_NAME=gfortran
dir_base=%{_builddir}
cp2k_version=sopt
dir_triplet=`tools/get_arch_code`
cp2k_dir=cp2k-%{version}
maxtasks=`getconf _NPROCESSORS_ONLN`
emptycheck="NO"
leakcheck="NO"
__EOF__
pushd tests
../tools/do_regtest -config fedora.config
popd
%endif

%files common
%defattr(-,root,root,-)
%doc COPYRIGHT README doc/tutorialCp2k.html

%files
%defattr(-,root,root,-)
%{_bindir}/cp2k.sopt

%files smp
%defattr(-,root,root,-)
%{_bindir}/cp2k.ssmp

%files openmpi
%defattr(-,root,root,-)
%{_libdir}/openmpi%{?_opt_cc_suffix}/bin/cp2k.popt_openmpi

%files mpich
%defattr(-,root,root,-)
%{_libdir}/mpich%{?_opt_cc_suffix}/bin/cp2k.popt_mpich

%changelog
* Fri Nov 15 2013 Dominik Mierzejewski <rpm@greysector.net> - 2.3-5.20130310svn12754
- update to current SVN 2.3 stable branch
- use xz to compress SVN snapshot tarball
- add requires for respective blacs and scalapack versions

* Mon Aug 05 2013 Deji Akingunola <dakingun@gmail.com> - 2.3-4.20130220
- Rename mpich2 sub-packages to mpich and rebuild for mpich-3.0

* Sat Apr 13 2013 Dominik Mierzejewski <rpm@greysector.net> - 2.3-3.20130220
- fix crashes in fftw on i686 (patch by Michael Banck)

* Wed Feb 20 2013 Dominik Mierzejewski <rpm@greysector.net> - 2.3-2.20130220
- update to current SVN 2.3 stable branch
- re-enable regtests
- drop svn patch (no longer needed)
- link with libfftw3_omp for ssmp build
- reorder libraries in LDFLAGS per M. Guidon's cp2k installation primer
- add -ffree-line-length-none to Fortran flags
- add a patch to echo the name of reach test (from Debian package)
- update libint/libderiv options to match current builds

* Wed Sep 05 2012 Dominik Mierzejewski <rpm@greysector.net> - 2.3-1
- updated to 2.3 release

* Sun Aug 26 2012 Dominik Mierzejewski <rpm@greysector.net> - 2.3-0.20120825
- updated to current 2.3 branch (trunk)
- added snapshot creator script
- moved new files out of -rpm patch and into separate SourceN entries
- dropped non-standard compiler flags from MPI builds

* Wed Jul 25 2012 Jussi Lehtola <jussilehtola@fedoraproject.org> - 2.1-7.20101006
- Rebuild due to changed libint.

* Tue Jul 24 2012 Thomas Spura <tomspur@fedoraproject.org> - 2.1-6.20101006
- don't run testsuite as it is only usefull when comparing to old outputs
  (which we don't have at buildtime)
- define common description macro
- also build with openmpi/mpich2
- new url

* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1-5.20101006
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1-4.20101006
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1-3.20101006
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Tue Dec 07 2010 Dominik Mierzejewski <rpm@greysector.net> 2.1-2.20101006
- make Summary more descriptive
- use atlas instead of blas/lapack
- pass special CFLAGS to support libint's higher values of angular momentum

* Fri Dec 03 2010 Dominik Mierzejewski <rpm@greysector.net> 2.1-1.20101006
- initial package