-
Notifications
You must be signed in to change notification settings - Fork 15
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
High index surfaces #400
Conversation
A new function to get a high index surface based on the step length, step orientation and kink orientation.
Updating the indentations
Pull Request Test Coverage Report for Build 1713832390
💛 - Coveralls |
There was a problem hiding this 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], |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this 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], |
There was a problem hiding this comment.
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.
There was a problem hiding this 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
…s a test for length of the slab.
There was a problem hiding this 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) | |||
|
There was a problem hiding this comment.
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.
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.
There was a problem hiding this 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.
There was a problem hiding this 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!
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. |
A new function to get a high index surface based on the step length, step orientation and kink orientation.