Skip to content

Refactor unit conversion and allow additional inputs#49

Open
GardevoirX wants to merge 9 commits into
metatomicfrom
units-conversion
Open

Refactor unit conversion and allow additional inputs#49
GardevoirX wants to merge 9 commits into
metatomicfrom
units-conversion

Conversation

@GardevoirX

Copy link
Copy Markdown

Summary

This PR aims at updating the unit-conversion-related codes with the newly implemented unit parser. Meanwhile it adds supports to the additional inputs to the models.

Will be ready when the new version of metatomic releases

@GardevoirX GardevoirX marked this pull request as ready for review June 22, 2026 18:52
Comment thread src/ML-METATOMIC/metatomic_units.h Outdated
Comment thread src/ML-METATOMIC/metatomic_units.cpp Outdated
Comment on lines +76 to +85
{"lmp::density", {
{"real", ""},
{"metal", ""},
{"si", ""},
{"cgs", ""},
{"electron", ""},
{"micro", ""},
{"nano", ""}
}},
{"lmp::dipole_moment", {}},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these different?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because in the unit page of lammps these quantities are listed but not the standard quantities of mta

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I meant why use empty strings for lmp::density but nothing for lmp::dipole_moment? Anyway, I'd remove these for now, until we add a way to request/output these specifically

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I see, yes let's remove them

Comment thread src/ML-METATOMIC/metatomic_system.h
Comment thread src/ML-METATOMIC/metatomic_system.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you remove this file?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/ML-METATOMIC/fix_metatomic.cpp Outdated
Comment thread src/ML-METATOMIC/metatomic_system.cpp Outdated
Comment thread src/ML-METATOMIC/metatomic_system.cpp Outdated
Comment thread src/ML-METATOMIC/metatomic_system.cpp Outdated
for (const auto& [property, input]: inputs) {
const auto& property_name = property.c_str();
const auto& unit = input->unit().c_str();
if (strcmp(property_name, "mass") == 0 || strcmp(property_name, "masses") == 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LAMMPS does not need to support both old and new names. It should call requested_inputs on the TorchScript model with use_new_names=true and only handle the new names.https://github.com/metatensor/metatomic/blob/7ee8113b5beb890145ff1f60db7e3525562e1959/python/metatomic_torch/metatomic/torch/model.py#L498

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants