psi4.core.set_variable(key, val)

Sets scalar or array QCVariable key to val in global memory.

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

  • val (Union[Matrix, ndarray, float]) – Scalar or array to be stored in key. If ndarray and data key does not naturally fit in 2D Matrix (often charge and multipole QCVariables), it will be reshaped, as all ndarray are stored as Matrix.


ValidationError – If val is a scalar but key already exists as an array variable. Or if val is an array but key already exists as a scalar variable.

Return type: