http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Map_height_at_atoms.py&feed=atom&action=history
Map height at atoms.py - Revision history
2024-03-29T08:02:58Z
Revision history for this page on the wiki
MediaWiki 1.23.1
http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Map_height_at_atoms.py&diff=565&oldid=prev
Nicksauter: Created page with "<pre> # LIBTBX_SET_DISPATCHER_NAME xfel.map_height_at_atoms from __future__ import division from libtbx.str_utils import make_sub_header from libtbx.utils import Sorry import..."
2014-08-22T06:04:14Z
<p>Created page with "<pre> # LIBTBX_SET_DISPATCHER_NAME xfel.map_height_at_atoms from __future__ import division from libtbx.str_utils import make_sub_header from libtbx.utils import Sorry import..."</p>
<p><b>New page</b></p><div><pre><br />
# LIBTBX_SET_DISPATCHER_NAME xfel.map_height_at_atoms<br />
<br />
from __future__ import division<br />
from libtbx.str_utils import make_sub_header<br />
from libtbx.utils import Sorry<br />
import sys<br />
<br />
master_phil_str = """<br />
map_type = anom<br />
.type = str<br />
exclude_free_r_reflections = False<br />
.type = bool<br />
fill_missing_f_obs = False<br />
.type = bool<br />
resolution_factor = 0.25<br />
.type = float<br />
selection = element CA or element ZN<br />
.type = atom_selection<br />
"""<br />
<br />
def master_phil () :<br />
from mmtbx.command_line import generate_master_phil_with_inputs<br />
return generate_master_phil_with_inputs(<br />
phil_string=master_phil_str,<br />
enable_automatic_twin_detection=False)<br />
<br />
def run (args, out=sys.stdout) :<br />
usage_string = """\<br />
xfel.map_height_at_atoms model.pdb data.mtz [map_type=MAP_TYPE] \\<br />
[selection=ATOM_SELECTION]<br />
"""<br />
import mmtbx.command_line<br />
cmdline = mmtbx.command_line.load_model_and_data(<br />
update_f_part1_for="map",<br />
args=args,<br />
master_phil=master_phil(),<br />
process_pdb_file=False,<br />
prefer_anomalous=True,<br />
usage_string=usage_string,<br />
#set_wavelength_from_model_header=True,<br />
#set_inelastic_form_factors="sasaki",<br />
out=out)<br />
params = cmdline.params<br />
fmodel = cmdline.fmodel<br />
xray_structure = fmodel.xray_structure<br />
pdb_hierarchy = cmdline.pdb_hierarchy<br />
sel_cache = pdb_hierarchy.atom_selection_cache()<br />
selection = sel_cache.selection(params.selection).iselection()<br />
if (len(selection) == 0) :<br />
raise Sorry("No atoms selected!")<br />
params = cmdline.params<br />
map_coeffs = fmodel.map_coefficients(<br />
map_type=params.map_type,<br />
exclude_free_r_reflections=params.exclude_free_r_reflections,<br />
fill_missing=params.fill_missing_f_obs)<br />
fft_map = map_coeffs.fft_map(<br />
resolution_factor=params.resolution_factor).apply_sigma_scaling()<br />
real_map = fft_map.real_map_unpadded()<br />
make_sub_header("Map analysis", out=out)<br />
from scitbx.array_family import flex<br />
print >> out, "Maximum grid point value: %6.2f sigma" % \<br />
flex.max(real_map.as_1d())<br />
print >> out, ""<br />
for i_seq in selection :<br />
sc = xray_structure.scatterers()[i_seq]<br />
map_value = real_map.tricubic_interpolation(sc.site)<br />
print >> out, "%s : %6.2f sigma" % (sc.label, map_value)<br />
<br />
if (__name__ == "__main__") :<br />
run(sys.argv[1:])<br />
</pre></div>
Nicksauter