diff --git a/VERSION b/VERSION index a4c853ea2..133cad286 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.4.2 +6.4.3 diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg index fd1dbf334..75ca709a8 100644 --- a/doc/doxygen.cfg +++ b/doc/doxygen.cfg @@ -38,7 +38,7 @@ PROJECT_NAME = "SIRIUS" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "6.4.2" +PROJECT_NUMBER = "6.4.3" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/python_module/pybind11 b/python_module/pybind11 index 6e39b765b..f7bc18f52 160000 --- a/python_module/pybind11 +++ b/python_module/pybind11 @@ -1 +1 @@ -Subproject commit 6e39b765b2333cd191001f22fe57ea218bd6ccf2 +Subproject commit f7bc18f528bb35cd06c93d0a58c17e6eea3fa68c diff --git a/src/generated.f90 b/src/generated.f90 index 75df664e9..728e154c9 100644 --- a/src/generated.f90 +++ b/src/generated.f90 @@ -2754,54 +2754,54 @@ subroutine sirius_option_get_length_aux(section,length)& call sirius_option_get_length_aux(section,length) end subroutine sirius_option_get_length -!> @brief return the name and a type of an option from its index -!> @param [in] section name of the section -!> @param [out] elem_ index of the option -!> @param [out] key_name name of the option -!> @param [out] type type of the option (real, integer, boolean, string) -subroutine sirius_option_get_name_and_type(section,elem_,key_name,type) +!> @brief Return the name and a type of an option from its index. +!> @param [in] section Name of the section. +!> @param [in] elem Index of the option. +!> @param [out] key_name Name of the option. +!> @param [out] type Type of the option (real, integer, boolean, string). +subroutine sirius_option_get_name_and_type(section,elem,key_name,type) implicit none character(C_CHAR), dimension(*), intent(in) :: section -integer(C_INT), intent(out) :: elem_ +integer(C_INT), intent(in) :: elem character(C_CHAR), dimension(*), intent(out) :: key_name integer(C_INT), intent(out) :: type interface -subroutine sirius_option_get_name_and_type_aux(section,elem_,key_name,type)& +subroutine sirius_option_get_name_and_type_aux(section,elem,key_name,type)& &bind(C, name="sirius_option_get_name_and_type") use, intrinsic :: ISO_C_BINDING character(C_CHAR), dimension(*), intent(in) :: section -integer(C_INT), intent(out) :: elem_ +integer(C_INT), intent(in) :: elem character(C_CHAR), dimension(*), intent(out) :: key_name integer(C_INT), intent(out) :: type end subroutine end interface -call sirius_option_get_name_and_type_aux(section,elem_,key_name,type) +call sirius_option_get_name_and_type_aux(section,elem,key_name,type) end subroutine sirius_option_get_name_and_type !> @brief return the description and usage of a given option !> @param [in] section name of the section !> @param [in] name name of the option -!> @param [out] desc_ description of the option -!> @param [out] usage_ how to use the option -subroutine sirius_option_get_description_usage(section,name,desc_,usage_) +!> @param [out] desc description of the option +!> @param [out] usage how to use the option +subroutine sirius_option_get_description_usage(section,name,desc,usage) implicit none character(C_CHAR), dimension(*), intent(in) :: section character(C_CHAR), dimension(*), intent(in) :: name -character(C_CHAR), dimension(*), intent(out) :: desc_ -character(C_CHAR), dimension(*), intent(out) :: usage_ +character(C_CHAR), dimension(*), intent(out) :: desc +character(C_CHAR), dimension(*), intent(out) :: usage interface -subroutine sirius_option_get_description_usage_aux(section,name,desc_,usage_)& +subroutine sirius_option_get_description_usage_aux(section,name,desc,usage)& &bind(C, name="sirius_option_get_description_usage") use, intrinsic :: ISO_C_BINDING character(C_CHAR), dimension(*), intent(in) :: section character(C_CHAR), dimension(*), intent(in) :: name -character(C_CHAR), dimension(*), intent(out) :: desc_ -character(C_CHAR), dimension(*), intent(out) :: usage_ +character(C_CHAR), dimension(*), intent(out) :: desc +character(C_CHAR), dimension(*), intent(out) :: usage end subroutine end interface -call sirius_option_get_description_usage_aux(section,name,desc_,usage_) +call sirius_option_get_description_usage_aux(section,name,desc,usage) end subroutine sirius_option_get_description_usage !> @brief return the default value of the option diff --git a/src/input.hpp b/src/input.hpp index 1dd917bf1..e6dd17d2a 100644 --- a/src/input.hpp +++ b/src/input.hpp @@ -22,6 +22,7 @@ * \brief Contains input parameters structures. * * \todo Some of the parameters belong to SCF ground state mini-app. Mini-app should parse this values itself. + * \todo parse atomic coordinates and magnetic field separtely, not as 6D vector. */ #ifndef __INPUT_HPP__ @@ -47,25 +48,25 @@ namespace sirius { [a3_x, a3_y, a3_z] ], - "lattice_vectors_scale" : scale, + "lattice_vectors_scale" : (float) scale, - "atom_types" : [label_A, label_B, ...], + "atom_types" : ["label_A", "label_B", ...], "atom_files" : { - label_A : file_A, - label_B : file_B, + "label_A" : "file_A", + "label_B" : "file_B", ... }, "atom_coordinate_units" : units, "atoms" : { - label_A: [ + "label_A": [ coordinates_A_1, coordinates_A_2, ... ], - label_B : [ + "label_B" : [ coordinates_B_1, coordinates_B_2, ... @@ -187,6 +188,15 @@ struct Unit_cell_input }; /// Parse mixer input section. +/** The following part of the input file is parsed: + \code{.json} + "mixer" : { + "beta" : (float) beta, + "beta0" : beta0, + "linear_mix_rms_tol" : + } + \endcode + */ struct Mixer_input { /// Mixing paramter. diff --git a/src/sirius_api.cpp b/src/sirius_api.cpp index deeef6abd..8035341bc 100644 --- a/src/sirius_api.cpp +++ b/src/sirius_api.cpp @@ -2625,118 +2625,127 @@ void sirius_update_atomic_potential(void* const* handler__) } -/* @fortran begin function void sirius_option_get_length return the number of options in a given section - @fortran argument in required string section name of the seciton - @fortran argument out required int length number of options contained in the section +/* @fortran begin function void sirius_option_get_length return the number of options in a given section + @fortran argument in required string section name of the seciton + @fortran argument out required int length number of options contained in the section @fortran end */ -void sirius_option_get_length(char *section, int *length) +void sirius_option_get_length(char const* section__, int *length__) { - const json &parser = sirius::get_options_dictionary(); - // ugly as hell but fortran is a piece of .... - for ( char *p = section; *p; p++) *p = tolower(*p); + auto const& parser = sirius::get_options_dictionary(); + + auto section = std::string(section__); + std::transform(section.begin(), section.end(), section.begin(), ::tolower); - *length = parser[section].size(); + *length__ = parser[section].size(); } -/* @fortran begin function void sirius_option_get_name_and_type return the name and a type of an option from its index - @fortran argument in required string section name of the section - @fortran argument out required int elem_ index of the option - @fortran argument out required string key_name name of the option - @fortran argument out required int type type of the option (real, integer, boolean, string) +/* @fortran begin function void sirius_option_get_name_and_type Return the name and a type of an option from its index. + @fortran argument in required string section Name of the section. + @fortran argument in required int elem Index of the option. + @fortran argument out required string key_name Name of the option. + @fortran argument out required int type Type of the option (real, integer, boolean, string). @fortran end */ -void sirius_option_get_name_and_type(char *section, int *elem_, char *key_name, int *type) +void sirius_option_get_name_and_type(char const* section__, int const* elem__, char* key_name__, int* type__) { const json &dict = sirius::get_options_dictionary(); - // ugly as hell but fortran is a piece of .... - for ( char *p = section; *p; p++) *p = tolower(*p); + auto section = std::string(section__); + std::transform(section.begin(), section.end(), section.begin(), ::tolower); int elem = 0; - *type = -1; - for (auto& el : dict[section].items()) - { - if (elem == *elem_) { + *type__ = -1; + for (auto& el : dict[section].items()) { + if (elem == *elem__) { if (!dict[section][el.key()].count("default_value")) { std::cout << "key : " << el.key() << "\n the default_value key is missing" << std::endl; exit(0); } if (dict[section][el.key()]["default_value"].is_array()) { - *type = 10; - if (dict[section][el.key()]["default_value"][0].is_number_integer()) - *type += 1; - if (dict[section][el.key()]["default_value"][0].is_number_float()) - *type += 2; - if (dict[section][el.key()]["default_value"][0].is_boolean()) - *type += 3; - if (dict[section][el.key()]["default_value"][0].is_string()) - *type += 4; + *type__ = 10; + if (dict[section][el.key()]["default_value"][0].is_number_integer()) { + *type__ += 1; + } + if (dict[section][el.key()]["default_value"][0].is_number_float()) { + *type__ += 2; + } + if (dict[section][el.key()]["default_value"][0].is_boolean()) { + *type__ += 3; + } + if (dict[section][el.key()]["default_value"][0].is_string()) { + *type__ += 4; + } } else { - if (dict[section][el.key()]["default_value"].is_number_integer()) - *type = 1; - if (dict[section][el.key()]["default_value"].is_number_float()) - *type = 2; - if (dict[section][el.key()]["default_value"].is_boolean()) - *type = 3; - if (dict[section][el.key()]["default_value"].is_string()) - *type = 4; + if (dict[section][el.key()]["default_value"].is_number_integer()) { + *type__ = 1; + } + if (dict[section][el.key()]["default_value"].is_number_float()) { + *type__ = 2; + } + if (dict[section][el.key()]["default_value"].is_boolean()) { + *type__ = 3; + } + if (dict[section][el.key()]["default_value"].is_string()) { + *type__ = 4; + } } - std::memcpy(key_name, el.key().c_str(), el.key().size()); + std::memcpy(key_name__, el.key().c_str(), el.key().size()); } elem++; } } -/* @fortran begin function void sirius_option_get_description_usage return the description and usage of a given option - @fortran argument in required string section name of the section - @fortran argument in required string name name of the option - @fortran argument out required string desc_ description of the option - @fortran argument out required string usage_ how to use the option +/* @fortran begin function void sirius_option_get_description_usage return the description and usage of a given option + @fortran argument in required string section name of the section + @fortran argument in required string name name of the option + @fortran argument out required string desc description of the option + @fortran argument out required string usage how to use the option @fortran end */ - -void sirius_option_get_description_usage(char * section, char * name, char *desc_, char *usage_) +void sirius_option_get_description_usage(char const* section__, char const* name__, char* desc__, char* usage__) { const json &parser = sirius::get_options_dictionary(); - // ugly as hell but fortran is a piece of .... - for ( char *p = section; *p; p++) *p = tolower(*p); - // ugly as hell but fortran is a piece of .... - // for ( char *p = name; *p; p++) *p = tolower(*p); + auto section = std::string(section__); + std::transform(section.begin(), section.end(), section.begin(), ::tolower); + + auto name = std::string(name__); if (parser[section][name].count("description")) { - std::string description = parser[section][name].value("description", ""); - std::copy(description.begin(), description.end(), desc_); + auto description = parser[section][name].value("description", ""); + std::copy(description.begin(), description.end(), desc__); } if (parser[section][name].count("usage")) { - std::string usage = parser[section][name].value("usage",""); - std::copy(usage.begin(), usage.end(), usage_); + auto usage = parser[section][name].value("usage", ""); + std::copy(usage.begin(), usage.end(), usage__); } } -/* @fortran begin function void sirius_option_get_int return the default value of the option - @fortran argument in required string section name of the section of interest - @fortran argument in required string name name of the element - @fortran argument out required int default_value table containing the default values (if vector) - @fortran argument out required int length length of the table containing the default values +/* @fortran begin function void sirius_option_get_int return the default value of the option + @fortran argument in required string section name of the section of interest + @fortran argument in required string name name of the element + @fortran argument out required int default_value table containing the default values (if vector) + @fortran argument out required int length length of the table containing the default values @fortran end */ -void sirius_option_get_int(char * section, char * name, int *default_value, int *length) +void sirius_option_get_int(char const* section__, char const* name__, int *default_value__, int *length__) { - const json &parser = sirius::get_options_dictionary(); + auto const &parser = sirius::get_options_dictionary(); - // ugly as hell but fortran is a piece of .... - for ( char *p = section; *p; p++) *p = tolower(*p); - // ugly as hell but fortran is a piece of .... - // for ( char *p = name; *p; p++) *p = tolower(*p); - if (!parser[section][name].count("default_value")) - std::cout << "default value is mossing" << std::endl; + auto section = std::string(section__); + std::transform(section.begin(), section.end(), section.begin(), ::tolower); + + auto name = std::string(name__); + + if (!parser[section][name].count("default_value")) { + std::cout << "default value is missing" << std::endl; + } if (parser[section][name]["default_value"].is_array()) { std::vector v = parser[section][name]["default_value"].get>(); - *length = v.size(); - memcpy(default_value, &v[0], v.size() * sizeof(int)); + *length__ = v.size(); + std::memcpy(default_value__, &v[0], v.size() * sizeof(int)); } else { - *default_value = parser[section][name].value("default_value", -1); + *default_value__ = parser[section][name].value("default_value", -1); } }