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

MAINT: refactor read_eam #43

Merged
merged 2 commits into from
Jun 15, 2020
Merged

MAINT: refactor read_eam #43

merged 2 commits into from
Jun 15, 2020

Conversation

wgnoehring
Copy link
Contributor

Refactored read_eam

The number of strings and numbers in each EAM table is well-defined and can be calculated after reading the header info (ignoring comments in the header and after '#'). The new version of read_eam calculates the expected number of values and checks if the table is correct. If not, it raises a ValueError. The motivation for this change is that read_eam failed in some cases where the table contained extra values, but it was not clear that these extra values were to blame, see #26

eam/alloy and eam/fs file styles are very similar. The previous version of read_eam had some repeated code. The present version makes use of the similarities.

Renamed a few variables and replaced old-style format strings by f-strings in write_eam.

Wolfram Georg Nöhring added 2 commits June 11, 2020 18:08
The number of strings and numbers in each EAM table is well-defined
and can be calculated after reading the header info (ignoring comments
in the header and after '#'). The new version of read_eam calculates
the expected number of values and checks if the table is correct. We
raise a ValueError if this is not so. The motivation for this change
is that read_eam failed in some cases where the table contained extra
values, but it was not clear that these extra values were to blame.

eam/alloy and eam/fs file styles are very similar. The previous
version of read_eam had some repeated code. The present
version makes use of the similarities to reduce code size.

Renamed a few variables for clarity.
Changed formatting / restructuredtext in docstring.
@pastewka
Copy link
Collaborator

Sounds good. Does this fix #26?

@pastewka pastewka merged commit c90b994 into libAtoms:master Jun 15, 2020
@wgnoehring
Copy link
Contributor Author

#26 is likely a problem of the potential table. The table in question contains more points than specified in the header. I think that in this case the user should decide how to modify the table. However, the revised reader makes it clear that the table contains the wrong number of points.

@wgnoehring wgnoehring deleted the 20_eam_io branch June 17, 2020 15:41
@pastewka
Copy link
Collaborator

Okay, sounds good!

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