To keep the original residue numbers from the gro file, you could also temporarily store additional numbering in the segment identifier, and after loading get it back from there:
_pdbline = "ATOM %5i %-3s %3s%2s%4i" +\ " %8.3f%8.3f%8.3f%6.2f%6.2f %4s%2s \n" def pdbOut(atom,i=1): segi = '%02d%02d' % (i/100000,atom[2]/10000) stuff = [i%1e5,atom[0][:3],atom[1],atom[3],atom[2]%1e4] +\ list(atom[4:])+[1,40,segi,atom[0][0]] return _pdbline % tuple(stuff) And after cmd.read_pdbstr: cmd.alter(objname, '(ID,resi,segi)=' +\ '(ID+100000*int(segi[:2]), resv+10000*int(segi[2:]), "")') Cheers, Thomas On 08/18/2011 10:40 AM, Tsjerk Wassenaar wrote: > Hi Joseph, > > Sorry about that. A bit naive with the numbering. To fix it, change the > function > > def pdbOut(atom,i=1): > return _pdbline%((i,) + (atom[0][:3],) + (atom[1],) + (atom[3],) + > (atom[2],) + atom[4:] + (1,40) + (atom[0][0],)) > > to > > def pdbOut(atom,i=1): > stuff = > [i%1e5,atom[0][:3],atom[1],atom[3],atom[2]%1e4]+list(atom[4:])+[1,40,atom[0][0]] > return _pdbline % tuple(stuff) > > It worked for me on a .gro file with 160k atoms :) > > Cheers, > > Tsjerk > > 2011/8/18 Joseph André<andrejos...@gmail.com>: >> Hi Tsjerk, >> Thanks for the script. It works great on my protein. However when I try to >> load the solvated system> 100.000 atoms I have problems with water >> molecules. Is it possible to handle gro files with more than 100.000 atoms >> and 9999 residues? >> Best -- Thomas Holder MPI for Developmental Biology ------------------------------------------------------------------------------ Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 _______________________________________________ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net