-
Notifications
You must be signed in to change notification settings - Fork 27
Bugfix for get_points_in_sphere (Superceded by #60) #57
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
Conversation
|
Hello Phillip, I tried to run the program with the suggested changes, but the outcome is the same as before the changes on my computer. I was wondering if converting: actually changes anything? I tried with the rotation matrices for (-60,-60,0) and (30,-60,0) to see if there were any difference in the values of a, b and c between the original and changed implementations. I found them to be the same for both implementations and they are also equal for both rotation matrices. I also tested the distance function for both reciprocal_lattice and standard_base. It turns out they give the same distance between points of fractional coordinates [0.5,0.5,0.5] and [0.8,0.8,0.8] (Arbitrarily chosen relative coordinates. ). So I believe the bugfix does not actually change how the code runs. I have to admit that I am not really sure how the process should run. Do we want the standard base to be the direct lattice? I believe standard_base behaves like reciprocal_lattice in every instance where it is called in the function. They are not equal, as reciprocal_lattice.base is not equal to standard_base.base, but their function-specific behavior seems to be equal. Below is the code I have run to test the functions when orientations (-60,-60,0) and (30,-60,0) still provided the same diffraction pattern. Regards, Code I have run: |
Just to confirm, how far did you run the changes. Did you install this branches code?
It looks like it doesn't, you're right. But there is more than that in the PR :)
Here I have to protest! The docstrings for the
The reasons this code is better (I hope) is that now you find that the 100 is present (say) you can use reciprocal_lattice_cartesian() to get the correct location in cartesians. Here is an MWE which sadly doesn't work (although I think it would for the cubic case). My proposal is that we instead work entirely in the standard basis, and then at the final step rotate all our cartesians by the rotation matrix. For this to work we need a R that is applied on the left of the cartesian coordinates. I've not figured out what the best way to extract R from diffpy objects is yet. |
I am still quite new to git, so I have just copied the changes seen in "files changed" in this PR and added it manually to the file in the diffsims library. If there is an easy way to switch to a specific branch I would be very happy to hear about it! :)
I am a bit confused here. The changes I have seen are five lines added and four lines removed. I wanted to see how these lines would change the logic of which points are selected. I have assumed that moving the local import to global import would not change anything for this function. Furthermore, a,b and c are set to the same numbers. I can only see that the change from reciprocal_base to standard_base is used at one more instance, and that is in calculating the boolean "in-sphere". As the distance function seems to give the same distance (allthough the interpretation is that it is in relative coordinates), I can not see how it will change the behavior of the function. I tried the distance function for relative coordinates against the origin. That is, standard_base.dist([0.3,0.5,0.7],[0,0,0]) and recip_latt.dist([0.3,0.5,0.7],[0,0,0]), as it is used in the function. As far as I can see it still gives the same distance, even when the original lattice is not cubic.
I think I understand. It is a utility that we did not have in the old code, but it is not yet in use in the new code?
I think this is a good idea! I will let you know if I should come across a way to extract R from diffpy objects. |
|
In terms of the physics (and code solution) I think #59 is the answer. I'll address the other bits of comments shortly. |
|
Superceded by #60. |
name: Bugfix for
get_points_in_sphereabout: Full details in #56
Release Notes
Comments
@EirikOpheim if you could run this on your test case before we merge that would be great.