Skip to content

Commit

Permalink
Release 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
reiher-research-group committed Aug 26, 2024
1 parent 3cb70af commit 22e9dc8
Show file tree
Hide file tree
Showing 46 changed files with 721 additions and 228 deletions.
19 changes: 17 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
Changelog
=========

Release 1.4.0
-------------

Changes (DB schema changing)
- Remove `MODEL_TRANSFORMATION` elementary step type

Additions (backwards compatible):
- Exact type of stored integers in the database is checked before retrieval in case fields have been manipulated with other MongoDB applications
- Projection options are added to almost all internal database queries to reduce the bandwidth requirements.
- Added support for list-of-lists of integers as elements in value collections (calculation settings etc.).

Release 1.3.0
-------------

Expand All @@ -13,8 +24,12 @@ Changes (DB schema changing):

Additions (backwards compatible):
- Python package now includes pure Python code for more complex query utilities. This code is added in the modules
`queries`, `energy_query_functions`, `compound_and_flask_creation`, `concentration_query_functions`, and `insert_concentration`.
All of them are top level modules (`import scine_database.energy_query_functions`)
- `queries`
- `energy_query_functions`
- `compound_and_flask_creation`
- `concentration_query_functions`
- `insert_concentration`.
All of them are top level modules (`import scine_database.energy_query_functions`)
- Added the possibility to configure the connection based on a custom URI instead of credentials.

Release 1.2.0
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.9)

project(Database
VERSION 1.3.0
VERSION 1.4.0
DESCRIPTION "The SCINE database interface."
)

Expand Down
7 changes: 7 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ J. P. Unsleber, S. A. Grimmel, M. Reiher,
"Chemoton 2.0: Autonomous Exploration of Chemical Reaction Networks",
*J. Chem. Theory Comput.*, **2022**, *18*, 5393.

Furthermore, when publishing results obtained with any SCINE module, please cite the following paper:

T. Weymuth, J. P. Unsleber, P. L. Türtscher, M. Steiner, J.-G. Sobez, C. H. Müller, M. Mörchen,
V. Klasovita, S. A. Grimmel, M. Eckhoff, K.-S. Csizi, F. Bosia, M. Bensberg, M. Reiher,
"SCINE—Software for chemical interaction networks", *J. Chem. Phys.*, **2024**, *160*, 222501
(DOI `10.1063/5.0206974 <https://doi.org/10.1063/5.0206974>`_).

Support and Contact
-------------------

Expand Down
4 changes: 2 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class ScineDatabaseConan(ScineConan):
name = "scine_database"
version = "1.3.0"
version = "1.4.0"
url = "https://github.com/qcscine/database"
description = """
The SCINE Database is a database wrapper for a MongoDB encoding reaction
Expand Down Expand Up @@ -48,7 +48,7 @@ class ScineDatabaseConan(ScineConan):
requires = [
"mongo-cxx-driver/3.6.0",
"eigen/[~=3.3.7]",
"scine_utilities/9.0.0"
"scine_utilities/10.0.0"
]
cmake_name = "Database"
cmake_definitions = {
Expand Down
11 changes: 11 additions & 0 deletions src/Database/Database/Exceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ class DuplicateIDException : public std::exception {
}
};

/**
* @class SelfDuplicateException
* @brief An exception to throw if a given structure is a duplicate of itself.
*/
class SelfDuplicateException : public std::exception {
public:
const char* what() const throw() {
return "The given structure is a duplicate of itself. This cannot be.";
}
};

/**
* @class MissingCredentialsException
* @brief An exception to throw if no credentials are present to establish a connection to a database.
Expand Down
6 changes: 2 additions & 4 deletions src/Database/Database/Layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ const std::map<CalculationStatus, std::string> EnumMaps::status2str = {
// clang-format off
const std::map<std::string, ElementaryStepType> EnumMaps::str2estype = {
{"regular", ElementaryStepType::REGULAR},
{"barrierless", ElementaryStepType::BARRIERLESS},
{"model_transformation", ElementaryStepType::MODEL_TRANSFORMATION}
{"barrierless", ElementaryStepType::BARRIERLESS}
};
const std::map<ElementaryStepType, std::string> EnumMaps::estype2str = {
{ElementaryStepType::REGULAR, "regular"},
{ElementaryStepType::BARRIERLESS, "barrierless"},
{ElementaryStepType::MODEL_TRANSFORMATION, "model_transformation"}
{ElementaryStepType::BARRIERLESS, "barrierless"}
};
// clang-format on

Expand Down
2 changes: 1 addition & 1 deletion src/Database/Database/Layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ enum class StructureLabel : unsigned {
SCAN_OBSERVER = 107,
};

enum class ElementaryStepType : unsigned { REGULAR = 0, BARRIERLESS = 1, MODEL_TRANSFORMATION = 2 };
enum class ElementaryStepType : unsigned { REGULAR = 0, BARRIERLESS = 1 };

namespace Layout {

Expand Down
9 changes: 5 additions & 4 deletions src/Database/Database/Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
#include "Database/Objects/Calculation.h"
#include "Database/Objects/Compound.h"
#include "Database/Objects/ElementaryStep.h"
#include "Database/Objects/Impl/Fields.h"
#include "Database/Objects/Property.h"
#include "Database/Objects/Reaction.h"
#include "Database/Objects/Structure.h"
#include "Database/Version.h"
/* External Includes */
#include <bsoncxx/builder/stream/document.hpp>
#include <cassert>
#include <iostream>
#include <mongocxx/client.hpp>
#include <mongocxx/collection.hpp>
#include <mongocxx/database.hpp>
Expand Down Expand Up @@ -200,9 +200,10 @@ std::tuple<int, int, int> Manager::getDBVersion() {
if (!optional)
return {0, 0, 0};
auto view = optional.value().view();
int major = view["version"]["major"].get_int32();
int minor = view["version"]["minor"].get_int32();
int patch = view["version"]["patch"].get_int32();
auto versionView = view["version"];
const int major = Fields::getIntegerFromElement<bsoncxx::document::element, int>(versionView["major"]);
const int minor = Fields::getIntegerFromElement<bsoncxx::document::element, int>(versionView["minor"]);
const int patch = Fields::getIntegerFromElement<bsoncxx::document::element, int>(versionView["patch"]);
return {major, minor, patch};
}
void Manager::init(bool moreIndices) {
Expand Down
70 changes: 52 additions & 18 deletions src/Database/Database/Objects/Calculation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Calculation::Job Calculation::getJob() const {
Calculation::Job job("dummy");
job.order = jobDoc["order"].get_utf8().value.to_string();
job.memory = jobDoc["memory"].get_double();
job.cores = jobDoc["cores"].get_int32();
job.cores = Fields::getInteger<int>(jobDoc, "cores");
job.disk = jobDoc["disk"].get_double();
return job;
}
Expand All @@ -167,7 +167,9 @@ void Calculation::setJob(const Calculation::Job& job) const {
<< close_document
<< finalize;
// clang-format on
_collection->mongocxx().find_one_and_update(selection.view(), update.view());
auto options = mongocxx::options::find_one_and_update();
options.projection(document{} << "_id" << 1 << finalize);
_collection->mongocxx().find_one_and_update(selection.view(), update.view(), options);
}

/*=========*
Expand Down Expand Up @@ -201,7 +203,9 @@ void Calculation::addStructure(const ID& id) const {
<< close_document
<< finalize;
// clang-format on
_collection->mongocxx().find_one_and_update(selection.view(), update.view());
auto options = mongocxx::options::find_one_and_update();
options.projection(document{} << "_id" << 1 << finalize);
_collection->mongocxx().find_one_and_update(selection.view(), update.view(), options);
}

void Calculation::removeStructure(const ID& id) const {
Expand All @@ -219,7 +223,9 @@ void Calculation::removeStructure(const ID& id) const {
<< close_document
<< finalize;
// clang-format on
_collection->mongocxx().find_one_and_update(selection.view(), update.view());
auto options = mongocxx::options::find_one_and_update();
options.projection(document{} << "_id" << 1 << finalize);
_collection->mongocxx().find_one_and_update(selection.view(), update.view(), options);
}

bool Calculation::hasStructure(const ID& id) const {
Expand Down Expand Up @@ -275,7 +281,9 @@ void Calculation::setSetting(const std::string& key, const Utils::UniversalSetti
<< close_document
<< finalize;
// clang-format on
_collection->mongocxx().find_one_and_update(selection.view(), update.view());
auto options = mongocxx::options::find_one_and_update();
options.projection(document{} << "_id" << 1 << finalize);
_collection->mongocxx().find_one_and_update(selection.view(), update.view(), options);
}

Utils::UniversalSettings::GenericValue Calculation::getSetting(const std::string& key) const {
Expand Down Expand Up @@ -319,7 +327,9 @@ void Calculation::removeSetting(const std::string& key) const {
<< close_document
<< finalize;
// clang-format on
_collection->mongocxx().find_one_and_update(selection.view(), update.view());
auto options = mongocxx::options::find_one_and_update();
options.projection(document{} << "_id" << 1 << finalize);
_collection->mongocxx().find_one_and_update(selection.view(), update.view(), options);
}

void Calculation::clearSettings() const {
Expand All @@ -337,7 +347,9 @@ void Calculation::clearSettings() const {
<< close_document
<< finalize;
// clang-format on
_collection->mongocxx().find_one_and_update(selection.view(), update.view());
auto options = mongocxx::options::find_one_and_update();
options.projection(document{} << "_id" << 1 << finalize);
_collection->mongocxx().find_one_and_update(selection.view(), update.view(), options);
}

Utils::UniversalSettings::ValueCollection Calculation::getSettings() const {
Expand Down Expand Up @@ -372,7 +384,9 @@ void Calculation::setSettings(const Utils::UniversalSettings::ValueCollection& s
<< close_document
<< finalize;
// clang-format on
_collection->mongocxx().find_one_and_update(selection.view(), update.view());
auto options = mongocxx::options::find_one_and_update();
options.projection(document{} << "_id" << 1 << finalize);
_collection->mongocxx().find_one_and_update(selection.view(), update.view(), options);
}

/*===========*
Expand Down Expand Up @@ -410,7 +424,9 @@ void Calculation::setResults(Calculation::Results& results) const {
<< close_document
<< finalize;
// clang-format on
_collection->mongocxx().find_one_and_update(selection.view(), update.view());
auto options = mongocxx::options::find_one_and_update();
options.projection(document{} << "_id" << 1 << finalize);
_collection->mongocxx().find_one_and_update(selection.view(), update.view(), options);
}

void Calculation::clearResults() const {
Expand All @@ -435,7 +451,9 @@ void Calculation::clearResults() const {
<< close_document
<< finalize;
// clang-format on
_collection->mongocxx().find_one_and_update(selection.view(), update.view());
auto options = mongocxx::options::find_one_and_update();
options.projection(document{} << "_id" << 1 << finalize);
_collection->mongocxx().find_one_and_update(selection.view(), update.view(), options);
}

Calculation::Results Calculation::getResults() const {
Expand Down Expand Up @@ -487,7 +505,9 @@ void Calculation::setAuxiliary(std::string key, const ID& id) const {
<< close_document
<< finalize;
// clang-format on
_collection->mongocxx().find_one_and_update(selection.view(), update.view());
auto options = mongocxx::options::find_one_and_update();
options.projection(document{} << "_id" << 1 << finalize);
_collection->mongocxx().find_one_and_update(selection.view(), update.view(), options);
}

ID Calculation::getAuxiliary(std::string key) const {
Expand Down Expand Up @@ -531,7 +551,9 @@ void Calculation::removeAuxiliary(std::string key) const {
<< close_document
<< finalize;
// clang-format on
_collection->mongocxx().find_one_and_update(selection.view(), update.view());
auto options = mongocxx::options::find_one_and_update();
options.projection(document{} << "_id" << 1 << finalize);
_collection->mongocxx().find_one_and_update(selection.view(), update.view(), options);
}

void Calculation::setAuxiliaries(std::map<std::string, ID> auxiliaries) const {
Expand All @@ -553,7 +575,9 @@ void Calculation::setAuxiliaries(std::map<std::string, ID> auxiliaries) const {
<< close_document
<< finalize;
// clang-format on
_collection->mongocxx().find_one_and_update(selection.view(), update.view());
auto options = mongocxx::options::find_one_and_update();
options.projection(document{} << "_id" << 1 << finalize);
_collection->mongocxx().find_one_and_update(selection.view(), update.view(), options);
}

void Calculation::clearAuxiliaries() const {
Expand All @@ -571,7 +595,9 @@ void Calculation::clearAuxiliaries() const {
<< close_document
<< finalize;
// clang-format on
_collection->mongocxx().find_one_and_update(selection.view(), update.view());
auto options = mongocxx::options::find_one_and_update();
options.projection(document{} << "_id" << 1 << finalize);
_collection->mongocxx().find_one_and_update(selection.view(), update.view(), options);
}

std::map<std::string, ID> Calculation::getAuxiliaries() const {
Expand Down Expand Up @@ -615,7 +641,9 @@ void Calculation::setRestartInformation(const std::string& key, const ID& id) co
<< close_document
<< finalize;
// clang-format on
_collection->mongocxx().find_one_and_update(selection.view(), update.view());
auto options = mongocxx::options::find_one_and_update();
options.projection(document{} << "_id" << 1 << finalize);
_collection->mongocxx().find_one_and_update(selection.view(), update.view(), options);
}

ID Calculation::getRestartInformation(const std::string& key) const {
Expand Down Expand Up @@ -659,7 +687,9 @@ void Calculation::removeRestartInformation(const std::string& key) const {
<< close_document
<< finalize;
// clang-format on
_collection->mongocxx().find_one_and_update(selection.view(), update.view());
auto options = mongocxx::options::find_one_and_update();
options.projection(document{} << "_id" << 1 << finalize);
_collection->mongocxx().find_one_and_update(selection.view(), update.view(), options);
}

void Calculation::setRestartInformation(const std::map<std::string, ID>& restart_information) const {
Expand All @@ -681,7 +711,9 @@ void Calculation::setRestartInformation(const std::map<std::string, ID>& restart
<< close_document
<< finalize;
// clang-format on
_collection->mongocxx().find_one_and_update(selection.view(), update.view());
auto options = mongocxx::options::find_one_and_update();
options.projection(document{} << "_id" << 1 << finalize);
_collection->mongocxx().find_one_and_update(selection.view(), update.view(), options);
}

void Calculation::clearRestartInformation() const {
Expand All @@ -699,7 +731,9 @@ void Calculation::clearRestartInformation() const {
<< close_document
<< finalize;
// clang-format on
_collection->mongocxx().find_one_and_update(selection.view(), update.view());
auto options = mongocxx::options::find_one_and_update();
options.projection(document{} << "_id" << 1 << finalize);
_collection->mongocxx().find_one_and_update(selection.view(), update.view(), options);
}

std::map<std::string, ID> Calculation::getRestartInformation() const {
Expand Down
Loading

0 comments on commit 22e9dc8

Please sign in to comment.