-
Notifications
You must be signed in to change notification settings - Fork 6
Allow model to request additional inputs from the engine #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
ase
Luthaf
left a comment
There was a problem hiding this 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!
| "dipole", | ||
| "charges", | ||
| "magmom", | ||
| "magmoms", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
|
Could you add the new outputs in a separate PR? It will also need documentation and changes to |
Luthaf
left a comment
There was a problem hiding this 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`.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 inarrays, so someone can write a module using the data, and create ase.Atoms with the data inarrays/info, and everything just works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah okay, understood
| f"Though the property {quantity} is available in `ase`, it is " | ||
| "currently not supported by metatomic." |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
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
Sure, I do it after we merge this? Or it would be the perquisite of this PR? |
|
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... |
|
You should be able to add new "standard output" as a standalone PR, even if no code is using this output yet. |
Co-authored-by: Guillaume Fraux <luthaf@luthaf.fr>
48a0897 to
b132ce6
Compare
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 ofTensorMapis released).Closes #104
Contributor (creator of pull-request) checklist
Reviewer checklist