smtbx.ab_initio.charge_flipping
index
/net/chevy/raid1/nat/src/cctbx_project/smtbx/ab_initio/charge_flipping.py

Charge flipping algorithm(s) and related data structures
 
References.
 
[1] G. Oszl{'a}nyi and A. S{"u}t{\H o}.
Ab initio structure solution by charge flipping.
Acta Cryst. A, 60:134--141, 2003.
 
[2] G. Oszl{'a}nyi and A. S{"u}t{\H o}.
Ab initio structure solution by charge flipping.
II. use of weak reflections. Acta Cryst. A, 61:147, 2004.
 
[3] L. Palatinus and G. Chapuis
SUPERFLIP -- a computer program for the solution of crystal structures
by charge flipping in arbitry dimensions
J. Appl. Cryst., 40:786--790, 2007
 
[4] M. Shiono and M.M. Woolfson.
Direct-space methods in phase extension and phase determination.
I. low-density elimination. Acta Cryst. A, 48:451-456, 1992.
--> This is a protein paper
 
[5] H. Takakura, M. Shiono, T.J. Sato, A. Yamamoto, and A.P. Tsai.
Ab initio structure determination of icosahedral zn-mg-ho quasicrystals
by density modification method.
Phys. Rev. Lett., 86:236, 2001
--> This is an elaboration on the method in [4] as well as an application in a
different compartment of crystallography. This is also the method used
in SUPERFLIP circa Sept 2007 to polish the electron density after the charge
flipping method has converged.
 
[6] G. Oszl{'a}nyi and A. S{"u}t{\H o}. The charge flipping algorithm. Acta
Cryst. A64:123-134, 2008

 
Modules
       
smtbx.ab_initio
cctbx.crystal
cctbx.array_family.flex
itertools
cctbx.maptbx
math
cctbx.miller
libtbx.object_oriented_patterns
scitbx
cctbx.sgtbx
cctbx.symmetry_search
sys
cctbx.translation_search

 
Classes
       
__builtin__.object
density_modification_iterator
basic_iterator
weak_reflection_improved_iterator
low_density_elimination_iterator
observable_evolution
solving_iterator

 
class basic_iterator(density_modification_iterator)
    An iterator over the sequence of electron densities and structure
factors obtained by repeateadly applying the basic charge flipping
described in ref. [1].
 
 
Method resolution order:
basic_iterator
density_modification_iterator
__builtin__.object

Methods defined here:
__init__(self, delta=None, **kwds)
c_tot_over_c_flip(self)
modify_electron_density(self)
This shall modify rho in place
normalise(self, normalisations, divide=True)

Methods inherited from density_modification_iterator:
__iter__(self)
compute_electron_density_map(self)
Compute the electron density from the structure factors self.f_calc
and the 000 component self.f_000, scaling by the unit cell volume
compute_structure_factors(self)
Compute the structure factors self._g of self.rho_map,
as well as the 000 component self._g_000, scaling them by the number of
grid points
denormalise(self, normalisations)
next(self)
perform one cycle and return itself
r1_factor(self)
start(self, f_obs, phases, f_000=0)
transfer_phase_to_f_obs(self)

Data descriptors inherited from density_modification_iterator:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class density_modification_iterator(__builtin__.object)
    Skeleton for any method which, like charge flipping, does cycles like
 
  rho --|1|--> rho' --|Fourier analysis|--> g --|2|--> f
   ^                                                   |
   |----------------|Fourier synthesis|----------------|
 
where the transformation (1) and (2) are specific to each method.
 
Synopsis:
  flipping = heir_of_density_modification_iterator(...)
  flipping.start(f_obs, initial_phases)
  flipping.next() # 1st cycle
  flipping.next() # 2nd cycle
  ....
 
  Methods defined here:
__init__(self, **kwds)
__iter__(self)
compute_electron_density_map(self)
Compute the electron density from the structure factors self.f_calc
and the 000 component self.f_000, scaling by the unit cell volume
compute_structure_factors(self)
Compute the structure factors self._g of self.rho_map,
as well as the 000 component self._g_000, scaling them by the number of
grid points
denormalise(self, normalisations)
next(self)
perform one cycle and return itself
normalise(self, normalisations, divide=True)
r1_factor(self)
start(self, f_obs, phases, f_000=0)
transfer_phase_to_f_obs(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class low_density_elimination_iterator(density_modification_iterator)
    A method related to charge flipping.
C.f. Ref [4].
 
 
Method resolution order:
low_density_elimination_iterator
density_modification_iterator
__builtin__.object

Methods defined here:
__init__(self, constant_rho_c=None, **kwds)
modify_electron_density(self)
normalise(self, normalisations, divide=True)
rho_c(self)
shiono_woolfson_rho_c(self)
The rho_c suggested in Ref [4]

Methods inherited from density_modification_iterator:
__iter__(self)
compute_electron_density_map(self)
Compute the electron density from the structure factors self.f_calc
and the 000 component self.f_000, scaling by the unit cell volume
compute_structure_factors(self)
Compute the structure factors self._g of self.rho_map,
as well as the 000 component self._g_000, scaling them by the number of
grid points
denormalise(self, normalisations)
next(self)
perform one cycle and return itself
r1_factor(self)
start(self, f_obs, phases, f_000=0)
transfer_phase_to_f_obs(self)

Data descriptors inherited from density_modification_iterator:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class observable_evolution(__builtin__.object)
     Methods defined here:
__init__(self, **kwds)
append(self, x)
had_phase_transition(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
increasing = True
noise_level_after = 0.2
noise_level_before = 0.3
smoothing_coefficient = 0.25

 
class solving_iterator(__builtin__.object)
     Methods defined here:
__init__(self, flipping_iterator, f_obs, **kwds)
__iter__(self)
Note: a loop for flipping in solving_iterator_obj: that is
interrupted by break will reliably result in a call
solving_iterator_obj.clean_up() in Python 2.5+ while the code should
still run on earlier versions of Python but without the clean-up.
clean_up(self)
The generator-based state machine pattern used to implement this
class creates cycles for each generator:
   self.polishing.gi_frame.f_locals['self'] is self == True
for example.
Thus reference counting does not have it collected,
and self.flipping_iterator is not collected either.
The latter holds large objects (a fft_map and a miller.array), which
results in the memory being used to creep up each time a charge
flipping run is done.
Note: using a weak reference for solving.flipping_iterator would not work
because that object is also owned by several of the generators' frame
mentionned above.
 
Thus we delete the generators after the run has finished, therefore
breaking the cycle.

Static methods defined here:
initial_phases_for lambda f_obs

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
delta_guessing_method = 'sigma'
delta_over_sigma = 1.1
extra_iterations_on_f_after_phase_transition = 10
initial_flipped_fraction = 0.8
map_sigma_stability_threshold = 0.01
map_skewness_stability_threshold = 0.01
max_attempts_to_get_phase_transition = 5
max_attempts_to_get_sharp_correlation_map = 5
max_delta_guessing_iterations = 10
max_solving_iterations = 500
min_cc_peak_height = 0.9
min_delta_guessing_iterations = 4
normalisations_for = None
polishing_iterations = 5
yield_during_delta_guessing = False
yield_solving_interval = 10

 
class weak_reflection_improved_iterator(basic_iterator)
    The variation described in ref. [2]
 
 
Method resolution order:
weak_reflection_improved_iterator
basic_iterator
density_modification_iterator
__builtin__.object

Methods defined here:
__init__(self, delta=None, delta_varphi=1.5707963267948966, weak_reflection_fraction=0.2, **kwds)
start(self, f_obs, phases, f_000=0)
sort f_obs by increasing amplitudes once and for all
transfer_phase_to_f_obs(self)

Methods inherited from basic_iterator:
c_tot_over_c_flip(self)
modify_electron_density(self)
This shall modify rho in place
normalise(self, normalisations, divide=True)

Methods inherited from density_modification_iterator:
__iter__(self)
compute_electron_density_map(self)
Compute the electron density from the structure factors self.f_calc
and the 000 component self.f_000, scaling by the unit cell volume
compute_structure_factors(self)
Compute the structure factors self._g of self.rho_map,
as well as the 000 component self._g_000, scaling them by the number of
grid points
denormalise(self, normalisations)
next(self)
perform one cycle and return itself
r1_factor(self)

Data descriptors inherited from density_modification_iterator:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
amplitude_quasi_normalisations(f_obs)
f_calc_symmetrisations(f_obs, f_calc_in_p1, min_cc_peak_height)
loop(solving, verbose=True, out=<open file '<stdout>', mode 'w'>)

 
Data
        division = _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)
generators = _Feature((2, 2, 0, 'alpha', 1), (2, 3, 0, 'final', 0), 0)