From dad5f85782dff0bda225cbcf8a5e9266efd33d8e Mon Sep 17 00:00:00 2001 From: Pascal Merz Date: Thu, 20 Feb 2020 18:11:13 -0700 Subject: [PATCH] Use legacy code path for t_graph (modular simulator) This change redirects simulations which will require a t_graph object to the legacy code path. It also adds an assert to catch cases in which the redirection would fail in a more graceful way. Fixes #3389 Change-Id: I17a70e504c206b2798cd2439c0c0ff5d5cd112e3 --- docs/release-notes/2020/2020.1.rst | 8 ++++++++ src/gromacs/modularsimulator/modularsimulator.cpp | 5 +++++ src/gromacs/modularsimulator/topologyholder.cpp | 6 ++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/2020/2020.1.rst b/docs/release-notes/2020/2020.1.rst index fe2d306396..c860e8cbca 100644 --- a/docs/release-notes/2020/2020.1.rst +++ b/docs/release-notes/2020/2020.1.rst @@ -131,6 +131,14 @@ have temporary names, but all content will be in sync. :issue:`2440` +Fix simulations using graph and modular simulations +""""""""""""""""""""""""""""""""""""""""""""""""""" + +Simulations using modular simulator and a graph object would fail with a +segmentation fault. + +:issue:`3389` + Fixes for ``gmx`` tools ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/gromacs/modularsimulator/modularsimulator.cpp b/src/gromacs/modularsimulator/modularsimulator.cpp index 14a52c4d77..8036261e0e 100644 --- a/src/gromacs/modularsimulator/modularsimulator.cpp +++ b/src/gromacs/modularsimulator/modularsimulator.cpp @@ -53,6 +53,7 @@ #include "gromacs/mdlib/checkpointhandler.h" #include "gromacs/mdlib/constr.h" #include "gromacs/mdlib/energyoutput.h" +#include "gromacs/mdlib/forcerec.h" #include "gromacs/mdlib/mdatoms.h" #include "gromacs/mdlib/resethandler.h" #include "gromacs/mdlib/stat.h" @@ -944,6 +945,10 @@ bool ModularSimulator::isInputCompatible(bool exitOn isInputCompatible && conditionalAssert(!doMembed, "Membrane embedding is not supported by the modular simulator."); + const bool useGraph = !areMoleculesDistributedOverPbc(*inputrec, globalTopology, MDLogger()); + isInputCompatible = + isInputCompatible + && conditionalAssert(!useGraph, "Graph is not supported by the modular simulator."); // TODO: Change this to the boolean passed when we merge the user interface change for the GPU update. isInputCompatible = isInputCompatible diff --git a/src/gromacs/modularsimulator/topologyholder.cpp b/src/gromacs/modularsimulator/topologyholder.cpp index 2c7662c1f3..e5bf8f5b87 100644 --- a/src/gromacs/modularsimulator/topologyholder.cpp +++ b/src/gromacs/modularsimulator/topologyholder.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2019, by the GROMACS development team, led by + * Copyright (c) 2019,2020, 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. @@ -66,11 +66,13 @@ TopologyHolder::TopologyHolder(const gmx_mtop_t& globalTopology, } else { + t_graph* graph = nullptr; // Generate and initialize new topology // Note that most of the data needed for the constructor is used here - // this function should probably be simplified sooner or later. - mdAlgorithmsSetupAtomData(cr, inputrec, globalTopology, localTopology_.get(), fr, nullptr, + mdAlgorithmsSetupAtomData(cr, inputrec, globalTopology, localTopology_.get(), fr, &graph, mdAtoms, constr, vsite, nullptr); + GMX_RELEASE_ASSERT(graph == nullptr, "Graph is not implemented for the modular simulator."); } } -- 2.11.4.GIT