homebrew-core/Formula/nwchem.rb

77 lines
2.6 KiB
Ruby

class Nwchem < Formula
desc "High-performance computational chemistry tools"
homepage "http://www.nwchem-sw.org"
url "https://github.com/nwchemgit/nwchem/releases/download/v7.0.0-release/nwchem-7.0.0-release.revision-2c9a1c7c-src.2020-02-26.tar.bz2"
version "7.0.0"
sha256 "1046e13a4c7f95860c8e8fac2b4d80657900ecd07a8242943d564048ce303514"
license "ECL-2.0"
revision 2
livecheck do
url "https://github.com/nwchemgit/nwchem.git"
regex(/^v?(\d+(?:\.\d+)+)-release$/i)
end
bottle do
cellar :any
sha256 "fb3cfb7f4fb39a67732ca6998eda76e6cc1c16e8bec2c6798d0f11f1551329a8" => :catalina
sha256 "8bfc48faf6c9c75f1ac2f4888c6c5efde34ed13423b3f0672f33629951f8e3de" => :mojave
sha256 "2b21719fbfaa701d3b68381ce04a2fa115cafb94f11ace38519bf91b9569c89f" => :high_sierra
end
depends_on "gcc" # for gfortran
depends_on "open-mpi"
depends_on "openblas"
depends_on "python@3.8"
depends_on "scalapack"
def install
pkgshare.install "QA"
cd "src" do
(prefix/"etc").mkdir
(prefix/"etc/nwchemrc").write <<~EOS
nwchem_basis_library #{pkgshare}/libraries/
nwchem_nwpw_library #{pkgshare}/libraryps/
ffield amber
amber_1 #{pkgshare}/amber_s/
amber_2 #{pkgshare}/amber_q/
amber_3 #{pkgshare}/amber_x/
amber_4 #{pkgshare}/amber_u/
spce #{pkgshare}/solvents/spce.rst
charmm_s #{pkgshare}/charmm_s/
charmm_x #{pkgshare}/charmm_x/
EOS
inreplace "util/util_nwchemrc.F", "/etc/nwchemrc", "#{etc}/nwchemrc"
ENV["NWCHEM_TOP"] = buildpath
ENV["NWCHEM_LONG_PATHS"] = "Y"
# needed to use python 3.X to skip using default python2
ENV["PYTHONVERSION"] = Language::Python.major_minor_version "python3"
ENV["BLASOPT"] = "-L#{Formula["openblas"].opt_lib} -lopenblas"
ENV["LAPACK_LIB"] = "-L#{Formula["openblas"].opt_lib} -lopenblas"
ENV["BLAS_SIZE"] = "4"
ENV["SCALAPACK"] = "-L#{Formula["scalapack"].opt_prefix}/lib -lscalapack"
ENV["USE_64TO32"] = "y"
system "make", "nwchem_config", "NWCHEM_MODULES=all python"
system "make", "NWCHEM_TARGET=MACX64", "USE_MPI=Y"
bin.install "../bin/MACX64/nwchem"
pkgshare.install "basis/libraries"
pkgshare.install "nwpw/libraryps"
pkgshare.install Dir["data/*"]
end
end
test do
cp_r pkgshare/"QA", testpath
cd "QA" do
ENV["NWCHEM_TOP"] = pkgshare
ENV["NWCHEM_TARGET"] = "MACX64"
ENV["NWCHEM_EXECUTABLE"] = "#{bin}/nwchem"
system "./runtests.mpi.unix", "procs", "0", "dft_he2+", "pyqa3", "prop_mep_gcube", "pspw", "tddft_h2o", "tce_n2"
end
end
end