#include "forceelement.h"
+#include "gromacs/domdec/mdsetup.h"
#include "gromacs/math/vectypes.h"
+#include "gromacs/mdlib/constr.h"
#include "gromacs/mdlib/force.h"
#include "gromacs/mdlib/force_flags.h"
#include "gromacs/mdlib/mdatoms.h"
+#include "gromacs/mdrun/shellfc.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/pbcutil/pbc.h"
ForceElement::ForceElement(StatePropagatorData* statePropagatorData,
EnergyElement* energyElement,
FreeEnergyPerturbationElement* freeEnergyPerturbationElement,
+ bool isVerbose,
bool isDynamicBox,
FILE* fplog,
const t_commrec* cr,
gmx_vsite_t* vsite,
ImdSession* imdSession,
pull_t* pull_work,
+ Constraints* constr,
+ const gmx_mtop_t* globalTopology,
gmx_enfrot* enforcedRotation) :
+ shellfc_(init_shell_flexcon(fplog,
+ globalTopology,
+ constr ? constr->numFlexibleConstraints() : 0,
+ inputrec->nstcalcenergy,
+ DOMAINDECOMP(cr))),
+ doShellFC_(shellfc_ != nullptr),
nextNSStep_(-1),
nextEnergyCalculationStep_(-1),
nextVirialCalculationStep_(-1),
freeEnergyPerturbationElement_(freeEnergyPerturbationElement),
localTopology_(nullptr),
isDynamicBox_(isDynamicBox),
+ isVerbose_(isVerbose),
+ nShellRelaxationSteps_(0),
ddBalanceRegionHandler_(cr),
lambda_(),
fplog_(fplog),
pull_work_(pull_work),
fcd_(fcd),
runScheduleWork_(runScheduleWork),
+ constr_(constr),
enforcedRotation_(enforcedRotation)
{
lambda_.fill(0);
+
+ if (doShellFC_ && !DOMAINDECOMP(cr))
+ {
+ // This was done in mdAlgorithmsSetupAtomData(), but shellfc
+ // won't be available outside this element.
+ make_local_shells(cr, mdAtoms->mdatoms(), shellfc_);
+ }
}
void ForceElement::scheduleTask(Step step, Time time, const RegisterRunFunctionPtr& registerRunFunction)
| (nextVirialCalculationStep_ == step ? GMX_FORCE_VIRIAL : 0)
| (nextEnergyCalculationStep_ == step ? GMX_FORCE_ENERGY : 0)
| (nextFreeEnergyCalculationStep_ == step ? GMX_FORCE_DHDL : 0)
- | (nextNSStep_ == step ? GMX_FORCE_NS : 0));
-
- (*registerRunFunction)(std::make_unique<SimulatorRunFunction>(
- [this, step, time, flags]() { run(step, time, flags); }));
+ | (!doShellFC_ && nextNSStep_ == step ? GMX_FORCE_NS : 0));
+
+ (*registerRunFunction)(std::make_unique<SimulatorRunFunction>([this, step, time, flags]() {
+ if (doShellFC_)
+ {
+ run<true>(step, time, flags);
+ }
+ else
+ {
+ run<false>(step, time, flags);
+ }
+ }));
}
void ForceElement::elementSetup()
GMX_ASSERT(localTopology_, "Setup called before local topology was set.");
}
+template<bool doShellFC>
void ForceElement::run(Step step, Time time, unsigned int flags)
{
// Disabled functionality
- Awh* awh = nullptr;
- gmx_edsam* ed = nullptr;
- gmx_multisim_t* ms = nullptr;
+ gmx_multisim_t* ms = nullptr;
+
if (!DOMAINDECOMP(cr_) && (flags & GMX_FORCE_NS) && inputrecDynamicBox(inputrec_))
{
ArrayRef<real> lambda =
freeEnergyPerturbationElement_ ? freeEnergyPerturbationElement_->lambdaView() : lambda_;
- do_force(fplog_, cr_, ms, inputrec_, awh, enforcedRotation_, imdSession_, pull_work_, step,
- nrnb_, wcycle_, localTopology_, box, x, hist, forces, force_vir, mdAtoms_->mdatoms(),
- energyElement_->enerdata(), fcd_, lambda, fr_, runScheduleWork_, vsite_,
- energyElement_->muTot(), time, ed, static_cast<int>(flags), ddBalanceRegionHandler_);
+ if (doShellFC)
+ {
+ auto v = statePropagatorData_->velocitiesView();
+
+ relax_shell_flexcon(
+ fplog_, cr_, ms, isVerbose_, enforcedRotation_, step, inputrec_, imdSession_,
+ pull_work_, step == nextNSStep_, static_cast<int>(flags), localTopology_, constr_,
+ energyElement_->enerdata(), fcd_, statePropagatorData_->localNumAtoms(), x, v, box,
+ lambda, hist, forces, force_vir, mdAtoms_->mdatoms(), nrnb_, wcycle_, shellfc_, fr_,
+ runScheduleWork_, time, energyElement_->muTot(), vsite_, ddBalanceRegionHandler_);
+ nShellRelaxationSteps_++;
+ }
+ else
+ {
+ // Disabled functionality
+ Awh* awh = nullptr;
+ gmx_edsam* ed = nullptr;
+
+ do_force(fplog_, cr_, ms, inputrec_, awh, enforcedRotation_, imdSession_, pull_work_, step,
+ nrnb_, wcycle_, localTopology_, box, x, hist, forces, force_vir, mdAtoms_->mdatoms(),
+ energyElement_->enerdata(), fcd_, lambda, fr_, runScheduleWork_, vsite_,
+ energyElement_->muTot(), time, ed, static_cast<int>(flags), ddBalanceRegionHandler_);
+ }
energyElement_->addToForceVirial(force_vir, step);
}
+void ForceElement::elementTeardown()
+{
+ if (doShellFC_)
+ {
+ done_shellfc(fplog_, shellfc_, nShellRelaxationSteps_);
+ }
+}
+
void ForceElement::setTopology(const gmx_localtop_t* top)
{
localTopology_ = top;
/*
* 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.
/*! \libinternal \file
* \brief Declares the force element for the modular simulator
*
+ * This element calculates the forces, with or without shells or
+ * flexible constraints.
+ *
* \author Pascal Merz <pascal.merz@me.com>
* \ingroup module_modularsimulator
*/
#include "topologyholder.h"
struct gmx_enfrot;
+struct gmx_shellfc_t;
struct gmx_wallcycle;
struct pull_t;
struct t_fcdata;
* \ingroup module_modularsimulator
* \brief Force element
*
- * The force element manages the call to do_force(...)
+ * The force element manages the call to either
+ * do_force(...) or relax_shell_flexcon(...)
*/
class ForceElement final :
public ISimulatorElement,
ForceElement(StatePropagatorData* statePropagatorData,
EnergyElement* energyElement,
FreeEnergyPerturbationElement* freeEnergyPerturbationElement,
+ bool isVerbose,
bool isDynamicBox,
FILE* fplog,
const t_commrec* cr,
gmx_vsite_t* vsite,
ImdSession* imdSession,
pull_t* pull_work,
+ Constraints* constr,
+ const gmx_mtop_t* globalTopology,
gmx_enfrot* enforcedRotation);
/*! \brief Register force calculation for step / time
//! Check that we got the local topology
void elementSetup() override;
- //! No element teardown needed
- void elementTeardown() override {}
+ //! Print some final output
+ void elementTeardown() override;
private:
//! ITopologyHolderClient implementation
//! IEnergySignallerClient implementation
SignallerCallbackPtr registerEnergyCallback(EnergySignallerEvent event) override;
//! The actual do_force call
+ template<bool doShellFC>
void run(Step step, Time time, unsigned int flags);
+ //! The shell / FC helper struct
+ gmx_shellfc_t* shellfc_;
+ //! Whether shells or flexible constraints are present
+ const bool doShellFC_;
+
//! The next NS step
Step nextNSStep_;
//! The next energy calculation step
//! Whether we're having a dynamic box
const bool isDynamicBox_;
+ //! Whether we're being verbose
+ const bool isVerbose_;
+ //! The number of shell relaxation steps we did
+ Step nShellRelaxationSteps_;
//! DD / DLB helper object
const DDBalanceRegionHandler ddBalanceRegionHandler_;
t_fcdata* fcd_;
//! Schedule of work for each MD step for this task.
MdrunScheduleWorkload* runScheduleWork_;
+ //! Handles constraints.
+ Constraints* constr_;
//! Handles enforced rotation.
gmx_enfrot* enforcedRotation_;
};
#include "freeenergyperturbationelement.h"
#include "parrinellorahmanbarostat.h"
#include "propagator.h"
-#include "shellfcelement.h"
#include "signallers.h"
#include "statepropagatordata.h"
#include "trajectoryelement.h"
{
const bool isVerbose = mdrunOptions.verbose;
const bool isDynamicBox = inputrecDynamicBox(inputrec);
- // Check for polarizable models and flexible constraints
- if (ShellFCElement::doShellsOrFlexConstraints(topologyHolder_->globalTopology(),
- constr ? constr->numFlexibleConstraints() : 0))
- {
- auto shellFCElement = std::make_unique<ShellFCElement>(
- statePropagatorDataPtr, energyElementPtr, freeEnergyPerturbationElement, isVerbose,
- isDynamicBox, fplog, cr, inputrec, mdAtoms, nrnb, fr, fcd, wcycle, runScheduleWork, vsite,
- imdSession, pull_work, constr, &topologyHolder_->globalTopology(), enforcedRotation);
- topologyHolder_->registerClient(shellFCElement.get());
- neighborSearchSignallerBuilder->registerSignallerClient(
- compat::make_not_null(shellFCElement.get()));
- energySignallerBuilder->registerSignallerClient(compat::make_not_null(shellFCElement.get()));
-
- // std::move *should* not be needed with c++-14, but clang-3.6 still requires it
- return std::move(shellFCElement);
- }
- else
- {
- auto forceElement = std::make_unique<ForceElement>(
- statePropagatorDataPtr, energyElementPtr, freeEnergyPerturbationElement,
- isDynamicBox, fplog, cr, inputrec, mdAtoms, nrnb, fr, fcd, wcycle, runScheduleWork,
- vsite, imdSession, pull_work, enforcedRotation);
- topologyHolder_->registerClient(forceElement.get());
- neighborSearchSignallerBuilder->registerSignallerClient(compat::make_not_null(forceElement.get()));
- energySignallerBuilder->registerSignallerClient(compat::make_not_null(forceElement.get()));
-
- // std::move *should* not be needed with c++-14, but clang-3.6 still requires it
- return std::move(forceElement);
- }
+
+ auto forceElement = std::make_unique<ForceElement>(
+ statePropagatorDataPtr, energyElementPtr, freeEnergyPerturbationElement, isVerbose,
+ isDynamicBox, fplog, cr, inputrec, mdAtoms, nrnb, fr, fcd, wcycle, runScheduleWork, vsite,
+ imdSession, pull_work, constr, &topologyHolder_->globalTopology(), enforcedRotation);
+ topologyHolder_->registerClient(forceElement.get());
+ neighborSearchSignallerBuilder->registerSignallerClient(compat::make_not_null(forceElement.get()));
+ energySignallerBuilder->registerSignallerClient(compat::make_not_null(forceElement.get()));
+
+ // std::move *should* not be needed with c++-14, but clang-3.6 still requires it
+ return std::move(forceElement);
}
std::unique_ptr<ISimulatorElement> ModularSimulator::buildIntegrator(
+++ /dev/null
-/*
- * This file is part of the GROMACS molecular simulation package.
- *
- * 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.
- *
- * GROMACS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1
- * of the License, or (at your option) any later version.
- *
- * GROMACS is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with GROMACS; if not, see
- * http://www.gnu.org/licenses, or write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * If you want to redistribute modifications to GROMACS, please
- * consider that scientific software is very special. Version
- * control is crucial - bugs must be traceable. We will be happy to
- * consider code for inclusion in the official distribution, but
- * derived work must not be called official GROMACS. Details are found
- * in the README & COPYING files - if they are missing, get the
- * official version at http://www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the research papers on the package. Check out http://www.gromacs.org.
- */
-/*! \internal \file
- * \brief Defines the shell / flex constraints element for the modular simulator
- *
- * \author Pascal Merz <pascal.merz@me.com>
- * \ingroup module_modularsimulator
- */
-
-#include "gmxpre.h"
-
-#include "shellfcelement.h"
-
-#include "gromacs/domdec/mdsetup.h"
-#include "gromacs/math/vectypes.h"
-#include "gromacs/mdlib/constr.h"
-#include "gromacs/mdlib/force.h"
-#include "gromacs/mdlib/force_flags.h"
-#include "gromacs/mdlib/mdatoms.h"
-#include "gromacs/mdrun/shellfc.h"
-#include "gromacs/mdtypes/inputrec.h"
-#include "gromacs/mdtypes/mdatom.h"
-#include "gromacs/pbcutil/pbc.h"
-#include "gromacs/topology/atoms.h"
-#include "gromacs/topology/mtop_util.h"
-
-#include "energyelement.h"
-#include "freeenergyperturbationelement.h"
-#include "statepropagatordata.h"
-
-struct gmx_edsam;
-struct gmx_enfrot;
-struct gmx_multisim_t;
-class history_t;
-
-namespace gmx
-{
-bool ShellFCElement::doShellsOrFlexConstraints(const gmx_mtop_t& mtop, int nflexcon)
-{
- if (nflexcon != 0)
- {
- return true;
- }
- std::array<int, eptNR> n = gmx_mtop_particletype_count(mtop);
- return n[eptShell] != 0;
-}
-
-ShellFCElement::ShellFCElement(StatePropagatorData* statePropagatorData,
- EnergyElement* energyElement,
- FreeEnergyPerturbationElement* freeEnergyPerturbationElement,
- bool isVerbose,
- bool isDynamicBox,
- FILE* fplog,
- const t_commrec* cr,
- const t_inputrec* inputrec,
- const MDAtoms* mdAtoms,
- t_nrnb* nrnb,
- t_forcerec* fr,
- t_fcdata* fcd,
- gmx_wallcycle* wcycle,
- MdrunScheduleWorkload* runScheduleWork,
- gmx_vsite_t* vsite,
- ImdSession* imdSession,
- pull_t* pull_work,
- Constraints* constr,
- const gmx_mtop_t* globalTopology,
- gmx_enfrot* enforcedRotation) :
- nextNSStep_(-1),
- nextEnergyCalculationStep_(-1),
- nextVirialCalculationStep_(-1),
- nextFreeEnergyCalculationStep_(-1),
- statePropagatorData_(statePropagatorData),
- energyElement_(energyElement),
- freeEnergyPerturbationElement_(freeEnergyPerturbationElement),
- localTopology_(nullptr),
- isDynamicBox_(isDynamicBox),
- isVerbose_(isVerbose),
- nSteps_(0),
- ddBalanceRegionHandler_(cr),
- fplog_(fplog),
- cr_(cr),
- inputrec_(inputrec),
- mdAtoms_(mdAtoms),
- nrnb_(nrnb),
- wcycle_(wcycle),
- fr_(fr),
- vsite_(vsite),
- imdSession_(imdSession),
- pull_work_(pull_work),
- fcd_(fcd),
- runScheduleWork_(runScheduleWork),
- constr_(constr),
- enforcedRotation_(enforcedRotation)
-{
- lambda_.fill(0);
-
- shellfc_ = init_shell_flexcon(fplog, globalTopology, constr_ ? constr_->numFlexibleConstraints() : 0,
- inputrec->nstcalcenergy, DOMAINDECOMP(cr));
-
- GMX_ASSERT(shellfc_, "ShellFCElement built, but init_shell_flexcon returned a nullptr");
-
- if (!DOMAINDECOMP(cr))
- {
- // This was done in mdAlgorithmsSetupAtomData(), but shellfc
- // won't be available outside this element.
- make_local_shells(cr, mdAtoms->mdatoms(), shellfc_);
- }
-}
-
-void ShellFCElement::scheduleTask(Step step, Time time, const RegisterRunFunctionPtr& registerRunFunction)
-{
- unsigned int flags =
- (GMX_FORCE_STATECHANGED | GMX_FORCE_ALLFORCES | (isDynamicBox_ ? GMX_FORCE_DYNAMICBOX : 0)
- | (nextVirialCalculationStep_ == step ? GMX_FORCE_VIRIAL : 0)
- | (nextEnergyCalculationStep_ == step ? GMX_FORCE_ENERGY : 0)
- | (nextFreeEnergyCalculationStep_ == step ? GMX_FORCE_DHDL : 0));
-
- const bool isNSStep = (step == nextNSStep_);
- (*registerRunFunction)(std::make_unique<SimulatorRunFunction>(
- [this, step, time, flags, isNSStep]() { run(step, time, isNSStep, flags); }));
- nSteps_++;
-}
-
-void ShellFCElement::elementSetup()
-{
- GMX_ASSERT(localTopology_, "Setup called before local topology was set.");
-}
-
-void ShellFCElement::run(Step step, Time time, bool isNSStep, unsigned int flags)
-{
- // Disabled functionality
- gmx_multisim_t* ms = nullptr;
-
- if (!DOMAINDECOMP(cr_) && isNSStep && inputrecDynamicBox(inputrec_))
- {
- // TODO: Correcting the box is done in DomDecHelper (if using DD) or here (non-DD simulations).
- // Think about unifying this responsibility, could this be done in one place?
- auto box = statePropagatorData_->box();
- correct_box(fplog_, step, box);
- }
-
- auto x = statePropagatorData_->positionsView();
- auto v = statePropagatorData_->velocitiesView();
- auto forces = statePropagatorData_->forcesView();
- auto box = statePropagatorData_->constBox();
- history_t* hist = nullptr; // disabled
-
- tensor force_vir = { { 0 } };
- // TODO: Make lambda const (needs some adjustments in lower force routines)
- ArrayRef<real> lambda =
- freeEnergyPerturbationElement_ ? freeEnergyPerturbationElement_->lambdaView() : lambda_;
- relax_shell_flexcon(fplog_, cr_, ms, isVerbose_, enforcedRotation_, step, inputrec_, imdSession_,
- pull_work_, isNSStep, static_cast<int>(flags), localTopology_, constr_,
- energyElement_->enerdata(), fcd_, statePropagatorData_->localNumAtoms(), x,
- v, box, lambda, hist, forces, force_vir, mdAtoms_->mdatoms(), nrnb_,
- wcycle_, shellfc_, fr_, runScheduleWork_, time, energyElement_->muTot(),
- vsite_, ddBalanceRegionHandler_);
- energyElement_->addToForceVirial(force_vir, step);
-}
-
-void ShellFCElement::elementTeardown()
-{
- done_shellfc(fplog_, shellfc_, nSteps_);
-}
-
-void ShellFCElement::setTopology(const gmx_localtop_t* top)
-{
- localTopology_ = top;
-}
-
-SignallerCallbackPtr ShellFCElement::registerNSCallback()
-{
- return std::make_unique<SignallerCallback>(
- [this](Step step, Time gmx_unused time) { this->nextNSStep_ = step; });
-}
-
-SignallerCallbackPtr ShellFCElement::registerEnergyCallback(EnergySignallerEvent event)
-{
- if (event == EnergySignallerEvent::EnergyCalculationStep)
- {
- return std::make_unique<SignallerCallback>(
- [this](Step step, Time /*unused*/) { nextEnergyCalculationStep_ = step; });
- }
- if (event == EnergySignallerEvent::VirialCalculationStep)
- {
- return std::make_unique<SignallerCallback>(
- [this](Step step, Time /*unused*/) { nextVirialCalculationStep_ = step; });
- }
- if (event == EnergySignallerEvent::FreeEnergyCalculationStep)
- {
- return std::make_unique<SignallerCallback>(
- [this](Step step, Time /*unused*/) { nextFreeEnergyCalculationStep_ = step; });
- }
- return nullptr;
-}
-} // namespace gmx
+++ /dev/null
-/*
- * This file is part of the GROMACS molecular simulation package.
- *
- * 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.
- *
- * GROMACS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1
- * of the License, or (at your option) any later version.
- *
- * GROMACS is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with GROMACS; if not, see
- * http://www.gnu.org/licenses, or write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * If you want to redistribute modifications to GROMACS, please
- * consider that scientific software is very special. Version
- * control is crucial - bugs must be traceable. We will be happy to
- * consider code for inclusion in the official distribution, but
- * derived work must not be called official GROMACS. Details are found
- * in the README & COPYING files - if they are missing, get the
- * official version at http://www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the research papers on the package. Check out http://www.gromacs.org.
- */
-/*! \libinternal \file
- * \brief Declares the shell / flex constraints element for the modular simulator
- *
- * \author Pascal Merz <pascal.merz@me.com>
- * \ingroup module_modularsimulator
- */
-
-#ifndef GMX_MODULARSIMULATOR_SHELLFCELEMENT_H
-#define GMX_MODULARSIMULATOR_SHELLFCELEMENT_H
-
-#include <array>
-
-#include "gromacs/domdec/dlbtiming.h"
-#include "gromacs/mdtypes/md_enums.h"
-#include "gromacs/utility/real.h"
-
-#include "modularsimulatorinterfaces.h"
-#include "topologyholder.h"
-
-struct gmx_enfrot;
-struct gmx_shellfc_t;
-struct gmx_wallcycle;
-struct pull_t;
-struct t_fcdata;
-struct t_nrnb;
-
-namespace gmx
-{
-class Awh;
-class EnergyElement;
-class FreeEnergyPerturbationElement;
-class ImdSession;
-class MDAtoms;
-class MdrunScheduleWorkload;
-class StatePropagatorData;
-
-/*! \libinternal
- * \ingroup module_modularsimulator
- * \brief Shell & flex constraints element
- *
- * The ShellFCElement manages the call to relax_shell_flexcon(...)
- */
-class ShellFCElement final :
- public ISimulatorElement,
- public ITopologyHolderClient,
- public INeighborSearchSignallerClient,
- public IEnergySignallerClient
-{
-public:
- //! Constructor
- ShellFCElement(StatePropagatorData* statePropagatorData,
- EnergyElement* energyElement,
- FreeEnergyPerturbationElement* freeEnergyPerturbationElement,
- bool isVerbose,
- bool isDynamicBox,
- FILE* fplog,
- const t_commrec* cr,
- const t_inputrec* inputrec,
- const MDAtoms* mdAtoms,
- t_nrnb* nrnb,
- t_forcerec* fr,
- t_fcdata* fcd,
- gmx_wallcycle* wcycle,
- MdrunScheduleWorkload* runScheduleWork,
- gmx_vsite_t* vsite,
- ImdSession* imdSession,
- pull_t* pull_work,
- Constraints* constr,
- const gmx_mtop_t* globalTopology,
- gmx_enfrot* enforcedRotation);
-
- /*! \brief Register shell / flex constraint calculation for step / time
- *
- * @param step The step number
- * @param time The time
- * @param registerRunFunction Function allowing to register a run function
- */
- void scheduleTask(Step step, Time time, const RegisterRunFunctionPtr& registerRunFunction) override;
-
- //! Check that we got the local topology
- void elementSetup() override;
- //! Print some final output
- void elementTeardown() override;
-
- //! Whether either shells or flexible constraints are used
- static bool doShellsOrFlexConstraints(const gmx_mtop_t& mtop, int nflexcon);
-
-private:
- //! ITopologyHolderClient implementation
- void setTopology(const gmx_localtop_t* top) override;
- //! INeighborSearchSignallerClient implementation
- SignallerCallbackPtr registerNSCallback() override;
- //! IEnergySignallerClient implementation
- SignallerCallbackPtr registerEnergyCallback(EnergySignallerEvent event) override;
- //! The actual do_force call
- void run(Step step, Time time, bool isNSStep, unsigned int flags);
-
- //! The shell / FC helper struct
- gmx_shellfc_t* shellfc_;
-
- //! The next NS step
- Step nextNSStep_;
- //! The next energy calculation step
- Step nextEnergyCalculationStep_;
- //! The next energy calculation step
- Step nextVirialCalculationStep_;
- //! The next free energy calculation step
- Step nextFreeEnergyCalculationStep_;
-
- //! Pointer to the micro state
- StatePropagatorData* statePropagatorData_;
- //! Pointer to the energy element
- EnergyElement* energyElement_;
- //! The free energy perturbation element
- FreeEnergyPerturbationElement* freeEnergyPerturbationElement_;
-
- //! The local topology - updated by Topology via Client system
- const gmx_localtop_t* localTopology_;
-
- //! Whether we're having a dynamic box
- const bool isDynamicBox_;
- //! Whether we're being verbose
- const bool isVerbose_;
- //! The number of shell relaxation steps we did
- Step nSteps_;
-
- //! DD / DLB helper object
- const DDBalanceRegionHandler ddBalanceRegionHandler_;
-
- /* \brief The FEP lambda vector
- *
- * Used if FEP is off, since do_force
- * requires lambda to be allocated anyway
- */
- std::array<real, efptNR> lambda_;
-
- // Access to ISimulator data
- //! Handles logging.
- FILE* fplog_;
- //! Handles communication.
- const t_commrec* cr_;
- //! Contains user input mdp options.
- const t_inputrec* inputrec_;
- //! Atom parameters for this domain.
- const MDAtoms* mdAtoms_;
- //! Manages flop accounting.
- t_nrnb* nrnb_;
- //! Manages wall cycle accounting.
- gmx_wallcycle* wcycle_;
- //! Parameters for force calculations.
- t_forcerec* fr_;
- //! Handles virtual sites.
- gmx_vsite_t* vsite_;
- //! The Interactive Molecular Dynamics session.
- ImdSession* imdSession_;
- //! The pull work object.
- pull_t* pull_work_;
- //! Helper struct for force calculations.
- t_fcdata* fcd_;
- //! Schedule of work for each MD step for this task.
- MdrunScheduleWorkload* runScheduleWork_;
- //! Handles constraints.
- Constraints* constr_;
- //! Handles enforced rotation.
- gmx_enfrot* enforcedRotation_;
-};
-
-} // namespace gmx
-
-#endif // GMX_MODULARSIMULATOR_SHELLFCELEMENT_H