Base classes (analphipy.base_potential)#
Functions:
|
Make sure segments are in correct format. |
Classes:
|
Abstract class from which base classes inherit. |
|
Base Class for creating cut potential from base potential |
|
Pair potential cut at position |
|
Pair potential cut and linear force shifted at |
|
Base class for potentials. |
- analphipy.base_potential.segments_converter(segments)[source]#
Make sure segments are in correct format.
- class analphipy.base_potential.PhiAbstract(*, r_min=None, phi_min=None, segments=None)[source]#
Bases:
objectAbstract class from which base classes inherit.
- Parameters:
r_min (
float) – Location of minimum in potential energy.phi_min (
float, optional) – Value of potential energy at minimum.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-]])
Attributes:
Position of minimum in \(\phi(r)\)
Value of
phiat minimum.Integration limits
Methods:
asdict()Convert object to dictionary.
new_like(**kws)Create a new object with optional parameters.
assign(**kws)Alias to
new_like().phi(r)Pair potential.
dphidr(r)Derivative of pair potential.
minimize(r0[, bounds])Determine position r where
phiis minimized.assign_min_numeric(r0[, bounds])Create new object with minima set by numerical minimization.
to_nf(**kws)Create a
analphipy.norofrenkel.NoroFrenkelPairobject.to_measures(**kws)Create a
analphipy.measures.Measuresobject.- r_min#
Position of minimum in \(\phi(r)\)
- phi_min#
Value of
phiat minimum.
- segments#
Integration limits
- new_like(**kws)[source]#
Create a new object with optional parameters.
- Parameters:
**kws – attribute, value pairs.
- assign(**kws)[source]#
Alias to
new_like().
- phi(r)[source]#
Pair potential.
- Parameters:
r (array-like) – pair separation
- Returns:
phi (
ndarray) – Evaluated pair potential.
- dphidr(r)[source]#
Derivative of pair potential.
This returns the value of \(d \phi(r) / dr\)
- Parameters:
r (array-like) – pair separation
- Returns:
dphidr (
ndarray) – Pair potential values.
- minimize(r0, bounds=None, **kws)[source]#
Determine position r where
phiis minimized.- Parameters:
r0 (
float) – Guess for position of minimum. If value is ‘mean’, then user0 = mean(bounds).bounds (
tupleoffloat,{'segments'}, optional) – Bounds for minimization search. If tuple, should be of formbounds=(lower_bound, upper_bound). If ‘segments, thenbounds=(segments[0], segments[-1]). If None, no bounds used.**kws – Extra arguments to
analphipy.utils.minimize_phi()
- Returns:
rmin (
float) –phi(rmin)is found location of minimum.phimin (
float) – Value ofphi(rmin), i.e., the value ofphiat the minimumoutput (
object) – Output class fromscipy.optimize.minimize().
See also
- assign_min_numeric(r0, bounds=None, **kws)[source]#
Create new object with minima set by numerical minimization.
call
minimize()
- to_nf(**kws)[source]#
Create a
analphipy.norofrenkel.NoroFrenkelPairobject.- Parameters:
**kws – Extra arguments to
analphipy.norofrenkel.NoroFrenkelPairconstructor. parameters phi, semgnets, r_min’, `phi_min default to values from self.- Returns:
- to_measures(**kws)[source]#
Create a
analphipy.measures.Measuresobject.- Parameters:
**kws – Extra arguments to
analphipy.measures.Measuresconstructor. parameters phi, semgnets default to values from self.- Returns:
- class analphipy.base_potential.PhiCutBase(phi_base, rcut, *, r_min=None, phi_min=None)[source]#
Bases:
PhiAbstractBase Class for creating cut potential from base potential
\[ \begin{align}\begin{aligned}\begin{split}\phi_{\rm cut}(r) = \begin{cases} \phi(r) + {\text _vcorrect}(r) & r < r_{\rm cut} \\ 0 & r_{\rm cut} \leq r \end{cases}\end{split}\\\begin{split}\frac{d \phi_{\rm cut}(r)}{d r} = \begin{cases} \frac{d \phi(r)}{d r} + {\text _dvdrcorrect}(r) & r < r_{\rm cut} \\ 0 & r_{\rm cut} \leq r \end{cases}\end{split}\end{aligned}\end{align} \]So, for example, for just cut, _vcorrect(r) = -v(rcut), dvrcut=0, and for lfs, _vcorrect(r) = -v(rcut) - dv(rcut)/dr (r - rcut) _dvcorrect(r) = …
- Parameters:
r_min (
float) – Location of minimum in potential energy.phi_min (
float, optional) – Value of potential energy at minimum.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-]])
Attributes:
Instance of (sub)class of
analphipy.base_potential.PhiAbstractPosition to cut the potential
Integration limits
Value of
phiat minimum.Position of minimum in \(\phi(r)\)
Methods:
phi(r)Pair potential.
dphidr(r)Derivative of pair potential.
asdict()Convert object to dictionary.
assign(**kws)Alias to
new_like().assign_min_numeric(r0[, bounds])Create new object with minima set by numerical minimization.
minimize(r0[, bounds])Determine position r where
phiis minimized.new_like(**kws)Create a new object with optional parameters.
to_measures(**kws)Create a
analphipy.measures.Measuresobject.to_nf(**kws)Create a
analphipy.norofrenkel.NoroFrenkelPairobject.- phi_base#
Instance of (sub)class of
analphipy.base_potential.PhiAbstract
- rcut#
Position to cut the potential
- segments#
Integration limits
- phi(r)[source]#
Pair potential.
- Parameters:
r (array-like) – pair separation
- Returns:
phi (
ndarray) – Evaluated pair potential.
- dphidr(r)[source]#
Derivative of pair potential.
This returns the value of \(d \phi(r) / dr\)
- Parameters:
r (array-like) – pair separation
- Returns:
dphidr (
ndarray) – Pair potential values.
- assign(**kws)[source]#
Alias to
new_like().
- assign_min_numeric(r0, bounds=None, **kws)[source]#
Create new object with minima set by numerical minimization.
call
minimize()
- minimize(r0, bounds=None, **kws)[source]#
Determine position r where
phiis minimized.- Parameters:
r0 (
float) – Guess for position of minimum. If value is ‘mean’, then user0 = mean(bounds).bounds (
tupleoffloat,{'segments'}, optional) – Bounds for minimization search. If tuple, should be of formbounds=(lower_bound, upper_bound). If ‘segments, thenbounds=(segments[0], segments[-1]). If None, no bounds used.**kws – Extra arguments to
analphipy.utils.minimize_phi()
- Returns:
rmin (
float) –phi(rmin)is found location of minimum.phimin (
float) – Value ofphi(rmin), i.e., the value ofphiat the minimumoutput (
object) – Output class fromscipy.optimize.minimize().
See also
- new_like(**kws)[source]#
Create a new object with optional parameters.
- Parameters:
**kws – attribute, value pairs.
- phi_min#
Value of
phiat minimum.
- r_min#
Position of minimum in \(\phi(r)\)
- to_measures(**kws)[source]#
Create a
analphipy.measures.Measuresobject.- Parameters:
**kws – Extra arguments to
analphipy.measures.Measuresconstructor. parameters phi, semgnets default to values from self.- Returns:
- to_nf(**kws)[source]#
Create a
analphipy.norofrenkel.NoroFrenkelPairobject.- Parameters:
**kws – Extra arguments to
analphipy.norofrenkel.NoroFrenkelPairconstructor. parameters phi, semgnets, r_min’, `phi_min default to values from self.- Returns:
- class analphipy.base_potential.PhiCut(phi_base, rcut, *, r_min=None, phi_min=None)[source]#
Bases:
PhiCutBasePair potential cut at position
r_cut.\[\begin{split}\phi_{\rm cut}(r) = \begin{cases} \phi(r) - \phi(r_{\rm cut}) & r < r_{\rm cut} \\ 0 & r_{\rm cut} \leq r \end{cases}\end{split}\]- Parameters:
phi_base (
analphipy.base_potential.PhiBaseinstance) – Potential class to perform cut on.rcut (
float) – Where to ‘cut’ the potential.r_min – The description is missing.
phi_min – The description is missing.
Methods:
asdict()Convert object to dictionary.
assign(**kws)Alias to
new_like().assign_min_numeric(r0[, bounds])Create new object with minima set by numerical minimization.
dphidr(r)Derivative of pair potential.
minimize(r0[, bounds])Determine position r where
phiis minimized.new_like(**kws)Create a new object with optional parameters.
phi(r)Pair potential.
to_measures(**kws)Create a
analphipy.measures.Measuresobject.to_nf(**kws)Create a
analphipy.norofrenkel.NoroFrenkelPairobject.Attributes:
Instance of (sub)class of
analphipy.base_potential.PhiAbstractValue of
phiat minimum.Position of minimum in \(\phi(r)\)
Position to cut the potential
Integration limits
- assign(**kws)[source]#
Alias to
new_like().
- assign_min_numeric(r0, bounds=None, **kws)[source]#
Create new object with minima set by numerical minimization.
call
minimize()
- dphidr(r)[source]#
Derivative of pair potential.
This returns the value of \(d \phi(r) / dr\)
- Parameters:
r (array-like) – pair separation
- Returns:
dphidr (
ndarray) – Pair potential values.
- minimize(r0, bounds=None, **kws)[source]#
Determine position r where
phiis minimized.- Parameters:
r0 (
float) – Guess for position of minimum. If value is ‘mean’, then user0 = mean(bounds).bounds (
tupleoffloat,{'segments'}, optional) – Bounds for minimization search. If tuple, should be of formbounds=(lower_bound, upper_bound). If ‘segments, thenbounds=(segments[0], segments[-1]). If None, no bounds used.**kws – Extra arguments to
analphipy.utils.minimize_phi()
- Returns:
rmin (
float) –phi(rmin)is found location of minimum.phimin (
float) – Value ofphi(rmin), i.e., the value ofphiat the minimumoutput (
object) – Output class fromscipy.optimize.minimize().
See also
- new_like(**kws)[source]#
Create a new object with optional parameters.
- Parameters:
**kws – attribute, value pairs.
- phi(r)[source]#
Pair potential.
- Parameters:
r (array-like) – pair separation
- Returns:
phi (
ndarray) – Evaluated pair potential.
- phi_base#
Instance of (sub)class of
analphipy.base_potential.PhiAbstract
- phi_min#
Value of
phiat minimum.
- r_min#
Position of minimum in \(\phi(r)\)
- rcut#
Position to cut the potential
- segments#
Integration limits
- to_measures(**kws)[source]#
Create a
analphipy.measures.Measuresobject.- Parameters:
**kws – Extra arguments to
analphipy.measures.Measuresconstructor. parameters phi, semgnets default to values from self.- Returns:
- to_nf(**kws)[source]#
Create a
analphipy.norofrenkel.NoroFrenkelPairobject.- Parameters:
**kws – Extra arguments to
analphipy.norofrenkel.NoroFrenkelPairconstructor. parameters phi, semgnets, r_min’, `phi_min default to values from self.- Returns:
- class analphipy.base_potential.PhiLFS(phi_base, rcut, *, r_min=None, phi_min=None)[source]#
Bases:
PhiCutBasePair potential cut and linear force shifted at
r_cut.\[\begin{split}\phi_{\rm lfs}(r) = \begin{cases} \phi(r) - \left( \frac{d \phi}{d r} \right)_{\rm cut} (r - r_{\rm cut}) - \phi(r_{\rm cut}) & r < r_{\rm cut} \\ 0 & r_{\rm cut} < r \end{cases}\end{split}\]- Parameters:
phi_base (
analphipy.base_potential.PhiAbstract)rcut (
float) – Position to cut the potential.r_min – The description is missing.
phi_min – The description is missing.
Methods:
asdict()Convert object to dictionary.
assign(**kws)Alias to
new_like().assign_min_numeric(r0[, bounds])Create new object with minima set by numerical minimization.
dphidr(r)Derivative of pair potential.
minimize(r0[, bounds])Determine position r where
phiis minimized.new_like(**kws)Create a new object with optional parameters.
phi(r)Pair potential.
to_measures(**kws)Create a
analphipy.measures.Measuresobject.to_nf(**kws)Create a
analphipy.norofrenkel.NoroFrenkelPairobject.Attributes:
Instance of (sub)class of
analphipy.base_potential.PhiAbstractValue of
phiat minimum.Position of minimum in \(\phi(r)\)
Position to cut the potential
Integration limits
- assign(**kws)[source]#
Alias to
new_like().
- assign_min_numeric(r0, bounds=None, **kws)[source]#
Create new object with minima set by numerical minimization.
call
minimize()
- dphidr(r)[source]#
Derivative of pair potential.
This returns the value of \(d \phi(r) / dr\)
- Parameters:
r (array-like) – pair separation
- Returns:
dphidr (
ndarray) – Pair potential values.
- minimize(r0, bounds=None, **kws)[source]#
Determine position r where
phiis minimized.- Parameters:
r0 (
float) – Guess for position of minimum. If value is ‘mean’, then user0 = mean(bounds).bounds (
tupleoffloat,{'segments'}, optional) – Bounds for minimization search. If tuple, should be of formbounds=(lower_bound, upper_bound). If ‘segments, thenbounds=(segments[0], segments[-1]). If None, no bounds used.**kws – Extra arguments to
analphipy.utils.minimize_phi()
- Returns:
rmin (
float) –phi(rmin)is found location of minimum.phimin (
float) – Value ofphi(rmin), i.e., the value ofphiat the minimumoutput (
object) – Output class fromscipy.optimize.minimize().
See also
- new_like(**kws)[source]#
Create a new object with optional parameters.
- Parameters:
**kws – attribute, value pairs.
- phi(r)[source]#
Pair potential.
- Parameters:
r (array-like) – pair separation
- Returns:
phi (
ndarray) – Evaluated pair potential.
- phi_base#
Instance of (sub)class of
analphipy.base_potential.PhiAbstract
- phi_min#
Value of
phiat minimum.
- r_min#
Position of minimum in \(\phi(r)\)
- rcut#
Position to cut the potential
- segments#
Integration limits
- to_measures(**kws)[source]#
Create a
analphipy.measures.Measuresobject.- Parameters:
**kws – Extra arguments to
analphipy.measures.Measuresconstructor. parameters phi, semgnets default to values from self.- Returns:
- to_nf(**kws)[source]#
Create a
analphipy.norofrenkel.NoroFrenkelPairobject.- Parameters:
**kws – Extra arguments to
analphipy.norofrenkel.NoroFrenkelPairconstructor. parameters phi, semgnets, r_min’, `phi_min default to values from self.- Returns:
- class analphipy.base_potential.PhiBase(*, r_min=None, phi_min=None, segments=None)[source]#
Bases:
PhiAbstractBase class for potentials.
- Parameters:
r_min (
float) – Location of minimum in potential energy.phi_min (
float, optional) – Value of potential energy at minimum.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-]])
Methods:
cut(rcut)Create a
PhiCutpotential.lfs(rcut)Create a
PhiLFSpotential.asdict()Convert object to dictionary.
assign(**kws)Alias to
new_like().assign_min_numeric(r0[, bounds])Create new object with minima set by numerical minimization.
dphidr(r)Derivative of pair potential.
minimize(r0[, bounds])Determine position r where
phiis minimized.new_like(**kws)Create a new object with optional parameters.
phi(r)Pair potential.
to_measures(**kws)Create a
analphipy.measures.Measuresobject.to_nf(**kws)Create a
analphipy.norofrenkel.NoroFrenkelPairobject.Attributes:
Value of
phiat minimum.Position of minimum in \(\phi(r)\)
Integration limits
- assign(**kws)[source]#
Alias to
new_like().
- assign_min_numeric(r0, bounds=None, **kws)[source]#
Create new object with minima set by numerical minimization.
call
minimize()
- dphidr(r)[source]#
Derivative of pair potential.
This returns the value of \(d \phi(r) / dr\)
- Parameters:
r (array-like) – pair separation
- Returns:
dphidr (
ndarray) – Pair potential values.
- minimize(r0, bounds=None, **kws)[source]#
Determine position r where
phiis minimized.- Parameters:
r0 (
float) – Guess for position of minimum. If value is ‘mean’, then user0 = mean(bounds).bounds (
tupleoffloat,{'segments'}, optional) – Bounds for minimization search. If tuple, should be of formbounds=(lower_bound, upper_bound). If ‘segments, thenbounds=(segments[0], segments[-1]). If None, no bounds used.**kws – Extra arguments to
analphipy.utils.minimize_phi()
- Returns:
rmin (
float) –phi(rmin)is found location of minimum.phimin (
float) – Value ofphi(rmin), i.e., the value ofphiat the minimumoutput (
object) – Output class fromscipy.optimize.minimize().
See also
- new_like(**kws)[source]#
Create a new object with optional parameters.
- Parameters:
**kws – attribute, value pairs.
- phi(r)[source]#
Pair potential.
- Parameters:
r (array-like) – pair separation
- Returns:
phi (
ndarray) – Evaluated pair potential.
- phi_min#
Value of
phiat minimum.
- r_min#
Position of minimum in \(\phi(r)\)
- segments#
Integration limits
- to_measures(**kws)[source]#
Create a
analphipy.measures.Measuresobject.- Parameters:
**kws – Extra arguments to
analphipy.measures.Measuresconstructor. parameters phi, semgnets default to values from self.- Returns:
- to_nf(**kws)[source]#
Create a
analphipy.norofrenkel.NoroFrenkelPairobject.- Parameters:
**kws – Extra arguments to
analphipy.norofrenkel.NoroFrenkelPairconstructor. parameters phi, semgnets, r_min’, `phi_min default to values from self.- Returns: