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 SHELX hkl file export to dials.export #1925

Merged
merged 15 commits into from
Jan 17, 2022
Merged

Conversation

huwjenkins
Copy link
Contributor

For small molecule work it would be useful to be able to write SHELX hkl format from the output of dials.scale without a detour via MTZ format. This PR adds that functionality.

It also:

  1. Writes a stub of a SHELX .ins file with information from the scaled.expt or refined_cell.expt file. I have never used XPREP but I copied the format from here

  2. By default scales up intensities so the maximum/minimum is 9999.00/-9999.00 maximising precision in f8.2 format.

@dagewa made some comments which I've already addressed.

huwjenkins and others added 9 commits November 8, 2021 12:18
…artiality (dials#1911)

Some corner cases:

If the bin critical value is None rather than 0 because of missing all
reflections, replace None with 0.0 so that the flex.double call is sane.

If no partiality column in reflection table, make sum_partial_reflections a
no-op i.e. simply return the input table.
This means the docutils constraint is properly picked up
Copy link
Contributor

@jbeilstenedmands jbeilstenedmands left a comment

Choose a reason for hiding this comment

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

Thanks for adding this new feature, it's a great addition. Thank you for also adding tests!
The changes look good overall to me, the only thing that needs addressing is the slight change in _write_ins.
Are you able to rebase your branch on top of the latest changes in dials:main, in the 'files changed' diffs it's showing some unrelated changes from recent commits?
Thanks, James

wl, *uc.parameters()
)
)
if uc_sd is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if uc_sd is not None:
if uc_sd:

I was testing on scaled datafiles, and L162 caused a crash when trying to format the string as uc_sd was (), because the cell had no parameter sds. This change should stop that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I've changed that and removed the lines setting uc_sd to None as it shouldn't be required now. I'm still not sure exactly why sometimes unit cell esds disappear - e.g. changing space group from P222 to P212121 with dials.reindex removes them which doesn't make sense to me (but that's outside the scope of this PR).

Copy link
Contributor

Choose a reason for hiding this comment

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

changing space group from P222 to P212121 with dials.reindex removes them which doesn't make sense to me
In the general case changing the space group invalidates the unit cell esds, but I guess we might need to handle separately the special case where we're not changing the Bravais lattice. Could you make a separate issue for this with an example?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed the lines setting uc_sd to None as it shouldn't be required now

🤦 77ff15f fixes bug that I introduced here. Added test too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the general case changing the space group invalidates the unit cell esds, but I guess we might need to handle separately the special case where we're not changing the Bravais lattice. Could you make a separate issue for this with an example?

Done: #1934

command_line/export.py Outdated Show resolved Hide resolved
@dagewa
Copy link
Member

dagewa commented Nov 15, 2021

@huwjenkins you might also want to add your name to the AUTHORS file as part of this PR.

@ndevenish
Copy link
Member

I've merged in the latest main changes, this changeset should be easier to read now.

@huwjenkins
Copy link
Contributor Author

Are you able to rebase your branch on top of the latest changes in dials:main, in the 'files changed' diffs it's showing some unrelated changes from recent commits?

I tried to do that before but obviously didn't do it correctly as that's what added the unrelated commits to this branch! Would it be possible to expand the section in dials/CONTRIBUTING.md too have more explicit instructions than "by e.g. using git rebase"? Thanks!

@huwjenkins
Copy link
Contributor Author

One comment from @dagewa here was about the naming for the option shelx.scale which scales up intensities so maximum is 9999.00. Should this be 'rescale' or 'upscale' or something to indicate this is independent of the option intensities=scale? Suggestions welcome!

@huwjenkins
Copy link
Contributor Author

huwjenkins commented Nov 17, 2021

@huwjenkins you might also want to add your name to the AUTHORS file as part of this PR.

Thanks 🙂

@ndevenish
Copy link
Member

Would it be possible to expand the section in dials/CONTRIBUTING.md too have more explicit instructions than "by e.g. using git rebase"? Thanks!

Hmm, yes, I'll have a think about the wording - this would have been fine not to rebase, and rebase is a tool that not a lot of people know well.

@ndevenish ndevenish merged commit ba5acad into dials:main Jan 17, 2022
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

6 participants