Author: bugman Date: Thu Nov 27 15:16:48 2014 New Revision: 26782 URL: http://svn.gna.org/viewcvs/relax?rev=26782&view=rev Log: Modified the printouts from the structure.write_pdb user function if models are present. Instead of printing out 'MODEL', 'ATOM, HETATM, TER' and 'ENDMDL' for each model, the header 'MODEL records' is printed followed by a single '.' character for each model. For structures with many models, this results in a huge speed up of the user function which is strongly limited by how fast the terminal can display text. Modified: trunk/lib/structure/internal/object.py Modified: trunk/lib/structure/internal/object.py URL: http://svn.gna.org/viewcvs/relax/trunk/lib/structure/internal/object.py?rev=26782&r1=26781&r2=26782&view=diff ============================================================================== --- trunk/lib/structure/internal/object.py (original) +++ trunk/lib/structure/internal/object.py Thu Nov 27 15:16:48 2014 @@ -29,6 +29,7 @@ from os import F_OK, access, curdir, sep from os.path import abspath from re import search +import sys from time import asctime from warnings import warn @@ -2799,6 +2800,10 @@ # Coordinate section # ###################### + # Initial printout if models are present. + if model_records: + print("\nMODEL records:") + # Loop over the models. for model in self.model_loop(model_num): # Initialise record counts. @@ -2811,8 +2816,8 @@ #################################### if model_records: - # Print out. - print("\nMODEL %s" % model.num) + # Printout. + sys.stdout.write('.') # Write the model record. pdb_write.model(file, serial=model.num) @@ -2825,8 +2830,9 @@ index = 0 atom_serial = 0 for mol in model.mol_loop(): - # Print out. - print("ATOM, HETATM, TER") + # Printout. + if not model_records: + print("ATOM, HETATM, TER") # Loop over the atomic data. atom_record = False @@ -2889,7 +2895,8 @@ ######################################## if model_records: - print("ENDMDL") + if not model_records: + print("ENDMDL") pdb_write.endmdl(file) @@ -2897,6 +2904,8 @@ ############################ # Print out. + if model_records: + sys.stdout.write('\n') print("CONECT") # Initialise record counts.