Skip to content

Conversation

@GardevoirX
Copy link
Contributor

@GardevoirX GardevoirX commented Nov 20, 2025

Currently the model can only ask for properties like energies, forces, and stresses from the simulation engine, which largely limited the scope of calculateable properties. This PR aims at allowing for more additional inputs from ase. Will be ready for review after the unit conversion is implemented (after the metadata feature of TensorMap is released).

Closes #104

Contributor (creator of pull-request) checklist

  • Tests updated (for new features and bugfixes)?
  • Documentation updated (for new features)?
  • Issue referenced (for PRs that solve an issue)?

Reviewer checklist

  • CHANGELOG updated with public API or any other important changes?

@Luthaf Luthaf changed the title Allow model to request additional inputs from ase Allow model to request additional inputs from the engine Nov 26, 2025
Copy link
Member

@Luthaf Luthaf left a comment

Choose a reason for hiding this comment

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

This is going in the right direction!

Comment on lines 55 to 58
"dipole",
"charges",
"magmom",
"magmoms",
Copy link
Member

Choose a reason for hiding this comment

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

For now I would limit properties that can be passed around to the standard ouputs (which we might want to rename to "standard data layout?"): https://docs.metatensor.org/metatomic/latest/outputs/index.html

Copy link
Member

Choose a reason for hiding this comment

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

Or we expose these as ase::<name>, and document them explicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Might the latter one would be better, since the same property might have different names in different softwares

Copy link
Member

@Luthaf Luthaf Nov 26, 2025

Choose a reason for hiding this comment

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

Well, ideally one would just request "charge" with per_atom=True, and get the corresponding data from any simulation engine.

We can use non-standard names for things that are only available in one engine, but things should be standardized where possible.

@GardevoirX GardevoirX marked this pull request as ready for review December 12, 2025 10:29
@Luthaf
Copy link
Member

Luthaf commented Dec 12, 2025

Could you add the new outputs in a separate PR? It will also need documentation and changes to _check_output, like for example in #63.

Copy link
Member

@Luthaf Luthaf left a comment

Choose a reason for hiding this comment

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

The code also need to convert the units of the extra inputs in AtomisticModel.forward

)
infos = ARRAY_PROPERTIES[quantity]
else:
raise ValueError(f"The property {quantity} is not available in `ase`.")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
raise ValueError(f"The property {quantity} is not available in `ase`.")
raise ValueError(f"The model requested '{quantity}', which is not available in `ase`.")

Although should we check in atoms.arrays before throwing this error? Especially for custom things

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so if we don't have a getter for the requested quantity, we try to check it in atoms.arrays? and if we fail to find it, we will throw an error?

Copy link
Member

@Luthaf Luthaf Dec 15, 2025

Choose a reason for hiding this comment

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

We have three kinds of data a model could request

  • standard data, as done in this PR. This is supported across models and engines
  • engine-specific data, i.e. ase::<something>. Models can request it, but only ASE can provide it. The list of these is fixed and documented in the ASE calculator.
  • fully custom data, i.e. whatever::name. Here we could try to find it in arrays, so someone can write a module using the data, and create ase.Atoms with the data in arrays/info, and everything just works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah okay, understood

Comment on lines 964 to 965
f"Though the property {quantity} is available in `ase`, it is "
"currently not supported by metatomic."
Copy link
Member

Choose a reason for hiding this comment

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

IMO these should be made available as ase::<name>, using the same syntax as for custom outputs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm but if we don't give these properties getters and unit conversion rules, users still cannot have access to these, so I don't see the point of renaming them as ase::<name>

Copy link
Member

Choose a reason for hiding this comment

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

I don't understand what you mean? If someone requests ase::free_energy in kJ/mol, we can return that taking the data from ase and converting from eV to kJ/mol

@GardevoirX
Copy link
Contributor Author

Could you add the new outputs in a separate PR? It will also need documentation and changes to _check_output, like for example in #63.

Sure, I do it after we merge this? Or it would be the perquisite of this PR?

@Luthaf
Copy link
Member

Luthaf commented Dec 15, 2025

It can be done before or after this PR, but the corresponding code should be removed from this one!

@GardevoirX
Copy link
Contributor Author

It can be done before or after this PR, but the corresponding code should be removed from this one!

okay let me think about it, for now I think these two are coupled with each other...

@Luthaf
Copy link
Member

Luthaf commented Dec 15, 2025

You should be able to add new "standard output" as a standalone PR, even if no code is using this output yet.

@GardevoirX GardevoirX mentioned this pull request Dec 16, 2025
4 tasks
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.

Implement a wrapper for heat flux calculation

2 participants