[gmx-users] How to make coordinate file with correct numbering in the atoms when inbetween atoms are removed

Justin A. Lemkul jalemkul at vt.edu
Sat Nov 19 17:58:45 CET 2011

Ioannis Beis wrote:
> Dear gromacs users,
> It seems that because of my inexperience I have been trapped in a 
> simple-looking labyrinth. I wanted to change a .gro file containing 
> hydrated bilayer, in which I want to remove/modify certain atoms from 
> certain lipid residues, e.g. cutting off a polar head. This kind of 
> structure would serve as starting structure subject to equilibration. 
> Since the resulting structures -after deleting certain atom lines- had 
> atoms missing, the numbering in the .gro file was no longer correct. I 
> tried using trjconv and trjcat to solve the problem and they were 
> complaining about the inconsistency between total number of atoms and 
> numbering. pdb2gmx was complaining about not finding my residues in the 
> files of the forcefield, even though I explicitly gave as an input my 
> topology.
> I supposed that I could do the job in matlab. I wrote a script for the 
> simplest case, which made the appropriate operations and saved the file 
> exactly in the same format. Nevertheless, vmd could not visualize the 
> file at all, even though grompp could use it as an input to assemble the 
> binary .tpr . I tried fromdos with the .gro file but had no result. I 
> also tried using trjconv on the "invisible" file with additional input 
> the .tpr file that I made earlier and this produced a new .gro file with 
> modified names for lipid residues (e.g. 1DOPC instead of first four 
> digits of the name 1DOP as it was in the original file), but made the 
> file visible by vmd. Nonetheless, vmd interpreted my modified lipid into 
> two residues, i.e. one polar hydrogen as one and the rest lipid as 
> another (??), despite the fact that the .gro file has the correct 
> numbering of residues.
> I know that some of the above problems might be independent, but all I 
> am looking for eventually is if there is a practical implementation of 
> typing five words and a program from the GROMACS package taking the n 
> atoms of the .gro file and correcting their number ID into the correct 
> one, based on the order they appear in the file, so that they become 
> 1,2,...,n without gaps.

Get a count of the number of atoms using 'wc -l' and subtract three - that's how 
many atoms you have.  Enter that on line 2 of the .gro file to make it a 
legitimate file.  Then:

genconf -renumber



Justin A. Lemkul
Ph.D. Candidate
ICTAS Doctoral Scholar
Department of Biochemistry
Virginia Tech
Blacksburg, VA
jalemkul[at]vt.edu | (540) 231-9080


More information about the gromacs.org_gmx-users mailing list