Skip to content

write message to log when important objects are None-d or replaced with other objects

Ask Hjorth Larsen requested to merge askhl/gpaw:more-output into master

Add a setattr object to PAW which prints when important objects are deleted:

[Discarding density]
[Discarding occupations]
[Discarding Hamiltonian]
[Discarding wave functions for <gpaw.wavefunctions.base.EmptyWaveFunctions instance at 0x7fe67d4cb200>]```

This will be written after completing a calculation on calc.set(h=...), for example.

It is difficult and repetitive to do it every time an object is set to None or something else.  Therefore, __setattr__ is the only way to catch them all safely.  However I am not sure whether this could interact with other mechanisms related to other versions of Python, pickling or whatever.  For __setattr__ to work, PAWTextOutput has been turned into a new-style class.

Merge request reports