ObservablesLCWP

About the ObservablesLCWP class

The WaveBlocks Project

@author: R. Bourquin @copyright: Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016 R. Bourquin @license: Modified BSD License

Inheritance diagram

Inheritance diagram of ObservablesLCWP

Class documentation

class WaveBlocksND.ObservablesLCWP[source]

This class implements observable computation for linear combinations \Upsilon of wavepackets \Psi_j. There are no assumptions made on the type of the wavepackets \Psi_j in \Upsilon := \sum_{j=0}^J c_j \Psi_j.

__init__()[source]

Initialize a new ObservablesLCWP instance for observable computation of linear combinations \Upsilon of wavepackets \Psi_j.

kinetic_energy(lincomb, *, matrix=None, component=None, summed=False, return_matrix=False)[source]

Compute the kinetic energy E_{\text{kin}} := \langle\Upsilon|T|\Upsilon\rangle of a linear combination \Upsilon of wavepackets.

Parameters:
  • linbomc – The linear combination \Upsilon of which we compute the kinetic energy.
  • matrix (An ndarray or None (default).) – The kinetic overlap matrix. If None the matrix is computed internally.
  • component (Integer or None.) – The index i of the components \Phi_i whose kinetic energy we want to compute. If set to None the computation is performed for all N components.
  • return_matrix (Boolean, default is False.) – Whether to return the kinetic overlap matrix used internally.
Returns:

The kinetic energy of \Upsilon and optionally the kinetic overlap matrix M_T.

kinetic_overlap_matrix(lincomb, *, component=None)[source]

Compute the kinetic overlap matrix {M_T}_{r,c} = \langle\Upsilon_r|T|\Upsilon_c\rangle.

Parameters:
  • lincomb – The linear combination \Upsilon.
  • component (Integer or None.) – The index i of the components \Phi_i whose kinetic energy we want to compute. If set to None the computation is performed for all N components.
Returns:

The matrix M_T.

norm(lincomb, *, matrix=None, component=None, summed=False, return_matrix=False)[source]

Compute the L^2 norm \langle\Upsilon|\Upsilon\rangle of a linear combination \Upsilon of wavepackets.

Parameters:
  • lincomb (A LinearCombinationOfWavepackets subclass instance.) – The linear combination \Upsilon of which we compute the norm.
  • matrix (An ndarray or None (default).) – The overlap matrix. If None the matrix is computed internally.
  • component – The index i of the components \Phi_i whose norm is calculated. The default value is None which means to compute norms of all N components.
  • return_matrix (Boolean, default is False.) – Whether to return the overlap matrix used internally.
Returns:

The norm of \Upsilon and optionally the overlap matrix M.

overlap_matrix(lincomb, *, component=None)[source]

Compute the overlap matrix M_{r,c} = \langle\Upsilon_r|\Upsilon_c\rangle.

Note that this function is just a shortcut for calling the inner product evaluator directly.

Parameters:
  • lincomb – The linear combination \Upsilon.
  • component (int or None.) – The index i of the components \Phi_i whose overlap is calculated. The default value is None which means to compute overlaps of all N components.
Returns:

The matrix M.

potential_energy(lincomb, potential, *, matrix=None, component=None, summed=False, return_matrix=False)[source]

Compute the potential energy E_{\text{pot}} := \langle\Upsilon|V|\Upsilon\rangle. of a linear combination \Upsilon of wavepackets.

Parameters:
  • linbomc – The linear combination \Upsilon of which we compute the potential energy.
  • potential – The potential V(x). (Actually, not the potential object itself but one of its V.evaluate_* methods.)
  • matrix (An ndarray or None per default.) – The potential overlap matrix. If None the matrix is computed internally.
  • component (Integer or None.) – The index i of the components \Phi_i whose potential energy we want to compute. If set to None the computation is performed for all N components.
  • return_matrix (Boolean, default is False.) – Whether to return the potential overlap matrix used internally.
Returns:

The potential energy of \Upsilon and optionally the potential overlap matrix M_V.

potential_overlap_matrix(lincomb, potential, *, component=None)[source]

Compute the potential overlap matrix {M_V}_{r,c} = \langle\Upsilon_r|V|\Upsilon_c\rangle.

Parameters:
  • lincomb – The linear combination \Upsilon.
  • potential – The potential V(x). (Actually, not the potential object itself but one of its V.evaluate_* methods.)
  • component (Integer or None.) – The index i of the components \Phi_i whose potential energy we want to compute. If set to None the computation is performed for all N components.
Returns:

The matrix M_V.

set_gradient(gradient)[source]

Set the gradient.

Parameters:gradient (A Gradient subclass instance.) – A gradient operator.
set_innerproduct(innerproduct)[source]

Set the innerproduct.

Parameters:innerproduct (A InnerProduct subclass instance.) – An inner product for computing the integrals. The inner product is used for the computation of brakets \langle \Psi | \cdot | \Psi \rangle.

Note

Make sure to use an inhomogeneous inner product here.