Enable terminus-specific atom translation
authorErik Lindahl <erik@kth.se>
Mon, 23 Jun 2014 22:28:15 +0000 (00:28 +0200)
committerErik Lindahl <erik@kth.se>
Mon, 23 Jun 2014 22:41:00 +0000 (00:41 +0200)
By adding protein-nterm and protein-cterm classes for atom
name translation in xlateat.dat we now avoid replacing
names such as O2 in non-standard amino acids. This patch
also corrects a cosmetic issue in the number of residues
claimed to be found in each chain by pdb2gmx.

Fixes #567.

Change-Id: I5956991e3ff3e5e1202330a857fd773f9e9b6945

share/top/xlateat.dat
src/gromacs/gmxpreprocess/pdb2gmx.c
src/gromacs/gmxpreprocess/xlate.c

index 71583c184f09ef3102a4b3b26d6c8d306071e18a..ff815a5ec0713ff518c792f3138fd6e9cf46c4e0 100644 (file)
@@ -1,28 +1,28 @@
 26
-ILE     CD1    CD
-ILE     HD11   HD1
-ILE      HD12   HD2
-ILE      HD13   HD3
-HOH     O      OW
-HOH      OW1    OW
-HO4     O      OW
-HO4      OW1    OW
-HO5     O      OW
-HO5      OW1    OW
-HEME    N_A    NA
-HEME    N_B    NB
-HEME    N_C    NC
-HEME    N_D    ND
-protein         O1     O
-protein         O2     OXT
-protein         OT1    O
-protein         OT2    OXT
-protein         OT     OXT
-protein  O'     O
-protein  O''    OXT
-protein  OC1   O
-protein  OC2   OXT
-protein  HN     H
-protein  HT1    H1
-protein  HT2    H2
-protein  HT3    H3
+ILE            CD1    CD
+ILE            HD11   HD1
+ILE            HD12   HD2
+ILE            HD13   HD3
+HOH            O      OW
+HOH            OW1    OW
+HO4            O      OW
+HO4            OW1    OW
+HO5            O      OW
+HO5            OW1    OW
+HEME           N_A    NA
+HEME           N_B    NB
+HEME           N_C    NC
+HEME           N_D    ND
+protein        HN     H
+protein-nterm  HT1    H1
+protein-nterm  HT2    H2
+protein-nterm  HT3    H3
+protein-cterm  O1     O
+protein-cterm  O2     OXT
+protein-cterm  OT1    O
+protein-cterm  OT2    OXT
+protein-cterm  OT     OXT
+protein-cterm  O'     O
+protein-cterm  O''    OXT
+protein-cterm  OC1    O
+protein-cterm  OC2    OXT
index b8686eefefcd92c62760f21da3956f1ab28fa1ca..3e26de80b6d4aa36f2fc41ebb6e6d1ccdc2e4c77 100644 (file)
@@ -1714,7 +1714,7 @@ int gmx_pdb2gmx(int argc, char *argv[])
     printf("There are %d chains and %d blocks of water and "
            "%d residues with %d atoms\n",
            nch-nwaterchain, nwaterchain,
-           pdba_all.resinfo[pdba_all.atom[natom-1].resind].nr, natom);
+           pdba_all.nres, natom);
 
     printf("\n  %5s  %4s %6s\n", "chain", "#res", "#atoms");
     for (i = 0; (i < nch); i++)
index dac0b3cd652d78b2783ba6e8ebbaabe369c3f491..4391a33b7a78e20f7cb30a605869956c6a58526c 100644 (file)
@@ -147,6 +147,7 @@ void rename_atoms(const char *xlfile, const char *ffdir,
     char        **f;
     char          c, *rnm, atombuf[32], *ptr0, *ptr1;
     gmx_bool      bReorderedNum, bRenamed, bMatch;
+    gmx_bool      bStartTerm, bEndTerm;
 
     nxlate = 0;
     xlatom = NULL;
@@ -172,6 +173,10 @@ void rename_atoms(const char *xlfile, const char *ffdir,
     for (a = 0; (a < atoms->nr); a++)
     {
         resind = atoms->atom[a].resind;
+
+        bStartTerm = (resind == 0) || atoms->resinfo[resind].chainnum != atoms->resinfo[resind-1].chainnum;
+        bEndTerm   = (resind >= atoms->nres-1) || atoms->resinfo[resind].chainnum != atoms->resinfo[resind+1].chainnum;
+
         if (bResname)
         {
             rnm = *(atoms->resinfo[resind].name);
@@ -205,6 +210,10 @@ void rename_atoms(const char *xlfile, const char *ffdir,
             {
                 /* Match the residue name */
                 bMatch = (xlatom[i].res == NULL ||
+                          (gmx_strcasecmp("protein-nterm", xlatom[i].res) == 0 &&
+                           gmx_residuetype_is_protein(rt, rnm) && bStartTerm) ||
+                          (gmx_strcasecmp("protein-cterm", xlatom[i].res) == 0 &&
+                           gmx_residuetype_is_protein(rt, rnm) && bEndTerm) ||
                           (gmx_strcasecmp("protein", xlatom[i].res) == 0 &&
                            gmx_residuetype_is_protein(rt, rnm)) ||
                           (gmx_strcasecmp("DNA", xlatom[i].res) == 0 &&