# [cctbxbb] Patterson map data structure

Dmytro Guzenko Dmytro.Guzenko at pharm.kuleuven.be
Tue Oct 16 06:47:40 PDT 2012

```Hello Nathaniel,

> Given a grid coordinate u,v,w you can calculate the fractional coordinate by dividing u,v,w by n_real,
> and if necessary, the Cartesian coordinate by unit_cell.orthogonalize(site_frac=site_frac).

I think I got it, just to confirm:
-------------------------------------------
# extracting x,y,z from pmap into cart_coord and corresponding weights into p_weight

n_real = pmap.n_real()
unit_cell = pmap.unit_cell()
grid2cart = maptbx.grid2cart(n_real,unit_cell.orthogonalization_matrix())

n_points_total = n_real*n_real*n_real
cart_coord = flex.double(flex.grid(3,n_points_total))
p_weight = flex.double(n_points_total)

for plain_ind,grid_point in enumerate(flex.nested_loop(n_real)):
cart_coord[0,plain_ind],cart_coord[1,plain_ind],cart_coord[2,plain_ind] = grid2cart(grid_point)
p_weight[plain_ind] = rmap[grid_point]
-------------------------------------------

The syntax is probably not optimal - I am new to python (and to crystallography, for that matter). By the way, I noticed that many weights are negative, is this possible in a patterson map or am I doing something wrong?

I prepare the map like this (alphaHelix.pdb is from http://www.lorieau.com/methods-and-reference/biophysics-and-biochemistry/31-model-protein-secondary-structures.html):
-------------------------------------------
pdb_inp = pdb.input(file_name="alphaHelix.pdb")
xray_structure = pdb_inp.xray_structure_simple()
fcalc = xray_structure.structure_factors(d_min=2, algorithm="fft").f_calc()
pmap = fcalc.patterson_map(d_min=2, symmetry_flags=maptbx.use_space_group_symmetry)
pmap.statistics().show_summary()
-------------------------------------------
max 6.48589e+07
min -507708 <---
mean -8.76639e-10 <---
sigma 1.05336e+06
-------------------------------------------

Thanks again!
Dmytro.
```