dyson.util.misc#

Miscellaneous utility functions.

Functions

cache_by_id(func)

Decorator to cache function results based on the id of the arguments.

catch_warnings([warning_type])

Context manager to catch warnings.

get_mean_field(atom, basis[, charge, spin])

Get a mean-field object for a given system.

dyson.util.misc.catch_warnings(warning_type: type[Warning] = <class 'Warning'>) Iterator[list[WarningMessage]][source]#

Context manager to catch warnings.

Returns:

A list of caught warnings.

dyson.util.misc.cache_by_id(func: Callable) Callable[source]#

Decorator to cache function results based on the id of the arguments.

Parameters:

func – The function to cache.

Returns:

A wrapper function that caches results based on the id of the arguments.

dyson.util.misc.get_mean_field(atom: str, basis: str, charge: int = 0, spin: int = 0) RHF[source]#

Get a mean-field object for a given system.

Intended as a convenience function for examples.

Parameters:
  • atom – The atomic symbol of the system.

  • basis – The basis set to use.

  • charge – The total charge of the system.

  • spin – The total spin of the system.

Returns:

A mean-field object for the system.