Noro-Frenkel pair potential analysis (analphipy.norofrenkel
)#
A collection of routines to analyze pair potentials using Noro-Frenkel analysis.
References
Classes:
|
Class to calculate Noro-Frenkel parameters. |
Functions:
|
Noro-Frenkel effective lambda parameter |
|
Calculate derivative of |
|
Noro-Frenkel/Barker-Henderson effective hard sphere diameter. |
|
Derivative with respect to inverse temperature |
- class analphipy.norofrenkel.NoroFrenkelPair(phi, segments, r_min, phi_min, quad_kws=None)[source]#
Bases:
object
Class to calculate Noro-Frenkel parameters.
- Parameters:
phi (
callable()
) – Potential function.segments (sequence of
int
) – Integration limits. Forn = len(segments)
integration will be performed over ranges(segments[0], segments[1]), (segments[1], segments[2]), ..., (segments[n-2], segments[n-]])
r_min (
float
) – Location of minimum in potential energy.phi_min (
float
, optional) – Value of potential energy at minimum.quad_kws (mapping, optional) – Extra arguments to
analphipy.utils.quad_segments()
Methods:
phi_rep
(r)Repulsive part of potential.
from_phi
(phi, segments[, r_min, bounds, ...])Create object from pair potential function.
from_phi_class
(phi[, r_min, bounds, quad_kws])Create object, trying to use pre computed values for
r_min
,phi_min
.secondvirial
(beta, **kws)Second virial coefficient.
sig
(beta, **kws)Effective hard sphere diameter.
eps
([beta])Effective square well epsilon.
lam
(beta, **kws)Effective square well lambda.
sw_dict
(beta, **kws)Dictionary view of Noro-Frenkel parameters.
secondvirial_dbeta
(beta, **kws)Derivative of
secondvirial
with respect tobeta
.sig_dbeta
(beta, **kws)Derivative of effective hard-sphere diameter with respect to
beta
.lam_dbeta
(beta, **kws)Derivative of effective lambda parameter with respect to
beta
.secondvirial_sw
(beta, **kws)Second virial coefficient of effective square well fluid.
B2
(beta, **kws)Alias to
secondvirial()
.B2_dbeta
(beta, **kws)Alias to
secondvirial_dbeta()
.B2_sw
(beta, **kws)Alias to
secondvirial_sw()
.table
(betas[, props, key_format])Create a dictionary of outputs for multiple values of inverse temperature
beta
.- phi_rep(r)[source]#
Repulsive part of potential.
This is the Weeks-Chandler-Anderson decomposition.
- Parameters:
r (
float
or array-like) – Pair separation distance(s).- Returns:
output (
float
orndarray
) – Value ofphi_ref
at separation(s)r
.
- classmethod from_phi(phi, segments, r_min=None, bounds=None, quad_kws=None, **kws)[source]#
Create object from pair potential function.
- Parameters:
phi (
callable()
) – Potential function.segments (sequence of
int
) – Integration limits. Forn = len(segments)
integration will be performed over ranges(segments[0], segments[1]), (segments[1], segments[2]), ..., (segments[n-2], segments[n-]])
r_min (
float
, optional) – Optional guess for numerically finding minimum in phi.bounds (array-like, optional) – Optional bounds for numerically locating
r_min
.quad_kws (mapping, optional) – Optional arguments to
analphipy.utils.quad_segments()
.**kws – Extra arguments to
analphipy.utils.minimize_phi()
.
- Returns:
output (
object
) – instance of calling class
- classmethod from_phi_class(phi, r_min=None, bounds=None, quad_kws=None, **kws)[source]#
Create object, trying to use pre computed values for
r_min
,phi_min
.- Parameters:
r_min (
float
, optional) – Optional guess for numerically finding minimum in phi.bounds (array-like, optional) – Optional bounds for numerically locating
r_min
.quad_kws (mapping, optional) – Optional arguments to
analphipy.utils.quad_segments()
.**kws – Extra arguments to
analphipy.utils.minimize_phi()
.
- Returns:
output (
object
) – instance of calling class
- sig_dbeta(beta, **kws)[source]#
Derivative of effective hard-sphere diameter with respect to
beta
.See also
- lam_dbeta(beta, **kws)[source]#
Derivative of effective lambda parameter with respect to
beta
.See also
- secondvirial_sw(beta, **kws)[source]#
Second virial coefficient of effective square well fluid.
For testing. This should be the same of value from
secondvirial()
- B2(beta, **kws)[source]#
Alias to
secondvirial()
.
- B2_dbeta(beta, **kws)[source]#
Alias to
secondvirial_dbeta()
.
- B2_sw(beta, **kws)[source]#
Alias to
secondvirial_sw()
.
- table(betas, props=None, key_format='{prop}', **kws)[source]#
Create a dictionary of outputs for multiple values of inverse temperature
beta
.- Parameters:
betas (array-like) – Array of values of inverse temperature
beta
.key_format (
string
, default"{prop}"
) – Each key in the output dictionary will have the valuekey_format.format(prop=prop)
- Returns:
output (
dict
) – dictionary of arrays.
- analphipy.norofrenkel.lam_nf(beta, sig, eps, B2)[source]#
Noro-Frenkel effective lambda parameter
This is the value of \(\lambda\) in a square well potential which matches second virial coefficients. The square well fluid is defined as [1]
\[\begin{split}\phi_{\rm sw}(r) = \begin{cases} \infty & r \leq \sigma \\ \epsilon & \sigma < r \leq \lambda \sigma \\ 0 & r > \lambda \sigma \end{cases}\end{split}\]- Parameters:
- Returns:
lam_nf (
float
) – Value of lambda in an effective square well fluid which matchesB2
.
- analphipy.norofrenkel.lam_nf_dbeta(beta, sig, eps, lam, B2, B2_dbeta, sig_dbeta)[source]#
Calculate derivative of
lam_nf
with respect tobeta
.- Parameters:
beta (
float
) – Inverse temperature.sig (
float
) – Particle diameter.eps (
float
) – Energy parameter in square well potential. The convention is thateps
is the same as the value ofphi
at the minimum.B2 (
float
) – Second virial coefficient to match.lam (
float
) – Value fromanalphipy.norofrenkel.lam_nf()
.B2_dbeta (
float
) – d(B2)/d(beta) atbeta
sig_dbeta (
float
) – derivative of Noro-Frenkel sigma w.r.t inverse temperature at beta
- Returns:
lam_nf_dbeta (
float
) – Value ofd(lam_nf)/d(beta)
See also
- analphipy.norofrenkel.sig_nf(phi_rep, beta, segments, err=False, full_output=False, **kws)[source]#
Noro-Frenkel/Barker-Henderson effective hard sphere diameter.
This is calculated using the formula [1] [2]
\[\sigma_{{\rm BH}}(\beta) = \int_0^{{\infty}} dr \left( 1 - \exp[-\beta \phi_{{\rm rep}}(r)]\right)\]where \(\phi_{{\rm rep}}(r)\) is the repulsive part of the potential [3].
- Parameters:
phi_rep (
callable()
) – Repulsive part of pair potential.beta (
float
) – Inverse temperature.segments (sequence of
int
) – Integration limits. Forn = len(segments)
integration will be performed over ranges(segments[0], segments[1]), (segments[1], segments[2]), ..., (segments[n-2], segments[n-]])
phi_rep (
callable()
) – Repulsive part of pair potential.beta (
float
) – Inverse temperature.segments (array-like) – Integration segments.
full_output (
bool
, defaultTrue
) – If True, return full_output.
- Returns:
See also
- analphipy.norofrenkel.sig_nf_dbeta(phi_rep, beta, segments, err=False, full_output=False, **kws)[source]#
Derivative with respect to inverse temperature
beta
ofsig_nf
.\[\frac{d \sigma_{\rm BH}}{d\beta} = \int_0^{\infty} dr \phi_{\rm rep}(r) \exp[-\beta \phi_{\rm rep}(r)]\]- Parameters:
phi_rep (
callable()
) – Repulsive part of pair potential.beta (
float
) – Inverse temperature.segments (array-like) – Integration segments.
full_output (
bool
, defaultTrue
) – If True, return full_output.**kws – The description is missing.
- Returns:
See also