%global git 0 %global commit 570c9d190fee556c62e5bd0a9c6797c4dffcc271 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global blaslib openblas %global blasvar o %global cmake_blas_flags -DBLAS_LIBRARIES=%{_libdir}/lib%{blaslib}%{blasvar}.so -DLAPACK_LIBRARIES=%{_libdir}/lib%{blaslib}%{blasvar}.so Name: lammps Version: 20241119 Release: 1%{?dist} Summary: Molecular Dynamics Simulator # Automatically converted from old format: GPLv2 - review is highly recommended. License: GPL-2.0-only Url: https://www.lammps.org/ Source0: lammps-patch_19Nov2024.tar.gz Source1: googletest-1.12.1.tar.gz Source2: yaml-0.2.5.tar.gz Source3: opencl-loader-2024.05.09.tar.gz Source4: spglib-1.11.2.1.tar.gz Source5: heffte-2.4.0.tar.gz Patch0: 0-lammps-change-cmake-download.patch # https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval # mpi is broken on s390x see, bug #2322073 ExcludeArch: %{ix86} s390x BuildRequires: environment-modules BuildRequires: fftw-devel BuildRequires: gcc-c++ BuildRequires: gcc-fortran BuildRequires: libpng-devel BuildRequires: libjpeg-devel %ifnarch %ix86 BuildRequires: openmpi-devel BuildRequires: python3-mpi4py-openmpi BuildRequires: python3-mpi4py-mpich %endif BuildRequires: mpich-devel BuildRequires: python3-devel BuildRequires: python3-numpy BuildRequires: fftw3-devel BuildRequires: zlib-devel BuildRequires: gsl-devel BuildRequires: voro++-devel BuildRequires: %{blaslib}-devel BuildRequires: hdf5-devel BuildRequires: kim-api-devel BuildRequires: kim-api-examples BuildRequires: cmake3 >= 3.16 BuildRequires: ocl-icd-devel BuildRequires: opencl-headers BuildRequires: tbb-devel BuildRequires: readline-devel # before F33 there was no kokkos package %if 0%{?fedora} >= 33 %ifnarch i686 armv7hl %global with_kokkos 1 # kokkos needs a lot of memory %global _smp_mflags -j1 BuildRequires: kokkos-devel >= 4.3 %endif %endif Requires: %{name}-data %global lammps_desc \ LAMMPS is a classical molecular dynamics code, and an acronym for Large-scale \ Atomic/Molecular Massively Parallel Simulator.\ \ LAMMPS has potentials for soft materials (biomolecules, polymers) and \ solid-state materials (metals, semiconductors) and coarse-grained or \ mesoscopic systems. It can be used to model atoms or, more generically, as a \ parallel particle simulator at the atomic, meso, or continuum scale. \ \ LAMMPS runs on single processors or in parallel using message-passing \ techniques and a spatial-decomposition of the simulation domain. The code is \ designed to be easy to modify or extend with new functionality. %description %{lammps_desc} %ifnarch %ix86 %global with_openmpi 1 %package openmpi Summary: LAMMPS Open MPI binaries and libraries Requires: openmpi Requires: %{name}-data %description openmpi %{lammps_desc} This package contains LAMMPS Open MPI binaries and libraries %endif %package mpich Summary: LAMMPS MPICH binaries and libraries Requires: mpich Requires: %{name}-data %description mpich %{lammps_desc} This package contains LAMMPS MPICH binaries and libraries %package -n python3-%{name} Summary: LAMMPS Python interface Requires: python3 Requires: python3-numpy Requires: %{name}%{?_isa} = %{version}-%{release} %{?python_provide:%python_provide python3-%{name}} %description -n python3-%{name} %{lammps_desc} This package contains LAMMPS Python interface %package headers Summary: Development headers for LAMMPS %description headers %{lammps_desc} This package contains development headers for LAMMPS. %package devel Summary: Development libraries for LAMMPS Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}-headers%{?_isa} = %{version}-%{release} %description devel %{lammps_desc} This package contains development libraries for serial LAMMPS. %package mpich-devel Summary: Development libraries for MPICH LAMMPS Requires: %{name}-mpich%{?_isa} = %{version}-%{release} Requires: %{name}-headers%{?_isa} = %{version}-%{release} %description mpich-devel %{lammps_desc} This package contains development headers and libraries for MPICH LAMMPS. %ifnarch %ix86 %package openmpi-devel Summary: Development libraries for Open MPI LAMMPS Requires: %{name}-openmpi%{?_isa} = %{version}-%{release} Requires: %{name}-headers%{?_isa} = %{version}-%{release} %description openmpi-devel %{lammps_desc} This package contains development libraries for Open MPI LAMMPS. %endif %package data Summary: Data files for LAMMPS BuildArch: noarch %description data %{lammps_desc} This package contains data files for LAMMPS. BuildRequires: python3-setuptools >= 42 BuildRequires: python3-wheel BuildRequires: python3-build %prep %autosetup -p1 -n lammps-patch_19Nov2024 cp %{SOURCE5} cmake/ %build set +e . /etc/profile.d/modules.sh set -e for mpi in '' mpich %{?with_openmpi:openmpi} ; do test -n "${mpi}" && module load mpi/${mpi}-%{_arch} if [ -z "$mpi" ]; then mkdir build && cd build else mkdir build-${mpi} && cd build-${mpi} fi #python wrapper isn't mpi specific %{cmake3} ../cmake \ -C ../cmake/presets/all_on.cmake \ -C ../cmake/presets/nolib.cmake \ %{cmake_blas_flags} \ -DCMAKE_TUNE_FLAGS='' \ -DCMAKE_CUSTOM_LINKER="default" \ -DPKG_PYTHON=ON \ -DPKG_VORONOI=ON \ -DPKG_ATC=ON \ -DPKG_H5MD=ON \ %{?with_kokkos:-DPKG_KOKKOS=ON -DEXTERNAL_KOKKOS=ON} \ -DPKG_KIM=ON \ -DENABLE_TESTING=ON \ -DGTEST_URL=file://%{S:1} \ -DYAML_URL=file://%{S:2} \ -DOPENCL_LOADER_URL=file://%{S:3} \ -DSPGLIB_URL=file://%{S:4} \ -DDOWNLOAD_POTENTIALS=OFF \ -DPYTHON_INSTDIR=%{python3_sitelib} \ -DCMAKE_INSTALL_SYSCONFDIR=/etc \ -DPKG_GPU=ON -DGPU_API=OpenCL \ -DBUILD_OMP=ON \ -DFFT=FFTW3 \ %ifnarch x86_64 %x86 -DPKG_INTEL=OFF \ %endif -DCMAKE_INSTALL_BINDIR=${MPI_BIN:-%{_bindir}} -DCMAKE_INSTALL_LIBDIR=${MPI_LIB:-%{_libdir}} -DLAMMPS_MACHINE="${MPI_SUFFIX#_}" -DLAMMPS_LIB_SUFFIX="${MPI_SUFFIX#_}" -DCMAKE_INSTALL_MANDIR=${MPI_MAN:-%{_mandir}} \ ${mpi:+-DBUILD_MPI=ON -DFFT_USE_HEFFTE=ON -DCMAKE_EXE_LINKER_FLAGS="%{__global_ldflags} -Wl,-rpath -Wl,${MPI_LIB} -Wl,--enable-new-dtags" -DCMAKE_SHARED_LINKER_FLAGS="%{__global_ldflags} -Wl,-rpath -Wl,${MPI_LIB} -Wl,--enable-new-dtags" $(test "$mpi" != openmpi || echo "-DMPIEXEC_PREFLAGS=--oversubscribe") } \ $(test -z "${mpi}" && echo -DBUILD_MPI=OFF -DBUILD_LAMMPS_SHELL=ON -DBUILD_TOOLS=ON) cmake --build . -j8 test -n "${mpi}" && module unload mpi/${mpi}-%{_arch} cd .. done cd python %py3_build %install set +e . /etc/profile.d/modules.sh set -e for mpi in '' mpich %{?with_openmpi:openmpi} ; do if [ -z "$mpi" ]; then %make_install -C build else %make_install -C build-${mpi} fi done cd python %py3_install %files %doc README %license LICENSE %{_bindir}/lmp %{_mandir}/man1/lmp.* %{_libdir}/liblammps.so.* %{_bindir}/msi2lmp %{_mandir}/man1/msi2lmp.* %{_bindir}/binary2txt %{_bindir}/chain.x %{_bindir}/micelle2d.x %{_bindir}/stl_bin2txt %{_bindir}/phana %exclude %{_builddir}/lammps-patch_19Nov2024/build/phana_build/spglib_build_ext/include/spglib.h %exclude %{_builddir}/lammps-patch_19Nov2024/build/phana_build/spglib_build_ext/lib/libsymspg.a %files devel %{_libdir}/liblammps.so %{_libdir}/pkgconfig/liblammps.pc %{_libdir}/cmake/LAMMPS %ifnarch %ix86 %files openmpi-devel %{_libdir}/openmpi*/lib/liblammps_openmpi.so %{_libdir}/openmpi*/lib/pkgconfig/liblammps_openmpi.pc %{_libdir}/openmpi*/lib/cmake/LAMMPS %endif %files mpich-devel %{_libdir}/mpich*/lib/liblammps_mpich.so %{_libdir}/mpich*/lib/pkgconfig/liblammps_mpich.pc %{_libdir}/mpich*/lib/cmake/LAMMPS %files -n python3-%{name} %{python3_sitelib}/lammps %{python3_sitelib}/lammps-*.egg-info %files headers %license LICENSE %{_includedir}/%{name}/ %ifnarch %ix86 %files openmpi %license LICENSE %{_libdir}/openmpi*/bin/lmp_openmpi %{_mandir}/openmpi*/man1/lmp_openmpi.* %{_libdir}/openmpi*/lib/liblammps_openmpi.so.* %endif %files mpich %license LICENSE %{_libdir}/mpich*/bin/lmp_mpich %{_mandir}/mpich*/man1/lmp_mpich.* %{_libdir}/mpich*/lib/liblammps_mpich.so.* %files data %license LICENSE %{_datadir}/%{name} %config %{_sysconfdir}/profile.d/lammps.* %changelog * Tue Dec 12 2024 zhtianyu - 20241119-1 - Package init