2021-10-06 13:57:05 +00:00
|
|
|
{ lib, stdenv
|
2021-02-05 17:12:51 +00:00
|
|
|
, gfortran, blas, lapack, scalapack
|
|
|
|
, useMpi ? false
|
|
|
|
, mpi
|
2021-10-06 13:57:05 +00:00
|
|
|
, fetchFromGitLab
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2021-10-06 13:57:05 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
version = "4.1.5";
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "siesta";
|
|
|
|
|
2021-10-06 13:57:05 +00:00
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "siesta-project";
|
|
|
|
repo = "siesta";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0lz8rfl5xwdj17zn7a30ipi7cgjwqki21a7wg9rdg7iwx27bpnmg";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace Src/siesta_init.F --replace '/bin/rm' 'rm'
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
passthru = {
|
|
|
|
inherit mpi;
|
|
|
|
};
|
|
|
|
|
2021-09-26 12:46:18 +00:00
|
|
|
nativeBuildInputs = [ gfortran ];
|
|
|
|
|
|
|
|
buildInputs = [ blas lapack ]
|
2021-02-05 17:12:51 +00:00
|
|
|
++ lib.optionals useMpi [ mpi scalapack ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
enableParallelBuilding = false; # Started making trouble with gcc-11
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
# Must do manually because siesta does not do the regular
|
2020-04-24 23:36:52 +00:00
|
|
|
# ./configure; make; make install
|
|
|
|
configurePhase = ''
|
|
|
|
cd Obj
|
|
|
|
sh ../Src/obj_setup.sh
|
|
|
|
cp gfortran.make arch.make
|
|
|
|
'';
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
preBuild = ''
|
|
|
|
# See https://gitlab.com/siesta-project/siesta/-/commit/a10bf1628e7141ba263841889c3503c263de1582
|
|
|
|
# This may be fixed in the next release.
|
2020-04-24 23:36:52 +00:00
|
|
|
makeFlagsArray=(
|
2022-05-18 14:49:53 +00:00
|
|
|
FFLAGS="-fallow-argument-mismatch"
|
|
|
|
)
|
|
|
|
'' + (if useMpi then ''
|
|
|
|
makeFlagsArray+=(
|
2020-04-24 23:36:52 +00:00
|
|
|
CC="mpicc" FC="mpifort"
|
|
|
|
FPPFLAGS="-DMPI" MPI_INTERFACE="libmpi_f90.a" MPI_INCLUDE="."
|
|
|
|
COMP_LIBS="" LIBS="-lblas -llapack -lscalapack"
|
|
|
|
);
|
|
|
|
'' else ''
|
2022-05-18 14:49:53 +00:00
|
|
|
makeFlagsArray+=(
|
2020-04-24 23:36:52 +00:00
|
|
|
COMP_LIBS="" LIBS="-lblas -llapack"
|
|
|
|
);
|
2022-05-18 14:49:53 +00:00
|
|
|
'');
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp -a siesta $out/bin
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
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.
|
|
|
|
'';
|
2021-10-06 13:57:05 +00:00
|
|
|
homepage = "https://siesta-project.org/siesta/";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
maintainers = [ maintainers.costrouc ];
|
|
|
|
};
|
|
|
|
}
|