Friday, 13 November 2015

Drawing predictions

Sometimes it would be useful to see what DIALS thinks are the reflections on an image - this is easily achieved by indexing the data then asking to have the reflection profiles generated, then predicting, then plotting the predictions as follows - from indexing get an experiments file and indexed reflections, then:

Graemes-MacBook-Pro-2:index graeme$ dials.create_profile_model 15_experiments.json 15_indexed.pickle 
The following parameters have been modified:

input {
  experiments = 15_experiments.json
  reflections = 15_indexed.pickle
}

Removed invalid coordinates, 2513 remaining................................0.00s
Sigma B: 0.030353
Sigma M: 0.048908
Wrote experiments to experiments_with_profile_model.json...................0.01s

followed by:

Graemes-MacBook-Pro-2:index graeme$ dials.predict experiments_with_profile_model.json 
The following parameters have been modified:

input {
  experiments = experiments_with_profile_model.json
}

Saved 7392 reflections to predicted.pickle.................................0.01s

and finally:

dials.image_viewer 14_datablock.json predicted.pickle

Job done - you can now see the reflections! This will allow you to look to see that the reflection model matches the observed spots.

Thursday, 8 October 2015

Using Refined Geometry

From time to time you may be faced with a situation where the geometric description of the experiment was not quite right, and you know you have data where you can refine it but want to apply this refinement to another data set. With DIALS, you can. Here's how.

First following the usual recipes get to the point of having the "reference" data processed i.e. some refined_experiments.json file available. You can then fold this information back in with dials.import:


dials.import datablock=../demo/datablock.json \
reference_geometry=../demo/experiments_3.json 

that way when you use the geometry in index it's using the refined geometry. It also shows the neat import datablock from datablock feature - you could just as well have passed a path to the images here. If you have got this refined geometry from a previous look at this data then you can just recycle the strong spot pickle file and rerun indexing, as I did in previous post...

By way of an aside, if you are off to a beamline to record some hard to process data it is well worth taking some nice crystals along i.e. insulin, thaumatin, and recording a calibration set at the same distance and wavelength you will use for the hard experiments. BTW the xia2 equivalent is:

reference_geometry=../demo/experiments_3.json

So you don't even need to do the processing by hand...

Checking Indexing Symmetry

From time to time it may happen you record data with the wrong beam centre in the header (say) and then, if you have a large unit cell, you can have a lot of fun trying to get the data to process right... why? Because it may index perfectly well but with the wrong origin in reciprocal space.

Clearly you can resolve this by looking at the data - however it's much more fun to use DIALS!

OK, so we have run the usual dials.find_spots, dials.index shuffle & ended up with something which looks ... sensible:

Final refined crystal models:
model 1 (93307 reflections):
Crystal:
   Unit cell: (57.593, 57.688, 148.089, 90.579, 90.455, 89.758)
   Space group: P 1
   U matrix:  {{ 0.3287,  0.1200, -0.9368},
               { 0.0693, -0.9923, -0.1027},
               {-0.9419, -0.0312, -0.3344}}
   B matrix:  {{ 0.0174,  0.0000,  0.0000},
               {-0.0001,  0.0173,  0.0000},
               { 0.0001,  0.0002,  0.0068}}
   A = UB:    {{ 0.0056,  0.0019, -0.0063},
               { 0.0013, -0.0172, -0.0007},
               {-0.0164, -0.0006, -0.0023}}

Saving refined experiments to experiments.json

Saving refined reflections to indexed.pickle

However we know here that the beam centre is wrong - how to work out the right centre? Look for the inversion symmetry in the intensities of the strong spots as follows:

dials.check_indexing_symmetry experiments.json indexed.pickle \
grid_search_scope=3 symop_threshold=0.7

This will check the symmetry operations implied by the input experiment (in this case P1; nothing to see here) and since we have set the grid search scope it will also compute the CC on the -h,-k,-l operator taking in to account shifts in h,k,l of -3 to +3 => 343 permutations; it will then print (in this case) those which give a CC > 0.7 and also the 0,0,0 for reference - here we find that the data are indeed misindexed:

symop_threshold = 0.7
grid_search_scope = 3
input {
 experiments = experiments.json
 reflections = indexed.pickle
}

Checking HKL origin:

dH dK dL   Nref    CC
0  0  0  26890 0.393
0  0  2  27849 0.965

So you can then apply this shift to the indexed reflections and rerun the refinement - this should sort out your geometry nicely. You do this with:

dials.reindex indexed.pickle hkl_offset=0,0,2 output.reflections=reindexed.pickle

If this happened to me, I would take the refined geometry and rerun the indexing (that's for another post). In the case I was working on here this improved the #reflections indexed from 93307 to 269577 - worthwhile!

Happy twiddling!

What is this blog?

This is an unofficial blog showing some of the fun things which can be done with the DIALS software (from http://dials.diamond.ac.uk or http://dials.lbl.gov). This does not form part of the official documentation, and readers should be warned that sometimes things will go "out of date" as the software evolves. However it's also fun to see what can be done, right? I'll post stuff here when I do interesting things which I think others may find useful.