diff --git a/regtest/metatensor/rt-soap/soap_cv.py b/regtest/metatensor/rt-soap/soap_cv.py index 2db5007f87..5ec28ae244 100644 --- a/regtest/metatensor/rt-soap/soap_cv.py +++ b/regtest/metatensor/rt-soap/soap_cv.py @@ -60,9 +60,11 @@ def forward( soap_block = soap.block() projected = soap_block.values @ self.pca_projection + samples = soap_block.samples.remove("center_type") + block = TensorBlock( values=projected, - samples=soap_block.samples, + samples=samples, components=[], properties=Labels("soap_pca", torch.tensor([[0], [1], [2]], device=device)), ) @@ -99,7 +101,7 @@ def forward( description=""" A simple collective variable for testing purposes """, - authors=["..."], + authors=["Some Author"], references={ "implementation": ["ref to SOAP code"], "architecture": ["ref to SOAP"], diff --git a/src/metatensor/metatensor.cpp b/src/metatensor/metatensor.cpp index cc33db7160..bc149e603e 100644 --- a/src/metatensor/metatensor.cpp +++ b/src/metatensor/metatensor.cpp @@ -134,10 +134,11 @@ MetatensorPlumedAction::MetatensorPlumedAction(const ActionOptions& options): try { this->model_ = metatensor_torch::load_atomistic_model(model_path, extensions_directory); } catch (const std::exception& e) { - error("failed to load model at '" + model_path + "': " + e.what()); + this->error("failed to load model at '" + model_path + "': " + e.what()); } // extract information from the model + auto metadata = this->model_.run_method("metadata").toCustomClass(); this->capabilities_ = this->model_.run_method("capabilities").toCustomClass(); auto requests_ivalue = this->model_.run_method("requested_neighbors_lists"); for (auto request_ivalue: requests_ivalue.toList()) { @@ -145,6 +146,14 @@ MetatensorPlumedAction::MetatensorPlumedAction(const ActionOptions& options): this->nl_requests_.push_back(request); } + log.printf("\n%s\n", metadata->print().c_str()); + // add the model references to PLUMED citation handling mechanism + for (const auto& it: metadata->references) { + for (const auto& ref: it.value()) { + this->cite(ref); + } + } + // parse the atomic types from the input file std::vector atomic_types; std::vector species_to_types; @@ -168,7 +177,7 @@ MetatensorPlumedAction::MetatensorPlumedAction(const ActionOptions& options): int32_t type = i; if (has_custom_types) { if (species_to_types.size() < static_cast(i)) { - error( + this->error( "SPECIES_TO_TYPES is too small, it should have one entry " "for each species (we have at least " + std::to_string(i) + " species and " + std::to_string(species_to_types.size()) +