Skip to content
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

Vasp mapping parser #3

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open

Vasp mapping parser #3

wants to merge 4 commits into from

Conversation

ladinesa
Copy link
Collaborator

No description provided.

@ladinesa ladinesa requested a review from JFRudzinski January 20, 2025 17:21
Copy link
Contributor

@JFRudzinski JFRudzinski left a comment

Choose a reason for hiding this comment

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

Perhaps @ndaelman-hu also wants to check this

src/nomad_simulation_parsers/parsers/utils.py Outdated Show resolved Hide resolved
src/nomad_simulation_parsers/parsers/__init__.py Outdated Show resolved Hide resolved
Comment on lines +40 to +44
mainfile_contents_re=(
r'^\s*<\?xml version="1\.0" encoding="ISO-8859-1"\?>\s*?\s*<modeling>?\s*'
r'<generator>?\s*<i name="program" type="string">\s*vasp\s*</i>?|'
r'^\svasp[\.\d]+.+?(?:\(build|complex)[\s\S]+?executed on'
),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would put the HDF5 parser above xml in the matching priority

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

which hdf5 parser?

mainfile_mime_re='(application/.*)|(text/.*)',
mainfile_name_re='.*[^/]*xml[^/]*',
mainfile_alternative=True,
supported_compressions=['gz', 'bz2', 'xz'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't the compression support be specified at a higher level?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it is in the correct place, in MatchingParser

src/nomad_simulation_parsers/parsers/exciting/parser.py Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please explain why annotations have to be removed in the pydocs.
From the code below, I take that it removes the old key. But could one simply not call that key, correct?

Copy link
Collaborator Author

@ladinesa ladinesa Jan 21, 2025

Choose a reason for hiding this comment

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

If we do not add then remove the added annotations every time we call parse, the annotations from the other parsers will be picked up and may override our intended annotation if the same key is used. added doc

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is mapping to the old schema, correct?
You can merge this, but I'll have to redo it for the new schema

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i am still targeting this branch 100-moving-simulation-workflow-definitions-to-this-repo please advise which is the latest so I can make the necessary changes

src/nomad_simulation_parsers/parsers/vasp/parser.py Outdated Show resolved Hide resolved
Comment on lines +36 to +50
def get_data(self, source: dict[str, Any], **kwargs) -> Any:
if source.get(self.value_key):
return source[self.value_key]
path = kwargs.get('path')
if path is None:
return

parser = Path(path=path)
return parser.get_data(source)

def get_forces(self, source: dict[str, Any]) -> dict[str, Any]:
value = self.get_data(source, path='.varray.v')
if value is None:
return {}
return dict(forces=value, npoints=len(value), rank=[3])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we still using this older style for extracting forces? Can't we use the mapping annotation here too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

there is a bug for the def of forces i think so i have to define the rank directly here.

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.

3 participants