-
Notifications
You must be signed in to change notification settings - Fork 8
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 feature for multiple lattice parameters/phases in polycrystal_from_odf #16
Conversation
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 solid to me. :=)
Altough, we need to make the unit tests pass / add one for the case of multi phase, and update the examples.
xrd_simulator/templates.py
Outdated
unit_cell (:obj:`list` of :obj:`float`): Crystal unit cell representation of the form | ||
[a,b,c,alpha,beta,gamma], where alpha,beta and gamma are in units of degrees while | ||
unit_cell (:obj:`list of lists` of :obj:`float`): Crystal unit cell representation of the form | ||
[[a,b,c,alpha,beta,gamma],], where alpha,beta and gamma are in units of degrees while | ||
a,b and c are in units of anstrom. |
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.
Can we add a sentence to each of these arguments which specify that "When unit_cell is an iterable with several instances of unit cell parameters, the polycrystal represents a multi-phase material."
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 is updated.
@@ -131,6 +132,8 @@ def polycrystal_from_odf( | |||
strain_tensor(x) -> :obj:`numpy array` of shape ``(3,3)`` where input variable ``x`` is | |||
a :obj:`numpy array` of shape ``(3,)`` representing a spatial coordinate in the | |||
cylinder (x,y,z). | |||
phase_fraction (:obj: `list` of :obj:`float`): Phase fraction represented as probability, summing up to 1. | |||
Default None; will take even distribution of crystals. | |||
|
|||
Returns: | |||
(:obj:`xrd_simulator.polycrystal.Polycrystal`) |
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 also neeed to edit the example file. c.f docs/source/examples/example_polycrystal_from_odf.py
This example is included into the docs so it now needs to reflect the changes. I suggest to make it a simple 2-phase material example.
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 added a 2 phase example, albeit with trivial input values.
# Sample is uniformly single phase | ||
phases = [Phase(unit_cell, sgname, path_to_cif_file)] | ||
element_phase_map = np.zeros((mesh.number_of_elements,)).astype(int) | ||
|
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 solid to me. :=)
Altough, we need to make the unit tests pass / add one for the case of multi phase.
Great that you are contributing @vamatya ❤️ 🤟 🎉 Some things still need to be done before we can merge.
Cheers, |
2. Update code to handle both single and multi-phase inputs 3. Add unit test for 2 phase example 4. Add example for 2 phase material
Feature add for ingesting multiple lattice parameters, sgname and cif files, and corresponding phase fractions for
polycrystal_from_odf
function.