Just to avoid any confusion between mine and Nat's responses, there are two similarly named functions in miller.array, common_set and common_sets.
Hi Jan,You will need to get a matching set of indices for both arrays before calculating the R1 factor. The simplest way to do this would be by calling the miller.array.common_sets() function:e.g. where f_obs and f_calc are two arrays that are not necessarily matching sets of indices:f_obs, f_calc = f_obs.common_sets(f_calc)Hope that helps,RichardOn 6 July 2012 11:59, Jan Marten Simons <marten@xtal.rwth-aachen.de> wrote:
Hi,
I'm facing a new challenge while working with cctbx:
Imagine a set of (possibly incomplete) measured intesities, or integrated
intensities from xrd powder patterns (I_obs) and a fitting crystal symmetry
(xtal_symm). Now if I want to check if a given structure would generate the
same intensities. (--> low R1) the following code exibits the problem:
# -*- coding: utf-8 -*-
from __future__ import division
from cctbx import xray
from cctbx import crystal
from cctbx.array_family import flex
from libtbx import Auto
obs_file = "Test.hkl" # in shelx hklf4 format
xtal_symm = crystal.symmetry(
unit_cell=(4.000, 5.4321, 7.531, 90.0, 90.0, 90.0),
space_group_symbol="P mm2")
trial_structure = xray.structure(
special_position_settings=crystal.special_position_settings(
crystal_symmetry=xtal_symm),
scatterers=flex.xray_scatterer([
xray.scatterer(
label="Si",
site=(0.0,0.0,0.0),
u=0.2)]))
# load (integral) intensities from diffraction data
from iotbx import reflection_file_reader
rfl = reflection_file_reader.any_reflection_file("amplitudes="+obs_file,
ensure_read_access=True)
I_obs = rfl.as_miller_arrays(crystal_symmetry=xtal_symm,
force_symmetry=False,
merge_equivalents=True,
base_array_info=None)[0]
I_obs = I_obs.discard_sigmas()
f_obs = I_obs.as_amplitude_array()
f_calc = trial_structure.structure_factors(d_min=1.0).f_calc()
f_calc.merge_equivalents()
R1 = f_calc.r1_factor(f_obs, scale_factor=Auto, assume_index_matching=False)
gives:
" assert other.indices().size() == self.indices().size()
AssertionError "
Is there some way to get the R1_factor for this kind of scenario?
Cheers and thanks in advance,
Jan
_______________________________________________
cctbxbb mailing list
cctbxbb@phenix-online.org
http://phenix-online.org/mailman/listinfo/cctbxbb