nixpkgs/pkgs/applications/science/chemistry/siesta/default.nix
Markus Kowalewski 6dba41fbcb
mpi: use mpi attribute consistently as the default MPI implementations
Use the attribute mpi to provide a system wide default MPI
implementation. The default is openmpi (as before).
This now allows for overriding the MPI implentation by using
the overlay mechanism. Build all packages with mpich instead
of the default openmpi can now be achived like this:
self: super:
 {
   mpi = super.mpich;
 }

All derivations that have been using "mpi ? null" to provide optional
building with MPI have been change in the following way to allow for
optional builds with MPI:
{ ...
, mpi
, useMpi ? false
}
2021-01-23 12:15:13 +01:00

71 lines
2 KiB
Nix

{ lib, stdenv, fetchurl
, gfortran, blas, lapack, scalapack
, useMpi ? false
, mpi
}:
stdenv.mkDerivation {
version = "4.1-b3";
pname = "siesta";
src = fetchurl {
url = "https://launchpad.net/siesta/4.1/4.1-b3/+download/siesta-4.1-b3.tar.gz";
sha256 = "1450jsxj5aifa0b5fcg7mxxq242fvqnp4zxpgzgbkdp99vrp06gm";
};
passthru = {
inherit mpi;
};
buildInputs = [ blas lapack gfortran ]
++ lib.optionals useMpi [ mpi scalapack ];
enableParallelBuilding = true;
# Must do manualy becuase siesta does not do the regular
# ./configure; make; make install
configurePhase = ''
cd Obj
sh ../Src/obj_setup.sh
cp gfortran.make arch.make
'';
preBuild = if useMpi then ''
makeFlagsArray=(
CC="mpicc" FC="mpifort"
FPPFLAGS="-DMPI" MPI_INTERFACE="libmpi_f90.a" MPI_INCLUDE="."
COMP_LIBS="" LIBS="-lblas -llapack -lscalapack"
);
'' else ''
makeFlagsArray=(
COMP_LIBS="" LIBS="-lblas -llapack"
);
'';
installPhase = ''
mkdir -p $out/bin
cp -a siesta $out/bin
'';
meta = with lib; {
description = "A first-principles materials simulation code using DFT";
longDescription = ''
SIESTA is both a method and its computer program
implementation, to perform efficient electronic structure
calculations and ab initio molecular dynamics simulations of
molecules and solids. SIESTA's efficiency stems from the use
of strictly localized basis sets and from the implementation
of linear-scaling algorithms which can be applied to suitable
systems. A very important feature of the code is that its
accuracy and cost can be tuned in a wide range, from quick
exploratory calculations to highly accurate simulations
matching the quality of other approaches, such as plane-wave
and all-electron methods.
'';
homepage = "https://www.quantum-espresso.org/";
license = licenses.gpl2;
platforms = [ "x86_64-linux" ];
maintainers = [ maintainers.costrouc ];
};
}