Blob Blame History Raw
Name:		wannier90
Version:	2.0.0
Release:	6%{?dist}
Summary:	Maximally-localised Wannier functions 
Group:		Applications/Engineering
License:	GPLv2+
URL:		http://www.wannier.org/
Source0:	http://www.wannier.org/code/%{name}-%{version}.tar.gz
# Patch to enable building of shared library
Patch0:		wannier90-2.0.0-sharedlib.patch
BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)

BuildRequires:	gcc-gfortran
# For test phase
BuildRequires:	perl(Cwd)

# Linear algebra: use ATLAS
BuildRequires:	atlas-devel

# For documentation
BuildRequires:	tex(latex)
BuildRequires:	ghostscript
%if 0%{?fedora} > 17
BuildRequires:	tex(a4wide.sty)
BuildRequires:	tex(multirow.sty)
BuildRequires:	tex(groff.enc)
%endif

%description
Wannier90 is a program for calculating maximally-localised Wannier functions
(MLWF) from a set of Bloch energy bands that may or may not be attached to or
mixed with other bands. The formalism works by minimising the total spread of
the MLWF in real space. This is done in the space of unitary matrices that
describe rotations of the Bloch bands at each k-point. As a result, wannier90
is independent of the basis set used in the underlying calculation to obtain
the Bloch states. Therefore, it may be interfaced straightforwardly to any
electronic structure code. The locality of MLWF can be exploited to compute
band-structure, density of states and Fermi surfaces at modest computational
cost.

Furthermore, wannier90 is able to output MLWF for visualisation and other
post-processing purposes. Wannier functions are already used in a wide variety
of applications. These include analysis of chemical bonding in real space;
calculation of dielectric properties via the modern theory of polarisation;
and as an accurate and minimal basis set in the construction of model
Hamiltonians for large-scale systems, in linear-scaling quantum Monte Carlo
calculations, and for efficient computation of material properties, such as
the anomalous Hall coefficient.

%package devel
Summary:	Development modules for Wannier90
Group:		Development/Languages
Requires:	%{name} = %{version}-%{release}

%description devel
This package contains Fortran modules for Wannier90.

%package doc
Summary:	Documentation for Wannier90
Group:		Documentation
%if 0%{?fedora} > 10 || 0%{?rhel} > 5
BuildArch:	noarch
%endif

%description doc
This package contains the tutorial and user's guide for Wannier90.


%prep
%setup -q
%patch0 -p1 -b .sharedlib
# Remove executable flag from utility that is included in doc
chmod 644 utility/kmesh.pl
# Convert documentation
for file in CHANGE.log; do
 sed "s|\r||g" $file > $file.new && \
 touch -r $file $file.new && \
 mv $file.new $file
done

%build
# Generate make.sys
echo "F90 = gfortran" > make.sys
echo "FCOPTS = %{optflags} -fPIC" >> make.sys
echo "LDOPTS = %{optflags} -fPIC" >> make.sys

# Use ATLAS
%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7
echo "LIBS = -L%{_libdir}/atlas -lsatlas" >> make.sys
%else
echo "LIBS = -L%{_libdir}/atlas -llapack -lf77blas -latlas" >> make.sys
%endif
# Use reference LAPACK
#echo "LIBS = -lblas -llapack" >> make.sys

make -C src %{?_smp_mflags}

# Build documentation
make -C doc/user_guide
make -C doc/tutorial


%install
rm -rf %{buildroot}
# Binary & library
install -D -p -m 755 wannier90.x %{buildroot}%{_bindir}/wannier90.x
install -D -p -m 755 postw90.x   %{buildroot}%{_bindir}/postw90.x
# Must install as executable so that find-debuginfo catches this
install -D -p -m 755 libwannier.so %{buildroot}%{_libdir}/libwannier.so

# Fortran module files
mkdir -p %{buildroot}%{_fmoddir}
install -p -m 644 src/obj/*.mod %{buildroot}%{_fmoddir}/

%clean
rm -rf %{buildroot} 

%check
# Set path so that wannier finds its library
export LD_LIBRARY_PATH=`pwd`
make test

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig


%files
%defattr(-,root,root,-)
%doc CHANGE.log LICENCE README utility/ examples/ 
%{_bindir}/wannier90.x
%{_bindir}/postw90.x
%{_libdir}/libwannier.so

%files devel
%defattr(-,root,root,-)
%{_fmoddir}/w90_*.mod

%files doc
%defattr(-,root,root,-)
%doc doc/tutorial.pdf doc/user_guide.pdf

%changelog
* Sun Feb 05 2017 Kalev Lember <klember@redhat.com> - 2.0.0-6
- Rebuilt for libgfortran soname bump

* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Fri Jun 19 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Mon Aug 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Tue Oct 15 2013 Susi Lehtola <jussilehtola@fedoraproject.org> - 2.0.0-1
- Update to 2.0.0.

* Mon Sep 23 2013 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.2-9
- Rebuild against new ATLAS.

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Mar 06 2013 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.2-7
- Fix FTBFS in rawhide.

* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Sun Jul 22 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Tue Feb 16 2010 Jussi Lehtola <jussilehtola@fedoraproject.org> - 1.2-2
- Link library correctly against ATLAS.

* Wed Jan 27 2010 Jussi Lehtola <jussilehtola@fedoraproject.org> - 1.2-1
- Update to 1.2.

* Wed Sep 16 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 1.1-6
- Fix location of Fortran modules.
- Fix check phase.
- Use ATLAS instead of reference BLAS & LAPACK.

* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Sat May 16 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 1.1-4
- Fix EPEL build by adding explicit BR: blas-devel.

* Fri May 15 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 1.1-3
- Link binary against shared library.
- Put library back into main package.

* Tue Apr 21 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 1.1-2
- Break libs into own package.

* Tue Apr 21 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 1.1-1
- First release.