I deleted various functions to print particles from utils.py and patched the examples which used them.
for p in particles p.show()
does the job well enough not to have extra code floating around.
Index: kernel/pyext/IMP/utils.py =================================================================== --- kernel/pyext/IMP/utils.py (revision 363) +++ kernel/pyext/IMP/utils.py (working copy) @@ -105,43 +105,6 @@ i = i + 1 fp.close()
- -def show_particles_pos(particles): - """Show IMP particles' positions""" - for i in range(0, len(particles)): - print 'particle', i, - print 'X', particles[i].x(), - print 'Y', particles[i].y(), - print 'Z', particles[i].z() - - -def show_particles(particles): - """ Show IMP particle' attributes""" - for i in range(0, len(particles)): - print 'particle', i - print ' float attributes:' - float_attr_iter = IMP.FloatAttributeIterator() - float_attr_iter.reset(particles[i]) - while float_attr_iter.next(): - print ' ', float_attr_iter.get_key(), ": ", \ - float_attr_iter.get_value() - - print ' int attributes:' - int_attr_iter = IMP.IntAttributeIterator() - int_attr_iter.reset(particles[i]) - while int_attr_iter.next(): - print ' ', int_attr_iter.get_key(), ": ", \ - int_attr_iter.get_value() - - print ' string attributes:' - string_attr_iter = IMP.StringAttributeIterator() - string_attr_iter.reset(particles[i]) - while string_attr_iter.next(): - print ' ', string_attr_iter.get_key(), ": ", \ - string_attr_iter.get_value() - print - - def show_distances(particles): """Show distances using IMP particles""" for i in range(0, len(particles)): Index: kernel/doc/examples/misc/energy_demo.py =================================================================== --- kernel/doc/examples/misc/energy_demo.py (revision 363) +++ kernel/doc/examples/misc/energy_demo.py (working copy) @@ -132,4 +132,5 @@ mdl.write (file='out.pdb', model_format='PDB')
IMP.utils.show_distances(particles) -IMP.utils.show_particles(particles) +for p in particles: + p.show() Index: kernel/doc/examples/misc/modeller_opt.py =================================================================== --- kernel/doc/examples/misc/modeller_opt.py (revision 363) +++ kernel/doc/examples/misc/modeller_opt.py (working copy) @@ -53,3 +53,6 @@ IMP.modeller_intf.show_modeller_and_imp(atoms, particles) IMP.utils.show_distances(particles) IMP.utils.show_particles_pos(particles) +for p in particles: + print 'particle'+str( p.get_index().get_index()) + IMP.XYZDecorator.cast(p).show()