pyPRISM.core.Density module

class pyPRISM.core.Density.Density(types)[source]

Bases: object

Container for pair and site densities

Mathematical Definition

\[\rho^{pair}_{\alpha,\beta} = \rho_{\alpha} \rho_{\beta}\]
\[\begin{split}\rho^{site}_{\alpha,\beta} = \begin{cases} \rho_{\alpha} & \text{if } i = j \\ \rho_{\alpha} + \rho_{\beta} & \text{if } i \neq j \end{cases}\end{split}\]
\[\rho^{total} = \sum_{\alpha} \rho^{site}_{\alpha,\alpha}\]

Variable Definitions

\(\rho_{\alpha}\)
Number density of site \(\alpha\)
\(\rho^{pair}_{\alpha,\beta}\)
Pair number density of pair \(\alpha,\beta\)
\(\rho^{site}_{\alpha,\beta}\)
Site number density of pair \(\alpha,\beta\)
\(\rho^{total}\)
Total site number density

Description

This class describes the makeup of the system in terms of both total site and pair densities. The container provides a simple interface for getting and setting (via square brackets [ ]) site densities and also takes care of calculating the total site and total pair number densities. The total site and pair number densities can be accessed as MatrixArrays (pyPRISM.core.MatrixArray) attributes.

Example

import pyPRISM

rho = pyPRISM.Density(['A','B','C'])

rho['A'] = 0.25
rho['B'] = 0.35
rho['C'] = 0.15

rho.pair['A','B'] #pair density rho_AB = 0.25 * 0.35
rho.site['A','B'] #site density rho_AB = 0.25 + 0.35
rho.site['B','B'] #site density rho_BB = 0.35
rho.total         #total density rho   = 0.25 + 0.35 + 0.15
__init__(types)[source]

Constructor

Parameters:types (list) – List of types of sites
density

Table of site number density values

Type:pyPRISM.core.ValueTable
total

Total number density

Type:float
site

Site density for each pair.

Type:pyPRISM.core.MatrixArray
pair

Pair site density for each pair.

Type:pyPRISM.core.MatrixArray
check()[source]

Are all densities set?

Raises:*ValueError* if densities are not all set.