Author: bugman Date: Thu Jul 3 15:04:20 2014 New Revision: 24433 URL: http://svn.gna.org/viewcvs/relax?rev=24433&view=rev Log: Redesign of the average domain position part of the frame_order.pdb_model user function. The Monte Carlo simulations are now represented. If the file root is set to the default of 'ave_pos', then these will be placed in the file 'ave_pos.pdb', or a compressed version. Each simulation is in a different model, matching the geometric representation '*_sim.pdb' files. The original structure is copied for each model, and then rotated to the MC simulation average position. Modified: branches/frame_order_cleanup/pipe_control/pymol_control.py branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py branches/frame_order_cleanup/user_functions/pymol_control.py Modified: branches/frame_order_cleanup/pipe_control/pymol_control.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/pipe_control/pymol_control.py?rev=24433&r1=24432&r2=24433&view=diff ============================================================================== --- branches/frame_order_cleanup/pipe_control/pymol_control.py (original) +++ branches/frame_order_cleanup/pipe_control/pymol_control.py Thu Jul 3 15:04:20 2014 @@ -353,6 +353,7 @@ # Find all PDB files. pdb_files = find_pdb_files(path=path, file_root=root) + pdb_files += find_pdb_files(path=path, file_root=root+'_sim') # Read in the PDB files. print pdb_files Modified: branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py?rev=24433&r1=24432&r2=24433&view=diff ============================================================================== --- branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py (original) +++ branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py Thu Jul 3 15:04:20 2014 @@ -446,26 +446,70 @@ # Printout. subsection(file=sys.stdout, text="Creating a PDB file with the moving domains shifted to the average position.") - # 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) - origin = pipe_centre_of_mass(atom_id=domain_moving(), verbosity=0) - structure.rotate(R=R, origin=origin, atom_id=domain_moving()) - - # Then translate the moving domain. - structure.translate(T=[cdp.ave_pos_x, cdp.ave_pos_y, cdp.ave_pos_z], atom_id=domain_moving()) - - # Output to PDB format. - if format == 'PDB': - file = open_write_file(file_name=file+'.pdb', dir=dir, compress_type=compress_type, force=force) - structure.write_pdb(file=file) - file.close() + # Initialise. + titles = [] + sims = [] + file_root = [] + models = [] + + # The real average position. + titles.append("real average position") + sims.append(False) + file_root.append(file) + models.append([None]) + + # The positive MC simulation representation. + if hasattr(cdp, 'sim_number'): + titles.append("MC simulation representation") + sims.append(True) + file_root.append("%s_sim" % file) + models.append([i+1 for i in range(cdp.sim_number)]) + + # Loop over each representation and add the contents. + for i in range(len(titles)): + # Printout. + subsubsection(file=sys.stdout, text="Creating the %s." % titles[i]) + + # Make a copy of the structural object (so as to preserve the original structure). + structure = deepcopy(cdp.structure) + + # Loop over each model. + for j in range(len(models[i])): + # Create or set the models, if needed. + if models[i][j] == 1: + structure.set_model(model_new=1) + elif models[i][j] != None: + structure.add_model(model=models[i][j]) + + # Loop over each model. + for j in range(len(models[i])): + # First rotate the moving domain to the average position. + R = zeros((3, 3), float64) + if hasattr(cdp, 'ave_pos_alpha'): + if sims[i]: + euler_to_R_zyz(cdp.ave_pos_alpha_sim[j], cdp.ave_pos_beta_sim[j], cdp.ave_pos_gamma_sim[j], R) + else: + euler_to_R_zyz(cdp.ave_pos_alpha, cdp.ave_pos_beta, cdp.ave_pos_gamma, R) + else: + if sims[i]: + euler_to_R_zyz(0.0, cdp.ave_pos_beta_sim[j], cdp.ave_pos_gamma_sim[j], R) + else: + euler_to_R_zyz(0.0, cdp.ave_pos_beta, cdp.ave_pos_gamma, R) + origin = pipe_centre_of_mass(atom_id=domain_moving(), verbosity=0) + structure.rotate(R=R, origin=origin, model=models[i][j], atom_id=domain_moving()) + + # Then translate the moving domain. + if sims[i]: + T = [cdp.ave_pos_x_sim[j], cdp.ave_pos_y_sim[j], cdp.ave_pos_z_sim[j]] + else: + T = [cdp.ave_pos_x, cdp.ave_pos_y, cdp.ave_pos_z] + structure.translate(T=T, model=models[i][j], atom_id=domain_moving()) + + # Output to PDB format. + if format == 'PDB': + pdb_file = open_write_file(file_name=file_root[i]+'.pdb', dir=dir, compress_type=compress_type, force=force) + structure.write_pdb(file=pdb_file) + pdb_file.close() def create_distribution(format='PDB', file=None, dir=None, compress_type=0, force=False): Modified: branches/frame_order_cleanup/user_functions/pymol_control.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/user_functions/pymol_control.py?rev=24433&r1=24432&r2=24433&view=diff ============================================================================== --- branches/frame_order_cleanup/user_functions/pymol_control.py (original) +++ branches/frame_order_cleanup/user_functions/pymol_control.py Thu Jul 3 15:04:20 2014 @@ -189,7 +189,11 @@ # Description. uf.desc.append(Desc_container()) uf.desc[-1].add_paragraph("This user function is designed to be combined with the frame_order.pdb_model user function. It will take the three PDB representations created by frame_order.pdb_model - the molecular structure with the averaged domain positions, the frame order dynamics representation files, and the moving domain distribution file - and display them in PyMOL. Rather than loading the three representations into PyMOL manually, this user function will change the representation to significantly improve the visualisation.") -uf.desc[-1].add_paragraph("For the frame order representation files,if the file root is left to the default of 'frame_order' then all of the following files will be loaded: 'frame_order.pdb', 'frame_order_pos.pdb', 'frame_order_neg.pdb', 'frame_order_sim.pdb', 'frame_order_sim_pos.pdb', 'frame_order_sim_neg.pdb'. The user function will not only search for these files, but also all *.gz and *.bz2 versions of these files. This is to support all output files from the frame_order.pdb_model user function.") +uf.desc[-1].add_paragraph("For the frame order position files, if the file roots are left to the defaults then the following files will be loaded:") +uf.desc[-1].add_list_element("The file root 'ave_pos' will load the 'ave_pos.pdb' and 'ave_pos_sim.pdb' files.") +uf.desc[-1].add_list_element("The file root 'frame_order' will load the 'frame_order.pdb', 'frame_order_pos.pdb', 'frame_order_neg.pdb', 'frame_order_sim.pdb', 'frame_order_sim_pos.pdb' and 'frame_order_sim_neg.pdb' files.") +uf.desc[-1].add_list_element("The file root 'dist' will load the 'dist.pdb' file.") +uf.desc[-1].add_paragraph("The user function will not only search for these files, but also all *.gz and *.bz2 versions of these files. This is to support all output files from the frame_order.pdb_model user function.") uf.backend = pymol_control.frame_order uf.menu_text = "&frame_order" uf.gui_icon = "relax.frame_order"