* \param[in] repl_ex_nst How often we do replica exchange (in steps)
* \param[in] repl_ex_nex How many replicas we have
* \param[in] repl_ex_seed The seed for Monte Carlo swaps
+ * \param[in] membed Membrane embedding data structure
* \param[in] cpt_period How often to checkpoint the simulation
* \param[in] max_hours Maximume length of the simulation (wall time)
* \param[in] imdport Interactive MD port (socket)
gmx_edsam_t ed,
t_forcerec *fr,
int repl_ex_nst, int repl_ex_nex, int repl_ex_seed,
+ gmx_membed_t gmx_unused * membed,
real cpt_period, real max_hours,
int imdport,
unsigned long Flags,
gmx_edsam_t ed,
t_forcerec *fr,
int repl_ex_nst, int repl_ex_nex, int repl_ex_seed,
+ gmx_membed_t gmx_unused *membed,
real cpt_period, real max_hours,
int imdport,
unsigned long Flags,
gmx_edsam_t gmx_unused ed,
t_forcerec *fr,
int gmx_unused repl_ex_nst, int gmx_unused repl_ex_nex, int gmx_unused repl_ex_seed,
+ gmx_membed_t gmx_unused *membed,
real gmx_unused cpt_period, real gmx_unused max_hours,
int imdport,
unsigned long gmx_unused Flags,
gmx_edsam_t gmx_unused ed,
t_forcerec *fr,
int gmx_unused repl_ex_nst, int gmx_unused repl_ex_nex, int gmx_unused repl_ex_seed,
+ gmx_membed_t gmx_unused *membed,
real gmx_unused cpt_period, real gmx_unused max_hours,
int imdport,
unsigned long gmx_unused Flags,
gmx_edsam_t gmx_unused ed,
t_forcerec *fr,
int gmx_unused repl_ex_nst, int gmx_unused repl_ex_nex, int gmx_unused repl_ex_seed,
+ gmx_membed_t gmx_unused *membed,
real gmx_unused cpt_period, real gmx_unused max_hours,
int imdport,
unsigned long gmx_unused Flags,
gmx_edsam_t gmx_unused ed,
t_forcerec *fr,
int gmx_unused repl_ex_nst, int gmx_unused repl_ex_nex, int gmx_unused repl_ex_seed,
+ gmx_membed_t gmx_unused *membed,
real gmx_unused cpt_period, real gmx_unused max_hours,
int imdport,
unsigned long gmx_unused Flags,
gmx_edsam_t gmx_unused ed,
t_forcerec *fr,
int gmx_unused repl_ex_nst, int gmx_unused repl_ex_nex, int gmx_unused repl_ex_seed,
+ gmx_membed_t gmx_unused *membed,
real gmx_unused cpt_period, real gmx_unused max_hours,
int gmx_unused imdport,
unsigned long gmx_unused Flags,
t_nrnb *nrnb, gmx_wallcycle_t wcycle,
gmx_edsam_t ed, t_forcerec *fr,
int repl_ex_nst, int repl_ex_nex, int repl_ex_seed,
+ gmx_membed_t *membed,
real cpt_period, real max_hours,
int imdport,
unsigned long Flags,
/* Interactive MD */
gmx_bool bIMDstep = FALSE;
- gmx_membed_t *membed = NULL;
#ifdef GMX_FAHCORE
/* Temporary addition for FAHCORE checkpointing */
}
groups = &top_global->groups;
- if (opt2bSet("-membed", nfile, fnm))
- {
- if (MASTER(cr))
- {
- fprintf(stderr, "Initializing membed");
- }
- /* Note that membed cannot work in parallel because mtop is
- * changed here. Fix this if we ever want to make it run with
- * multiple ranks. */
- membed = init_membed(fplog, nfile, fnm, top_global, ir, state_global, cr, &cpt_period);
- }
-
if (ir->eSwapCoords != eswapNO)
{
/* Initialize ion swapping code */
finish_swapcoords(ir->swap);
}
- if (membed != nullptr)
- {
- free_membed(membed);
- }
-
/* IMD cleanup, if bIMD is TRUE. */
IMD_finalize(ir->bIMD, ir->imd);
#include "deform.h"
#include "md.h"
+#include "membed.h"
#include "repl_ex.h"
#include "resource-division.h"
gmx_int64_t reset_counters;
gmx_edsam_t ed = NULL;
int nthreads_pme = 1;
+ gmx_membed_t * membed = NULL;
gmx_hw_info_t *hwinfo = NULL;
/* The master rank decides early on bUseGPU and broadcasts this later */
gmx_bool bUseGPU = FALSE;
wcycle_set_reset_counters(wcycle, reset_counters);
}
+ // Membrane embedding must be initialized before we call init_forcerec()
+ if (opt2bSet("-membed", nfile, fnm))
+ {
+ if (MASTER(cr))
+ {
+ fprintf(stderr, "Initializing membed");
+ }
+ /* Note that membed cannot work in parallel because mtop is
+ * changed here. Fix this if we ever want to make it run with
+ * multiple ranks. */
+ membed = init_membed(fplog, nfile, fnm, mtop, inputrec, state, cr, &cpt_period);
+ }
+
snew(nrnb, 1);
if (cr->duty & DUTY_PP)
{
fcd, state,
mdatoms, nrnb, wcycle, ed, fr,
repl_ex_nst, repl_ex_nex, repl_ex_seed,
+ membed,
cpt_period, max_hours,
imdport,
Flags,
/* Free GPU memory and context */
free_gpu_resources(fr, cr, &hwinfo->gpu_info, fr ? fr->gpu_opt : NULL);
+ if (membed != nullptr)
+ {
+ free_membed(membed);
+ }
+
gmx_hardware_info_free(hwinfo);
/* Does what it says */