* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
+
+#include "config.h"
+#include <math.h>
#include <string.h>
#include <time.h>
-#include <math.h>
-#include "sysstuff.h"
-#include "string2.h"
-#include "network.h"
-#include "smalloc.h"
-#include "nrnb.h"
-#include "main.h"
-#include "force.h"
-#include "macros.h"
-#include "names.h"
-#include "gmx_fatal.h"
-#include "txtdump.h"
-#include "typedefs.h"
-#include "update.h"
-#include "constr.h"
-#include "vec.h"
-#include "tgroup.h"
-#include "mdebin.h"
-#include "vsite.h"
-#include "force.h"
-#include "mdrun.h"
-#include "md_support.h"
-#include "sim_util.h"
-#include "domdec.h"
-#include "mdatoms.h"
-#include "ns.h"
-#include "mtop_util.h"
-#include "pme.h"
-#include "bondf.h"
-#include "gmx_omp_nthreads.h"
-#include "md_logging.h"
#include "gromacs/fileio/confio.h"
+#include "gromacs/fileio/mtxio.h"
#include "gromacs/fileio/trajectory_writing.h"
-#include "gromacs/linearalgebra/mtxio.h"
+#include "gromacs/imd/imd.h"
+#include "gromacs/legacyheaders/bonded-threading.h"
+#include "gromacs/legacyheaders/constr.h"
+#include "gromacs/legacyheaders/domdec.h"
+#include "gromacs/legacyheaders/force.h"
+#include "gromacs/legacyheaders/gmx_omp_nthreads.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/legacyheaders/md_logging.h"
+#include "gromacs/legacyheaders/md_support.h"
+#include "gromacs/legacyheaders/mdatoms.h"
+#include "gromacs/legacyheaders/mdebin.h"
+#include "gromacs/legacyheaders/mdrun.h"
+#include "gromacs/legacyheaders/names.h"
+#include "gromacs/legacyheaders/network.h"
+#include "gromacs/legacyheaders/nrnb.h"
+#include "gromacs/legacyheaders/ns.h"
+#include "gromacs/legacyheaders/pme.h"
+#include "gromacs/legacyheaders/sim_util.h"
+#include "gromacs/legacyheaders/tgroup.h"
+#include "gromacs/legacyheaders/txtdump.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/update.h"
+#include "gromacs/legacyheaders/vsite.h"
+#include "gromacs/legacyheaders/types/commrec.h"
#include "gromacs/linearalgebra/sparsematrix.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/pbcutil/mshift.h"
+#include "gromacs/pbcutil/pbc.h"
#include "gromacs/timing/wallcycle.h"
#include "gromacs/timing/walltime_accounting.h"
+#include "gromacs/topology/mtop_util.h"
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
typedef struct {
t_state s;
t_graph **graph, t_mdatoms *mdatoms, gmx_global_stat_t *gstat,
gmx_vsite_t *vsite, gmx_constr_t constr,
int nfile, const t_filenm fnm[],
- gmx_mdoutf_t *outf, t_mdebin **mdebin)
+ gmx_mdoutf_t *outf, t_mdebin **mdebin,
+ int imdport, unsigned long gmx_unused Flags,
+ gmx_wallcycle_t wcycle)
{
int i;
real dvdl_constr;
init_nrnb(nrnb);
+ /* Interactive molecular dynamics */
+ init_IMD(ir, cr, top_global, fplog, 1, state_global->x,
+ nfile, fnm, NULL, imdport, Flags);
+
if (DOMAINDECOMP(cr))
{
*top = dd_init_local_top(top_global);
/* Constrain the starting coordinates */
dvdl_constr = 0;
constrain(PAR(cr) ? NULL : fplog, TRUE, TRUE, constr, &(*top)->idef,
- ir, NULL, cr, -1, 0, mdatoms,
+ ir, NULL, cr, -1, 0, 1.0, mdatoms,
ems->s.x, ems->s.x, NULL, fr->bMolPBC, ems->s.box,
ems->s.lambda[efptFEP], &dvdl_constr,
NULL, NULL, nrnb, econqCoord, FALSE, 0, 0);
*gstat = global_stat_init(ir);
}
- *outf = init_mdoutf(fplog, nfile, fnm, 0, cr, ir, top_global, NULL);
+ *outf = init_mdoutf(fplog, nfile, fnm, 0, cr, ir, top_global, NULL, wcycle);
snew(*enerd, 1);
init_enerdata(top_global->groups.grps[egcENER].nr, ir->fepvals->n_lambda,
em_state_t *state,
t_state *state_global, rvec *f_global)
{
- int mdof_flags;
+ int mdof_flags;
+ gmx_bool bIMDout = FALSE;
+
+
+ /* Shall we do IMD output? */
+ if (ir->bIMD)
+ {
+ bIMDout = do_per_step(step, IMD_get_step(ir->imd->setup));
+ }
- if ((bX || bF || confout != NULL) && !DOMAINDECOMP(cr))
+ if ((bX || bF || bIMDout || confout != NULL) && !DOMAINDECOMP(cr))
{
copy_em_coords(state, state_global);
f_global = state->f;
{
mdof_flags |= MDOF_F;
}
+
+ /* If we want IMD output, set appropriate MDOF flag */
+ if (ir->bIMD)
+ {
+ mdof_flags |= MDOF_IMD;
+ }
+
mdoutf_write_to_trajectory_files(fplog, cr, outf, mdof_flags,
top_global, step, (double)step,
&state->s, state_global, state->f, f_global);
wallcycle_start(wcycle, ewcCONSTR);
dvdl_constr = 0;
constrain(NULL, TRUE, TRUE, constr, &top->idef,
- ir, NULL, cr, count, 0, md,
+ ir, NULL, cr, count, 0, 1.0, md,
s1->x, s2->x, NULL, bMolPBC, s2->box,
s2->lambda[efptBONDED], &dvdl_constr,
NULL, NULL, nrnb, econqCoord, FALSE, 0, 0);
}
/* Calculate long range corrections to pressure and energy */
- calc_dispcorr(fplog, inputrec, fr, count, top_global->natoms, ems->s.box, ems->s.lambda[efptVDW],
+ calc_dispcorr(inputrec, fr, top_global->natoms, ems->s.box, ems->s.lambda[efptVDW],
pres, force_vir, &prescorr, &enercorr, &dvdlcorr);
enerd->term[F_DISPCORR] = enercorr;
enerd->term[F_EPOT] += enercorr;
wallcycle_start(wcycle, ewcCONSTR);
dvdl_constr = 0;
constrain(NULL, FALSE, FALSE, constr, &top->idef,
- inputrec, NULL, cr, count, 0, mdatoms,
+ inputrec, NULL, cr, count, 0, 1.0, mdatoms,
ems->s.x, ems->f, ems->f, fr->bMolPBC, ems->s.box,
ems->s.lambda[efptBONDED], &dvdl_constr,
NULL, &shake_vir, nrnb, econqForceDispl, FALSE, 0, 0);
- if (fr->bSepDVDL && fplog)
- {
- gmx_print_sepdvdl(fplog, "Constraints", t, dvdl_constr);
- }
enerd->term[F_DVDL_CONSTR] += dvdl_constr;
m_add(force_vir, shake_vir, vir);
wallcycle_stop(wcycle, ewcCONSTR);
gmx_membed_t gmx_unused membed,
real gmx_unused cpt_period, real gmx_unused max_hours,
const char gmx_unused *deviceOptions,
+ int imdport,
unsigned long gmx_unused Flags,
gmx_walltime_accounting_t walltime_accounting)
{
init_em(fplog, CG, cr, inputrec,
state_global, top_global, s_min, &top, &f, &f_global,
nrnb, mu_tot, fr, &enerd, &graph, mdatoms, &gstat, vsite, constr,
- nfile, fnm, &outf, &mdebin);
+ nfile, fnm, &outf, &mdebin, imdport, Flags, wcycle);
/* Print to log file */
print_em_start(fplog, cr, walltime_accounting, wcycle, CG);
do_log = do_per_step(step, inputrec->nstlog);
do_ene = do_per_step(step, inputrec->nstenergy);
+
+ /* Prepare IMD energy record, if bIMD is TRUE. */
+ IMD_fill_energy_record(inputrec->bIMD, inputrec->imd, enerd, step, TRUE);
+
if (do_log)
{
print_ebin_header(fplog, step, step, s_min->s.lambda[efptFEP]);
TRUE, mdebin, fcd, &(top_global->groups), &(inputrec->opts));
}
+ /* Send energies and positions to the IMD client if bIMD is TRUE. */
+ if (do_IMD(inputrec->bIMD, step, cr, TRUE, state_global->box, state_global->x, inputrec, 0, wcycle) && MASTER(cr))
+ {
+ IMD_send_positions(inputrec->imd);
+ }
+
/* Stop when the maximum force lies below tolerance.
* If we have reached machine precision, converged is already set to true.
*/
} /* End of the loop */
+ /* IMD cleanup, if bIMD is TRUE. */
+ IMD_finalize(inputrec->bIMD, inputrec->imd);
+
if (converged)
{
step--; /* we never took that last step in this case */
gmx_membed_t gmx_unused membed,
real gmx_unused cpt_period, real gmx_unused max_hours,
const char gmx_unused *deviceOptions,
+ int imdport,
unsigned long gmx_unused Flags,
gmx_walltime_accounting_t walltime_accounting)
{
init_em(fplog, LBFGS, cr, inputrec,
state, top_global, &ems, &top, &f, &f_global,
nrnb, mu_tot, fr, &enerd, &graph, mdatoms, &gstat, vsite, constr,
- nfile, fnm, &outf, &mdebin);
+ nfile, fnm, &outf, &mdebin, imdport, Flags, wcycle);
/* Do_lbfgs is not completely updated like do_steep and do_cg,
* so we free some memory again.
*/
}
stepsize = 1.0/fnorm;
- converged = FALSE;
/* Start the loop over BFGS steps.
* Each successful step is counted, and we continue until
mdof_flags |= MDOF_F;
}
+ if (inputrec->bIMD)
+ {
+ mdof_flags |= MDOF_IMD;
+ }
+
mdoutf_write_to_trajectory_files(fplog, cr, outf, mdof_flags,
top_global, step, (real)step, state, state, f, f);
TRUE, mdebin, fcd, &(top_global->groups), &(inputrec->opts));
}
+ /* Send x and E to IMD client, if bIMD is TRUE. */
+ if (do_IMD(inputrec->bIMD, step, cr, TRUE, state->box, state->x, inputrec, 0, wcycle) && MASTER(cr))
+ {
+ IMD_send_positions(inputrec->imd);
+ }
+
/* Stop when the maximum force lies below tolerance.
* If we have reached machine precision, converged is already set to true.
*/
} /* End of the loop */
+ /* IMD cleanup, if bIMD is TRUE. */
+ IMD_finalize(inputrec->bIMD, inputrec->imd);
+
if (converged)
{
step--; /* we never took that last step in this case */
gmx_membed_t gmx_unused membed,
real gmx_unused cpt_period, real gmx_unused max_hours,
const char gmx_unused *deviceOptions,
+ int imdport,
unsigned long gmx_unused Flags,
gmx_walltime_accounting_t walltime_accounting)
{
init_em(fplog, SD, cr, inputrec,
state_global, top_global, s_try, &top, &f, &f_global,
nrnb, mu_tot, fr, &enerd, &graph, mdatoms, &gstat, vsite, constr,
- nfile, fnm, &outf, &mdebin);
+ nfile, fnm, &outf, &mdebin, imdport, Flags, wcycle);
/* Print to log file */
print_em_start(fplog, cr, walltime_accounting, wcycle, SD);
upd_mdebin(mdebin, FALSE, FALSE, (double)count,
mdatoms->tmass, enerd, &s_try->s, inputrec->fepvals, inputrec->expandedvals,
s_try->s.box, NULL, NULL, vir, pres, NULL, mu_tot, constr);
+
+ /* Prepare IMD energy record, if bIMD is TRUE. */
+ IMD_fill_energy_record(inputrec->bIMD, inputrec->imd, enerd, count, TRUE);
+
print_ebin(mdoutf_get_fp_ene(outf), TRUE,
do_per_step(steps_accepted, inputrec->nstdisreout),
do_per_step(steps_accepted, inputrec->nstorireout),
bAbort = TRUE;
}
+ /* Send IMD energies and positions, if bIMD is TRUE. */
+ if (do_IMD(inputrec->bIMD, count, cr, TRUE, state_global->box, state_global->x, inputrec, 0, wcycle) && MASTER(cr))
+ {
+ IMD_send_positions(inputrec->imd);
+ }
+
count++;
} /* End of the loop */
- /* Print some shit... */
+ /* IMD cleanup, if bIMD is TRUE. */
+ IMD_finalize(inputrec->bIMD, inputrec->imd);
+
+ /* Print some data... */
if (MASTER(cr))
{
fprintf(stderr, "\nwriting lowest energy coordinates.\n");
gmx_membed_t gmx_unused membed,
real gmx_unused cpt_period, real gmx_unused max_hours,
const char gmx_unused *deviceOptions,
+ int imdport,
unsigned long gmx_unused Flags,
gmx_walltime_accounting_t walltime_accounting)
{
state_global, top_global, state_work, &top,
&f, &f_global,
nrnb, mu_tot, fr, &enerd, &graph, mdatoms, &gstat, vsite, constr,
- nfile, fnm, &outf, NULL);
+ nfile, fnm, &outf, NULL, imdport, Flags, wcycle);
natoms = top_global->natoms;
snew(fneg, natoms);