2021-10-28 14:47:06 +00:00
|
|
|
{ lib, stdenv, fetchurl, cmake, hwloc, fftw, perl, blas, lapack, mpi, cudatoolkit
|
|
|
|
, singlePrec ? true
|
|
|
|
, enableMpi ? false
|
|
|
|
, enableCuda ? false
|
|
|
|
, cpuAcceleration ? null
|
2012-11-23 14:29:17 +00:00
|
|
|
}:
|
|
|
|
|
2020-11-27 10:33:45 +00:00
|
|
|
let
|
|
|
|
# Select reasonable defaults for all major platforms
|
|
|
|
# The possible values are defined in CMakeLists.txt:
|
|
|
|
# AUTO None SSE2 SSE4.1 AVX_128_FMA AVX_256 AVX2_256
|
|
|
|
# AVX2_128 AVX_512 AVX_512_KNL MIC ARM_NEON ARM_NEON_ASIMD
|
|
|
|
SIMD = x: if (cpuAcceleration != null) then x else
|
|
|
|
if stdenv.hostPlatform.system == "i686-linux" then "SSE2" else
|
|
|
|
if stdenv.hostPlatform.system == "x86_64-linux" then "SSE4.1" else
|
|
|
|
if stdenv.hostPlatform.system == "x86_64-darwin" then "SSE4.1" else
|
2021-11-28 11:43:57 +00:00
|
|
|
if stdenv.hostPlatform.system == "aarch64-linux" then "ARM_NEON_ASIMD" else
|
2020-11-27 10:33:45 +00:00
|
|
|
"None";
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "gromacs";
|
2023-02-08 13:10:27 +00:00
|
|
|
version = "2023";
|
2012-11-23 14:29:17 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2020-11-27 10:33:45 +00:00
|
|
|
url = "ftp://ftp.gromacs.org/pub/gromacs/gromacs-${version}.tar.gz";
|
2023-02-08 13:10:27 +00:00
|
|
|
sha256 = "sha256-rJLG2nL7vMpBT9io2Xnlbs8XxMHNq+0tpc+05yd7e6g=";
|
2012-11-23 14:29:17 +00:00
|
|
|
};
|
|
|
|
|
2019-10-07 11:03:13 +00:00
|
|
|
nativeBuildInputs = [ cmake ];
|
2021-10-28 11:50:39 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
fftw
|
|
|
|
perl
|
|
|
|
hwloc
|
|
|
|
blas
|
|
|
|
lapack
|
2021-10-28 14:46:13 +00:00
|
|
|
] ++ lib.optional enableMpi mpi
|
|
|
|
++ lib.optional enableCuda cudatoolkit
|
2021-10-28 11:50:39 +00:00
|
|
|
;
|
|
|
|
|
2021-10-28 14:46:13 +00:00
|
|
|
propagatedBuildInputs = lib.optional enableMpi mpi;
|
|
|
|
propagatedUserEnvPkgs = lib.optional enableMpi mpi;
|
2012-11-23 14:29:17 +00:00
|
|
|
|
2020-11-27 10:33:45 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DGMX_SIMD:STRING=${SIMD cpuAcceleration}"
|
|
|
|
"-DGMX_OPENMP:BOOL=TRUE"
|
2021-10-28 11:50:39 +00:00
|
|
|
"-DBUILD_SHARED_LIBS=ON"
|
2020-11-27 10:33:45 +00:00
|
|
|
] ++ (
|
2019-10-28 09:17:49 +00:00
|
|
|
if singlePrec then [
|
|
|
|
"-DGMX_DOUBLE=OFF"
|
|
|
|
] else [
|
|
|
|
"-DGMX_DOUBLE=ON"
|
|
|
|
"-DGMX_DEFAULT_SUFFIX=OFF"
|
|
|
|
]
|
|
|
|
) ++ (
|
2021-10-28 12:52:30 +00:00
|
|
|
if enableMpi
|
2021-10-28 11:50:39 +00:00
|
|
|
then [
|
|
|
|
"-DGMX_MPI:BOOL=TRUE"
|
|
|
|
"-DGMX_THREAD_MPI:BOOL=FALSE"
|
|
|
|
]
|
|
|
|
else [
|
|
|
|
"-DGMX_MPI:BOOL=FALSE"
|
|
|
|
]
|
2021-10-28 14:46:13 +00:00
|
|
|
) ++ lib.optional enableCuda "-DGMX_GPU=CUDA";
|
2012-11-23 14:29:17 +00:00
|
|
|
|
2022-09-28 14:48:34 +00:00
|
|
|
postFixup = ''
|
|
|
|
substituteInPlace "$out"/lib/pkgconfig/*.pc \
|
|
|
|
--replace '=''${prefix}//' '=/' \
|
|
|
|
--replace "$out/$out/" "$out/"
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2023-02-19 20:43:38 +00:00
|
|
|
homepage = "https://www.gromacs.org";
|
2019-10-28 09:17:49 +00:00
|
|
|
license = licenses.gpl2;
|
2014-08-24 14:21:08 +00:00
|
|
|
description = "Molecular dynamics software package";
|
2012-11-23 14:29:17 +00:00
|
|
|
longDescription = ''
|
|
|
|
GROMACS is a versatile package to perform molecular dynamics,
|
|
|
|
i.e. simulate the Newtonian equations of motion for systems
|
|
|
|
with hundreds to millions of particles.
|
|
|
|
|
|
|
|
It is primarily designed for biochemical molecules like
|
|
|
|
proteins, lipids and nucleic acids that have a lot of
|
|
|
|
complicated bonded interactions, but since GROMACS is
|
|
|
|
extremely fast at calculating the nonbonded interactions (that
|
|
|
|
usually dominate simulations) many groups are also using it
|
|
|
|
for research on non-biological systems, e.g. polymers.
|
|
|
|
|
|
|
|
GROMACS supports all the usual algorithms you expect from a
|
|
|
|
modern molecular dynamics implementation, (check the online
|
|
|
|
reference or manual for details), but there are also quite a
|
|
|
|
few features that make it stand out from the competition.
|
|
|
|
|
2023-01-21 21:41:12 +00:00
|
|
|
See: https://www.gromacs.org/About_Gromacs for details.
|
2012-11-23 14:29:17 +00:00
|
|
|
'';
|
2016-08-02 17:50:55 +00:00
|
|
|
platforms = platforms.unix;
|
2021-10-28 11:50:39 +00:00
|
|
|
maintainers = with maintainers; [ sheepforce markuskowa ];
|
2012-11-23 14:29:17 +00:00
|
|
|
};
|
|
|
|
}
|