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

Add grain boundary generator #1200

Merged
merged 5 commits into from Jul 12, 2018
Merged

Add grain boundary generator #1200

merged 5 commits into from Jul 12, 2018

Conversation

ucsdlxg
Copy link
Contributor

@ucsdlxg ucsdlxg commented Jul 10, 2018

Summary

This generator provides two methods to generate grain boundaries (GBs) from bulk conventional cell (fcc, bcc can from the primitive cell), and works for Cubic, Tetragonal, Orthorhombic, Rhombohedral, and Hexagonal systems. The first one is to generate GBs from given parameters, which includes
GB plane, rotation axis, rotation angle. The second one is to generate GBs from given transformation matrices for each grain. It works for any general GB, including both twist, tilt GBs, etc.

It also contains functions that can generate all possible sigma values and from sigma value to generate rotation angles needed for the GB generator.

all_coords = []
for site in bottom_grain:
all_coords.append(site.coords)
for site in top_grain:
Copy link
Member

Choose a reason for hiding this comment

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

Hi, I'm working with Hui on visualization of grain boundaries. Would it be possible to add a 'grain' site property here? something like,

all_coords = []
grain_labels = []
for site in bottom_grain:
    all_coords.append(site.coords)
    grain_labels.append('bottom_grain')
[...]
gb_with_vac = Structure(..., site_properties={'grain_label':grain_labels})

It would make it easier to visualize the grains during generation.

Copy link
Member

Choose a reason for hiding this comment

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

This looks like a great PR. I was wondering if it would be possible to mark which sites as co-incident between the top and bottom grains also? To make it possible to make a co-incident site lattice figure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is easy to label the grain sites( top or bottom, already implemented).
For the co-incident sites, I do not have a good way to label them for now.
Welcome for any suggestions.

Copy link
Member

Choose a reason for hiding this comment

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

Many thanks for adding grain labels.

For coincident sites, is it possible to create an additional structure where you extend both the top and bottom grains to fill the entire cell?

Copy link
Member

Choose a reason for hiding this comment

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

If you can create that structure (i.e. a structure with top and bottom grains fully-extended so that they overlap each other), finding co-incident sites would be fairly straight forward. I'd be happy to sketch out an implementation if you get to that stage.

Copy link
Member

Choose a reason for hiding this comment

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

Completely agreed, these were just the default colours don’t worry. We can change them to something more sensible!

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh yeah, the second graph is easier to recognize the two grains has a rotation angle. Also, I am wondering will it be difficult to add the icons which allow the users to rotate around specific directions (e.g.: x, y, and z-axis or rotation axis in a more general way) like the icons that are available in Vesta? Which might be convenient for users to look through the characteristics of GB structures by rotate it along the rotation axis.

Copy link
Member

Choose a reason for hiding this comment

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

This is fully 3D so you can rotate it :) If you’re on the update call tomorrow, I’ll give a demonstration.

Copy link
Contributor

Choose a reason for hiding this comment

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

You mean the MP Dissemination Thrust call on this Friday? If so, yes, I will be there, and looking forward to the pretty 3D structures!
Also, about the rotation, I actually mean an extra button, which allows the user to specify the rotation axis. The users just need to click the icon once, the structure will be rotated around that specific axis and angle, or even do animation. I record an example to show as here: https://www.youtube.com/watch?v=WhR1WH2Sz3A.
If you can achieve this type of animation, it will be fabulous ;)

Copy link
Member

Choose a reason for hiding this comment

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

Oh, it's Friday! Even better. Rotating about an axis should be fine, as long as I have the axis of rotation in the Cartesian space of the crystal. I'll take a look tomorrow and see if I can make it work.

@mkhorton
Copy link
Member

mkhorton commented Jul 11, 2018 via email

@shyuep shyuep merged commit 8107dfa into materialsproject:master Jul 12, 2018
@mkhorton
Copy link
Member

Now I've had some time to take a closer look at this, I had a few quick questions/comments:

  • Regarding "# angle tolerance should be looser" + tol_angle = 100 * tol -- why not just change the default kwarg here?
  • How does lat_type work? Why not just get the lattice type via spacegroup analyzer?
  • Will this work if you input the conventional unit cell and not the primitive? The vol_ratio = line seems to make certain assumptions about the input structure that I'm not sure I understand.

Thanks!

@ucsdlxg
Copy link
Contributor Author

ucsdlxg commented Jul 13, 2018

First, I just think the tolerance for angle should be smaller than that for distance when determining the lattice type, and do not want to use two tolerance parameters.

Second, when the function has 'lat_type' input parameter, then it has no concrete structure within it. If it has a structure, we will determine the lat_type from its structure properties (no lat_type input parameter needed). I just use the structure's lattice (a, b, c) and angle (alpha, beta, gamma) to determine the lat_type without using the spacegroup analyzer. I do not want the user to swap the a,b,c or angles. e.g. for hexagonal lattice, a=b!=c. gamma=120. Maybe spacegroup can do similar thing, I am not very familiar with it. Anyway, this part is quick.

Third, you can use conventional cell to generate the GB. Only fcc and bcc can also use the primitive cell. But if you use conventional cell for bcc or fcc, the code cannot guarantee the smallest GB structure.

Definitely, the code may need to be optimized further. Open for any suggestions.

Thanks!

@shyuep
Copy link
Member

shyuep commented Jul 13, 2018

I suggest we do the following:
i. The user supplies whatever cell he wants, and we define (100) etc. based on the supplied structure. If he chooses to use primitive, we assume (100) refers to the primitive a direction. We should not allow alternative structure input based on lat_type. That is a recipe for disaster as there will be multiple methods for generating structure.
ii. Angle tolerance should be a default parameter.
iii. Pls move the gb generator to pymatgen.analysis.gb for now and update all tests accordingly. We will decide whether it should be part of core in future.

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.

None yet

4 participants