From 4e72d111e92555e993dff69c6f230246c6ce1795 Mon Sep 17 00:00:00 2001 From: Shamrock Lee <44064051+ShamrockLee@users.noreply.github.com> Date: Fri, 5 Aug 2022 00:37:54 +0000 Subject: [PATCH] raspa: init at 2.0.47 and add tests --- .../science/molecular-dynamics/raspa/data.nix | 33 ++++++++ .../molecular-dynamics/raspa/default.nix | 79 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 + 3 files changed, 116 insertions(+) create mode 100644 pkgs/applications/science/molecular-dynamics/raspa/data.nix create mode 100644 pkgs/applications/science/molecular-dynamics/raspa/default.nix diff --git a/pkgs/applications/science/molecular-dynamics/raspa/data.nix b/pkgs/applications/science/molecular-dynamics/raspa/data.nix new file mode 100644 index 000000000000..bcc9dc3b372e --- /dev/null +++ b/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/pkgs/applications/science/molecular-dynamics/raspa/default.nix b/pkgs/applications/science/molecular-dynamics/raspa/default.nix new file mode 100644 index 000000000000..149db0504bf1 --- /dev/null +++ b/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/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index eb033db5acff..d63e419782a5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -37875,6 +37875,10 @@ with pkgs; pspp = callPackage ../applications/science/math/pspp { }; + raspa = callPackage ../applications/science/molecular-dynamics/raspa { }; + + raspa-data = callPackage ../applications/science/molecular-dynamics/raspa/data.nix { }; + ssw = callPackage ../applications/misc/ssw { }; pynac = callPackage ../applications/science/math/pynac { };