diff options
Diffstat (limited to 'nixpkgs/pkgs/applications/science/molecular-dynamics')
7 files changed, 435 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/science/molecular-dynamics/dl-poly-classic/default.nix b/nixpkgs/pkgs/applications/science/molecular-dynamics/dl-poly-classic/default.nix new file mode 100644 index 000000000000..cf4584979ba2 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/molecular-dynamics/dl-poly-classic/default.nix @@ -0,0 +1,39 @@ +{ lib, stdenv, fetchurl +, gfortran, mpi +}: + +stdenv.mkDerivation { + version = "1.10"; + pname = "DL_POLY_Classic"; + + src = fetchurl { + url = "https://ccpforge.cse.rl.ac.uk/gf/download/frsrelease/574/8924/dl_class_1.10.tar.gz"; + sha256 = "1r76zvln3bwycxlmqday0sqzv5j260y7mdh66as2aqny6jzd5ld7"; + }; + + nativeBuildInputs = [ gfortran ]; + + buildInputs = [ mpi ]; + + configurePhase = '' + cd source + cp -v ../build/MakePAR Makefile + ''; + + buildPhase = '' + make dlpoly + ''; + + installPhase = '' + mkdir -p $out/bin + cp -v ../execute/DLPOLY.X $out/bin + ''; + + meta = with lib; { + homepage = "https://www.ccp5.ac.uk/DL_POLY_C"; + description = "DL_POLY Classic is a general purpose molecular dynamics simulation package"; + license = licenses.bsdOriginal; + platforms = [ "x86_64-linux" ]; + maintainers = [ maintainers.costrouc ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/molecular-dynamics/gromacs/default.nix b/nixpkgs/pkgs/applications/science/molecular-dynamics/gromacs/default.nix new file mode 100644 index 000000000000..2ca47d812bbf --- /dev/null +++ b/nixpkgs/pkgs/applications/science/molecular-dynamics/gromacs/default.nix @@ -0,0 +1,101 @@ +{ lib, stdenv, fetchurl, cmake, hwloc, fftw, perl, blas, lapack, mpi, cudatoolkit +, singlePrec ? true +, config +, enableMpi ? false +, enableCuda ? config.cudaSupport +, cpuAcceleration ? null +}: + +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 + if stdenv.hostPlatform.system == "aarch64-linux" then "ARM_NEON_ASIMD" else + "None"; + +in stdenv.mkDerivation rec { + pname = "gromacs"; + version = "2023.3"; + + src = fetchurl { + url = "ftp://ftp.gromacs.org/pub/gromacs/gromacs-${version}.tar.gz"; + sha256 = "sha256-Tsj40MevdrE/j9FtuOLBIOdJ3kOa6VVNn2U/gS140cs="; + }; + + patches = [ ./pkgconfig.patch ]; + + outputs = [ "out" "dev" "man" ]; + + nativeBuildInputs = [ cmake ]; + + buildInputs = [ + fftw + perl + hwloc + blas + lapack + ] ++ lib.optional enableMpi mpi + ++ lib.optional enableCuda cudatoolkit + ; + + propagatedBuildInputs = lib.optional enableMpi mpi; + propagatedUserEnvPkgs = lib.optional enableMpi mpi; + + cmakeFlags = [ + "-DGMX_SIMD:STRING=${SIMD cpuAcceleration}" + "-DGMX_OPENMP:BOOL=TRUE" + "-DBUILD_SHARED_LIBS=ON" + ] ++ ( + if singlePrec then [ + "-DGMX_DOUBLE=OFF" + ] else [ + "-DGMX_DOUBLE=ON" + "-DGMX_DEFAULT_SUFFIX=OFF" + ] + ) ++ ( + if enableMpi + then [ + "-DGMX_MPI:BOOL=TRUE" + "-DGMX_THREAD_MPI:BOOL=FALSE" + ] + else [ + "-DGMX_MPI:BOOL=FALSE" + ] + ) ++ lib.optional enableCuda "-DGMX_GPU=CUDA"; + + postInstall = '' + moveToOutput share/cmake $dev + ''; + + meta = with lib; { + homepage = "https://www.gromacs.org"; + license = licenses.lgpl21Plus; + description = "Molecular dynamics software package"; + 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. + + See: https://www.gromacs.org/about.html for details. + ''; + platforms = platforms.unix; + maintainers = with maintainers; [ sheepforce markuskowa ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/molecular-dynamics/gromacs/pkgconfig.patch b/nixpkgs/pkgs/applications/science/molecular-dynamics/gromacs/pkgconfig.patch new file mode 100644 index 000000000000..6740d2312369 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/molecular-dynamics/gromacs/pkgconfig.patch @@ -0,0 +1,24 @@ +diff --git a/src/external/muparser/muparser.pc.in b/src/external/muparser/muparser.pc.in +index 646787cb53..9b97ad57f7 100644 +--- a/src/external/muparser/muparser.pc.in ++++ b/src/external/muparser/muparser.pc.in +@@ -1,7 +1,5 @@ +-prefix=@CMAKE_INSTALL_PREFIX@ +-exec_prefix=${prefix} +-libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ +-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ ++libdir=@CMAKE_INSTALL_FULL_LIBDIR@ ++includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + + Name: @PACKAGE_NAME@ + Description: Mathematical expressions parser library +diff --git a/src/gromacs/libgromacs.pc.cmakein b/src/gromacs/libgromacs.pc.cmakein +index ec1ed6684e..ca1105474a 100644 +--- a/src/gromacs/libgromacs.pc.cmakein ++++ b/src/gromacs/libgromacs.pc.cmakein +@@ -1,4 +1,4 @@ +-libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ ++libdir=@CMAKE_INSTALL_FULL_LIBDIR@ + + Name: libgromacs@GMX_LIBS_SUFFIX@ + Description: Gromacs library diff --git a/nixpkgs/pkgs/applications/science/molecular-dynamics/lammps/default.nix b/nixpkgs/pkgs/applications/science/molecular-dynamics/lammps/default.nix new file mode 100644 index 000000000000..7924d044c2ab --- /dev/null +++ b/nixpkgs/pkgs/applications/science/molecular-dynamics/lammps/default.nix @@ -0,0 +1,121 @@ +{ lib +, stdenv +, fetchFromGitHub +, libpng +, gzip +, fftw +, blas +, lapack +, cmake +, cudaPackages +, pkg-config +# Available list of packages can be found near here: +# +# - https://github.com/lammps/lammps/blob/develop/cmake/CMakeLists.txt#L222 +# - https://docs.lammps.org/Build_extras.html +, packages ? { + ASPHERE = true; + BODY = true; + CLASS2 = true; + COLLOID = true; + COMPRESS = true; + CORESHELL = true; + DIPOLE = true; + GRANULAR = true; + KSPACE = true; + MANYBODY = true; + MC = true; + MISC = true; + MOLECULE = true; + OPT = true; + PERI = true; + QEQ = true; + REPLICA = true; + RIGID = true; + SHOCK = true; + ML-SNAP = true; + SRD = true; + REAXFF = true; +} +# Extra cmakeFlags to add as "-D${attr}=${value}" +, extraCmakeFlags ? {} +# Extra `buildInputs` - meant for packages that require more inputs +, extraBuildInputs ? [] +}: + +stdenv.mkDerivation (finalAttrs: { + # LAMMPS has weird versioning convention. Updates should go smoothly with: + # nix-update --commit lammps --version-regex 'stable_(.*)' + version = "2Aug2023_update1"; + pname = "lammps"; + + src = fetchFromGitHub { + owner = "lammps"; + repo = "lammps"; + rev = "stable_${finalAttrs.version}"; + hash = "sha256-Zmn87a726qdidBfyvJlYleYv9jqyFAakxjGrg3lipc0="; + }; + preConfigure = '' + cd cmake + ''; + nativeBuildInputs = [ + cmake + pkg-config + # Although not always needed, it is needed if cmakeFlags include + # GPU_API=cuda, and it doesn't users that don't enable the GPU package. + cudaPackages.autoAddOpenGLRunpathHook + ]; + + passthru = { + # Remove these at some point - perhaps after release 23.11. See discussion at: + # https://github.com/NixOS/nixpkgs/pull/238771#discussion_r1235459961 + mpi = throw "`lammps-mpi.passthru.mpi` was removed in favor of `extraBuildInputs`"; + inherit packages; + inherit extraCmakeFlags; + inherit extraBuildInputs; + }; + cmakeFlags = [ + ] + ++ (builtins.map (p: "-DPKG_${p}=ON") (builtins.attrNames (lib.filterAttrs (n: v: v) packages))) + ++ (lib.mapAttrsToList (n: v: "-D${n}=${v}") extraCmakeFlags) + ; + + buildInputs = [ + fftw + libpng + blas + lapack + gzip + ] ++ extraBuildInputs + ; + + postInstall = '' + # For backwards compatibility + ln -s $out/bin/lmp $out/bin/lmp_serial + # Install vim and neovim plugin + install -Dm644 ../../tools/vim/lammps.vim $out/share/vim-plugins/lammps/syntax/lammps.vim + install -Dm644 ../../tools/vim/filetype.vim $out/share/vim-plugins/lammps/ftdetect/lammps.vim + mkdir -p $out/share/nvim + ln -s $out/share/vim-plugins/lammps $out/share/nvim/site + ''; + + meta = with lib; { + description = "Classical Molecular Dynamics simulation code"; + longDescription = '' + LAMMPS is a classical molecular dynamics simulation code designed to + run efficiently on parallel computers. It was developed at Sandia + National Laboratories, a US Department of Energy facility, with + funding from the DOE. It is an open-source code, distributed freely + under the terms of the GNU Public License (GPL). + ''; + homepage = "https://lammps.sandia.gov"; + license = licenses.gpl2Plus; + platforms = platforms.linux; + # compiling lammps with 64 bit support blas and lapack might cause runtime + # segfaults. In anycase both blas and lapack should have the same #bits + # support. + broken = (blas.isILP64 && lapack.isILP64); + maintainers = [ maintainers.costrouc maintainers.doronbehar ]; + mainProgram = "lmp"; + }; +}) diff --git a/nixpkgs/pkgs/applications/science/molecular-dynamics/raspa/data.nix b/nixpkgs/pkgs/applications/science/molecular-dynamics/raspa/data.nix new file mode 100644 index 000000000000..bcc9dc3b372e --- /dev/null +++ b/nixpkgs/pkgs/applications/science/molecular-dynamics/raspa/data.nix @@ -0,0 +1,33 @@ +{ lib +, stdenvNoCC +, gzip +, raspa +}: + +stdenvNoCC.mkDerivation rec { + pname = "raspa-data"; + inherit (raspa) version src; + + outputs = [ "out" "doc" ]; + + nativeBuildInpuhs = [ gzip ]; + + installPhase = '' + runHook preInstall + mkdir -p "$out/share/raspa" + mv examples "$out/share/raspa" + mkdir -p "$doc/share/raspa" + mv -T "Docs" "$doc/share/raspa/doc" + runHook postInstall + ''; + + # Keep the shebangs of the examples from being patched + dontPatchShebangs = true; + + meta = with lib; { + inherit (raspa.meta) homepage license maintainers; + description = "Example packs and documentation of RASPA"; + outputsToInstall = [ "out" "doc" ]; + platforms = lib.platforms.all; + }; +} diff --git a/nixpkgs/pkgs/applications/science/molecular-dynamics/raspa/default.nix b/nixpkgs/pkgs/applications/science/molecular-dynamics/raspa/default.nix new file mode 100644 index 000000000000..149db0504bf1 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/molecular-dynamics/raspa/default.nix @@ -0,0 +1,79 @@ +{ lib +, stdenv +, fetchFromGitHub +, autoreconfHook +, makeWrapper +, fftw +, lapack +, openblas +, runCommandLocal +, raspa +, raspa-data +}: +stdenv.mkDerivation rec { + pname = "raspa"; + version = "2.0.47"; + + src = fetchFromGitHub { + owner = "iRASPA"; + repo = "RASPA2"; + rev = "v${version}"; + hash = "sha256-i8Y+pejiOuyPNJto+/0CmRoAnMljCrnDFx8qDh4I/68="; + }; + + nativeBuildInputs = [ + autoreconfHook + makeWrapper + ]; + + buildInputs = [ + fftw + lapack + openblas + ]; + + # Prepare for the Python binding packaging. + strictDeps = true; + + enableParallelBuilding = true; + + preAutoreconf = '' + mkdir "m4" + ''; + + postAutoreconf = '' + automake --add-missing + autoconf + ''; + + doCheck = true; + + # Wrap with RASPA_DIR + # so that users can run $out/bin/simulate directly + # without the need of a `run` srcipt. + postInstall = '' + wrapProgram "$out/bin/simulate" \ + --set RASPA_DIR "$out" + ''; + + passthru.tests.run-an-example = runCommandLocal "raspa-test-run-an-example" { } + '' + set -eu -o pipefail + exampleDir="${raspa-data}/share/raspa/examples/Basic/1_MC_Methane_in_Box" + exampleDirWritable="$(basename "$exampleDir")" + cp -rT "$exampleDir" "./$exampleDirWritable" + chmod u+rw -R "$exampleDirWritable" + cd "$exampleDirWritable" + ${raspa}/bin/simulate + touch "$out" + ''; + + meta = with lib; { + description = "A general purpose classical molecular simulation package"; + homepage = "https://iraspa.org/raspa/"; + license = licenses.mit; + platforms = platforms.all; + maintainers = with maintainers; [ ShamrockLee ]; + mainProgram = "simulate"; + }; +} diff --git a/nixpkgs/pkgs/applications/science/molecular-dynamics/viennarna/default.nix b/nixpkgs/pkgs/applications/science/molecular-dynamics/viennarna/default.nix new file mode 100644 index 000000000000..f292cbb378c9 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/molecular-dynamics/viennarna/default.nix @@ -0,0 +1,38 @@ +{ lib +, stdenv +, fetchurl +, gsl +, mpfr +, perl +, python3 +}: + +stdenv.mkDerivation rec { + pname = "viennarna"; + version = "2.5.1"; + + src = fetchurl { + url = "https://www.tbi.univie.ac.at/RNA/download/sourcecode/2_5_x/ViennaRNA-${version}.tar.gz"; + sha256 = "sha256-BUAEN88VWV4QsaJd9snEiFbzVhMPnR44D6iGa20n9Fc="; + }; + + buildInputs = [ + gsl + mpfr + perl + python3 + ]; + + configureFlags = [ + "--with-cluster" + "--with-kinwalker" + ]; + + meta = with lib; { + description = "Prediction and comparison of RNA secondary structures"; + homepage = "https://www.tbi.univie.ac.at/RNA/"; + license = licenses.unfree; + maintainers = with maintainers; [ prusnak ]; + platforms = platforms.unix; + }; +} |