Wavefunctions

The wavefunction module defines a set of pre-built components that can be used to set up a variety of different trial wavefunctions.

class qflow.wavefunctions.Wavefunction

The Wavefunction class provides a unified abstraction for all wavefunctions.

All other code expecting a wavefunction instance will take a Wavefunction reference.

In this context, a trial wavefunction is defied to be a class that can:

  • Have zero or more parameters, \(\vec\alpha\)

  • Evaluate given some system configuraiton \(\mathbf{X}\):

\[\text{Evaluation}_\Psi(\mathbf{X} = \Psi(\mathbf{X})\]
  • Compute the gradient w.r.t. each variational parameter, \(\vec{\alpha}\):

\[\text{Gradient}_\Psi(\mathbf{X}) = \frac{1}{\Psi(\mathbf{X})} \frac{\partial \Psi(\mathbf{X})}{\partial\vec\alpha}\]
  • Compute the drift force w.r.t. particle \(k\)’s dimensions ional coordinate \(l\):

\[\text{Drift}_{\Psi(\mathbf{X}), k,l} = \frac{2}{\Psi(\mathbf{X})} \frac{\partial \Psi(\mathbf{X})}{\partial X_{kl}}\]
  • Compute the laplacian of a system of \(N\) particles in \(D\) dimensions:

\[\text{Laplacian}_\Psi(\mathbf{X}) = \sum_{k=1}^N\sum_{l=1}^D \frac{1}{\Psi(\mathbf{X})}\frac{\partial^2 \Psi(\mathbf{X})}{\partial X_{kl}^2}\]

Note

Wavefunctions are limited to real-valued functions only - there is no support for complex valued wavefunctions at this time.

parameters

List of all variational parameters. Supports both read and write.

__call__(self: qflow.wavefunctions.Wavefunction, system: numpy.ndarray[float64[m, n]]) → float

Return the evaluation of the wavefunction for the given system

\[\text{Evaluation}_\Psi(\mathbf{X} = \Psi(\mathbf{X})\]
drift_force(*args, **kwargs)

Overloaded function.

  1. drift_force(self: qflow.wavefunctions.Wavefunction, system: numpy.ndarray[float64[m, n]], k: int, l: int) -> float

Return the drift force w.r.t. particle \(k\)’s dimensions ional coordinate \(l\):

\[\text{Drift}_{\Psi(\mathbf{X}), k, l} = \frac{2}{\Psi(\mathbf{X})} \frac{\partial \Psi(\mathbf{X})}{\partial X_{kl}}\]
  1. drift_force(self: qflow.wavefunctions.Wavefunction, system: numpy.ndarray[float64[m, n]]) -> numpy.ndarray[float64[1, n]]

Return a list of drift forces for all particles and all dimensions.

The list will be one-dimensional, such that \(\text{Drift}_{\Psi(\mathbf{X}), k,l}\) is at index k * D + l.

gradient(self: qflow.wavefunctions.Wavefunction, system: numpy.ndarray[float64[m, n]]) → numpy.ndarray[float64[1, n]]

Return the gradient w.r.t. each variational parameter, divided by the evaluation:

\[\text{Gradient}_\Psi(\mathbf{X}) = \frac{1}{\Psi(\mathbf{X})} \frac{\partial \Psi(\mathbf{X})}{\partial\vec\alpha}\]
laplacian(self: qflow.wavefunctions.Wavefunction, system: numpy.ndarray[float64[m, n]]) → float
\[\text{Laplacian}_\Psi(\mathbf{X}) = \sum_{k=1}^N\sum_{l=1}^D \frac{1}{\Psi(\mathbf{X})}\frac{\partial^2 \Psi(\mathbf{X})}{\partial X_{kl}^2}\]
symmetry_metric(self: qflow.wavefunctions.Wavefunction, sampler: Sampler, samples: int, max_permutations: int = 100) → float

Return an estimate of the symmetry of the wavefunction.

This is defined as follows:

\[S(\Psi) = \frac{\int_{-\infty}^\infty \text{d}\mathbf X\left|\frac{1}{n!} \sum_{\mathbf\alpha\in \mathcal{P}_n} P_{\mathbf\alpha}\Psi\right|^2}{\int_{-\infty}^\infty\text{d}\mathbf X \max_{\mathbf\alpha\in \mathcal{P}} \left|P_{\mathbf\alpha}\Psi\right|^2}\]

Here \(P_\mathbf{\alpha}\Psi\) denotes applying the permutation \(\mathbf{\alpha}\) to the input system before evaluating the wavefunction, and \(\mathcal{P}_n\) is the set of all permutations of \(n\) particles.

Properties of this metric:

  • It takes values in \([0, 1]\)

  • For symmetric wavefunctions, it equals exactly 1

  • For anti-symmetric wavefunctions, it equals exactly 0

  • Any other function evaluates in \((0, 1)\)

This integral will be approximated with Monte Carlo integration using samples from the provided sampling strategy, and using the specified number of samples. While the integral is defied over all permutations, a maximum of max_permutations will be used to make it tractable for large N.

Standalone Wavefunctions

class qflow.wavefunctions.SimpleGaussian

A product of gaussians:

\[\Psi(\mathbf{X}) = \prod_{i=1}^N e^{-\alpha ||\mathbf{X}_i||^2}\]

The only variational parameter is \(\alpha\).

For 3D systems, an optional fixed parameter \(\beta\) can be specified, which changes the above definition to:

\[\Psi(\mathbf{X}) = \prod_{i=1}^N e^{-\alpha\left(X_{i,1}^2 + X_{i,2}^2 + \beta X_{i,3}^2\right)}\]
__init__(self: qflow.wavefunctions.SimpleGaussian, alpha: float = 0.5, beta: float = 1) → None
class qflow.wavefunctions.HardSphereWavefunction

A product of gaussians and pairwise correlation factors:

\[\begin{split}\Psi(\mathbf{X}) = \prod_{i=1}^N e^{-\alpha\left(X_{i,1}^2 + X_{i,2}^2 + \beta X_{i,3}^2\right)} \prod_{j = i + 1}^{N} \begin{cases} 0 &\text{if}\ \ ||\mathbf{X}_i - \mathbf{X}_j|| \leq a\\ 1 - \frac{a}{||\mathbf{X}_i - \mathbf{X}_j||} &\text{otherwise} \end{cases}\end{split}\]

Similarly to SimpleGaussian, the only variational parameter is \(\alpha\), while the other two parameters \(\beta\) and \(a\) are assumed constant.

__init__(self: qflow.wavefunctions.HardSphereWavefunction, alpha: float = 0.5, beta: float = 1, a: float = 0) → None
class qflow.wavefunctions.JastrowPade

A correlation term meant to be suitable for particles in a harmonic oscillator potential with a repulsive Coulomb force causing interactions:

\[\Psi(\mathbf{X}) = \prod_{i < j}^N e^{\frac{\alpha r_ij}{1 + \beta r_ij}}\]
__init__(self: qflow.wavefunctions.JastrowPade, alpha: float = 0.5, beta: float = 1, alpha_is_constant: bool = True) → None
class qflow.wavefunctions.JastrowOrion

A correlation term meant to be suitable for particles in a harmonic oscillator potential with a repulsive Coulomb force causing interactions:

\[\Psi(\mathbf{X}) = \prod_{i < j}^N e^{-\frac{\beta^2}{2}||\mathbf{X_i}-\mathbf{X_j}||^2 + |\beta\gamma|||\mathbf{X_i}-\mathbf{X_j}||}\]
__init__(self: qflow.wavefunctions.JastrowOrion, beta: float = 1.0, gamma: float = 0) → None
class qflow.wavefunctions.RBMWavefunction
__init__(self: qflow.wavefunctions.RBMWavefunction, M: int, N: int, sigma2: float = 1, root_factor: float = 1) → None

Composite Wavfunctions

class qflow.wavefunctions.FixedWavefunction

Wrapper for any wavefunction that fixes the variational parameters.

This means that if this wavefunction is used in a optimization call, its parameters will not change. This is useful if parts of a wavefunction should be held constant, while another is allowed to be optimized.

__init__(self: qflow.wavefunctions.FixedWavefunction, wavefunction: _qflow_backend.wavefunctions.Wavefunction) → None
class qflow.wavefunctions.WavefunctionProduct

Defines a wavefunction that acts like the product of two others.

All derivatives will be suitably derived, so this is a simple way to produce compound expressions.

__init__(self: qflow.wavefunctions.WavefunctionProduct, Psi_1: _qflow_backend.wavefunctions.Wavefunction, Psi_2: _qflow_backend.wavefunctions.Wavefunction) → None
class qflow.wavefunctions.SumPooling

This wavefunction expects a wavefunction of two particles, \(f(\mathbf{x}_1, \mathbf{x}_2)\), and represents the following compound expression:

\[\Psi(\mathbf{X}) = \sum_{i \neq j}^N f(\mathbf{X}_i, \mathbf{X}_j)\]

This is guaranteed to produce a permutation symmetric wavefunction, given any suitable inner wavefunction \(f\).

__init__(self: qflow.wavefunctions.SumPooling, arg0: _qflow_backend.wavefunctions.Wavefunction) → None