Merge branch release-5-1
[alexxy/gromacs.git] / src / gromacs / trajectoryanalysis / modules / sasa.cpp
index 4f2b2d9fdf530fa68f4577b6f128dd3c52949068..edff30830f3311f17a373206b4b51f39ceddcca0 100644 (file)
@@ -413,7 +413,7 @@ Sasa::initOptions(Options *options, TrajectoryAnalysisSettings *settings)
         "See Eisenhaber F, Lijnzaad P, Argos P, Sander C, & Scharf M",
         "(1995) J. Comput. Chem. 16, 273-284 for the algorithm used.",
         "With [TT]-q[tt], the Connolly surface can be generated as well",
-        "in a [TT].pdb[tt] file where the nodes are represented as atoms",
+        "in a [REF].pdb[ref] file where the nodes are represented as atoms",
         "and the edges connecting the nearest nodes as CONECT records.",
         "[TT]-odg[tt] allows for estimation of solvation free energies",
         "from per-atom solvation energies per exposed surface area.[PAR]",
@@ -429,7 +429,7 @@ Sasa::initOptions(Options *options, TrajectoryAnalysisSettings *settings)
         "The average and standard deviation of the area over the trajectory",
         "can be calculated per residue and atom (options [TT]-or[tt] and",
         "[TT]-oa[tt]).[PAR]",
-        //"In combination with the latter option an [TT].itp[tt] file can be",
+        //"In combination with the latter option an [REF].itp[ref] file can be",
         //"generated (option [TT]-i[tt])",
         //"which can be used to restrain surface atoms.[PAR]",
 
@@ -445,7 +445,7 @@ Sasa::initOptions(Options *options, TrajectoryAnalysisSettings *settings)
         "that are both too high."
     };
 
-    options->setDescription(concatenateStrings(desc));
+    settings->setHelpText(desc);
 
     options->addOption(FileNameOption("o").filetype(eftPlot).outputFile().required()
                            .store(&fnArea_).defaultBasename("area")
@@ -477,7 +477,7 @@ Sasa::initOptions(Options *options, TrajectoryAnalysisSettings *settings)
     //options->addOption(DoubleOption("minarea").store(&minarea_)
     //                       .description("The minimum area (nm^2) to count an atom as a surface atom when writing a position restraint file (see help)"));
     options->addOption(BooleanOption("prot").store(&bIncludeSolute_)
-                           .description("Output the protein to the Connolly [TT].pdb[tt] file too"));
+                           .description("Output the protein to the Connolly [REF].pdb[ref] file too"));
     options->addOption(DoubleOption("dgs").store(&dgsDefault_)
                            .description("Default value for solvation free energy per area (kJ/mol/nm^2)"));
 
@@ -655,7 +655,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)");
@@ -667,11 +667,18 @@ Sasa::initAnalysis(const TrajectoryAnalysisSettings &settings,
         }
         {
             AnalysisDataAverageModulePointer avem(new AnalysisDataAverageModule);
+            int 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())
@@ -679,7 +686,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)");