<dt><b>dhdl-derivatives: (yes)</b></dt>
<dd>If yes (the default), the derivatives of the Hamiltonian with respect to lambda at each <b>nstdhdl</b> step are written out. These values are needed for interpolation of linear energy differences with <tt>g_bar</tt> (although the same can also be achieved with the right <b>foreign lambda</b> setting, that may not be as flexible), or with thermodynamic integration</dd>
<dt><b>dhdl-print-energy: (no)</b></dt>
-<dd> Include the total energy in the dhdl file. This information is needed for later analysis if the states of interest in the free e energy calculation are at different temperatures. If all are at the same temperature, this information is not needed.</dd>
+<dd> Include either the total or the potential energy in the dhdl file. Options are 'no', 'potential', or 'total'. This information is needed for later free energy analysis if the states of interest are at different temperatures. If all states are at the same temperature, this information is not needed. 'potential' is useful in case one is using <tt>mdrun -rerun</tt> to generate the <tt>dhdl.xvg</tt> file. When rerunning from an existing trajectory, the kinetic energy will often not be correct, and thus one must compute the residual free energy from the potential alone, with the kinetic energy component computed analytically.
+</dd>
<dt><b>separate-dhdl-file: (yes)</b></dt>
<dd><dl compact>
<dt><b>yes</b></dt>
}
if (file_version >= 79)
{
- gmx_fio_do_int(fio, fepvals->bPrintEnergy);
+ gmx_fio_do_int(fio, fepvals->edHdLPrintEnergy);
}
else
{
- fepvals->bPrintEnergy = FALSE;
+ fepvals->edHdLPrintEnergy = edHdLPrintEnergyNO;
}
/* handle lambda_neighbors */
block_bc(cr, fep->init_lambda);
block_bc(cr, fep->init_fep_state);
block_bc(cr, fep->delta_lambda);
- block_bc(cr, fep->bPrintEnergy);
+ block_bc(cr, fep->edHdLPrintEnergy);
block_bc(cr, fep->n_lambda);
if (fep->n_lambda > 0)
{
"fep-lambda", "mass-lambda", "coul-lambda", "vdw-lambda", "bonded-lambda", "restraint-lambda", "temperature-lambda", NULL
};
+const char *edHdLPrintEnergy_names[edHdLPrintEnergyNR+1] = {
+ "no", "total", "potential", "yes", NULL
+};
+
const char *elamstats_names[elamstatsNR+1] = {
"no", "metropolis-transition", "barker-transition", "minvar", "wang-landau", "weighted-wang-landau", NULL
};
}
}
PI("calc-lambda-neighbors", fep->lambda_neighbors);
- PS("dhdl-print-energy", EBOOL(fep->bPrintEnergy));
+ PS("dhdl-print-energy", edHdLPrintEnergy_names[fep->edHdLPrintEnergy]);
PR("sc-alpha", fep->sc_alpha);
PI("sc-power", fep->sc_power);
PR("sc-r-power", fep->sc_r_power);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014, 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.
nchars += 5; /* alchemical state */
}
- if (ir->fepvals->bPrintEnergy)
+ if (ir->fepvals->edHdLPrintEnergy != edHdLPrintEnergyNO)
{
nchars += 12; /* energy for dhdl */
}
{
ndh_tot += 1;
}
- if (ir->fepvals->bPrintEnergy)
+ if (ir->fepvals->edHdLPrintEnergy != edHdLPrintEnergyNO)
{
ndh_tot += 1;
}
STYPE ("temperature-lambdas", is->fep_lambda[efptTEMPERATURE], NULL);
ITYPE ("calc-lambda-neighbors", fep->lambda_neighbors, 1);
STYPE ("init-lambda-weights", is->lambda_weights, NULL);
- EETYPE("dhdl-print-energy", fep->bPrintEnergy, yesno_names);
+ EETYPE("dhdl-print-energy", fep->edHdLPrintEnergy, edHdLPrintEnergy_names);
RTYPE ("sc-alpha", fep->sc_alpha, 0.0);
ITYPE ("sc-power", fep->sc_power, 1);
RTYPE ("sc-r-power", fep->sc_r_power, 6.0);
}
}
- if (ir->bSimTemp)
+ if (fep->edHdLPrintEnergy == edHdLPrintEnergyYES)
{
- fep->bPrintEnergy = TRUE;
- /* always print out the energy to dhdl if we are doing expanded ensemble, since we need the total energy
- if the temperature is changing. */
+ fep->edHdLPrintEnergy = edHdLPrintEnergyTOTAL;
+ warning_note(wi, "Old option for dhdl-print-energy given: "
+ "changing \"yes\" to \"total\"\n");
+ }
+
+ if (ir->bSimTemp && (fep->edHdLPrintEnergy == edHdLPrintEnergyNO))
+ {
+ /* always print out the energy to dhdl if we are doing
+ expanded ensemble, since we need the total energy for
+ analysis if the temperature is changing. In some
+ conditions one may only want the potential energy, so
+ we will allow that if the appropriate mdp setting has
+ been enabled. Otherwise, total it is:
+ */
+ fep->edHdLPrintEnergy = edHdLPrintEnergyTOTAL;
}
if ((ir->efep != efepNO) || ir->bSimTemp)
extern const char *efep_names[efepNR+1];
extern const char *efpt_names[efptNR+1];
extern const char *efpt_singular_names[efptNR+1];
+extern const char *edHdLPrintEnergy_names[edHdLPrintEnergyNR+1];
extern const char *elamstats_names[elamstatsNR+1];
extern const char *elmcmove_names[elmcmoveNR+1];
extern const char *elmceq_names[elmceqNR+1];
efptFEP, efptMASS, efptCOUL, efptVDW, efptBONDED, efptRESTRAINT, efptTEMPERATURE, efptNR
};
+/* Printing the energy to the free energy dhdl file. YES is an alias to TOTAL, and
+ * will be converted in readir, so we never have to account for it in code.
+ */
+enum {
+ edHdLPrintEnergyNO, edHdLPrintEnergyTOTAL, edHdLPrintEnergyPOTENTIAL, edHdLPrintEnergyYES, edHdLPrintEnergyNR
+};
+
/* How the lambda weights are calculated:
elamstatsMETROPOLIS = using the metropolis criteria
elamstatsBARKER = using the Barker critera for transition weights - also called unoptimized Bennett
valid value if positive) */
int init_fep_state; /* the initial number of the state */
double delta_lambda; /* change of lambda per time step (fraction of (0.1) */
- gmx_bool bPrintEnergy; /* Whether to print the energy in the dhdl */
+ int edHdLPrintEnergy; /* print no, total or potential energies in dhdl */
int n_lambda; /* The number of foreign lambda points */
double **all_lambda; /* The array of all lambda values */
int lambda_neighbors; /* The number of neighboring lambda states to
nsets += 1; /*add fep state for expanded ensemble */
}
- if (fep->bPrintEnergy)
+ if (fep->edHdLPrintEnergy != edHdLPrintEnergyNO)
{
nsets += 1; /* add energy to the dhdl as well */
}
s += 1;
}
- if (fep->bPrintEnergy)
+ if (fep->edHdLPrintEnergy != edHdLPrintEnergyNO)
{
- sprintf(buf, "%s (%s)", "Energy", unit_energy);
+ switch (fep->edHdLPrintEnergy)
+ {
+ case edHdLPrintEnergyPOTENTIAL:
+ sprintf(buf, "%s (%s)", "Potential Energy", unit_energy);
+ break;
+ case edHdLPrintEnergyTOTAL:
+ case edHdLPrintEnergyYES:
+ default:
+ sprintf(buf, "%s (%s)", "Total Energy", unit_energy);
+ }
setname[s] = strdup(buf);
s += 1;
}
nsetsbegin = 0;
}
- if (fep->bPrintEnergy)
+ if (fep->edHdLPrintEnergy != edHdLPrintEnergyNO)
{
nsetsbegin += 1;
}
fprintf(md->fp_dhdl, " %4d", state->fep_state);
}
/* total energy (for if the temperature changes */
- if (fep->bPrintEnergy)
+
+ if (fep->edHdLPrintEnergy != edHdLPrintEnergyNO)
{
- store_energy = enerd->term[F_ETOT];
+ switch (fep->edHdLPrintEnergy)
+ {
+ case edHdLPrintEnergyPOTENTIAL:
+ store_energy = enerd->term[F_EPOT];
+ break;
+ case edHdLPrintEnergyTOTAL:
+ case edHdLPrintEnergyYES:
+ default:
+ store_energy = enerd->term[F_ETOT];
+ }
fprintf(md->fp_dhdl, " %#.8g", store_energy);
}
bExpanded = TRUE;
}
/* whether to print energies */
- if (ir->fepvals->bPrintEnergy)
+ if (ir->fepvals->edHdLPrintEnergy != edHdLPrintEnergyNO)
{
dhc->ndh += 1;
bEnergy = TRUE;
cmp_int(fp, "inputrec->fepvals->sc_power", -1, fep1->sc_power, fep2->sc_power);
cmp_real(fp, "inputrec->fepvals->sc_r_power", -1, fep1->sc_r_power, fep2->sc_r_power, ftol, abstol);
cmp_real(fp, "inputrec->fepvals->sc_sigma", -1, fep1->sc_sigma, fep2->sc_sigma, ftol, abstol);
- cmp_bool(fp, "inputrec->fepvals->bPrintEnergy", -1, fep1->bPrintEnergy, fep1->bPrintEnergy);
+ cmp_int(fp, "inputrec->fepvals->edHdLPrintEnergy", -1, fep1->edHdLPrintEnergy, fep1->edHdLPrintEnergy);
cmp_bool(fp, "inputrec->fepvals->bScCoul", -1, fep1->bScCoul, fep1->bScCoul);
cmp_int(fp, "inputrec->separate_dhdl_file", -1, fep1->separate_dhdl_file, fep2->separate_dhdl_file);
cmp_int(fp, "inputrec->dhdl_derivatives", -1, fep1->dhdl_derivatives, fep2->dhdl_derivatives);