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

Equivalent points #280

Merged
merged 22 commits into from
Jul 21, 2021
Merged

Equivalent points #280

merged 22 commits into from
Jul 21, 2021

Conversation

samwaseda
Copy link
Member

@samwaseda samwaseda commented Jul 14, 2021

Most important changes

  • All symmetry-related operations are now found in symmetry.py (which allowed me to reduce 200 lines in atoms.py)
  • Initialization via symmetry = structure.get_symmetry(), after which the attributes of symmetry can be used for different purposed (in the end this follows @jan-janssen's suggestion)
  • Original output of structure.get_symmetry() is still available (i.e. structure.get_symmetry()['rotations'] etc.)
  • !!! Unit tests are still relatively weak

Original purpose of this PR (i.e. get_arg_equivalent_sites())

This is very much equivalent to structure.group_points_by_symmetry, although the old function didn't work in many cases. Also instead of grouping the sites by lists, the new function returns their ID's.

Example: Group octahedral interstitial sites according to the box symmetries:

n_repeat = 2
a_0 = 4.
structure = pr.create.structure.bulk('Al', cubic=True, a=a_0).repeat(n_repeat)
sites = structure.get_wrapped_coordinates(structure.positions+np.array([0, 0, 0.5*a_0]))
del structure[0]
print(structure.get_symmetry().get_arg_equivalent_sites(sites))

This returns:

[0 1 1 2 1 1 3 2 1 3 1 2 3 3 3 2 0 0 0 2 1 0 1 2 1 1 0 2 3 1 1 2]

This should be very much equivalent to the distances between the vacancy and these positions:

print(np.round(structure.get_distances_array(v_position, sites), decimals=2))
[0 2 2 1 2 2 3 1 2 3 2 1 3 3 3 1 0 0 0 1 2 0 2 1 2 2 0 1 3 2 2 1]

Comments

  • There are some properties/functions with no DocString -> there I don't know what they exactly do, so I didn't add stuff
  • spglib-output was repeated in every function in the former version. This is now unified in symmetry._get_spglib_cell(). However, for some reason structure.get_cell().T was used for most of the places except for get_spacegroup() (which is now a property, spacegroup). As I have the feeling that .T should be removed everywhere, I removed it -> if you know more about this, and if this presents a problem, please let me know.

@coveralls
Copy link

coveralls commented Jul 14, 2021

Pull Request Test Coverage Report for Build 1049774120

  • 107 of 129 (82.95%) changed or added relevant lines in 2 files are covered.
  • 74 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.1%) to 68.017%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pyiron_atomistics/atomistics/structure/atoms.py 11 18 61.11%
pyiron_atomistics/atomistics/structure/symmetry.py 96 111 86.49%
Files with Coverage Reduction New Missed Lines %
pyiron_atomistics/atomistics/structure/neighbors.py 14 97.01%
pyiron_atomistics/atomistics/job/atomistic.py 60 72.95%
Totals Coverage Status
Change from base Build 1037555151: 0.1%
Covered Lines: 10893
Relevant Lines: 16015

💛 - Coveralls

Copy link
Contributor

@pmrv pmrv left a comment

Choose a reason for hiding this comment

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

Just briefly going over, I have to admit that I don't understand the uses cases get_symmetry() vs. get_equivalent_point() vs. group_points_by_symmetry(). I'll try to have a detailed look again tomorrow, but I do feel this is something the docstring should tell me without reading the source.

@samwaseda samwaseda marked this pull request as draft July 19, 2021 08:45
@samwaseda samwaseda linked an issue Jul 20, 2021 that may be closed by this pull request
@samwaseda samwaseda marked this pull request as ready for review July 20, 2021 12:51
@samwaseda samwaseda requested a review from pmrv July 20, 2021 13:04
@samwaseda samwaseda merged commit cc9e2a5 into master Jul 21, 2021
@delete-merged-branch delete-merged-branch bot deleted the equivalent_points branch July 21, 2021 14:28
@niklassiemer niklassiemer restored the equivalent_points branch August 2, 2021 06:59
@delete-merged-branch delete-merged-branch bot deleted the equivalent_points branch August 2, 2021 07:00
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.

What to use instead of get_symmetry?
3 participants