HenryCoefficient

class HenryCoefficient : public feasst::Analyze

Attempts TrialAdd, where all attempts are AlwaysReject ed. Assumes there is only one Trial, TrialAdd. Accumulates \(\langle e^{-\beta \Delta U}\rangle\), where \(\Delta U\) is the energy contribution of the attempt to add the particle.

The purpose of this Analyze class is to enable computation of the Henry’s Law constant for an adsorbate particle in a static medium. (The medium could be a porous material, hard confinment, position-dependent potential, frozen configuration of other particles, etc.)

Optionally, when the num_beta_taylor argument is specified (see below), HenryCoefficient also measures the averages:

\( K_j = \frac{\langle (-\Delta U)^j ~ e^{-\beta \Delta U}\rangle}{j!} \)

\( Q_j = \frac{\langle (-\Delta U)^j ~ e^{-2 \beta \Delta U}\rangle}{j! ~ j!} \)

These quantities may be used to extrapolate the HenryCoefficient in beta space using a Taylor-series expansion. See Siderius et al.[1] for background information and derivation of the listed terms.

When num_beta_taylor is specified, the output file of HenryCoefficient includes a JSON-formatted dictionary in the file header that stores relevant output:

  • beta_taylor contains \(K_j\) as a list for \(0 \leq j \leq\) num_beta_taylor.

  • beta_taylor2 contains \(Q_j\) as a list for \(0 \leq j \leq\) 2 num_beta_taylor.

  • beta stores the inverse temperature.

  • num_trials records the number of trial insertions.

\(Q_j\) is used for computation of the covariance matrix of the extrapolation coefficients, e.g.,

\(\textrm{cov} \left( K_j, K_l \right) = \frac{N_{mc}}{N_{mc}-1} \left( Q_{j+l} \frac{(j+l)! ~ (j+l)!}{j! ~ l!} - K_j \cdot K_l \right)\)

where \(N_{mc}\) is the number of test insertions (equal to num_trials in the output dictionary). The covariance matrix enable estimation of the uncertainty in an extrapolation function built from the Taylor-series expansion.

References:

Arguments

  • num_beta_taylor: number of derivatives of second virial ratio with respect to beta. (default: 0).

  • write_precision: number of decimals in writing taylor coefficients (default: 8).

  • Stepper arguments.

Public Functions

int num_beta_taylor() const

Return the number of beta derivatives, starting with 1.

std::string header(const MonteCarlo &mc) const

Return the header for writing.

void initialize(MonteCarlo *mc)

Initialize and precompute before trials.

void update(const MonteCarlo &mc)

Perform update action.

std::string write(const MonteCarlo &mc)

Perform write action.