pyPRISM.omega.FromArray module

class pyPRISM.omega.FromArray.FromArray(omega, k=None)[source]

Bases: pyPRISM.omega.Omega.Omega

Read intra-molecular correlations from a list or array

This class reads the omega from a Python list or Numpy array.

omega

Intra-molecular omega

Type:np.ndarray
k

Domain of the array data. If provided, this will be checked against the Fourier-space grid specified in the pyPRISM.core.Domain. An exception will be raised is they do not match.

Type:np.narray, optional

Example

import pyPRISM
import numpy as np
import matplotlib.pyplot as plt

#set all omega(k) = 1 for type A
sys = pyPRISM.System(['A','B'],kT=1.0)
sys.domain = pyPRISM.Domain(dr=0.1,length=1024)
omega = np.ones(sys.domain.k.shape[0])
sys.omega['A','A']  = pyPRISM.omega.FromArray(omega)
x = sys.domain.k
y = sys.omega['A','A'].calculate(x)

#plot using matplotlib
plt.plot(x,y)
plt.gca().set_xscale("log", nonposx='clip')
plt.gca().set_yscale("log", nonposy='clip')

plt.show()
__init__(omega, k=None)[source]

Constructor

Parameters:
  • omega (list,np.ndarray) – Python list or Numpy array containing values of omega as a function of wavenumber \(k\).
  • k (np.ndarray, optional) – Python list of Numpy array containing values of k. These must match the k values stored in the pyPRISM.core.Domain or an exception will be raised.
calculate(k)[source]

Return value of \(\hat{\omega}\) at supplied \(k\)

Parameters:k (np.ndarray) – array of wavenumber values to calculate \(\omega\) at