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

Get chemical symbols #100

Merged
merged 5 commits into from
Mar 3, 2021
Merged

Get chemical symbols #100

merged 5 commits into from
Mar 3, 2021

Conversation

samwaseda
Copy link
Member

I added neigh.chemical_symbols which gives the chemical symbols of the neighboring atoms.

I was not sure if I should call it neigh.get_chemical_symbols() or make it a property. Since there's no argument to add, I decided to make it a property, but I'm open to suggestions.

@coveralls
Copy link

coveralls commented Mar 3, 2021

Pull Request Test Coverage Report for Build 617775079

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.006%) to 64.719%

Totals Coverage Status
Change from base Build 615074828: 0.006%
Covered Lines: 10658
Relevant Lines: 16468

💛 - 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.

lgtm

@liamhuber
Copy link
Member

I was not sure if I should call it neigh.get_chemical_symbols() or make it a property. Since there's no argument to add, I decided to make it a property, but I'm open to suggestions.

I like this choice. My rationale is this:

  • Requires arguments --> Method (obviously 😛)
  • Alters parent object in place --> Method
  • Best described by a verb --> ...Method? Usually at least. But in this case it typically alters the parent object in place.
  • Else --> Property. ❤️ properties.

Copy link
Member

@liamhuber liamhuber left a comment

Choose a reason for hiding this comment

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

Cool, cool cool cool.

Change suggestions in the review, but nothing barring merging IMO, just see what you like.

@property
def chemical_symbols(self):
"""
Returns chemical symbols of the neighboring atoms.
Copy link
Member

Choose a reason for hiding this comment

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

codacy is going to whine that this could be on one line. I don't actually care strongly about this formatting choice, but I do like making codacy shut up 😉

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh ok I didn't know that.

@@ -339,6 +339,13 @@ def test_norm_order(self):
with self.assertRaises(ValueError):
neigh.norm_order = 3

def test_chemical_symbols(self):
Copy link
Member

Choose a reason for hiding this comment

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

❤️ tests

tests/atomistics/structure/test_neighbors.py Outdated Show resolved Hide resolved
@samwaseda samwaseda merged commit d7581cb into master Mar 3, 2021
@samwaseda samwaseda deleted the get_chemical_symbols branch March 3, 2021 14:22
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.

4 participants