Hi Celine, This is relatively straightforward with the sfcalc jiffy from $mmtbx/mmtbx/examples/sfcalc.py and should serve as a good example if you want to recode this yourself. HTH Peter Ralf W. Grosse-Kunstleve wrote:
Hi Celine,
Thank you for all those explanation. In fact the problem for me is not the mean of the recalculated map obtained but the range of it, which is no longer one.
Did you consider using the raw mask with the ones and zeros directly? That's the .data attribute of the bulk_solvent object. It is an integer array, but you can convert it with .data.as_double(). See also the .mask_as_xplor_map() method.
The only thing the FFT back and forth does is to introduce the Ewald-sphere truncation, which leads to a smoothing of the original mask. If you want that, a quick-and-dirty approach is to copy the .structure_factors() method, rename it, then replace miller_set.unit_cell().volume() with 1.0 in the computation of scale. I think you still need to divide by the number of grid points. Use the .fft_map() of the structure factors object (miller.array) returned by your modified method to get back a map with truncation effects, but on the same scale is the original mask.
To be more clear, what I am trying to do is to "calculate" data at different solvent contrasts from a pdb file. So I have a series of solvent electron densities and I would like to use the complex formula F = Fprotein in vacuum + solvent density*Fmask where Fmask are the structure factors from an indicator function that is 1 in the solvent region and 0 in the protein region (= my cctbx mask).
That sounds exactly like what's done by the f_model class, which will refine the "solvent density" for you. I think you can also specify a value. See mmtbx/mmtbx/examples/f_model_manager.py and the Computing Commission Newsletter No. 5 (http://cci.lbl.gov/publications/download/iucrcompcomm_jan2005.pdf). The code in the newsletter article is out of date, but the math is still accurate and examples/f_model_manager.py is the updated code. Fcalc in the newsletter formula (page 10 of the .pdf document) is your "Fprotein in vacuum". ksol is your "solvent density". You can set Uaniso and Bsol to 0 if you want.
Ralf
_______________________________________________ cctbxbb mailing list [email protected] http://www.phenix-online.org/mailman/listinfo/cctbxbb