Gromacs  2025-dev-20240614-602a366
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
#include <cstdio>
#include <memory>
#include "gromacs/math/vectypes.h"
#include "gromacs/utility/basedefinitions.h"
+ Include dependency graph for swapcoords.h:
+ This graph shows which files directly or indirectly include this file:


The "Computational Electrophysiology" protocol for ion/water position swapping.

Carsten Kutzner


std::unique_ptr< IMDModule > gmx::createSwapCoordinatesModule ()
 Creates a module for Computational Electrophysiology swapping.
t_swapinit_swapcoords (FILE *fplog, const t_inputrec *ir, const char *fn, const gmx_mtop_t &mtop, const t_state *globalState, ObservablesHistory *oh, t_commrec *cr, gmx::LocalAtomSetManager *atomSets, const gmx_output_env_t *oenv, const gmx::MdrunOptions &mdrunOptions, gmx::StartingBehavior startingBehavior)
 Initialize ion / water position swapping ("Computational Electrophysiology"). More...
void finish_swapcoords (t_swap *s)
 Finalizes ion / water position swapping, if it was active. More...
gmx_bool do_swapcoords (t_commrec *cr, int64_t step, double t, const t_inputrec *ir, t_swap *s, gmx_wallcycle *wcycle, rvec x[], matrix box, gmx_bool bVerbose, gmx_bool bRerun)
 "Computational Electrophysiology" main routine within MD loop. More...

Function Documentation

gmx_bool do_swapcoords ( t_commrec *  cr,
int64_t  step,
double  t,
const t_inputrec *  ir,
t_swap s,
gmx_wallcycle *  wcycle,
rvec  x[],
matrix  box,
gmx_bool  bVerbose,
gmx_bool  bRerun 

"Computational Electrophysiology" main routine within MD loop.

[in]crPointer to MPI communication data.
[in]stepThe number of the MD time step.
[in]tThe time.
[in]irStructure containing MD input parameters
[in,out]sThe structure needed for position swapping.
[in]wcycleCount wallcycles of swap routines for diagnostic output.
[in]xPositions of home particles this node owns.
[in]boxThe simulation box.
[in]bVerboseShould we be quiet or verbose?
[in]bRerunAre we doing a rerun?
Whether at least one pair of molecules was swapped.
void finish_swapcoords ( t_swap s)

Finalizes ion / water position swapping, if it was active.

[in]sPointer to swap data.
t_swap* init_swapcoords ( FILE *  fplog,
const t_inputrec *  ir,
const char *  fn,
const gmx_mtop_t &  mtop,
const t_state globalState,
ObservablesHistory oh,
t_commrec *  cr,
gmx::LocalAtomSetManager atomSets,
const gmx_output_env_t *  oenv,
const gmx::MdrunOptions mdrunOptions,
gmx::StartingBehavior  startingBehavior 

Initialize ion / water position swapping ("Computational Electrophysiology").

This routine does the memory allocation for various helper arrays, opens the output file, sets up swap data checkpoint writing, etc. and returns it.

[in]fplogGeneral output file, normally md.log.
[in]irStructure containing MD input parameters, among those also the structure needed for position swapping.
[in]fnOutput file name for swap data.
[in]mtopMolecular topology.
[in]globalStateThe global state, only used on the main rank.
[in]ohContains struct with swap data that is read from or written to checkpoint.
[in]crPointer to MPI communication data.
[in]atomSetsManager tending to swap atom indices.
[in]oenvNeeded to open the swap output XVGR file.
[in]mdrunOptionsOptions for mdrun.
[in]startingBehaviorDescribes whether this is a restart appending to output files