Author: bugman Date: Mon Mar 18 18:01:05 2013 New Revision: 18865 URL: http://svn.gna.org/viewcvs/relax?rev=18865&view=rev Log: Implemented the average structure creation component of the frame_order.pdb_model user function. This is the implementation of the _pdb_ave_pos() frame order specific method. The loaded structure is simply copied, rotated, translated, and then written out as a PDB file. Modified: branches/frame_order_testing/specific_fns/frame_order.py Modified: branches/frame_order_testing/specific_fns/frame_order.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/specific_fns/frame_order.py?rev=18865&r1=18864&r2=18865&view=diff ============================================================================== --- branches/frame_order_testing/specific_fns/frame_order.py (original) +++ branches/frame_order_testing/specific_fns/frame_order.py Mon Mar 18 18:01:05 2013 @@ -956,6 +956,26 @@ @keyword force: Flag which if set to True will cause any pre-existing file to be overwritten. @type force: bool """ + + # Make a copy of the structural object (so as to preserve the original structure). + structure = deepcopy(cdp.structure) + + # First rotate the moving domain to the average position. + R = zeros((3, 3), float64) + if hasattr(cdp, 'ave_pos_alpha'): + euler_to_R_zyz(cdp.ave_pos_alpha, cdp.ave_pos_beta, cdp.ave_pos_gamma, R) + else: + euler_to_R_zyz(0.0, cdp.ave_pos_beta, cdp.ave_pos_gamma, R) + structure.rotate(R=R, origin=cdp.pivot, atom_id=self._domain_moving()) + + # Then translate the moving domain. + if not self._translation_fixed(): + structure.translate(T=[cdp.ave_pos_x, cdp.ave_pos_y, cdp.ave_pos_z], atom_id=self._domain_moving()) + + # Write out the PDB file. + file = open_write_file(file_name=file, dir=dir, force=force) + structure.write_pdb(file=file) + file.close() def _pdb_distribution(self, file=None, dir=None, force=False):