Blob Blame History Raw
Name:		towhee
Version:	6.2.6
Release:	4%{?dist}
Summary:	A Monte Carlo molecular simulation code
Group:		Applications/Engineering
License:	GPLv2+
URL:		http://towhee.sourceforge.net/
Source0:	http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Provides:	towhee-executable = %{version}-%{release}
Requires:	towhee-common = %{version}-%{release}

# Bug 502883
# Error: operand out of range (0x0000000000008008 is not between 0xffffffffffff8000 and 0x0000000000007fff)
# -mminimal-toc doesn't help
ExcludeArch:	ppc64

BuildRequires:	gcc-gfortran
BuildRequires:	openmpi-devel

# Check for mpi-selector or environment-modules
%global selector 0
%global modules 0

%if 0%{?fedora} > 9
%global modules 1
%endif

%if 0%{?rhel} == 4
%global selector 1
%endif

%if 0%{?rhel} == 5
%global selector 1
%endif

%if %modules == 1
BuildRequires:	environment-modules
%endif

%if %selector == 1
BuildRequires:	mpi-selector
%endif

# End MPI requires section

%description
Towhee is a Monte Carlo molecular simulation code originally designed for the
prediction of fluid phase equilibria using atom-based force fields and the
Gibbs ensemble with particular attention paid to algorithms addressing
molecule conformation sampling. The code has subsequently been extended to
several ensembles, many different force fields, and solid (or at least porous)
phases.

This package contains binaries for serial operation and the utilities.

N.B. Due to some general names the utilities have a towhee- prefix, e.g.
analyse_movie is now towhee-analyse_movie.


%package mpi
Summary:	Towhee, MPI version
Group:		Applications/Engineering
Provides:	towhee-executable = %{version}-%{release}
Requires:	towhee-common = %{version}-%{release}

%description mpi
This package contains the MPI enabled binaries of Towhee.


%package common
Summary:	Towhee common files
Group:		Applications/Engineering
# So that the package gets removed with the binaries
Requires:	towhee-executable = %{version}-%{release}
%if 0%{?fedora} >= 11
BuildArch:	noarch
%endif

%description common
This package contains files needed for operation of Towhee.

%package doc
Summary:	Towhee manual
Group:		Applications/Engineering
# So that the package gets removed with the binaries
Requires:	towhee-executable = %{version}-%{release}
%if 0%{?fedora} >= 11
BuildArch:	noarch
%endif

%description doc
This package contains the HTML manual for Towhee.

%package examples
Summary:	Towhee examples
Group:		Applications/Engineering
Requires:	towhee-executable = %{version}-%{release}
%if 0%{?fedora} >= 11
BuildArch:	noarch
%endif

%description examples
This package contains examples for Towhee operation.



%prep
%setup -q
# Fix Force field locations in examples
for file in Examples/*/towhee_input; do
 sed "s|/towheebase/ForceFields|%{_datadir}/%{name}/ForceFields|g" $file > $file.new && \
 touch -r $file $file.new && \
 mv $file.new $file
done

%build
## Build the main binaries
# Use gfortran, not g77.
export F77=gfortran

## Build serial version
mkdir nompi
cd nompi
ln -s ../configure .
%configure
make %{?_smp_mflags}

# Utilities
cd Utils
make %{?_smp_mflags}
cd ..

cd ..

## Build parallel version
# Load MPI enviroment

%if %modules == 1
#. /etc/profile.d/modules.sh
module load openmpi-%{_arch}
export CFLAGS="%{optflags}"
%endif

%if %selector == 1
# Set MPI environment
mpi-selector --set `mpi-selector --list | grep openmpi`
source /etc/profile.d/mpi-selector.sh
%endif

# Use mpif90 to build
export F77=mpif90
mkdir mpi
cd mpi
ln -s ../configure .
%configure --enable-mpi --program-suffix=-mpi
make %{?_smp_mflags}
cd ..

%install
rm -rf %{buildroot} 
# Install binaries
make -C mpi install DESTDIR=%{buildroot} INSTALL="install -p"
make -C nompi install DESTDIR=%{buildroot} INSTALL="install -p"

# Install force fields
find ForceFields/ -name "Makefile*" -exec rm {} \;
mkdir -p %{buildroot}%{_datadir}/%{name}
cp -a ForceFields %{buildroot}%{_datadir}/%{name}

# Remove makefiles from the examples & remove executable permissions
find Manual/ -name "Makefile*" -exec rm {} \;
find Examples/ -name "Makefile*" -exec rm {} \;
find Examples/ -type f -exec chmod 644 {} \;

# Rename utilities
for bin in {analyse_{movie,histogram},car2towhee,charmm2pdb,{faux,pdb,xmd,xtl,xyz}2towhee,fitcoex,jre_to_towhee,maftodensity,rdf2pmfpair,unitcell}{,-mpi}; do
 mv %{buildroot}%{_bindir}/$bin %{buildroot}%{_bindir}/towhee-$bin
done
# Remove mpi versions of the utilities
rm %{buildroot}%{_bindir}/towhee-*-mpi

%clean
rm -rf %{buildroot} 


%files
%defattr(-,root,root,-)
%doc license.gpl
%{_bindir}/forcefield
%{_bindir}/towhee
# Utils
%{_bindir}/towhee-*

%files mpi
%defattr(-,root,root,-)
%doc license.gpl
%{_bindir}/forcefield-mpi
%{_bindir}/towhee-mpi

%files common
%defattr(-,root,root,-)
%doc license.gpl
%{_datadir}/%{name}/

%files doc
%defattr(-,root,root,-)
%doc Manual/projects/towhee/*

%files examples
%defattr(-,root,root,-)
%doc Examples/*

%changelog
* Fri Oct 23 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 6.2.6-4
- Fix FTBFS problem caused by behaviour change of openmpi.

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.2.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Thu Jul 16 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 6.2.6-1
- Restore ExcludeArch: ppc64.

* Thu Jul 16 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 6.2.6-1
- Update to upstream 6.2.6.

* Wed Jun 17 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 6.2.5-1
- Update to upstream 6.2.5, which fixes the naming bug of fitcoex in 6.2.4.

* Tue Jun 16 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 6.2.4-1
- Update to upstream 6.2.4, which adds utilities.

* Wed May 27 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 6.2.3-5
- ExcludeArch: ppc64 which is not working due to operand out of range error.
  See RHBZ #502883.

* Wed May 27 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 6.2.3-4
- Fix MPI build on rawhide.

* Wed May 27 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 6.2.3-3
- Fix build in rawhide.

* Mon May 25 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 6.2.3-2
- Split examples into own subpackage.
- Make examples and doc noarch on >=F11.

* Fri May 01 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 6.2.3-1
- Update to 6.2.3 that fixes shebangs and executable bit problems.

* Thu Apr 30 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 6.2.2-3
- Removed Makefiles also from ForceFields.

* Wed Apr 29 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 6.2.2-2
- Changed defines to globals.
- Added missing BR: openmpi-devel.

* Wed Apr 29 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 6.2.2-1
- First release.