SHELX/Platon OMIT Script

You've heard of the obscure little used program called Shelx? Well feel free to share your Shelx questions, in all forms XL, WinGX versions, Shelx versions, we take the lot and then your wondering what about general commands yep those and Shelx related issues, ideas, troubleshooting and of course general Shelx related hocus-pocus. Just post away - remember though:
Q2: When I start SHELXL on my PC the disk rattles loudly for several hours and smoke comes out of the back. Is this a bug?
A: You must be trying to run SHELX under some version of Windows! The best solution is to reformat the hard disk and install Linux. However the current release should produce less smoke.
Link: ShelX Homepage
User avatar
Rotating Anode With Optics
Posts: 264
Joined: 23 Apr 2009, 19:48

SHELX/Platon OMIT Script

Post by wlewis » 02 May 2022, 06:23

I threw this together this afternoon as I didn't want to trawl through 2000 reflections lines to find the reflections to OMIT in SHELX. This script takes the CKF file from Platon (Cif check reflection report) and finds all the reflections where RatioW > 10 or < -10, and also any reflections where Ratio < -100 (tagged with a ? in the file), and writes these to FILE.OMIT, where the contents can be directly pasted into a SHELX instruction file.

Save as a python file (.py) and run from the command line:

Code: Select all

Reads in a CKF and gets the reflections to be omitted from Section 2.
Runs from the command line with the file stem, and outputs filestem.omit as a text file.

import sys

    _file_stem = sys.argv[1]
    with open('{}.ckf'.format(_file_stem), 'r') as handle:
        _ckf_full =
except IndexError as e:
    print("You haven't provided a file stem to run this script on.")
except FileNotFoundError as e:
    print("The file '{}.ckf' cannot be found. Check the spelling and remember to omit '.ckf', you only need to provide the filestem.".format(_file_stem))
_section2 = _ckf_full.split("Section")[2].split('\n')[6:-8]

_results_indices = []

for line in _section2:
    # test for Ratio < -100
    if line[63:64] == '?':
    # test for RatioW <-10 or > 10
    elif abs(float(line.split()[-1])) >= 10.0:

if len(_results_indices) == 0:
    print('No reflections found to OMIT!')
    _output_string = 'OMIT ' + "\nOMIT ".join(_results_indices)
    with open('{}.omit'.format(_file_stem), 'w') as handle:
    print("OMITted reflections written to {}.omit".format(_file_stem))

Return to “Shelx”