#include <string>
#include "gromacs/applied_forces/awh/awh.h"
+#include "gromacs/applied_forces/awh/read_params.h"
#include "gromacs/fileio/enxio.h"
#include "gromacs/fileio/gmxfio.h"
#include "gromacs/fileio/xvgr.h"
//! \}
+static bool haveFepLambdaMoves(const t_inputrec& inputrec)
+{
+ return (inputrec.bExpanded && inputrec.expandedvals->elmcmove > LambdaMoveCalculation::No)
+ || (inputrec.efep != FreeEnergyPerturbationType::No && inputrec.bDoAwh
+ && awhHasFepLambdaDimension(*inputrec.awhParams));
+}
+
namespace gmx
{
bool isRerun,
const StartingBehavior startingBehavior,
const bool simulationsShareState,
- const MDModulesNotifiers& mdModulesNotifiers)
+ const MDModulesNotifiers& mdModulesNotifiers) :
+ haveFepLambdaMoves_(haveFepLambdaMoves(inputrec))
{
const char* ener_nm[F_NRE];
static const char* vir_nm[] = { "Vir-XX", "Vir-XY", "Vir-XZ", "Vir-YX", "Vir-YY",
FILE* fp;
const char *dhdl = "dH/d\\lambda", *deltag = "\\DeltaH", *lambda = "\\lambda",
*lambdastate = "\\lambda state";
- int i, nsets, nsets_de, nsetsbegin;
- int n_lambda_terms = 0;
- t_lambda* fep = ir->fepvals.get(); /* for simplicity */
- t_expanded* expand = ir->expandedvals.get();
- char lambda_vec_str[STRLEN], lambda_name_str[STRLEN];
+ int i, nsets, nsets_de, nsetsbegin;
+ int n_lambda_terms = 0;
+ t_lambda* fep = ir->fepvals.get(); /* for simplicity */
+ char lambda_vec_str[STRLEN], lambda_name_str[STRLEN];
int nsets_dhdl = 0;
int s = 0;
buf = gmx::formatString("T = %g (K) ", ir->opts.ref_t[0]);
}
if ((ir->efep != FreeEnergyPerturbationType::SlowGrowth)
- && (ir->efep != FreeEnergyPerturbationType::Expanded))
+ && (ir->efep != FreeEnergyPerturbationType::Expanded)
+ && !(ir->bDoAwh && awhHasFepLambdaDimension(*ir->awhParams)))
{
if ((fep->init_lambda >= 0) && (n_lambda_terms == 1))
{
nsets = nsets_dhdl + nsets_de; /* dhdl + fep differences */
- if (fep->n_lambda > 0 && (expand->elmcmove > LambdaMoveCalculation::No))
+ if (haveFepLambdaMoves(*ir))
{
nsets += 1; /*add fep state for expanded ensemble */
}
}
std::vector<std::string> setname(nsetsextend);
- if (expand->elmcmove > LambdaMoveCalculation::No)
+ if (haveFepLambdaMoves(*ir))
{
/* state for the fep_vals, if we have alchemical sampling */
setname[s++] = "Thermodynamic state";
* from this xvg legend.
*/
- if (expand->elmcmove > LambdaMoveCalculation::No)
+ if (haveFepLambdaMoves(*ir))
{
nsetsbegin = 1; /* for including the expanded ensemble */
}
real tmass,
const gmx_enerdata_t* enerd,
const t_lambda* fep,
- const t_expanded* expand,
const matrix box,
PTCouplingArrays ptCouplingArrays,
int fep_state,
/* the current free energy state */
/* print the current state if we are doing expanded ensemble */
- if (expand->elmcmove > LambdaMoveCalculation::No)
+ if (haveFepLambdaMoves_)
{
fprintf(fp_dhdl_, " %4d", fep_state);
}
struct gmx_output_env_t;
struct pull_t;
struct t_ebin;
-struct t_expanded;
struct t_fcdata;
struct t_grpopts;
struct t_inputrec;
* \param[in] tmass Total mass
* \param[in] enerd Energy data object.
* \param[in] fep FEP data.
- * \param[in] expand Expanded ensemble (for FEP).
* \param[in] lastbox PBC data.
* \param[in] ptCouplingArrays Arrays connected to pressure and temperature coupling.
* \param[in] fep_state The current alchemical state we are in.
real tmass,
const gmx_enerdata_t* enerd,
const t_lambda* fep,
- const t_expanded* expand,
const matrix lastbox,
PTCouplingArrays ptCouplingArrays,
int fep_state,
//! The dhdl.xvg output file
FILE* fp_dhdl_ = nullptr;
+ //! Whether the free-energy lambda moves dynamically between lambda states
+ bool haveFepLambdaMoves_;
//! Energy components for dhdl.xvg output
std::vector<double> dE_;
//! The delta U components (raw data + histogram)