variable

psi4.core.variable(key)

Return copy of scalar or array QCVariable key from global memory.

Parameters:

key (str) – Case-insensitive key to global double or Matrix storage maps.

Returns:

Requested QCVariable from global memory.

  • Scalar variables are returned as floats.

  • Array variables not naturally 2D (like multipoles or per-atom charges) are returned as ndarray of natural dimensionality.

  • Other array variables are returned as Matrix and may have an extra dimension with symmetry information.

Return type:

float or ndarray or Matrix

Raises:

KeyError – If key not set on self.

Example

>>> psi4.gradient("hf/cc-pvdz")
>>> psi4.variable("CURRENT ENERGY")
-100.00985995185668
>>> psi4.variable("CURRENT DIPOLE")
array([ 0.        ,  0.        , -0.83217802])
>>> psi4.variable("CURRENT GRADIENT")
<psi4.core.Matrix object at 0x12d884fc0>
>>> psi4.variable("CURRENT GRADIENT").np
array([[ 6.16297582e-33,  6.16297582e-33, -9.41037138e-02],
       [-6.16297582e-33, -6.16297582e-33,  9.41037138e-02]])