-
Notifications
You must be signed in to change notification settings - Fork 2k
Adding recipe for Himalaya #4681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
503db36
526fef6
514181b
6c3a79b
a1a4cfd
4c69b5b
6c12dde
06d077f
6a5f8ee
c75b155
039b6b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(cmake_wrapper) | ||
|
||
include(conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_subdirectory("source_subfolder") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"4.1.1": | ||
url: "https://github.com/Himalaya-Library/Himalaya/archive/4.1.1.tar.gz" | ||
sha256: "ee83db85f7be743708dc0e2e04cd2addcbbefca7470c11b18d3d9fedb325d36e" |
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -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 | ||||||||||||||
|
||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Many thanks for the proposal! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes no sense disabling fPIC when building shared library, so we disable it. Otherwise, it would affect the package ID, for both values. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, now I think I understand. :) You are saying that since Himalaya always builds a shared library, the |
||||||||||||||
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) | ||||||||||||||
Expander marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
|
||||||||||||||
def build(self): | ||||||||||||||
Expander marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
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"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
Expander marked this conversation as resolved.
Show resolved
Hide resolved
|
||
set_property(TARGET test_package PROPERTY CXX_STANDARD 14) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#include "himalaya/HierarchyCalculator.hpp" | ||
#include "himalaya/version.hpp" | ||
#include <iostream> | ||
#include <cmath> | ||
|
||
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; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"4.1.1": | ||
folder: all |
Uh oh!
There was an error while loading. Please reload this page.