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

High index surfaces #400

Merged
merged 16 commits into from
Jan 18, 2022
Merged

High index surfaces #400

merged 16 commits into from
Jan 18, 2022

Conversation

skatnagallu
Copy link
Contributor

A new function to get a high index surface based on the step length, step orientation and kink orientation.

A new function to get a high index surface based on the step length, step orientation and kink orientation.
@skatnagallu skatnagallu added the enhancement New feature or request label Oct 28, 2021
Updating the indentations
@sudarsan-surendralal sudarsan-surendralal added the good first issue Good for newcomers label Oct 28, 2021
@coveralls
Copy link

coveralls commented Oct 28, 2021

Pull Request Test Coverage Report for Build 1713832390

  • 34 of 35 (97.14%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.07%) to 70.167%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pyiron_atomistics/atomistics/structure/factory.py 34 35 97.14%
Totals Coverage Status
Change from base Build 1689646937: 0.07%
Covered Lines: 11614
Relevant Lines: 16552

💛 - Coveralls

Copy link
Member

@sudarsan-surendralal sudarsan-surendralal left a comment

Choose a reason for hiding this comment

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

This looks great @skatnagallu although I think some changes need to be more (see below)

@@ -407,3 +407,32 @@ def from_pymatgen(pymatgen_obj):
@wraps(ovito_to_pyiron)
def from_ovito(ovito_obj):
return ovito_to_pyiron(ovito_obj)

def get_high_ind_surf_sk(self, element='Ni', Xstr='fcc', lattice_constant=3.526, terraceOrientation=[1,1,1],

Choose a reason for hiding this comment

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

A more descriptive name like get_high_index_surface would be better

Copy link
Member

Choose a reason for hiding this comment

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

Indeed, with tab completion we don't need to be afraid of the slightly longer name.
I'd go with high_index_surface to better match the pattern of the other factory methods.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should also think about defaults for element and Xstr (maybe crystalstructure is a better name like for the ASE functions). Our other methods don't have defaults for elements and I'd prefer this to be consistent.

vec2 = (np.asanyarray(fin_kinkOrientation).dot(lengthTerrace)) + stepDownVector
highIndexSurface = np.cross(np.asanyarray(vec1),np.asanyarray(vec2))
highIndexSurface = np.array(highIndexSurface/np.gcd.reduce(highIndexSurface), dtype=int)
return fin_kinkOrientation, fin_stepOrientation, highIndexSurface

Choose a reason for hiding this comment

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

Here, you return the indices of the kink. step and the high index surface. But I guess it would be nice to go one step further and use these quantities to actually return the structure

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, very nice contribution! 👍

In addition to Sudarsan's comments:

  • Please make this PEP8 compliant (capitalization, etc). The easiest way to this is probably just download an IDE, e.g. pycharm, and open the atomistics repository as a project. For pycharm you can then just go through and get rid of all the yellow squiggles, most of which they'll probably have a recommendation for.
  • Please add a docstring

The final thing is to add a unit test. You're very welcome to do this yourself, but if it's new to you then once the other items have been dealt with I'd be happy to write the test up so you have an example pertaining to content you're super familiar with. Just ping me for re-review when you're ready 😄

@@ -407,3 +407,32 @@ def from_pymatgen(pymatgen_obj):
@wraps(ovito_to_pyiron)
def from_ovito(ovito_obj):
return ovito_to_pyiron(ovito_obj)

def get_high_ind_surf_sk(self, element='Ni', Xstr='fcc', lattice_constant=3.526, terraceOrientation=[1,1,1],
Copy link
Member

Choose a reason for hiding this comment

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

Indeed, with tab completion we don't need to be afraid of the slightly longer name.
I'd go with high_index_surface to better match the pattern of the other factory methods.

Copy link
Member

@sudarsan-surendralal sudarsan-surendralal left a comment

Choose a reason for hiding this comment

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

This looks good now. Some minor suggestions for improvement below

pyiron_atomistics/atomistics/structure/factory.py Outdated Show resolved Hide resolved
tests/atomistics/structure/test_high_index_surface.py Outdated Show resolved Hide resolved
pyiron_atomistics/atomistics/structure/factory.py Outdated Show resolved Hide resolved
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.

Very nice! I have a couple of nits still, and a test request, but IMO the only "real" outstanding issue is just a design question on how we should handle the return value(s) 😄

@@ -71,24 +73,29 @@ def aimsgb(self):

def cut(self, *args, **kwargs):
return self.ase.cut(*args, **kwargs)

Copy link
Member

Choose a reason for hiding this comment

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

I think elsewhere we do the doc addition immediately adjacent to the function definition, so for consistency let's just keep doing that instead of these newlines.

pyiron_atomistics/atomistics/structure/factory.py Outdated Show resolved Hide resolved
pyiron_atomistics/atomistics/structure/factory.py Outdated Show resolved Hide resolved
Refactored the function into two functions high_index_surface which returns only structure and high_index_surface_info which returns the Miller indices of the surface place, step and kink directions.
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.

Good stuff. I would like to wait to merge until the tests are passing -- I think the current failures relate to issues with hdf5io so this should only require some patience and some merging master into this branch.

Refactored the function into two functions high_index_surface which returns only structure and high_index_surface_info which returns the Miller indices of the surface place, step and kink directions.

made changes to high_index_surface function to use the given element, crystal_structure and lattice_constant.
Refactored the function into two functions high_index_surface which returns only structure and high_index_surface_info which returns the Miller indices of the surface place, step and kink directions.

corrected it to give periodic boundary conditions in all three directions.
Copy link
Member

@sudarsan-surendralal sudarsan-surendralal left a comment

Choose a reason for hiding this comment

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

Apart from a couple of minor changes, LGTM!

pyiron_atomistics/atomistics/structure/factory.py Outdated Show resolved Hide resolved
pyiron_atomistics/atomistics/structure/factory.py Outdated Show resolved Hide resolved
@stale
Copy link

stale bot commented Dec 4, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 4, 2021
@stale stale bot closed this Dec 18, 2021
@stale stale bot removed the stale label Jan 18, 2022
@sudarsan-surendralal sudarsan-surendralal merged commit ada9fdb into master Jan 18, 2022
@delete-merged-branch delete-merged-branch bot deleted the step_surface branch January 18, 2022 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants