Noro-Frenkel pair potential analysis (analphipy.norofrenkel)#

A collection of routines to analyze pair potentials using Noro-Frenkel analysis.

References

Functions:

sig_nf(phi_rep, beta, segments[, err, ...])

Noro-Frenkel/Barker-Henderson effective hard sphere diameter.

sig_nf_dbeta(phi_rep, beta, segments[, err, ...])

Derivative with respect to inverse temperature beta of sig_nf.

lam_nf(beta, sig, eps, B2)

Noro-Frenkel effective lambda parameter

lam_nf_dbeta(beta, sig, eps, lam, B2, ...)

Calculate derivative of lam_nf with respect to beta.

Classes:

NoroFrenkelPair(phi, segments, r_min, phi_min)

Class to calculate Noro-Frenkel parameters.

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. For n = 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.

  • err (bool, default False) – If True, return error value.

  • full_output (bool, default True) – If True, return full_output.

Returns:

See also

quad_segments

analphipy.norofrenkel.sig_nf_dbeta(phi_rep, beta, segments, err=False, full_output=False, **kws)[source]#

Derivative with respect to inverse temperature beta of sig_nf.

See refs [1] [2] [3]

\[\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 (sequence of int) – Integration limits. For n = 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.

  • err (bool, default False) – If True, return error value.

  • full_output (bool, default True) – If True, return full_output.

Returns:

See also

quad_segments

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:
  • beta (float) – Inverse temperature.

  • sig (float) – Particle diameter.

  • eps (float) – Energy parameter in square well potential. The convention is that eps is the same as the value of phi at the minimum.

  • B2 (float) – Second virial coefficient to match.

Returns:

lam_nf (float) – Value of lambda in an effective square well fluid which matches B2.

analphipy.norofrenkel.lam_nf_dbeta(beta, sig, eps, lam, B2, B2_dbeta, sig_dbeta)[source]#

Calculate derivative of lam_nf with respect to beta.

Parameters:
  • beta (float) – Inverse temperature.

  • sig (float) – Particle diameter.

  • eps (float) – Energy parameter in square well potential. The convention is that eps is the same as the value of phi at the minimum.

  • B2 (float) – Second virial coefficient to match.

  • lam (float) – Value from analphipy.norofrenkel.lam_nf().

  • B2_dbeta (float) – d(B2)/d(beta) at beta

  • sig_dbeta (float) – derivative of Noro-Frenkel sigma w.r.t inverse temperature at beta

Returns:

lam_nf_dbeta (float) – Value of d(lam_nf)/d(beta)

See also

lam_nf

class analphipy.norofrenkel.NoroFrenkelPair(phi, segments, r_min, phi_min, quad_kws=None)[source]#

Bases: object

Class to calculate Noro-Frenkel parameters.

See [1] [2] [3]

Parameters:
  • phi (callable()) – Potential function.

  • segments (sequence of int) – Integration limits. For n = 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, **kws)

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 to beta.

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 or ndarray) – Value of phi_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. For n = 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:
Returns:

output (object) – instance of calling class

secondvirial(beta, **kws)[source]#

Second virial coefficient.

See also

secondvirial

sig(beta, **kws)[source]#

Effective hard sphere diameter.

See also

sig_nf

eps(beta, **kws)[source]#

Effective square well epsilon.

This is equal to the minimum in phi.

lam(beta, **kws)[source]#

Effective square well lambda.

See also

lam_nf

sw_dict(beta, **kws)[source]#

Dictionary view of Noro-Frenkel parameters.

secondvirial_dbeta(beta, **kws)[source]#

Derivative of secondvirial with respect to beta.

sig_dbeta(beta, **kws)[source]#

Derivative of effective hard-sphere diameter with respect to beta.

See also

sig_nf_dbeta

lam_dbeta(beta, **kws)[source]#

Derivative of effective lambda parameter with respect to beta.

See also

lam_nf_dbeta

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.

  • props (sequence of string) – Name of methods to access.

  • key_format (string, default "{prop}") – Each key in the output dictionary will have the value key_format.format(prop=prop)

Returns:

output (dict) – dictionary of arrays.