Skip to content

Commit

Permalink
Merge pull request phbasler#91 from phbasler/develop
Browse files Browse the repository at this point in the history
RC 2.4
  • Loading branch information
phbasler authored Jul 18, 2022
2 parents 73a33e8 + 38a7a37 commit 3204852
Show file tree
Hide file tree
Showing 43 changed files with 1,319 additions and 18,474 deletions.
99 changes: 62 additions & 37 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,35 @@
cmake_minimum_required(VERSION 3.13)
project(
BSMPT
VERSION 2.3.3
VERSION 2.4.0
LANGUAGES C CXX
DESCRIPTION "BSMPT - Beyond the Standard Model Phase Transitions : A C++ package for the computation of the EWPT in BSM models")

# -------------------------------- options --------------------------------

option(UseLibCMAES "Use libcmaes to minimize the potential" ON)
option(UseNLopt "Use NLopt to minimize the potential" ON)
option(MakeAdditionalTesting "Build the executables used for further testing" OFF)
option(BSMPTCompileBaryo "Compile Baryogenesis" ON)
option(UseConan "Use conan to get dependencies" OFF)
option(EnableCoverage "Enable code coverage" OFF)


set(BSMPT_IS_TOPLEVEL NO)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set(BSMPT_IS_TOPLEVEL YES)
endif()

if(NOT BSMPT_IS_TOPLEVEL)
set(EnableCoverage OFF)
endif()

set(BSMPT_USE_VECTORIZATION ON)
if(EnableCoverage)
# The compiler flags don't mix well, so we turn it off in this scenario
set(BSMPT_USE_VECTORIZATION OFF)
endif()

# -------------------------------- setup cmake --------------------------------
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW) # use <packagename>_ROOT as search path
Expand All @@ -26,14 +51,11 @@ endif(NOT CMAKE_BUILD_TYPE)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")

option(UseLibCMAES "Use libcmaes to minimize the potential" ON)
option(UseNLopt "Use NLopt to minimize the potential" ON)
option(MakeAdditionalTesting "Build the executables used for further testing" OFF)
option(BSMPTCompileBaryo "Compile Baryogenesis" ON)


include(LTO)

option(UseConan "Use conan to get dependencies" OFF)


if(UseConan)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
Expand Down Expand Up @@ -126,7 +148,8 @@ endif()

configure_file(include/BSMPT/config.h.in include/BSMPT/config.h)

option(EnableCoverage "Enable code coverage" OFF)
# -------------------- Coverage --------------------------------------------------

if(EnableCoverage)
include(CodeCoverage)
append_coverage_compiler_flags()
Expand All @@ -149,7 +172,6 @@ if(EnableCoverage)
NAME coverage # New target name
EXECUTABLE ctest -j ${n_cores} # Executable in PROJECT_BINARY_DIR
BASE_DIRECTORY "${PROJECT_SOURCE_DIR}"
# EXCLUDE "_deps/*" "${PROJECT_SOURCE_DIR}/tests/*" "${PROJECT_SOURCE_DIR}/src/prog/*"
)
endif(EnableCoverage)

Expand Down Expand Up @@ -212,41 +234,44 @@ endif()


# ------------------------ Doxygen --------------------------------------------
if(BSMPT_IS_TOPLEVEL)
find_package(Doxygen)
if(DOXYGEN_FOUND)

set(DOXYGEN_USE_MATHJAX YES)
set(DOXYGEN_STRIP_FROM_INC_PATH "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(DOXYGEN_EXCLUDE
${CMAKE_CURRENT_SOURCE_DIR}/src/Kfactors/Kfunctions_grid_Part1.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Kfactors/Kfunctions_grid_Part2.cpp
)
set(DOXYGEN_PROJECT_BRIEF ${CMAKE_PROJECT_DESCRIPTION})
set(DOXYGEN_EXTRACT_PRIVATE YES)
set(DOXYGEN_GENERATE_TREEVIEW YES)
set(DOXYGEN_DISTRIBUTE_GROUP_DOC YES)
set(DOXYGEN_WARN_IF_UNDOCUMENTED YES)
set(DOXYGEN_WARN_IF_DOC_ERROR YES)
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE README.md)

doxygen_add_docs(doc
"${CMAKE_CURRENT_SOURCE_DIR}/include/"
"${CMAKE_CURRENT_SOURCE_DIR}/src/"
"${CMAKE_CURRENT_SOURCE_DIR}/README.md"
"${CMAKE_CURRENT_SOURCE_DIR}/Changelog.md")

else ()
message("Doxygen need to be installed to generate the doxygen documentation")
endif()

find_package(Doxygen)
if(DOXYGEN_FOUND AND CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)

set(DOXYGEN_USE_MATHJAX YES)
set(DOXYGEN_STRIP_FROM_INC_PATH "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(DOXYGEN_EXCLUDE
${CMAKE_CURRENT_SOURCE_DIR}/src/Kfactors/Kfunctions_grid_Part1.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Kfactors/Kfunctions_grid_Part2.cpp
)
set(DOXYGEN_PROJECT_BRIEF ${CMAKE_PROJECT_DESCRIPTION})
set(DOXYGEN_EXTRACT_PRIVATE YES)
set(DOXYGEN_GENERATE_TREEVIEW YES)
set(DOXYGEN_DISTRIBUTE_GROUP_DOC YES)
set(DOXYGEN_WARN_IF_UNDOCUMENTED YES)
set(DOXYGEN_WARN_IF_DOC_ERROR YES)
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE README.md)

doxygen_add_docs(doc
"${CMAKE_CURRENT_SOURCE_DIR}/include/"
"${CMAKE_CURRENT_SOURCE_DIR}/src/"
"${CMAKE_CURRENT_SOURCE_DIR}/README.md"
"${CMAKE_CURRENT_SOURCE_DIR}/Changelog.md")

else ()
message("Doxygen need to be installed to generate the doxygen documentation")
endif()

endif(BSMPT_IS_TOPLEVEL)


# -------------------- Testing ---------------------------------------------------
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
if(BSMPT_IS_TOPLEVEL)
include(CTest)
endif()

if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
if(BSMPT_IS_TOPLEVEL AND BUILD_TESTING)
add_subdirectory(tests)
endif()


3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ SPDX-License-Identifier: GPL-3.0-or-later

# Changelog

# 2022/XX: Release of v2.4.0
- Drop changelog in favor of [release notes](https://github.com/phbasler/BSMPT/releases)

# 2022/04: Release of v2.3.3
- Allow Conan to manage to dependencies
- Include LTO
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ SPDX-FileCopyrightText: 2021 Philipp Basler, Margarete Mühlleitner and Jonas M
SPDX-License-Identifier: GPL-3.0-or-later
-->

Program: BSMPT version 2.3.3
Program: BSMPT version 2.4.0

Released by: Philipp Basler and Margarete Mühlleitner and Jonas Müller
Released by: Philipp Basler and Lisa Biermann and Margarete Mühlleitner and Jonas Müller

[!["GitHub Discussions"](https://img.shields.io/badge/%20GitHub-%20Discussions-gray.svg?longCache=true&logo=github&colorB=purple)](https://github.com/phbasler/BSMPT/discussions)
[![Ubuntu unit tests](https://github.com/phbasler/BSMPT/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/phbasler/BSMPT/actions/workflows/test.yml)
Expand Down Expand Up @@ -121,6 +121,13 @@ Then you can call your model with `./binary YourModelName ...` .
5. In src/models/IncludeAllModels.cpp you have to add `#include <BSMPT/models/YourModel.h>` to the include list. Also to actually call your model you have to extend the FChoose function. For this you add a new case to the switch statement, which reads

case ModelIDs::YourModel: return std::make_unique<Class_YourModel>(); break;
### Generate the C++ code for a model
We provide currently two methods to generate the tensors and calculate the counter terms for a new model.

1. At tools/ModelGeneration/Maple we provide the maple Worksheet CreateModel.mw which you can use to implement your model and get the tensors.
2. At tools/ModelGeneration/sympy we provide a setup using only python3 with sympy (at least version 1.10!, if your packet manager only has an older installed, e.g. ubuntu 20.04 only has v1.6, then you have to install v1.10 or up with pip). Here we provide two examples, SM.py and G2HDM.py which both implement two different models and use the ModelGenerator.py module to calculate the tensors and CT. You can get the CT using `python3 SM.py --show ct` and the tensors by calling `python3 SM.py --show tensors`. If your counterterms don't have a unique solution, then the solution space will be shown to you and you have to add additional equations until you have a unique solution (e.g. the G2HDM example).
3. To show the simplified Tree level and counterterm potentials you can use `python3 SM.py --show treeSimpl` und `python3 SM.py --show CTSimpl`.



Expand Down Expand Up @@ -217,4 +224,6 @@ calculates the EWBG for each velocity.
This executable calculates the left-handed fermion density in front of the
wall as a function of the distance to the bubble wall.



[DoxygenLink]: https://phbasler.github.io/BSMPT/documentation
10 changes: 5 additions & 5 deletions include/BSMPT/minimizer/LibCMAES/MinimizeLibCMAES.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (C) 2020 Philipp Basler, Margarete Mühlleitner and Jonas Müller
// SPDX-FileCopyrightText: 2021 Philipp Basler, Margarete Mühlleitner and Jonas Müller
// SPDX-FileCopyrightText: 2021 Philipp Basler, Margarete Mühlleitner and Jonas
// Müller
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -37,10 +38,9 @@ struct LibCMAESReturn
* guess is given in start.
* @return the libcmaes run_status of the system
*/
LibCMAESReturn
min_cmaes_gen_all(const std::shared_ptr<Class_Potential_Origin> &modelPointer,
const double &Temp,
const std::vector<double> &VevMinimum);
LibCMAESReturn min_cmaes_gen_all(const Class_Potential_Origin &model,
const double &Temp,
const std::vector<double> &VevMinimum);

/**
* Finds a candidate for the local minimum using the CMAES algorithm.
Expand Down
14 changes: 7 additions & 7 deletions include/BSMPT/minimizer/LibNLOPT/MinimizeNLOPT.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-FileCopyrightText: 2021 Philipp Basler, Margarete Mühlleitner and Jonas Müller
// SPDX-FileCopyrightText: 2021 Philipp Basler, Margarete Mühlleitner and Jonas
// Müller
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -28,9 +29,9 @@ namespace LibNLOPT
*/
struct ShareInformationNLOPT
{
std::shared_ptr<Class_Potential_Origin> model;
const Class_Potential_Origin &model;
double Temp;
ShareInformationNLOPT(const std::shared_ptr<Class_Potential_Origin> &modelIn,
ShareInformationNLOPT(const Class_Potential_Origin &modelIn,
const double &TempIn)
: model{modelIn}
, Temp{TempIn}
Expand Down Expand Up @@ -76,14 +77,13 @@ NLOPTVEff(const std::vector<double> &x, std::vector<double> &grad, void *data);
/**
* @brief MinimizeUsingNLOPT minimizes the effective potential using the NLopt
* LN_COBYLA algorithm
* @param model pointer to the parameter point to be minimized
* @param model model reference
* @param Temp Temperature at which the potential should be minimized
* @return A ShareInformationNLOPT with the global minimum, the potential value
* and the nlopt::result of the minimization
*/
NLOPTReturnType
MinimizeUsingNLOPT(const std::shared_ptr<Class_Potential_Origin> &model,
const double &Temp);
NLOPTReturnType MinimizeUsingNLOPT(const Class_Potential_Origin &model,
const double &Temp);

/**
* @brief MinimizePlaneUsingNLOPT minimizes the effective potential in a given
Expand Down
52 changes: 26 additions & 26 deletions include/BSMPT/minimizer/MinimizeGSL.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (C) 2018 Philipp Basler and Margarete Mühlleitner
// SPDX-FileCopyrightText: 2021 Philipp Basler, Margarete Mühlleitner and Jonas Müller
// SPDX-FileCopyrightText: 2021 Philipp Basler, Margarete Mühlleitner and Jonas
// Müller
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -31,11 +32,10 @@ const double GSL_Tolerance = std::pow(10, -4);
*/
struct GSL_params
{
std::shared_ptr<Class_Potential_Origin> modelPointer;
const Class_Potential_Origin &model;
double Temp;
GSL_params(const std::shared_ptr<Class_Potential_Origin> &model,
const double &temperature)
: modelPointer{model}
GSL_params(const Class_Potential_Origin &modelIN, const double &temperature)
: model{modelIN}
, Temp{temperature} {};
};

Expand All @@ -57,7 +57,7 @@ int GSL_Minimize_From_S_gen_all(struct GSL_params &p,
* Minimize the Potential from different random starting points and choose the
* local minimum with the deepest potential value as the candidate for the
* global minimum
* @param modelPointer parameter point to minimise
* @param model model reference
* @param Temp Temperature at which to minimise the parameter point
* @param seed seed used to find the random starting points for the local
* optimisations
Expand All @@ -66,17 +66,17 @@ int GSL_Minimize_From_S_gen_all(struct GSL_params &p,
* @return first: vector with candidate for the global minimum, second: True if
* a candidate for the global minimum is found and false otherwise
*/
std::pair<std::vector<double>, bool> GSL_Minimize_gen_all(
const std::shared_ptr<Class_Potential_Origin> &modelPointer,
const double &Temp,
const int &seed,
bool UseMultiThreading = true);
std::pair<std::vector<double>, bool>
GSL_Minimize_gen_all(const Class_Potential_Origin &model,
const double &Temp,
const int &seed,
bool UseMultiThreading = true);

/**
* Minimize the Potential from different random starting points and choose the
* local minimum with the deepest potential value as the candidate for the
* global minimum
* @param modelPointer parameter point to minimise
* @param model model reference
* @param Temp Temperature at which to minimise the parameter point
* @param seed seed used to find the random starting points for the local
* optimisations
Expand All @@ -86,18 +86,18 @@ std::pair<std::vector<double>, bool> GSL_Minimize_gen_all(
* @return first: vector with candidate for the global minimum, second: True if
* a candidate for the global minimum is found and false otherwise
*/
std::pair<std::vector<double>, bool> GSL_Minimize_gen_all(
const std::shared_ptr<Class_Potential_Origin> &modelPointer,
const double &Temp,
const int &seed,
const std::size_t &MaxSol,
bool UseMultiThreading = true);
std::pair<std::vector<double>, bool>
GSL_Minimize_gen_all(const Class_Potential_Origin &model,
const double &Temp,
const int &seed,
const std::size_t &MaxSol,
bool UseMultiThreading = true);

/**
* Minimize the Potential from different random starting points and choose the
* local minimum with the deepest potential value as the candidate for the
* global minimum
* @param modelPointer parameter point to minimise
* @param model model reference
* @param Temp Temperature at which to minimise the parameter point
* @param seed seed used to find the random starting points for the local
* optimisations
Expand All @@ -108,13 +108,13 @@ std::pair<std::vector<double>, bool> GSL_Minimize_gen_all(
* @return first: vector with the solution, second: True if a candidate for the
* global minimum is found and false otherwise
*/
std::pair<std::vector<double>, bool> GSL_Minimize_gen_all(
const std::shared_ptr<Class_Potential_Origin> &modelPointer,
const double &Temp,
const int &seed,
std::vector<std::vector<double>> &saveAllMinima,
const std::size_t &MaxSol,
bool UseMultiThreading = true);
std::pair<std::vector<double>, bool>
GSL_Minimize_gen_all(const Class_Potential_Origin &model,
const double &Temp,
const int &seed,
std::vector<std::vector<double>> &saveAllMinima,
const std::size_t &MaxSol,
bool UseMultiThreading = true);

} // namespace Minimizer
} // namespace BSMPT
Expand Down
3 changes: 2 additions & 1 deletion include/BSMPT/minimizer/Minimizer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (C) 2018 Philipp Basler and Margarete Mühlleitner
// SPDX-FileCopyrightText: 2021 Philipp Basler, Margarete Mühlleitner and Jonas Müller
// SPDX-FileCopyrightText: 2021 Philipp Basler, Margarete Mühlleitner and Jonas
// Müller
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down
15 changes: 15 additions & 0 deletions include/BSMPT/models/ClassPotentialOrigin.h
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,21 @@ class Class_Potential_Origin
*/
void initVectors();

/**
* @brief sym4Dim Symmetrize scalar 4-dim tensor
* @param Tensor4Dim 4-dim scalar tensor
* @param Nk1 number of first indices
* @param Nk2 number of second indices
* @param Nk3 number of third indices
* @param Nk4 number of forth indices
*/
void sym4Dim(
std::vector<std::vector<std::vector<std::vector<double>>>> &Tensor4Dim,
std::size_t Nk1,
std::size_t Nk2,
std::size_t Nk3,
std::size_t Nk4);

/**
* Calculates the effective potential and its derivatives.
* @param v vev configuration at which the potential should be evaluated
Expand Down
Loading

0 comments on commit 3204852

Please sign in to comment.