Problem
_schwarz_screener_cache in gbasis/integrals/electron_repulsion.py is a
global dictionary with no eviction policy. During long sessions with different
basis sets and thresholds, it can keep accumulating entries leading to
unbounded memory growth.
Proposed Fix
One potential approach could be using weakref.WeakValueDictionary so cache
entries are automatically evicted when basis set objects are garbage collected.
Other options like LRU cache or a manual clear_cache() function could also
be considered — open to suggestions.
Related