};
/*! \brief All meta-data that is shared for all output files for one bias */
-class BiasReader
+struct BiasOutputSetup
{
- public:
- //! Constructor.
- BiasReader(int subblockStart,
- std::unique_ptr<OutputFile> awhOutputFile,
- std::unique_ptr<OutputFile> frictionOutputFile) :
- subblockStart_(subblockStart),
- awhOutputFile_(std::move(awhOutputFile)),
- frictionOutputFile_(std::move(frictionOutputFile))
- {
- }
+ //! Constructor.
+ BiasOutputSetup(int subblockStart,
+ std::unique_ptr<OutputFile> awhOutputFile,
+ std::unique_ptr<OutputFile> frictionOutputFile) :
+ subblockStart_(subblockStart),
+ awhOutputFile_(std::move(awhOutputFile)),
+ frictionOutputFile_(std::move(frictionOutputFile))
+ {
+ }
- //! Return the AWH output file data.
- const OutputFile &awhOutputFile() const
- {
- GMX_RELEASE_ASSERT(awhOutputFile_ != nullptr, "awhOutputFile() called without initialized AWH output file");
+ //! Return the AWH output file data.
+ const OutputFile &awhOutputFile() const
+ {
+ GMX_RELEASE_ASSERT(awhOutputFile_ != nullptr, "awhOutputFile() called without initialized AWH output file");
- return *awhOutputFile_.get();
- }
+ return *awhOutputFile_.get();
+ }
- //! Return the a pointer to the friction output file data, can return nullptr
- const OutputFile *frictionOutputFile() const
- {
- return frictionOutputFile_.get();
- }
+ //! Return the a pointer to the friction output file data, can return nullptr
+ const OutputFile *frictionOutputFile() const
+ {
+ return frictionOutputFile_.get();
+ }
- //! Return the starting subblock.
- int subblockStart() const
- {
- return subblockStart_;
- }
+ //! Return the starting subblock.
+ int subblockStart() const
+ {
+ return subblockStart_;
+ }
private:
const int subblockStart_; /**< The start index of the subblocks to read. */
const gmx_output_env_t *oenv) const;
private:
- std::vector<BiasReader> biasReader_; /**< The readers, one for each AWH bias. */
+ std::vector<BiasOutputSetup> biasOutputSetups_; /**< The output setups, one for each AWH bias. */
public:
- const real kT_; /**< kB*T in kJ/mol. */
+ const real kT_; /**< kB*T in kJ/mol. */
};
namespace
frictionOutputFile->initializeFrictionOutputFile(subblockStart, numSubBlocks, awhBiasParams, energyUnit, kT);
}
- biasReader_.emplace_back(BiasReader(subblockStart,
- std::move(awhOutputFile),
- std::move(frictionOutputFile)));
+ biasOutputSetups_.emplace_back(BiasOutputSetup(subblockStart,
+ std::move(awhOutputFile),
+ std::move(frictionOutputFile)));
subblockStart += numSubBlocks;
}
{
/* We look for AWH data every energy frame and count the no of AWH frames found. We only extract every 'skip' AWH frame. */
- for (auto &biasReader : biasReader_)
+ for (const auto &setup : biasOutputSetups_)
{
- const int subStart = biasReader.subblockStart();
+ const int subStart = setup.subblockStart();
/* Each frame and AWH instance extracted generates one xvg file. */
{
- const OutputFile &awhOutputFile = biasReader.awhOutputFile();
+ const OutputFile &awhOutputFile = setup.awhOutputFile();
FILE *fpAwh = awhOutputFile.openBiasOutputFile(time, oenv);
gmx_ffclose(fpAwh);
}
- const OutputFile *frictionOutputFile = biasReader.frictionOutputFile();
+ const OutputFile *frictionOutputFile = setup.frictionOutputFile();
if (frictionOutputFile != nullptr)
{
FILE *fpFriction = frictionOutputFile->openBiasOutputFile(time, oenv);