Ejemplo n.º 1
0
def export_single_mad_hkl(params):
    data = sorted(read_input_data("mad", params),
                  key=lambda d: d.info().wavelength)
    dt_labels = {
        v: k
        for (k, v) in params.items() if k in ("peak", "infl", "hrem", "lrem")
    }
    if not dt_labels:
        dt_labels = dict(
            zip(
                ("".join(dt.info().labels) for dt in data),
                ("hrem", "peak", "infl", "lrem"),
            ))
    res = {}
    for dt in data:
        for dt_name in dt_labels:
            if dt_name in "".join(dt.info().labels):
                dt_label = dt_labels[dt_name]
                hkl_filename = "%s_%s.hkl" % (params["prefix"], dt_label)
                print("Exporting data from columns %s to %s" %
                      (pformat(dt.info().labels), hkl_filename))
                with open(hkl_filename, "w") as fp:
                    miller_array_export_as_shelx_hklf(dt, fp)
                res[dt_label] = hkl_filename
    return res
Ejemplo n.º 2
0
def export_sad_hkl(params):
    data = read_input_data("sad", params)
    if len(data) > 1:
        try:
            sel_data = next(dt for dt in data
                            if params["label"] in "".join(dt.info().labels))
        except KeyError:
            raise ValueError(
                "Please specify column label to select a single dataset using --label parameter"
            )
        except StopIteration:
            raise ValueError("Dataset matching column label %s not found" %
                             params["label"])
    else:
        sel_data = data[0]
        if "label" in params:
            sel_data_labels = "".join(sel_data.info().labels)
            if params["label"] not in sel_data_labels:
                raise ValueError(
                    "Selected dataset colum label doesn't match --label %s" %
                    params["label"])
    hkl_filename = "%s.hkl" % params["prefix"]
    print("Exporting data from columns %s to %s" %
          (pformat(sel_data.info().labels), hkl_filename))
    with open(hkl_filename, "w") as fp:
        miller_array_export_as_shelx_hklf(sel_data, fp)
    return {"sad": hkl_filename}
Ejemplo n.º 3
0
def to_shelxcde(hklin, prefix, sites=0):
    '''Read hklin (unmerged reflection file) and generate SHELXC input file
  and HKL file'''

    from iotbx.reflection_file_reader import any_reflection_file
    from iotbx.shelx.hklf import miller_array_export_as_shelx_hklf
    reader = any_reflection_file(hklin)
    intensities = [
        ma for ma in reader.as_miller_arrays(merge_equivalents=False)
        if ma.info().labels == ['I', 'SIGI']
    ][0]
    mtz_object = reader.file_content()
    indices = reader.file_content().extract_original_index_miller_indices()
    intensities = intensities.customized_copy(indices=indices,
                                              info=intensities.info())
    with open('%s.hkl' % prefix, 'wb') as hkl_file_handle:
        miller_array_export_as_shelx_hklf(intensities, hkl_file_handle)
    uc = intensities.unit_cell().parameters()
    sg = intensities.space_group().type().lookup_symbol().replace(' ', '')
    open('%s.sh' % prefix, 'w').write('\n'.join([
        'shelxc %s << eof' % prefix,
        'cell %f %f %f %f %f %f' % uc,
        'spag %s' % sg,
        'sad %s.hkl' % prefix,
        'find %d' % sites,
        'maxm %d' % ((2 * intensities.data().size() // 1000000) + 1), 'eof', ''
    ]))
Ejemplo n.º 4
0
def export_mad_hkl(params):
    res = {}
    for lb in ("peak", "infl", "hrem", "lrem"):
        if lb in params:
            data = read_input_data(lb, params)
            if len(data) > 1:
                raise ValueError("Multiple datasets found in %s" % params[lb])
            hkl_filename = "%s_%s.hkl" % (params["prefix"], lb)
            with open(hkl_filename, "w") as fp:
                miller_array_export_as_shelx_hklf(data[0], fp)
            res[lb] = hkl_filename
    return res
Ejemplo n.º 5
0
def export_native_hkl(params):
    data = read_input_data("nat", params, False)
    if len(data) > 1:
        raise ValueError(
            "Multiple datasets found in the input native data file %s" %
            params["nat"])
    hkl_filename = "%s_nat.hkl" % params["prefix"]
    print("Exporting data from columns %s to %s" %
          (pformat(data[0].info().labels), hkl_filename))
    with open(hkl_filename, "w") as fp:
        miller_array_export_as_shelx_hklf(data[0], fp)
    return {"nat": hkl_filename}
Ejemplo n.º 6
0
def to_amber(hklin, prefix):
    """Read hklin (unmerged reflection file) HKL file containing
    H K L I sqrt(|I|)"""

    from iotbx.reflection_file_reader import any_reflection_file
    from iotbx.shelx import writer
    from iotbx.shelx.hklf import miller_array_export_as_shelx_hklf

    reader = any_reflection_file(hklin)
    mtz_object = reader.file_content()
    ma = reader.as_miller_arrays(merge_equivalents=False)
    labels = [c.info().labels for c in ma]
    if ["I", "SIGI"] not in labels:
        if ["I(+)", "SIGI(+)", "I(-)", "SIGI(-)"] in labels:
            print("Error: xia2.to_amber must be run on unmerged data.")
        else:
            print("Error: columns I / SIGI not found.")
        sys.exit(1)

    intensities = [c for c in ma if c.info().labels == ["I", "SIGI"]][0]

    indices = reader.file_content().extract_original_index_miller_indices()
    intensities = intensities.customized_copy(indices=indices,
                                              info=intensities.info())

    from scitbx.array_family import flex

    abs_intensities = flex.sqrt(flex.abs(intensities.data()))
    intensities.set_sigmas(abs_intensities)

    with open("%s.hkl" % prefix, "wb") as hkl_file_handle:
        miller_array_export_as_shelx_hklf(
            intensities,
            hkl_file_handle,
            scale_range=(-9999.0, 9999.0),
            normalise_if_format_overflow=True,
        )

    return
Ejemplo n.º 7
0
def to_shelxcde(hklin, prefix, sites=0):
    """Read hklin (unmerged reflection file) and generate SHELXC input file
    and HKL file"""

    from iotbx.reflection_file_reader import any_reflection_file
    from iotbx.shelx.hklf import miller_array_export_as_shelx_hklf

    reader = any_reflection_file(hklin)
    intensities = [
        ma for ma in reader.as_miller_arrays(merge_equivalents=False)
        if ma.info().labels == ["I", "SIGI"]
    ][0]
    mtz_object = reader.file_content()
    indices = reader.file_content().extract_original_index_miller_indices()
    intensities = intensities.customized_copy(indices=indices,
                                              info=intensities.info())
    with open("%s.hkl" % prefix, "wb") as hkl_file_handle:
        miller_array_export_as_shelx_hklf(intensities, hkl_file_handle)
    uc = intensities.unit_cell().parameters()
    sg = intensities.space_group().type().lookup_symbol().replace(" ", "")

    # spacegroup name disputes
    if sg.startswith("R3:"):
        sg = "H3"
    elif sg.startswith("R32:"):
        sg = "H32"

    open("%s.sh" % prefix, "w").write("\n".join([
        "shelxc %s << eof" % prefix,
        "cell %f %f %f %f %f %f" % uc,
        "spag %s" % sg,
        "sad %s.hkl" % prefix,
        "find %d" % sites,
        "maxm %d" % ((2 * intensities.data().size() // 1000000) + 1),
        "eof",
        "",
    ]))
Ejemplo n.º 8
0
def to_shelxcde(hklin, prefix, sites=0):
  '''Read hklin (unmerged reflection file) and generate SHELXC input file
  and HKL file'''

  from iotbx.reflection_file_reader import any_reflection_file
  from iotbx.shelx.hklf import miller_array_export_as_shelx_hklf
  reader = any_reflection_file(hklin)
  intensities = [ma for ma in reader.as_miller_arrays(merge_equivalents=False)
                 if ma.info().labels == ['I', 'SIGI']][0]
  mtz_object = reader.file_content()
  indices = reader.file_content().extract_original_index_miller_indices()
  intensities = intensities.customized_copy(indices=indices, info=intensities.info())
  with open('%s.hkl' % prefix, 'wb') as hkl_file_handle:
    miller_array_export_as_shelx_hklf(intensities, hkl_file_handle)
  uc = intensities.unit_cell().parameters()
  sg = intensities.space_group().type().lookup_symbol().replace(' ', '')
  open('%s.sh' % prefix, 'w').write('\n'.join([
    'shelxc %s << eof' % prefix,
    'cell %f %f %f %f %f %f' % uc,
    'spag %s' % sg,
    'sad %s.hkl' % prefix,
    'find %d' % sites,
    'maxm %d' % ((2 * intensities.data().size() // 1000000) + 1),
    'eof', '']))
Ejemplo n.º 9
0
def to_shelx(hklin, prefix, compound="", options=None):
    """Read hklin (unmerged reflection file) and generate SHELXT input file
    and HKL file"""

    reader = any_reflection_file(hklin)
    mtz_object = reader.file_content()
    ma = reader.as_miller_arrays(merge_equivalents=False)
    labels = [c.info().labels for c in ma]
    if ["I", "SIGI"] not in labels:
        if ["I(+)", "SIGI(+)", "I(-)", "SIGI(-)"] in labels:
            print("Error: xia2.to_shelx must be run on unmerged data.")
        else:
            print("Error: columns I / SIGI not found.")
        sys.exit(1)

    intensities = [c for c in ma if c.info().labels == ["I", "SIGI"]][0]

    indices = reader.file_content().extract_original_index_miller_indices()
    intensities = intensities.customized_copy(indices=indices,
                                              info=intensities.info())

    with open("%s.hkl" % prefix, "w") as hkl_file_handle:
        # limit values to 4 digits (before decimal point), as this is what shelxt
        # writes in its output files, and shelxl seems to read. ShelXL apparently
        # does not read values >9999 properly
        miller_array_export_as_shelx_hklf(
            intensities,
            hkl_file_handle,
            scale_range=(-9999.0, 9999.0),
            normalise_if_format_overflow=True,
        )

    crystal_symm = intensities.crystal_symmetry()

    wavelength = None
    if options:
        wavelength = options.wavelength
    if wavelength is None:
        mtz_crystals = mtz_object.crystals()
        wavelength = mtz_crystals[1].datasets()[0].wavelength()
    print("Experimental wavelength: %.3f Angstroms" % wavelength)

    unit_cell_dims = None
    unit_cell_esds = None
    cell_data = None
    if options and options.cell:
        if options.cell.endswith((".expt", ".json")):
            with open(options.cell, "r") as fh:
                cell_data = json.load(fh)
            if "solution_constrained" in cell_data:
                # json from xia2.get_unit_cell_errors (obsolete)
                solution = cell_data.get("solution_constrained",
                                         cell_data["solution_unconstrained"])
                unit_cell_dims = tuple([
                    solution[dim]["mean"]
                    for dim in ["a", "b", "c", "alpha", "beta", "gamma"]
                ])
                unit_cell_esds = tuple([
                    solution[dim]["population_standard_deviation"]
                    for dim in ["a", "b", "c", "alpha", "beta", "gamma"]
                ])
            else:
                # json from dials.two_theta_refine
                cell_data = None
                from dxtbx.model.experiment.experiment_list import ExperimentListFactory

                experiments = ExperimentListFactory.from_json_file(
                    options.cell)
                crystal = experiments.crystals()[0]
                unit_cell_dims = crystal.get_unit_cell().parameters()
                unit_cell_esds = crystal.get_cell_parameter_sd()

        else:  # treat as .cif
            import iotbx.cif

            cif = iotbx.cif.reader(file_path=options.cell).model()
            unit_cell = [
                cif.get("xia2", cif.get("two_theta_refine", {})).get(key)
                for key in (
                    "_cell_length_a",
                    "_cell_length_b",
                    "_cell_length_c",
                    "_cell_angle_alpha",
                    "_cell_angle_beta",
                    "_cell_angle_gamma",
                )
            ]

            # now need to inverse transform these ESD numbers into unit_cell_dims and unit_cell_esds
            def dim_esd(iucr_number_format):
                if "(" not in iucr_number_format:
                    return float(iucr_number_format), 0
                p = iucr_number_format.split("(")
                dim = float(p[0])
                esd = float(p[1].split(")")[0])
                if "." in p[0]:
                    esd = esd / (10**len(p[0].split(".")[1]))
                return dim, esd

            unit_cell_dims, unit_cell_esds = list(
                zip(*(dim_esd(p) for p in unit_cell)))

    cb_op = crystal_symm.change_of_basis_op_to_reference_setting()

    if cb_op.c().r().as_hkl() == "h,k,l":
        print("Change of basis to reference setting: %s" % cb_op)
        crystal_symm = crystal_symm.change_basis(cb_op)
        if str(cb_op) != "a,b,c":
            unit_cell_dims = None
            unit_cell_esds = None
            # Would need to apply operation to cell errors, too. Need a test case for this

    # crystal_symm.show_summary()
    xray_structure = structure(crystal_symmetry=crystal_symm)
    if compound:
        result = parse_compound(compound)
        for element in result:
            xray_structure.add_scatterer(
                scatterer(label=element, occupancy=result[element]))
    open("%s.ins" % prefix, "w").write("".join(
        writer.generator(
            xray_structure,
            wavelength=wavelength,
            full_matrix_least_squares_cycles=0,
            title=prefix,
            unit_cell_dims=unit_cell_dims,
            unit_cell_esds=unit_cell_esds,
        )))
    if options and options.cell and not options.cell.endswith(".cif"):
        generate_cif(
            prefix=prefix,
            unit_cell_data=cell_data,
            wavelength=wavelength,
            structure=xray_structure,
        )
Ejemplo n.º 10
0
def to_shelx(hklin, prefix, compound='', options=None):
    '''Read hklin (unmerged reflection file) and generate SHELXT input file
  and HKL file'''

    from iotbx.reflection_file_reader import any_reflection_file
    from iotbx.shelx import writer
    from iotbx.shelx.hklf import miller_array_export_as_shelx_hklf
    from cctbx.xray.structure import structure
    from cctbx.xray import scatterer

    reader = any_reflection_file(hklin)
    mtz_object = reader.file_content()
    ma = reader.as_miller_arrays(merge_equivalents=False)
    labels = [c.info().labels for c in ma]
    if ['I', 'SIGI'] not in labels:
        if ['I(+)', 'SIGI(+)', 'I(-)', 'SIGI(-)'] in labels:
            print "Error: xia2.to_shelx must be run on unmerged data."
        else:
            print "Error: columns I / SIGI not found."
        sys.exit(1)

    intensities = [c for c in ma if c.info().labels == ['I', 'SIGI']][0]

    # FIXME do I need to reindex to a conventional setting here

    indices = reader.file_content().extract_original_index_miller_indices()
    intensities = intensities.customized_copy(indices=indices,
                                              info=intensities.info())

    with open('%s.hkl' % prefix, 'wb') as hkl_file_handle:
        # limit values to 4 digits (before decimal point), as this is what shelxt
        # writes in its output files, and shelxl seems to read. ShelXL apparently
        # does not read values >9999 properly
        miller_array_export_as_shelx_hklf(intensities,
                                          hkl_file_handle,
                                          scale_range=(-9999., 9999.),
                                          normalise_if_format_overflow=True)

    crystal_symm = intensities.crystal_symmetry()

    wavelength = None
    if options:
        wavelength = options.wavelength
    if wavelength is None:
        mtz_crystals = mtz_object.crystals()
        wavelength = mtz_crystals[1].datasets()[0].wavelength()
    print 'Experimental wavelength: %.3f Angstroms' % wavelength

    unit_cell_dims = None
    unit_cell_esds = None
    cell_data = None
    if options and options.cell:
        if options.cell.endswith('.json'):
            with open(options.cell, 'r') as fh:
                cell_data = json.load(fh)
            if 'solution_constrained' in cell_data:
                # json from xia2.get_unit_cell_errors (obsolete)
                solution = cell_data.get('solution_constrained',
                                         cell_data['solution_unconstrained'])
                unit_cell_dims = tuple([
                    solution[dim]['mean']
                    for dim in ['a', 'b', 'c', 'alpha', 'beta', 'gamma']
                ])
                unit_cell_esds = tuple([
                    solution[dim]['population_standard_deviation']
                    for dim in ['a', 'b', 'c', 'alpha', 'beta', 'gamma']
                ])
            else:
                # json from dials.two_theta_refine
                cell_data = None
                from dxtbx.model.experiment.experiment_list import ExperimentListFactory
                experiments = ExperimentListFactory.from_json_file(
                    options.cell)
                crystal = experiments.crystals()[0]
                unit_cell_dims = crystal.get_unit_cell().parameters()
                unit_cell_esds = crystal.get_cell_parameter_sd()

        else:  # treat as .cif
            import iotbx.cif
            cif = iotbx.cif.reader(file_path=options.cell).model()
            unit_cell = [
                cif.get('xia2', cif.get('two_theta_refine', {})).get(key)
                for key in ('_cell_length_a', '_cell_length_b',
                            '_cell_length_c', '_cell_angle_alpha',
                            '_cell_angle_beta', '_cell_angle_gamma')
            ]

            # now need to inverse transform these ESD numbers into unit_cell_dims and unit_cell_esds
            def dim_esd(iucr_number_format):
                if '(' not in iucr_number_format:
                    return float(iucr_number_format), 0
                p = iucr_number_format.split('(')
                dim = float(p[0])
                esd = float(p[1].split(')')[0])
                if '.' in p[0]:
                    esd = esd / (10**len(p[0].split('.')[1]))
                return dim, esd

            unit_cell_dims, unit_cell_esds = zip(*(dim_esd(p)
                                                   for p in unit_cell))

    cb_op = crystal_symm.change_of_basis_op_to_reference_setting()

    if cb_op.c().r().as_hkl() == 'h,k,l':
        print 'Change of basis to reference setting: %s' % cb_op
        crystal_symm = crystal_symm.change_basis(cb_op)
        if str(cb_op) != "a,b,c":
            unit_cell_dims = None
            unit_cell_esds = None
            # Would need to apply operation to cell errors, too. Need a test case for this

    # crystal_symm.show_summary()
    xray_structure = structure(crystal_symmetry=crystal_symm)
    if compound:
        result = parse_compound(compound)
        for element in result:
            xray_structure.add_scatterer(
                scatterer(label=element, occupancy=result[element]))
    open('%s.ins' % prefix, 'w').write(''.join(
        writer.generator(xray_structure,
                         wavelength=wavelength,
                         full_matrix_least_squares_cycles=0,
                         title=prefix,
                         unit_cell_dims=unit_cell_dims,
                         unit_cell_esds=unit_cell_esds)))
    if options and options.cell and not options.cell.endswith('.cif'):
        generate_cif(prefix=prefix,
                     unit_cell_data=cell_data,
                     wavelength=wavelength,
                     structure=xray_structure)
Ejemplo n.º 11
0
def to_shelx(hklin, prefix, compound='', options={}):
  '''Read hklin (unmerged reflection file) and generate SHELXT input file
  and HKL file'''

  from iotbx.reflection_file_reader import any_reflection_file
  from iotbx.shelx import writer
  from iotbx.shelx.hklf import miller_array_export_as_shelx_hklf
  from cctbx.xray.structure import structure
  from cctbx.xray import scatterer

  reader = any_reflection_file(hklin)
  mtz_object = reader.file_content()
  intensities = [ma for ma in reader.as_miller_arrays(merge_equivalents=False)
                 if ma.info().labels == ['I', 'SIGI']][0]

  # FIXME do I need to reindex to a conventional setting here

  indices = reader.file_content().extract_original_index_miller_indices()
  intensities = intensities.customized_copy(indices=indices, info=intensities.info())

  with open('%s.hkl' % prefix, 'wb') as hkl_file_handle:
    # limit values to 4 digits (before decimal point), as this is what shelxt
    # writes in its output files, and shelxl seems to read. ShelXL apparently
    # does not read values >9999 properly
    miller_array_export_as_shelx_hklf(intensities, hkl_file_handle,
      scale_range=(-9999., 9999.), normalise_if_format_overflow=True)

  crystal_symm = intensities.crystal_symmetry()

  wavelength = options.wavelength
  if wavelength is None:
    mtz_crystals = mtz_object.crystals()
    wavelength = mtz_crystals[1].datasets()[0].wavelength()
  print 'Experimental wavelength: %.3f Angstroms' % wavelength

  unit_cell_dims = None
  unit_cell_esds = None
  cell_data = None
  if options.cell:
    with open(options.cell, 'r') as fh:
      cell_data = json.load(fh)
      solution = cell_data.get('solution_constrained', cell_data['solution_unconstrained'])
      unit_cell_dims = tuple([
          solution[dim]['mean'] for dim in ['a', 'b', 'c', 'alpha', 'beta', 'gamma']
        ])
      unit_cell_esds = tuple([
          solution[dim]['population_standard_deviation'] for dim in ['a', 'b', 'c', 'alpha', 'beta', 'gamma']
        ])

  cb_op = crystal_symm.change_of_basis_op_to_reference_setting()

  if cb_op.c().r().as_hkl() == 'h,k,l':
    print 'Change of basis to reference setting: %s' % cb_op
    crystal_symm = crystal_symm.change_basis(cb_op)
    if str(cb_op) != "a,b,c":
      unit_cell_dims = None
      unit_cell_esds = None
      # Would need to apply operation to cell errors, too. Need a test case for this

  # crystal_symm.show_summary()
  xray_structure = structure(crystal_symmetry=crystal_symm)
  if compound:
    result = parse_compound(compound)
    for element in result:
      xray_structure.add_scatterer(scatterer(label=element,
                                             occupancy=result[element]))
  open('%s.ins' % prefix, 'w').write(''.join(
    writer.generator(xray_structure,
                     wavelength=wavelength,
                     full_matrix_least_squares_cycles=0,
                     title=prefix,
                     unit_cell_esds=unit_cell_esds)))
  generate_cif(prefix=prefix, unit_cell_data=cell_data, wavelength=wavelength, structure=xray_structure)
Ejemplo n.º 12
0
    def _scale_finish_export_shelxt(self):
        '''Read hklin (unmerged reflection file) and generate SHELXT input file
    and HKL file'''

        from iotbx.reflection_file_reader import any_reflection_file
        from iotbx.shelx import writer
        from iotbx.shelx.hklf import miller_array_export_as_shelx_hklf
        from cctbx.xray.structure import structure
        from cctbx.xray import scatterer

        for wavelength_name in self._scalr_scaled_refl_files.keys():
            prefix = wavelength_name
            if len(self._scalr_scaled_refl_files.keys()) == 1:
                prefix = 'shelxt'
            prefixpath = os.path.join(self.get_working_directory(), prefix)

            mtz_unmerged = self._scalr_scaled_reflection_files['mtz_unmerged'][
                wavelength_name]
            reader = any_reflection_file(mtz_unmerged)
            intensities = [
                ma for ma in reader.as_miller_arrays(merge_equivalents=False)
                if ma.info().labels == ['I', 'SIGI']
            ][0]

            # FIXME do I need to reindex to a conventional setting here

            indices = reader.file_content(
            ).extract_original_index_miller_indices()
            intensities = intensities.customized_copy(indices=indices,
                                                      info=intensities.info())

            with open('%s.hkl' % prefixpath, 'wb') as hkl_file_handle:
                # limit values to 4 digits (before decimal point), as this is what shelxt
                # writes in its output files, and shelxl seems to read. ShelXL apparently
                # does not read values >9999 properly
                miller_array_export_as_shelx_hklf(
                    intensities,
                    hkl_file_handle,
                    scale_range=(-9999., 9999.),
                    normalise_if_format_overflow=True)

            crystal_symm = intensities.crystal_symmetry()

            unit_cell_dims = self._scalr_cell
            unit_cell_esds = self._scalr_cell_esd

            cb_op = crystal_symm.change_of_basis_op_to_reference_setting()

            if cb_op.c().r().as_hkl() == 'h,k,l':
                print('Change of basis to reference setting: %s' % cb_op)
                crystal_symm = crystal_symm.change_basis(cb_op)
                if str(cb_op) != "a,b,c":
                    unit_cell_dims = None
                    unit_cell_esds = None
                    # Would need to apply operation to cell errors, too. Need a test case for this

            # crystal_symm.show_summary()
            xray_structure = structure(crystal_symmetry=crystal_symm)

            compound = 'CNOH'
            if compound:
                from xia2.command_line.to_shelx import parse_compound
                result = parse_compound(compound)
                for element in result:
                    xray_structure.add_scatterer(
                        scatterer(label=element, occupancy=result[element]))

            wavelength = self._scalr_xcrystal.get_xwavelength(
                wavelength_name).get_wavelength()

            with open('%s.ins' % prefixpath, 'w') as insfile:
                insfile.write(''.join(
                    writer.generator(xray_structure,
                                     wavelength=wavelength,
                                     full_matrix_least_squares_cycles=0,
                                     title=prefix,
                                     unit_cell_dims=unit_cell_dims,
                                     unit_cell_esds=unit_cell_esds)))

            FileHandler.record_data_file('%s.ins' % prefixpath)
            FileHandler.record_data_file('%s.hkl' % prefixpath)