def f_calc_symmetrisations(f_obs, f_calc_in_p1, min_cc_peak_height):
  # The fast correlation map as per cctbx.translation_search.fast_nv1995
  # is computed and its peaks studied.
  # Inspiration from phenix.substructure.hyss for the parameters tuning.
  if 0: # Display f_calc_in_p1
    from crys3d.qttbx import map_viewer
    map_viewer.display(window_title="f_calc in P1 before fast CC",
                       fft_map=f_calc_in_p1.fft_map(),
                       iso_level_positive_range_fraction=0.8)

  crystal_gridding = f_obs.crystal_gridding(
    symmetry_flags=translation_search.symmetry_flags(
      is_isotropic_search_model=False,
      have_f_part=False),
    resolution_factor=1/3
  )
  correlation_map = translation_search.fast_nv1995(
    gridding=crystal_gridding.n_real(),
    space_group=f_obs.space_group(),
    anomalous_flag=f_obs.anomalous_flag(),
    miller_indices_f_obs=f_obs.indices(),
    f_obs=f_obs.data(),
    f_part=flex.complex_double(), ## no sub-structure is already fixed
    miller_indices_p1_f_calc=f_calc_in_p1.indices(),
    p1_f_calc=f_calc_in_p1.data()).target_map()

  if 0: # Display correlation_map
    from crys3d.qttbx import map_viewer
    map_viewer.display(window_title="Fast CC map",
                       raw_map=correlation_map,
                       unit_cell=f_calc_in_p1.unit_cell(),
                       positive_iso_level=0.8)

  search_parameters = maptbx.peak_search_parameters(
    peak_search_level=1,
    peak_cutoff=0.5,
    interpolate=True,
    min_distance_sym_equiv=1e-6,
    general_positions_only=False,
    min_cross_distance=f_obs.d_min()/2)
  ## The correlation map is not a miller.fft_map, just a 3D flex.double
  correlation_map_peaks = crystal_gridding.tags().peak_search(
    map=correlation_map,
    parameters=search_parameters)
  # iterate over the strong peak; for each, shift and symmetrised f_calc
  for peak in correlation_map_peaks:
    if peak.height < min_cc_peak_height: break
    sr = symmetry_search.shift_refinement(
      f_obs, f_calc_in_p1, peak.site)
    yield sr.symmetrised_shifted_sf.f_x, sr.shift, sr.goos.correlation
Exemple #2
0
def f_calc_symmetrisations(f_obs, f_calc_in_p1, min_cc_peak_height):
    # The fast correlation map as per cctbx.translation_search.fast_nv1995
    # is computed and its peaks studied.
    # Inspiration from phenix.substructure.hyss for the parameters tuning.
    if 0:  # Display f_calc_in_p1
        from crys3d.qttbx import map_viewer
        map_viewer.display(window_title="f_calc in P1 before fast CC",
                           fft_map=f_calc_in_p1.fft_map(),
                           iso_level_positive_range_fraction=0.8)

    crystal_gridding = f_obs.crystal_gridding(
        symmetry_flags=translation_search.symmetry_flags(
            is_isotropic_search_model=False, have_f_part=False),
        resolution_factor=1 / 3)
    correlation_map = translation_search.fast_nv1995(
        gridding=crystal_gridding.n_real(),
        space_group=f_obs.space_group(),
        anomalous_flag=f_obs.anomalous_flag(),
        miller_indices_f_obs=f_obs.indices(),
        f_obs=f_obs.data(),
        f_part=flex.complex_double(),  ## no sub-structure is already fixed
        miller_indices_p1_f_calc=f_calc_in_p1.indices(),
        p1_f_calc=f_calc_in_p1.data()).target_map()

    if 0:  # Display correlation_map
        from crys3d.qttbx import map_viewer
        map_viewer.display(window_title="Fast CC map",
                           raw_map=correlation_map,
                           unit_cell=f_calc_in_p1.unit_cell(),
                           positive_iso_level=0.8)

    search_parameters = maptbx.peak_search_parameters(
        peak_search_level=1,
        peak_cutoff=0.5,
        interpolate=True,
        min_distance_sym_equiv=1e-6,
        general_positions_only=False,
        min_cross_distance=f_obs.d_min() / 2)
    ## The correlation map is not a miller.fft_map, just a 3D flex.double
    correlation_map_peaks = crystal_gridding.tags().peak_search(
        map=correlation_map, parameters=search_parameters)
    # iterate over the strong peak; for each, shift and symmetrised f_calc
    for peak in correlation_map_peaks:
        if peak.height < min_cc_peak_height: break
        sr = symmetry_search.shift_refinement(f_obs, f_calc_in_p1, peak.site)
        yield sr.symmetrised_shifted_sf.f_x, sr.shift, sr.goos.correlation