Ideal gas reference (idealgas
)#
Analytic ideal gas in 1D in an external field. The position, \(x\), may vary from \(0 \leq x \leq L\), with the field acting linearly on \(x\), \(U(x) = a x\), where for simplicity we let \(a=1\). As a result, the potential energy of a system of \(N\) particles with positions \(x_1, x_2, ... x_N\) is the sum of the positions, \(U = \sum_{i=1}^N x_i\). This is a useful test system with analytical solutions coded alongside the ability to randomly generate data.
Functions:
|
Analytical derivative of order k w.r.t. |
Analytical derivative of order k w.r.t. |
|
Analytical derivative of order k w.r.t. |
|
Analytical derivative of order k w.r.t. |
|
|
Analytical derivative of order k w.r.t. |
|
Generates data points in specified shape, where the first index is the number of samples and the second is the number of independent IG particles Sample will be at beta with L=vol Returns tuple of the particle positions in each configuration and the potential energy of each sampled configuration. |
|
In the large-N limit, the probability of the potential energy is Normal, so provides that. |
|
Samples potential energy values from a system. |
|
Average position x at the inverse temperature beta. |
|
Analytical extrapolation and coefficients from beta0 to beta (at L=vol) using derivatives up to order |
|
Same as x_beta_extrap but for <beta*x>. |
|
Same as x_beta_extrap but with -ln<beta*x>. |
|
Same as x_beta_extrap but with -ln<x>. |
|
Cumulative probability density for position x for single particle. |
|
Canonical probability of position x for single article at inverse temperature beta. |
|
Sample positions from distribution at beta and vol. |
|
Variance in position, x at the inverse temperature beta. |
|
Analytical extrapolation coefficients from vol0 to vol (at beta) using derivatives up to order |
- thermoextrap.idealgas.dbeta_xave(k)[source]#
Analytical derivative of order k w.r.t. beta for the average of x.
Returns sympy function with expression for derivative.
- thermoextrap.idealgas.dbeta_xave_depend(k)[source]#
Analytical derivative of order k w.r.t. beta for the average of beta*x
Returns sympy function with expression for derivative.
Note that this is also the average dimensionless potential energy for a single particle And since particles are independent, can just multiply by N for a system of N particles
- thermoextrap.idealgas.dbeta_xave_depend_minuslog(k)[source]#
Analytical derivative of order k w.r.t. beta for -ln(<beta*x>)
Returns sympy function with expression for derivative.
- thermoextrap.idealgas.dbeta_xave_minuslog(k)[source]#
Analytical derivative of order k w.r.t. beta for -ln(<x>)
Returns sympy function with expression for derivative.
- thermoextrap.idealgas.dvol_xave(k)[source]#
Analytical derivative of order k w.r.t. L for average x
Returns sympy function with expression for derivative.
- thermoextrap.idealgas.generate_data(shape, beta, vol=1.0, rng=None)[source]#
Generates data points in specified shape, where the first index is the number of samples and the second is the number of independent IG particles Sample will be at beta with L=vol Returns tuple of the particle positions in each configuration and the potential energy of each sampled configuration.
r may be specified as an array of random numbers instead of shape
- thermoextrap.idealgas.u_prob(u, npart, beta, vol=1.0)[source]#
In the large-N limit, the probability of the potential energy is Normal, so provides that.
- thermoextrap.idealgas.u_sample(shape, beta, vol=1.0, rng=None)[source]#
Samples potential energy values from a system.
Note that
shape = (nsamp, npart)
Particle positions are randomly sampled withx_sample()
at beta to generate the configuration of the potential energy.
- thermoextrap.idealgas.x_ave(beta, vol=1.0)[source]#
Average position x at the inverse temperature beta.
- thermoextrap.idealgas.x_beta_extrap(order, beta0, beta, vol=1.0)[source]#
Analytical extrapolation and coefficients from beta0 to beta (at L=vol) using derivatives up to order
Returns extrapolation as first output and unnormalized coefficients as second.
- thermoextrap.idealgas.x_beta_extrap_depend(order, beta0, beta, vol=1.0)[source]#
Same as x_beta_extrap but for <beta*x>.
- thermoextrap.idealgas.x_beta_extrap_depend_minuslog(order, beta0, beta, vol=1.0)[source]#
Same as x_beta_extrap but with -ln<beta*x>.
- thermoextrap.idealgas.x_beta_extrap_minuslog(order, beta0, beta, vol=1.0)[source]#
Same as x_beta_extrap but with -ln<x>.
- thermoextrap.idealgas.x_cdf(x, beta, vol=1.0)[source]#
Cumulative probability density for position x for single particle.
- thermoextrap.idealgas.x_prob(x, beta, vol=1.0)[source]#
Canonical probability of position x for single article at inverse temperature beta.
- thermoextrap.idealgas.x_sample(shape, beta, vol=1.0, rng=None)[source]#
Sample positions from distribution at beta and vol.
Does sampling based on inversion of cumulative distribution function.
- Parameters:
- Returns:
output (
ndarray
) – Random sample from distribution.
Notes
If pass
r
, then use these to buildoutput
. Otherwise, build random array of shapeshape
.
- thermoextrap.idealgas.x_var(beta, vol=1.0)[source]#
Variance in position, x at the inverse temperature beta.