pyiron_atomistics
pyiron_atomistics copied to clipboard
Save structure generator metadata
Summary
Add structure generation metadata to our Atoms
class in the structure factory.
Detailed Description
We have a lot of detailed information on how we set up our structures in the notebooks. However, looking at a particular structure in a job returns 'only' the bare positions/cell/types etc.
It would be great to store things like the creation routine (ase.bulk
) or how often we simply repeat
ed the structure in the metadata of the Atoms
class.
Further Information, Files, and Links
I would love to see this. My naively preferred implementation would be Atoms(ASEAtoms, PyironObject)
and to give PyironObject.storage
a metadata
field (and probably with the helper property metadata
that exposes storage.metadata
easier. Then I guess we would want some sort of decorator to wrap all the generators with like
def structure_metadata(structure_producing_method):
def wrapper(*args, **kwargs):
structure = structure_producing_method(*args, **kwargs)
structure.metadata.source_code.method = structure_producing_method.__name__
structure.metadata.source_code.args = args
structure.metadata.source_code.kwargs = kwargs
return structure
return wrapper
(I'm just pulling that out of thin air, so no guarantee it works as written or has everything we want, but you get the idea).
To have structure also on the same DataContainer
footings sounds good to me :)
I would just use the info
dictionary that's already on every atoms, together with some small API to append and retrieve this data. That way we can also easily swap out the underlying storage, but we'd have the functionality straight way. Dual inheritance with PyironObject
could be problematic due to the conflicting HDF impl's.