diff --git a/recipes/himalaya/all/CMakeLists.txt b/recipes/himalaya/all/CMakeLists.txt new file mode 100644 index 0000000000000..c986d294c7547 --- /dev/null +++ b/recipes/himalaya/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory("source_subfolder") diff --git a/recipes/himalaya/all/conandata.yml b/recipes/himalaya/all/conandata.yml new file mode 100644 index 0000000000000..6fa4e64d74a56 --- /dev/null +++ b/recipes/himalaya/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "4.1.1": + url: "https://github.com/Himalaya-Library/Himalaya/archive/4.1.1.tar.gz" + sha256: "ee83db85f7be743708dc0e2e04cd2addcbbefca7470c11b18d3d9fedb325d36e" diff --git a/recipes/himalaya/all/conanfile.py b/recipes/himalaya/all/conanfile.py new file mode 100644 index 0000000000000..992ad94020e72 --- /dev/null +++ b/recipes/himalaya/all/conanfile.py @@ -0,0 +1,87 @@ +import os +from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.30.0" + + +class HimalayaConan(ConanFile): + name = "himalaya" + license = "GPL-3.0-only" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Himalaya-Library/Himalaya" + description = "C++ library to calculate three-loop corrections to the Higgs boson mass in the MSSM" + topics = ("conan", "high-energy", "physics", "hep", "Higgs", "mass", "MSSM") + settings = "os", "compiler", "build_type", "arch" + options = {"fPIC": [True, False], "shared": [True, False]} + default_options = {"fPIC": True, "shared": False} + exports_sources = ["CMakeLists.txt"] + generators = "cmake" + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _build_subfolder(self): + return "build_subfolder" + + @property + def _minimum_compilers_version(self): + return { + "Visual Studio": "15", + "gcc": "5", + "clang": "5", + "apple-clang": "5.1", + } + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, "14") + minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) + if not minimum_version: + self.output.warn("Himalaya requires C++14. Your compiler is unknown. Assuming it supports C++14.") + elif tools.Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration("Himalaya requires C++14, which your compiler does not support.") + if self.settings.compiler == "Visual Studio": + raise ConanInvalidConfiguration("Himalaya does not support {}".format(self.settings.compiler)) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def build_requirements(self): + self.build_requires("gfortran/10.2") + + def requirements(self): + self.requires("eigen/3.3.9") + + def source(self): + tools.get(**self.conan_data["sources"][self.version]) + os.rename("Himalaya-{}".format(self.version), self._source_subfolder) + + def build(self): + cmake = self._configure_cmake() + cmake.build() + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.definitions["BUILD_EXAMPLES"] = False + self._cmake.configure(build_folder=self._build_subfolder) + return self._cmake + + def package(self): + self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + tools.rmdir(os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "Himalaya" + self.cpp_info.names["cmake_find_package_multi"] = "Himalaya" + self.cpp_info.names["pkg_config"] = "himalaya" + self.cpp_info.libs = ["Himalaya", "DSZ"] + self.cpp_info.requires = ["eigen::eigen"] diff --git a/recipes/himalaya/all/test_package/CMakeLists.txt b/recipes/himalaya/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d9b7886e4b5f --- /dev/null +++ b/recipes/himalaya/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.1) +project(PackageTest CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_executable(test_package test_package.cpp) +target_link_libraries(test_package CONAN_PKG::himalaya) +set_property(TARGET test_package PROPERTY CXX_STANDARD 14) diff --git a/recipes/himalaya/all/test_package/conanfile.py b/recipes/himalaya/all/test_package/conanfile.py new file mode 100644 index 0000000000000..815d48290e119 --- /dev/null +++ b/recipes/himalaya/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +import os + +from conans import ConanFile, CMake, tools + + +class HimalayaTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/himalaya/all/test_package/test_package.cpp b/recipes/himalaya/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..96fe1aafafffd --- /dev/null +++ b/recipes/himalaya/all/test_package/test_package.cpp @@ -0,0 +1,87 @@ +#include "himalaya/HierarchyCalculator.hpp" +#include "himalaya/version.hpp" +#include +#include + +himalaya::Parameters setup_point(double MS, double tb, double xt) +{ + himalaya::Parameters pars; + + const double MS2 = MS*MS; + const double Xt = xt*MS; + const double beta = std::atan(tb); + pars.scale = MS; + pars.mu = MS; + pars.g1 = 0.46; + pars.g2 = 0.65; + pars.g3 = 1.166; + pars.vd = 246*std::cos(beta); + pars.vu = 246*std::sin(beta); + pars.mq2 << MS2, 0, 0, + 0, MS2, 0, + 0, 0, MS2; + pars.md2 << MS2, 0, 0, + 0, MS2, 0, + 0, 0, MS2; + pars.mu2 << MS2, 0, 0, + 0, MS2, 0, + 0, 0, MS2; + pars.ml2 << MS2, 0, 0, + 0, MS2, 0, + 0, 0, MS2; + pars.me2 << MS2, 0, 0, + 0, MS2, 0, + 0, 0, MS2; + pars.Au << 0, 0, 0, + 0, 0, 0, + 0, 0, Xt + pars.mu/tb; + pars.Ad << 0, 0, 0, 0, 0, 0, 0, 0, 0; + pars.Ae << 0, 0, 0, 0, 0, 0, 0, 0, 0; + pars.Yu << 0, 0, 0, 0, 0, 0, 0, 0, 0.862; + pars.Yd << 0, 0, 0, 0 ,0 ,0 ,0 ,0, 0.133; + pars.Ye << 0, 0, 0, 0, 0, 0, 0, 0, 0.101; + pars.MA = MS; + pars.M1 = MS; + pars.M2 = MS; + pars.MG = MS; + + pars.validate(true); + + return pars; +} + +int main() +{ + const auto point = setup_point(2000., 20., std::sqrt(6.)); + himalaya::HierarchyCalculator hc(point); + + try { + // calculate the 3-loop corrections O(α_t*α_s^2) + const auto ho = hc.calculateDMh3L(false); + + // extract 2x2 matrix with three-loop O(αt*αs^2) corrections + const auto dMh3L = ho.getDMh(3); + // extract three-loop O(αt*αs^2) correction to λ (DR'-bar scheme) + const double delta_lambda_3L_DR = ho.getDLambda(3); + // extract uncertainty estimate + const double delta_lambda_3L_uncertainty = ho.getDLambdaUncertainty(3); + // convert to MS-bar scheme + const double delta_lambda_3L_MS = + delta_lambda_3L_DR + ho.getDLambdaDRbarPrimeToMSbarShift(3); + + std::cout << "Himalaya version: " + << Himalaya_VERSION_MAJOR << '.' + << Himalaya_VERSION_MINOR << '.' + << Himalaya_VERSION_RELEASE << '\n'; + + std::cout << "ΔMh^2(3-loop,DR') = \n" << dMh3L << '\n' + << "Δλ(3-loop,DR') = " << delta_lambda_3L_DR + << " +- " << delta_lambda_3L_uncertainty << '\n' + << "Δλ(3-loop,MS) = " << delta_lambda_3L_MS + << " +- " << delta_lambda_3L_uncertainty << '\n'; + } catch (const std::exception& e) { + std::cerr << "Error: " << e.what() << '\n'; + } + + return 0; +} diff --git a/recipes/himalaya/config.yml b/recipes/himalaya/config.yml new file mode 100644 index 0000000000000..66b239fe54f48 --- /dev/null +++ b/recipes/himalaya/config.yml @@ -0,0 +1,3 @@ +versions: + "4.1.1": + folder: all