class Gromacs < Formula desc "Versatile package for molecular dynamics calculations" homepage "http://www.gromacs.org/" url "https://ftp.gromacs.org/pub/gromacs/gromacs-2018.3.tar.gz" sha256 "4423a49224972969c52af7b1f151579cea6ab52148d8d7cbae28c183520aa291" bottle do sha256 "7e7a91d9324d2eea4c6095a7b469c9b59a103d3e7a564e16f7f647f084c82433" => :mojave sha256 "ecef5c12a18508f6f7a0b6273f606680121f5a2ddc9df2c792cbbbd4ff9463cf" => :high_sierra sha256 "da427af1b26005972c484923bd199ee0fb642096123ed7a1ca5b00916d0353ff" => :sierra sha256 "9096c516ac4cb6cb3e21cf07d1ddbe1e2647ae92c031f2c8d2330ee72a6bfbc0" => :el_capitan end option "with-double", "Enables double precision" option "with-mpi", "Enable parallel support" depends_on "cmake" => :build depends_on "fftw" depends_on "gsl" depends_on "open-mpi" if build.with? "mpi" depends_on :x11 => :optional def install args = std_cmake_args + %w[-DGMX_GSL=ON] args << "-DGMX_DOUBLE=ON" if build.include? "enable-double" args << "-DGMX_MPI=ON" if build.with? "mpi" args << "-DGMX_X11=ON" if build.with? "x11" inreplace "scripts/CMakeLists.txt", "CMAKE_INSTALL_BINDIR", "CMAKE_INSTALL_DATADIR" mkdir "build" do system "cmake", "..", *args system "make" ENV.deparallelize { system "make", "install" } end bash_completion.install "build/scripts/GMXRC" => "gromacs-completion.bash" bash_completion.install "#{bin}/gmx-completion-gmx.bash" => "gmx-completion-gmx.bash" bash_completion.install "#{bin}/gmx-completion.bash" => "gmx-completion.bash" zsh_completion.install "build/scripts/GMXRC.zsh" => "_gromacs" end def caveats; <<~EOS GMXRC and other scripts installed to: #{HOMEBREW_PREFIX}/share/gromacs EOS end test do system "#{bin}/gmx", "help" end end