<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hi all,
<div class=""><br class="">
</div>
<div class="">I’m having a problem with the rotate_translate_map function from cctbx.maptbx.</div>
<div class=""><br class="">
</div>
<div class="">I have a 3D array (a mask of 0s and 1s, in this case) that I’m writing as a CCP4 map file. If I write it out “on the origin” (without running rotate_translate_map), then it’s fine (see attached “before.png”).&nbsp;</div>
<div class="">However, if I apply the rotate_translate_map function and then write it out, odd features appear at the edge of the unit cell (see “after.png”).&nbsp;</div>
<div class=""><br class="">
</div>
<div class="">It is NOT the case that the map is going through the “periodic boundary conditions” of the unit cell&nbsp;(the shift is less than one unit cell, as shown by the structure which is transformed by the same amount).</div>
<div class=""><br class="">
</div>
<div class="">The minimal code is:</div>
<div class="">———————————&nbsp;</div>
<div class="">
<div class="">array = cctbx.maptbx.rotate_translate_map(</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unit_cell=self.unit_cell(),</div>
<div class="">&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;map_data=array,</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rotation_matrix=scitbx.matrix.rec([1,0,0,0,1,0,0,0,1], (3,3)).elems,</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; translation_vector=(-1.0*scitbx.matrix.rec((X,Y,Z), (3,1))).elems &nbsp; &nbsp;</div>
<div class="">)</div>
<div class=""><br class="">
</div>
<div class=""># Write the map</div>
<div class="">iotbx.ccp4_map.write_ccp4_map(</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; file_name=f_name,</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unit_cell=self.unit_cell(),</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; space_group=self.space_group(),</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map_data=array,</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labels=flex.std_string(['’])</div>
<div class="">)</div>
</div>
<div class="">———————————&nbsp;</div>
<div class="">where (X,Y,Z) is a tuple for the origin shift.</div>
<div class=""><br class="">
</div>
<div class="">Is there something stupid that I’m missing? Has anyone else had the same problem?</div>
<div class="">The only code for a rotate_translate_map function I could find was actually in maptbx/average_densities.h and I couldn’t see anything obviously “wrong”… though I’m not that familiar with C&#43;&#43;.</div>
<div class=""><br class="">
</div>
<div class="">The maps and files can be found at&nbsp;<a href="https://www.dropbox.com/sh/xqrsk5lcn603416/AABiVO74g6A_jZMGn_DjxOmka?dl=0" class="">https://www.dropbox.com/sh/xqrsk5lcn603416/AABiVO74g6A_jZMGn_DjxOmka?dl=0</a></div>
<div class="">all “grid” files are without translation, and all “ref” files are after translation. both are written out exactly the same (the iotbx.ccp4_map call above).</div>
<div class=""><br class="">
</div>
<div class="">I’m using the cctbx bundled with a ccp4 nightly from 2016-10-22.</div>
<div class=""><br class="">
</div>
<div class="">Thanks,</div>
<div class="">Nick</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><img apple-inline="yes" id="183254A6-D9F8-43EB-9432-80EBA7D39A7F" src="cid:47E4EAC9-42DE-409E-88A4-A9E6948256A6@uu.nl" class=""><img apple-inline="yes" id="6D6A037A-8680-4A28-A233-FEFC01B04F5F" src="cid:A9A0D24D-C2A8-4524-88BD-939654541FE9@uu.nl" class=""></div>
</body>
</html>