From 76227ba50ecad258de8ac195edfa86857fc1c5d5 Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Tue, 23 Jun 2026 09:52:02 +0200 Subject: [PATCH 1/2] format metadata --- metatomic-core/include/metatomic/model.hpp | 17 +++++++++++++++++ metatomic-core/tests/misc.cpp | 20 ++++++++++++++------ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/metatomic-core/include/metatomic/model.hpp b/metatomic-core/include/metatomic/model.hpp index 1cae91bdf..fc4df3911 100644 --- a/metatomic-core/include/metatomic/model.hpp +++ b/metatomic-core/include/metatomic/model.hpp @@ -1,7 +1,24 @@ #pragma once +#include + #include +#include namespace metatomic { + /// Render model metadata as a human-readable string. + /// + /// @param metadata a JSON-serialized `ModelMetadata` object as produced by a + /// model's `metadata` callback + /// @return a human-readable rendering of the metadata + inline std::string format_metadata(const std::string& metadata) { + mta_string_t printed = nullptr; + auto status = mta_format_metadata(metadata.c_str(), &printed); + details::check_status(status); + + auto result = std::string(mta_string_view(printed)); + mta_string_free(printed); + return result; + } } // namespace metatomic diff --git a/metatomic-core/tests/misc.cpp b/metatomic-core/tests/misc.cpp index 0028f1b88..41bbe5b23 100644 --- a/metatomic-core/tests/misc.cpp +++ b/metatomic-core/tests/misc.cpp @@ -107,10 +107,6 @@ TEST_CASE("metatdata formatting") { }, "extra": {} })"; - auto* mta_string = mta_string_create(""); - REQUIRE(mta_string != nullptr); - auto status = mta_format_metadata(json.c_str(), &mta_string); - REQUIRE(status == MTA_SUCCESS); const auto* expected = R"(This is the name model ====================== @@ -136,6 +132,18 @@ Please cite the following references when using this model: * ref-2 * ref-3 )"; - CHECK(std::string(mta_string_view(mta_string)) == expected); - mta_string_free(mta_string); + + SECTION("C API") { + auto* mta_string = mta_string_create(""); + REQUIRE(mta_string != nullptr); + auto status = mta_format_metadata(json.c_str(), &mta_string); + REQUIRE(status == MTA_SUCCESS); + CHECK(std::string(mta_string_view(mta_string)) == expected); + mta_string_free(mta_string); + } + + SECTION("C++ API") { + auto result = metatomic::format_metadata(json); + CHECK(result == expected); + } } From 99fd385523a7e270c30369b3f8c2c106c81d56a7 Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Tue, 23 Jun 2026 10:54:28 +0200 Subject: [PATCH 2/2] ignore --- python/metatomic_ase/pyproject.toml | 3 +++ python/metatomic_torch/pyproject.toml | 3 +++ python/metatomic_torchsim/pyproject.toml | 3 +++ 3 files changed, 9 insertions(+) diff --git a/python/metatomic_ase/pyproject.toml b/python/metatomic_ase/pyproject.toml index fc44c1e88..02014d4d6 100644 --- a/python/metatomic_ase/pyproject.toml +++ b/python/metatomic_ase/pyproject.toml @@ -55,4 +55,7 @@ filterwarnings = [ "ignore:`compute_requested_neighbors_from_options` is deprecated and will be removed in a future version:UserWarning", # deprecation warning from warp/nvalchemi "ignore:warp.config.quiet is deprecated:DeprecationWarning", + # ASE + "ignore:Setting the shape on a NumPy array:DeprecationWarning", + "ignore:Use thermalize_momenta:DeprecationWarning", ] diff --git a/python/metatomic_torch/pyproject.toml b/python/metatomic_torch/pyproject.toml index fe432a0ae..ec78ee2a8 100644 --- a/python/metatomic_torch/pyproject.toml +++ b/python/metatomic_torch/pyproject.toml @@ -65,4 +65,7 @@ filterwarnings = [ "ignore:.*vesin.metatomic was only tested with metatomic.torch >=0.1.3,<0.2.*:UserWarning", # deprecation warning from vesin "ignore:`compute_requested_neighbors_from_options` is deprecated and will be removed in a future version:UserWarning", + # ASE + "ignore:Setting the shape on a NumPy array:DeprecationWarning", + "ignore:Use thermalize_momenta:DeprecationWarning", ] diff --git a/python/metatomic_torchsim/pyproject.toml b/python/metatomic_torchsim/pyproject.toml index 0ca3f3ebc..c571e1f18 100644 --- a/python/metatomic_torchsim/pyproject.toml +++ b/python/metatomic_torchsim/pyproject.toml @@ -62,4 +62,7 @@ filterwarnings = [ "ignore:The 'nvalchemiops.neighborlist' module has been renamed to 'nvalchemiops.neighbors':DeprecationWarning", # deprecation warning from warp/nvalchemi "ignore:warp.config.quiet is deprecated:DeprecationWarning", + # ASE + "ignore:Setting the shape on a NumPy array:DeprecationWarning", + "ignore:Use thermalize_momenta:DeprecationWarning", ]