def _trj_merge_trajectories(self, other_trajectory_name, rename_dict, move_nodes=False,<EOL>delete_trajectory=False, other_filename=None):
if other_filename is None or other_filename == self.filename:<EOL><INDENT>other_filename = self.filename<EOL>other_file = self._hdf5file<EOL>other_is_different = False<EOL><DEDENT>else:<EOL><INDENT>other_file = pt.open_file(filename=other_filename, mode='<STR_LIT>')<EOL>other_is_different = True<EOL><DEDENT>try:<EOL><INDENT>if not '<STR_LIT:/>' + other_trajectory_name in other_file:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>' % (self._trajectory_name,<EOL>other_trajectory_name,<EOL>other_filename))<EOL><DEDENT>for old_name in rename_dict:<EOL><INDENT>new_name = rename_dict[old_name]<EOL>split_name = old_name.split('<STR_LIT:.>')<EOL>old_location = '<STR_LIT:/>' + other_trajectory_name + '<STR_LIT:/>' + '<STR_LIT:/>'.join(split_name)<EOL>split_name = new_name.split('<STR_LIT:.>')<EOL>new_parent_location = '<STR_LIT:/>' + self._trajectory_name + '<STR_LIT:/>' + '<STR_LIT:/>'.join(split_name[:-<NUM_LIT:1>])<EOL>new_short_name = split_name[-<NUM_LIT:1>]<EOL>old_node = other_file.get_node(old_location)<EOL>if move_nodes:<EOL><INDENT>self._hdf5file.move_node( where=old_node, newparent=new_parent_location,<EOL>newname=new_short_name, createparents=True)<EOL><DEDENT>else:<EOL><INDENT>if other_is_different:<EOL><INDENT>new_parent_dot_location = '<STR_LIT:.>'.join(split_name[:-<NUM_LIT:1>])<EOL>new_parent_or_loc, _ = self._all_create_or_get_groups(<EOL>new_parent_dot_location)<EOL>create_parents = False<EOL><DEDENT>else:<EOL><INDENT>new_parent_or_loc = new_parent_location<EOL>create_parents = True<EOL><DEDENT>self._hdf5file.copy_node(where=old_node, newparent=new_parent_or_loc,<EOL>newname=new_short_name, createparents=create_parents,<EOL>recursive=True)<EOL><DEDENT><DEDENT>if delete_trajectory:<EOL><INDENT>other_file.remove_node(where='<STR_LIT:/>', name=other_trajectory_name, recursive=True)<EOL><DEDENT><DEDENT>finally:<EOL><INDENT>if other_is_different:<EOL><INDENT>other_file.flush()<EOL>other_file.close()<EOL><DEDENT><DEDENT>
Merges another trajectory into the current trajectory (as in self._trajectory_name).

        :param other_trajectory_name: Name of other trajectory
        :param rename_dict: Dictionary with old names (keys) and new names (values).
        :param move_nodes: Whether to move hdf5 nodes or copy them
        :param delete_trajectory: Whether to delete the other trajectory