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

Slightly relax the constraint satisfy condition of get_primitive_structure() #3285

Merged
merged 4 commits into from
Aug 31, 2023

Conversation

fyalcin
Copy link
Contributor

@fyalcin fyalcin commented Aug 31, 2023

Summary

Context here. I finally took some time to figure out why this was happening and it turned out to be the check that compares the lattice parameters of the primitive structures found against the constraints. The equivalency check in the current implementation is too strict to account for small changes in the constraints, which is why I went with np.isclose() with its default atol and rtol parameters which should still be strict enough.

I also include two unit tests, one for a general get_primitive_structure() call with constrain_latt which was missing, and #another to ensure two very similar constraints result in the same primitive structure.

fyalcin and others added 4 commits August 31, 2023 11:03
…traint condition has been adjusted to a more flexible criterion. Instead of requiring an exact match, the evaluation now utilizes np.isclose() for comparison, which should still be strict enough with the default atol and rtol values.
…n the Structure class. The first test focuses on evaluating the method with a constrain_latt parameter, while the second ensures the consistency of the primitive structure when two very similar constraints are used.
…traint perturbations test_primitive_with_similar_constraints()
Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

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

Looks good, thanks @fyalcin! 👍

I added the test file you linked in https://matsci.org/t/41663 but forgot to upload and improved the tests slightly.

@janosh janosh enabled auto-merge (squash) August 31, 2023 12:49
@janosh janosh merged commit faa42db into materialsproject:master Aug 31, 2023
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