# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os import subprocess from spack.package import * class Turbomole(Package): """TURBOMOLE: Program Package for ab initio Electronic Structure Calculations. Note: Turbomole requires purchase of a license to download. Go to the Turbomole home page, http://www.turbomole-gmbh.com, for details. Spack will search the current directory for this file. It is probably best to add this file to a Spack mirror so that it can be found from anywhere. For information on setting up a Spack mirror see https://spack.readthedocs.io/en/latest/mirrors.html""" homepage = "http://www.turbomole-gmbh.com/" manual_download = True version( "7.0.2", md5="92b97e1e52e8dcf02a4d9ac0147c09d6", url="file://%s/turbolinux702.tar.gz" % os.getcwd(), ) variant("mpi", default=True, description="Set up MPI environment") variant("smp", default=False, description="Set up SMP environment") # Turbomole's install is odd. There are three variants # - serial # - parallel, MPI # - parallel, SMP # # Only one of these can be active at a time. MPI and SMP are set as # variants so there could be up to 3 installs per version. Switching # between them would be accomplished with `module swap` commands. def do_fetch(self, mirror_only=True): if "+mpi" in self.spec and "+smp" in self.spec: raise InstallError("Can not have both SMP and MPI enabled in the " "same build.") super().do_fetch(mirror_only) def get_tm_arch(self): if "TURBOMOLE" in os.getcwd(): tm_sysname = Executable("./scripts/sysname") tm_arch = tm_sysname(output=str) return tm_arch.rstrip("\n") else: return def install(self, spec, prefix): calculate_version = "calculate_2.4_linux64" molecontrol_version = "MoleControl_2.5" tm_arch = self.get_tm_arch() tar = which("tar") dst = join_path(prefix, "TURBOMOLE") tar("-x", "-z", "-f", "thermocalc.tar.gz") with working_dir("thermocalc"): subprocess.call("./install<<