GibbsInitialize

class GibbsInitialize : public feasst::Modify

This class attempts to initialize a Gibbs simuilation. Here we refer to the low density as vapor and high density as liquid. The number of particles and volume in the liquid is N_L and V_L, while N_V and V_V are in the vapor. Because the densities of the vapor and liquid may be unknown at the start of a simulation, this class attempts to add/remove volume or particles from the lower density configuration to obtain two target conditions.

The equations are as follows:

\(N = \rho_V V_V + \rho_L V_L\)

\(V = V_V + V_L\)

This is two equations with four unknowns. Therefore, we should introduce two constraints.

The first constraint is that a given fraction of the total number of particles should be in the vapor phase. This leads to an equation as follows:

\(\rho_V V_V = f N\),

where f is the given fraction in this example. This sets the relative size of the two configurations.

The second constraint is that the number of particles will remain fixed. In this case,

\(V_L = N(1-f)/\rho_L\)

\(V_V = Nf/\rho_v\)

and the low density Configuration is adjusted yield the predicted total volume.

When all constraints pass within their given tolerance, the Criteria is set to complete to allow for production simulations.

Public Functions

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

Return the header for writing.

void initialize(MonteCarlo *mc)

Initialize and precompute before trials.

void update(MonteCarlo *mc)

Perform update.

std::string write(MonteCarlo *mc)

Perform write.

Arguments

  • particle_type: type of particle to consider density (default: 0).

  • fraction_particles_low_density: fractional amount of particles in the low density phase (default: 0.15).

  • fraction_particles_low_density_tolerane: tolerance on the fractional amount of particles in the low density phase (default: 0.05). When all tolerances are achieved, the Criteria is set to complete.

  • updates_density_equil: number of updates before computing average density (default: 1e7).

  • updates_per_adjust: number of updates per adjustment (default: 2e7).