pyPRISM.core.PRISM module¶
-
class
pyPRISM.core.PRISM.
PRISM
(sys)[source]¶ Bases:
object
Primary container for a storing a PRISM calculation
Each pyPRISM.PRISM object serves as an encapsulation of a fully specified PRISM problem including all inputs needed for the calculation and the function to be numerically minimized.
-
domain
¶ The Domain object fully specifies the Real- and Fourier- space solution grids.
Type: pyPRISM.Domain
-
directCorr
¶ The direct correlation function for all pairs of site types
Type: pyPRISM.MatrixArray
-
omega
¶ The intra-molecular correlation function for all pairs of site types
Type: pyPRISM.MatrixArray
-
closure
¶ Table of closure objects used to generate the direct correlation functions (directCorr)
Type: pyPRISM.core.PairTable of pyPRISM.closure.Closure
-
pairCorr
¶ The inter-molecular pair correlation functions for all pairs of site types. Also commonly refered to as the radial distribution functions.
Type: pyPRISM.MatrixArray
-
totalCorr
¶ The inter-molecular total correlation function is simply the pair correlation function y-shifted by 1.0 i.e. totalCorr = pairCorr - 1.0
Type: pyPRISM.MatrixArray
-
potential
¶ Interaction potentials for all pairs of sites
Type: pyPRISM.MatrixArray
-
GammaIn,GammaOut
Primary inputs and outputs of the PRISM cost function. Gamma is defined as “totalCorr - directCorr” (in Fourier space) and results from a change of variables used to remove divergences in the closure relations.
Type: pyPRISM.MatrixArray
-
OC,IOC,I,etc
Various MatrixArrays used as intermediates in the PRISM functional. These arrays are pre-allocated and stored for efficiency.
Type: pyPRISM.MatrixArray
-
x,y
Current inputs and outputs of the cost function
Type: float np.ndarray
-
pairDensityMatrix
¶ Rank by rank array of pair densities between sites. See
pyPRISM.core.Density
Type: float np.ndarray
-
siteDensityMatrix
¶ Rank by rank array of site densities. See
pyPRISM.core.Density
Type: float np.ndarray
-
cost:
Primary cost function used to define the criteria of a “converged” PRISM solution. The numerical solver will be given this function and will attempt to find the inputs (self.x) that make the outputs (self.y) as close to zero as possible.
-
cost
(x)[source]¶ Cost function
There are likely several cost functions that could be imagined using the PRISM equations. In this case we formulate a self-consistent formulation where we expect the input of the PRISM equations to be identical to the output.
The goal of the solve method is to numerically optimize the input (\(r \gamma_{in}\)) so that the output (\(r(\gamma_{in}-\gamma_{out})\)) is minimized to zero.
-
solve
(guess=None, method='krylov', options=None)[source]¶ Attempt to numerically solve the PRISM equations
Using the supplied inputs (in the constructor), we attempt to numerically solve the PRISM equations using the scheme laid out in
cost()
. If the numerical solution process is successful, the attributes of this class will contain the solved values for a given input i.e. self.totalCorr will contain the numerically optimized (solved) total correlation functions.This function also does basic checks to ensure that the results are physical. At this point, this consists of checking to make sure that the pair correlation functions are not negative. If this isn’t true a warning is issued to the user.
Parameters: - guess (np.ndarray, size (rank*rank*length)) – The initial guess of \(\gamma\) to the numerical solution process. The numpy array should be of size rank x rank x length corresponding to the a full flattened MatrixArray. If not specified, an initial guess of all zeros is used.
- method (string) – Set the type of optimization scheme to use. The scipy documentation for scipy.optimize.root details the possible values for this parameter.
- options: dict
- Dictionary of options specific to the chosen solver method. The scipy documentation for scipy.optimize.root details the possible values for this parameter.
-