/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018,2019,2020,2021, 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.
* \param[in] dimParams The dimension parameters.
* \param[in] grid The bias grid.
*/
- BiasState(const AwhBiasParams& awhBiasParams,
- double histogramSizeInitial,
- const std::vector<DimParams>& dimParams,
- const BiasGrid& grid);
+ BiasState(const AwhBiasParams& awhBiasParams,
+ double histogramSizeInitial,
+ ArrayRef<const DimParams> dimParams,
+ const BiasGrid& grid);
/*! \brief
* Restore the bias state from history.
* \param[in] grid The grid.
* \param[in,out] convolvedPmf Array returned will be of the same length as the AWH grid to store the convolved PMF in.
*/
- void calcConvolvedPmf(const std::vector<DimParams>& dimParams,
- const BiasGrid& grid,
- std::vector<float>* convolvedPmf) const;
+ void calcConvolvedPmf(ArrayRef<const DimParams> dimParams,
+ const BiasGrid& grid,
+ std::vector<float>* convolvedPmf) const;
/*! \brief
* Convolves the PMF and sets the initial free energy to its convolution.
* \param[in] dimParams The bias dimensions parameters
* \param[in] grid The bias grid.
*/
- void setFreeEnergyToConvolvedPmf(const std::vector<DimParams>& dimParams, const BiasGrid& grid);
+ void setFreeEnergyToConvolvedPmf(ArrayRef<const DimParams> dimParams, const BiasGrid& grid);
/*! \brief
* Normalize the PMF histogram.
* \param[in] filename Name of file to read PMF and target from.
* \param[in] numBias The number of biases.
*/
- void initGridPointState(const AwhBiasParams& awhBiasParams,
- const std::vector<DimParams>& dimParams,
- const BiasGrid& grid,
- const BiasParams& params,
- const std::string& filename,
- int numBias);
+ void initGridPointState(const AwhBiasParams& awhBiasParams,
+ ArrayRef<const DimParams> dimParams,
+ const BiasGrid& grid,
+ const BiasParams& params,
+ const std::string& filename,
+ int numBias);
/*! \brief
* Performs statistical checks on the collected histograms and warns if issues are detected.
* \param[in,out] force Force vector to set.
* Returns the umbrella potential.
*/
- double calcUmbrellaForceAndPotential(const std::vector<DimParams>& dimParams,
- const BiasGrid& grid,
- int point,
- ArrayRef<const double> neighborLambdaDhdl,
- gmx::ArrayRef<double> force) const;
+ double calcUmbrellaForceAndPotential(ArrayRef<const DimParams> dimParams,
+ const BiasGrid& grid,
+ int point,
+ ArrayRef<const double> neighborLambdaDhdl,
+ ArrayRef<double> force) const;
/*! \brief
* Calculates and sets the convolved force acting on the coordinate.
* \param[in] forceWorkBuffer Force work buffer, values only used internally.
* \param[in,out] force Bias force vector to set.
*/
- void calcConvolvedForce(const std::vector<DimParams>& dimParams,
- const BiasGrid& grid,
- gmx::ArrayRef<const double> probWeightNeighbor,
- ArrayRef<const double> neighborLambdaDhdl,
- gmx::ArrayRef<double> forceWorkBuffer,
- gmx::ArrayRef<double> force) const;
+ void calcConvolvedForce(ArrayRef<const DimParams> dimParams,
+ const BiasGrid& grid,
+ ArrayRef<const double> probWeightNeighbor,
+ ArrayRef<const double> neighborLambdaDhdl,
+ ArrayRef<double> forceWorkBuffer,
+ ArrayRef<double> force) const;
/*! \brief
* Move the center point of the umbrella potential.
* force and potential.
* \returns the new potential value.
*/
- double moveUmbrella(const std::vector<DimParams>& dimParams,
- const BiasGrid& grid,
- gmx::ArrayRef<const double> probWeightNeighbor,
- ArrayRef<const double> neighborLambdaDhdl,
- gmx::ArrayRef<double> biasForce,
- int64_t step,
- int64_t seed,
- int indexSeed,
- bool onlySampleUmbrellaGridpoint);
+ double moveUmbrella(ArrayRef<const DimParams> dimParams,
+ const BiasGrid& grid,
+ ArrayRef<const double> probWeightNeighbor,
+ ArrayRef<const double> neighborLambdaDhdl,
+ ArrayRef<double> biasForce,
+ int64_t step,
+ int64_t seed,
+ int indexSeed,
+ bool onlySampleUmbrellaGridpoint);
private:
/*! \brief
* \param[in] multiSimComm Struct for multi-simulation communication.
* \returns true if covered.
*/
- bool isSamplingRegionCovered(const BiasParams& params,
- const std::vector<DimParams>& dimParams,
- const BiasGrid& grid,
- const t_commrec* commRecord,
- const gmx_multisim_t* multiSimComm) const;
+ bool isSamplingRegionCovered(const BiasParams& params,
+ ArrayRef<const DimParams> dimParams,
+ const BiasGrid& grid,
+ const t_commrec* commRecord,
+ const gmx_multisim_t* multiSimComm) const;
/*! \brief
* Return the new reference weight histogram size for the current update.
* \param[in,out] fplog Log file.
* \param[in,out] updateList Work space to store a temporary list.
*/
- void updateFreeEnergyAndAddSamplesToHistogram(const std::vector<DimParams>& dimParams,
- const BiasGrid& grid,
- const BiasParams& params,
- const t_commrec* commRecord,
- const gmx_multisim_t* ms,
- double t,
- int64_t step,
- FILE* fplog,
- std::vector<int>* updateList);
+ void updateFreeEnergyAndAddSamplesToHistogram(ArrayRef<const DimParams> dimParams,
+ const BiasGrid& grid,
+ const BiasParams& params,
+ const t_commrec* commRecord,
+ const gmx_multisim_t* ms,
+ double t,
+ int64_t step,
+ FILE* fplog,
+ std::vector<int>* updateList);
/*! \brief
* Update the probability weights and the convolved bias.
* \returns the convolved bias.
*/
- double updateProbabilityWeightsAndConvolvedBias(const std::vector<DimParams>& dimParams,
- const BiasGrid& grid,
+ double updateProbabilityWeightsAndConvolvedBias(ArrayRef<const DimParams> dimParams,
+ const BiasGrid& grid,
ArrayRef<const double> neighborLambdaEnergies,
std::vector<double, AlignedAllocator<double>>* weight) const;
* \param[in] grid The grid.
* \param[in] probWeightNeighbor Probability weights of the neighbors.
*/
- void sampleProbabilityWeights(const BiasGrid& grid, gmx::ArrayRef<const double> probWeightNeighbor);
+ void sampleProbabilityWeights(const BiasGrid& grid, ArrayRef<const double> probWeightNeighbor);
/*! \brief
* Sample the reaction coordinate and PMF for future updates or analysis.
*/
void sampleCoordAndPmf(const std::vector<DimParams>& dimParams,
const BiasGrid& grid,
- gmx::ArrayRef<const double> probWeightNeighbor,
+ ArrayRef<const double> probWeightNeighbor,
double convolvedBias);
/*! \brief
* Calculates the convolved bias for a given coordinate value.
* \param[in] coordValue Coordinate value.
* \returns the convolved bias >= -GMX_FLOAT_MAX.
*/
- double calcConvolvedBias(const std::vector<DimParams>& dimParams,
- const BiasGrid& grid,
- const awh_dvec& coordValue) const;
+ double calcConvolvedBias(ArrayRef<const DimParams> dimParams,
+ const BiasGrid& grid,
+ const awh_dvec& coordValue) const;
/*! \brief
* Fills the given array with PMF values.
*
* \param[out] pmf Array(ref) to be filled with the PMF values, should have the same size as the bias grid.
*/
- void getPmf(gmx::ArrayRef<float> /*pmf*/) const;
+ void getPmf(ArrayRef<float> /*pmf*/) const;
/*! \brief Returns the current coordinate state.
*/