def expand_psivars(pvdefs): """Dictionary *pvdefs* has keys with names of PsiVariables to be created and values with dictionary of two keys: 'args', the PsiVariables that contribute to the key and 'func', a function (or lambda) to combine them. This function builds those PsiVariables if all the contributors are available. Helpful printing is available when PRINT > 2. """ verbose = core.get_global_option('PRINT') for pvar, action in pvdefs.items(): if verbose >= 2: print("""building %s %s""" % (pvar, '.' * (50 - len(pvar))), end='') psivars = core.scalar_variables() data_rich_args = [] for pv in action['args']: if isinstance(pv, str): if pv in psivars: data_rich_args.append(psivars[pv]) else: if verbose >= 2: print("""EMPTY, missing {}""".format(pv)) break else: data_rich_args.append(pv) else: result = action['func'](data_rich_args) core.set_variable(pvar, result) if verbose >= 2: print("""SUCCESS""")
def _core_variables(): return { **core.scalar_variables(), **{ k: _qcvar_reshape_get(k, v) for k, v in core.array_variables().items() } }
def _core_get_variables(): """ .. deprecated:: 1.4 Use :py:func:`psi4.core.variables` instead. """ warnings.warn( "Using `psi4.core.get_variables` instead of `psi4.core.variables` (or `psi4.core.scalar_variables` for scalar variables only) is deprecated, and in 1.4 it will stop working\n", category=FutureWarning, stacklevel=2) return core.scalar_variables()
def _core_variables(include_deprecated_keys: bool = False) -> Dict[str, Union[float, core.Matrix, np.ndarray]]: """Return all scalar or array QCVariables from global memory.""" dicary = {**core.scalar_variables(), **{k: _qcvar_reshape_get(k, v) for k, v in core.array_variables().items()}} if include_deprecated_keys: for old_key, current_key in _qcvar_transitions.items(): if current_key in dicary: dicary[old_key] = dicary[current_key] return dicary
def _core_get_variables(): warnings.warn( "Using `psi4.core.get_variables` instead of `psi4.core.variables` (or `psi4.core.scalar_variables` for scalar variables only) is deprecated, and in 1.4 it will stop working\n", category=FutureWarning, stacklevel=2) return core.scalar_variables()
def _core_variables(): return {**core.scalar_variables(), **core.array_variables()}