Fixed gmx sasa output residue numbering
authorCarlo Camilloni <carlo.camilloni@gmail.com>
Thu, 16 Jul 2015 14:16:47 +0000 (16:16 +0200)
committerCarlo Camilloni <carlo.camilloni@gmail.com>
Fri, 17 Jul 2015 12:27:39 +0000 (14:27 +0200)
gmx sasa with -or was writing the wrong residue numbers

Change-Id: I52b13f1eeec2ee028e5ec580139c0290df7b69c9

src/gromacs/trajectoryanalysis/modules/sasa.cpp

index eb7a3d3e69b215282c4ae987ce4151b690ec0e30..24507bf04ec5bbe41018b82486f1af5cc84608ba 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2006, The GROMACS development team.
- * Copyright (c) 2008,2009,2010,2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2008,2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -654,7 +654,7 @@ Sasa::initAnalysis(const TrajectoryAnalysisSettings &settings,
                 AnalysisDataPlotModulePointer plotm(
                         new AnalysisDataPlotModule(settings.plotSettings()));
                 plotm->setFileName(fnAtomArea_);
-                plotm->setTitle("Area per residue over the trajectory");
+                plotm->setTitle("Area per atom over the trajectory");
                 plotm->setXLabel("Atom");
                 plotm->setXFormat(8, 0);
                 plotm->setYLabel("Area (nm\\S2\\N)");
@@ -666,11 +666,18 @@ Sasa::initAnalysis(const TrajectoryAnalysisSettings &settings,
         }
         {
             AnalysisDataAverageModulePointer avem(new AnalysisDataAverageModule);
+            prevResind  = -1;
+            int row     = 0;
             for (int i = 0; i < surfaceSel_.posCount(); ++i)
             {
                 const int atomIndex     = surfaceSel_.position(i).atomIndices()[0];
                 const int residueIndex  = atoms.atom[atomIndex].resind;
-                avem->setXAxisValue(i, atoms.resinfo[residueIndex].nr);
+                if (residueIndex != prevResind)
+                {
+                    avem->setXAxisValue(row, atoms.resinfo[residueIndex].nr);
+                    prevResind = residueIndex;
+                    ++row;
+                }
             }
             residueArea_.addModule(avem);
             if (!fnResidueArea_.empty())
@@ -678,7 +685,7 @@ Sasa::initAnalysis(const TrajectoryAnalysisSettings &settings,
                 AnalysisDataPlotModulePointer plotm(
                         new AnalysisDataPlotModule(settings.plotSettings()));
                 plotm->setFileName(fnResidueArea_);
-                plotm->setTitle("Area per atom over the trajectory");
+                plotm->setTitle("Area per residue over the trajectory");
                 plotm->setXLabel("Residue");
                 plotm->setXFormat(8, 0);
                 plotm->setYLabel("Area (nm\\S2\\N)");