Project

General

Profile

Bug #2871

grompp segfault when using annealing

Added by Daniel Fragiadakis 6 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
preprocessing (pdb2gmx,grompp)
Target version:
Affected version - extra info:
Affected version:
Difficulty:
uncategorized
Close

Description

grompp crashes with a SIGSEGV when reading an input file with the annealing-* commands making annealing unusable.

The culprit is src/gromacs/gmxpreprocess/readir.cpp

In revision fe1788de the way in which these commands are read were changed introducing an error in reading the floating point values for anneal-time and anneal-temp into opts.anneal_{time,temp}, they are being put in memory location 0.
I think the problem is still there in all subsequent versions.

The following patch fixes the problem (I was not able to attach a file to this bug report)

diff --git a/src/gromacs/gmxpreprocess/readir.cpp b/src/gromacs/gmxpreprocess/readir.cpp
index f9b1f27e2..85e0393df 100644
--- a/src/gromacs/gmxpreprocess/readir.cpp
+++ b/src/gromacs/gmxpreprocess/readir.cpp
@@ -3396,8 +3396,18 @@ void do_index(const char* mdparin, const char *ndx,
                               simulatedAnnealingTemperatures.size(), k);
                 }

-                convertReals(wi, simulatedAnnealingTimes, "anneal-time", ir->opts.anneal_time[i]);
-                convertReals(wi, simulatedAnnealingTemperatures, "anneal-temp", ir->opts.anneal_temp[i]);
+                for (i = 0, k = 0; i < nr; i++)
+                {
+                    std::vector<std::string> temps(simulatedAnnealingTemperatures.begin(),
+                                                   simulatedAnnealingTemperatures.begin() + ir->opts.anneal_npoints[i]);
+                    std::vector<std::string> times(simulatedAnnealingTimes.begin(),
+                                                   simulatedAnnealingTimes.begin() + ir->opts.anneal_npoints[i]);
+
+                    convertReals(wi, times, "anneal-time", ir->opts.anneal_time[i]);
+                    convertReals(wi, temps, "anneal-temp", ir->opts.anneal_temp[i]);
+                    k += ir->opts.anneal_npoints[i];
+                }
+
                 for (i = 0, k = 0; i < nr; i++)
                 {
                     for (j = 0; j < ir->opts.anneal_npoints[i]; j++)

Associated revisions

Revision 2404693f (diff)
Added by Paul Bauer 5 months ago

Fix simulated annealing and add test

Refs #2871

Change-Id: Ibde5226a664d3d4d5558477fdf9b81e1219a5295

Revision 9453ea8c (diff)
Added by Paul Bauer 5 months ago

Fix segmentation fault with simulated annealing

Fix contributed by Daniel Fragiadakis.

Fixes #2871

Change-Id: I237d49f9996eb2ae869d59e4c39a6c2d33c9ece7

History

#1 Updated by Paul Bauer 6 months ago

Hello, can you upload a minimal test case for this (you should be able to attach files here as well).
I'm going to upload your patch, but we also need to be able to test it.

#2 Updated by Gerrit Code Review Bot 6 months ago

Gerrit received a related patchset '2' for Issue #2871.
Uploader: Paul Bauer ()
Change-Id: gromacs~release-2019~I237d49f9996eb2ae869d59e4c39a6c2d33c9ece7
Gerrit URL: https://gerrit.gromacs.org/9247

#3 Updated by Gerrit Code Review Bot 5 months ago

Gerrit received a related patchset '1' for Issue #2871.
Uploader: Paul Bauer ()
Change-Id: gromacs~master~Ibde5226a664d3d4d5558477fdf9b81e1219a5295
Gerrit URL: https://gerrit.gromacs.org/9332

#4 Updated by Mark Abraham 5 months ago

  • Description updated (diff)
  • Assignee changed from Daniel Fragiadakis to Paul Bauer

#5 Updated by Mark Abraham 5 months ago

  • Status changed from New to Fix uploaded

#6 Updated by Paul Bauer 5 months ago

  • Status changed from Fix uploaded to Resolved

#7 Updated by Paul Bauer 5 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF