Gromacs  2018.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions | Variables
#include "config.h"
#include <cstdio>
#include "gromacs/math/vectypes.h"
#include "gromacs/utility/basedefinitions.h"
+ Include dependency graph for imd.h:

Description

This file contains datatypes and function declarations necessary for mdrun to interface with VMD via the interactive molecular dynamics protocol.

Author
Martin Hoefling, Carsten Kutzner ckutz.nosp@m.ne@g.nosp@m.wdg.d.nosp@m.e

Functions

void write_IMDgroup_to_file (gmx_bool bIMD, t_inputrec *ir, t_state *state, gmx_mtop_t *sys, int nfile, const t_filenm fnm[])
 Writes out the group of atoms selected for interactive manipulation. More...
 
void dd_make_local_IMD_atoms (gmx_bool bIMD, gmx_domdec_t *dd, t_IMD *imd)
 Make a selection of the home atoms for the IMD group. More...
 
void init_IMD (t_inputrec *ir, t_commrec *cr, gmx_mtop_t *top_global, FILE *fplog, int defnstimd, rvec x[], int nfile, const t_filenm fnm[], const gmx_output_env_t *oenv, const MdrunOptions &mdrunOptions)
 Initializes (or disables) IMD. More...
 
gmx_bool do_IMD (gmx_bool bIMD, gmx_int64_t step, t_commrec *cr, gmx_bool bNS, matrix box, rvec x[], t_inputrec *ir, double t, gmx_wallcycle *wcycle)
 IMD required in this time step? Also checks for new IMD connection and syncs the nodes. More...
 
int IMD_get_step (t_gmx_IMD *IMDsetup)
 Get the IMD update frequency. More...
 
void IMD_apply_forces (gmx_bool bIMD, t_IMD *imd, t_commrec *cr, rvec *f, gmx_wallcycle *wcycle)
 Add external forces from a running interactive molecular dynamics session. More...
 
void IMD_fill_energy_record (gmx_bool bIMD, t_IMD *imd, gmx_enerdata_t *enerd, gmx_int64_t step, gmx_bool bHaveNewEnergies)
 Copy energies and convert to float from enerdata to the IMD energy record. More...
 
void IMD_send_positions (t_IMD *imd)
 Send positions and energies to the client. More...
 
void IMD_prep_energies_send_positions (gmx_bool bIMD, gmx_bool bIMDstep, t_IMD *imd, gmx_enerdata_t *enerd, gmx_int64_t step, gmx_bool bHaveNewEnergies, gmx_wallcycle *wcycle)
 Calls IMD_prepare_energies() and then IMD_send_positions(). More...
 
void IMD_finalize (gmx_bool bIMD, t_IMD *imd)
 Finalize IMD and do some cleaning up. More...
 

Variables

static const char IMDstr [] = "IMD:"
 Tag output from the IMD module with this string. More...
 

Function Documentation

void dd_make_local_IMD_atoms ( gmx_bool  bIMD,
gmx_domdec_t *  dd,
t_IMD *  imd 
)

Make a selection of the home atoms for the IMD group.

Should be called at every domain decomposition. Each node checks which of the atoms from "ind" are local and puts its local atom numbers into the "ind_local" array. Furthermore, in "xa_ind" it is stored at which position each local atom belongs in the assembled/collective array, so that on the master node all positions can be merged into the assembled array correctly.

Parameters
bIMDOnly springs into action if bIMD is TRUE. Otherwise returns directly.
ddStructure containing domain decomposition data.
imdThe IMD group of atoms.
gmx_bool do_IMD ( gmx_bool  bIMD,
gmx_int64_t  step,
t_commrec *  cr,
gmx_bool  bNS,
matrix  box,
rvec  x[],
t_inputrec *  ir,
double  t,
gmx_wallcycle *  wcycle 
)

IMD required in this time step? Also checks for new IMD connection and syncs the nodes.

Parameters
bIMDOnly springs into action if bIMD is TRUE. Otherwise returns directly.
stepThe time step.
crInformation structure for MPI communication.
bNSIs this a neighbor searching step?
boxThe simulation box.
xThe local atomic positions on this node.
irThe inputrec structure containing the MD input parameters including a pointer to the IMD data structure.
tThe time.
wcycleCount wallcycles of IMD routines for diagnostic output.
Returns
Whether or not we have to do IMD communication at this step.
void IMD_apply_forces ( gmx_bool  bIMD,
t_IMD *  imd,
t_commrec *  cr,
rvec *  f,
gmx_wallcycle *  wcycle 
)

Add external forces from a running interactive molecular dynamics session.

Parameters
bIMDReturns directly if bIMD is FALSE.
imdThe IMD data structure.
crInformation structure for MPI communication.
fThe forces.
wcycleCount wallcycles of IMD routines for diagnostic output.
void IMD_fill_energy_record ( gmx_bool  bIMD,
t_IMD *  imd,
gmx_enerdata_t *  enerd,
gmx_int64_t  step,
gmx_bool  bHaveNewEnergies 
)

Copy energies and convert to float from enerdata to the IMD energy record.

We do no conversion, so units in client are SI!

Parameters
bIMDOnly springs into action if bIMD is TRUE. Otherwise returns directly.
imdThe IMD data structure.
enerdContains the GROMACS energies for the different interaction types.
stepThe time step.
bHaveNewEnergiesOnly copy energies if we have done global summing of them before.
void IMD_finalize ( gmx_bool  bIMD,
t_IMD *  imd 
)

Finalize IMD and do some cleaning up.

Currently, IMD finalize closes the force output file.

Parameters
bIMDReturns directly if bIMD is FALSE.
imdThe IMD data structure.
int IMD_get_step ( t_gmx_IMD *  IMDsetup)

Get the IMD update frequency.

Parameters
IMDsetupOpaque pointer to IMD private data.
Returns
The current IMD update/communication frequency
void IMD_prep_energies_send_positions ( gmx_bool  bIMD,
gmx_bool  bIMDstep,
t_IMD *  imd,
gmx_enerdata_t *  enerd,
gmx_int64_t  step,
gmx_bool  bHaveNewEnergies,
gmx_wallcycle *  wcycle 
)

Calls IMD_prepare_energies() and then IMD_send_positions().

Parameters
bIMDReturns directly if bIMD is FALSE.
bIMDstepIf true, transfer the positions. Otherwise just update the time step and potentially the energy record.
imdThe IMD data structure.
enerdContains the GROMACS energies for the different interaction types.
stepThe time step.
bHaveNewEnergiesOnly update the energy record if we have done global summing of the energies.
wcycleCount wallcycles of IMD routines for diagnostic output.
void IMD_send_positions ( t_IMD *  imd)

Send positions and energies to the client.

Parameters
imdThe IMD data structure.
void init_IMD ( t_inputrec *  ir,
t_commrec *  cr,
gmx_mtop_t *  top_global,
FILE *  fplog,
int  defnstimd,
rvec  x[],
int  nfile,
const t_filenm  fnm[],
const gmx_output_env_t *  oenv,
const MdrunOptions &  mdrunOptions 
)

Initializes (or disables) IMD.

This function is called before the main MD loop over time steps, and it must be called prior to any call to dd_partition_system if in parallel.

Parameters
irThe inputrec structure containing the MD input parameters including a pointer to the IMD data structure.
crInformation structure for MPI communication.
top_globalThe topology of the whole system.
fplogGeneral output file, normally md.log.
defnstimdDefault IMD update (=communication) frequency.
xThe starting positions of the atoms.
nfileNumber of files.
fnmStruct containing file names etc.
oenvOutput options.
mdrunOptionsOptions for mdrun.
void write_IMDgroup_to_file ( gmx_bool  bIMD,
t_inputrec *  ir,
t_state state,
gmx_mtop_t *  sys,
int  nfile,
const t_filenm  fnm[] 
)

Writes out the group of atoms selected for interactive manipulation.

Called by grompp. The resulting file has to be read in by VMD if one wants it to connect to mdrun.

Parameters
bIMDOnly springs into action if bIMD is TRUE. Otherwise returns directly.
irStructure containing MD input parameters, among those the IMD data structure.
stateThe current state of the MD system.
sysThe global, complete system topology.
nfileNumber of files.
fnmFilename struct.

Variable Documentation

const char IMDstr[] = "IMD:"
static

Tag output from the IMD module with this string.