Skip to content

clean up mixers

Ask Hjorth Larsen requested to merge askhl/gpaw:pw-distribute-mixing into master

I could not actually implement redistribution for mixing without having to write the same thing for many different mixers, or otherwise fight the existing design. Thus, I have so far cleaned up the mixers instead.

The user creates a Mixer or MixerSum or BroydenMixerSum exactly as always, but the classes have been redone to get rid of a lot of terrible duplicated code. The user-created classes are now considered immutable. The density creates its own NewMixer (we can and should change the name) which holds the mutable state of the mixer (history), and a reference to the user-created object. The user-created objects are actually called "drivers" now because they only contain the input parameters and define the algorithm (mixing sum, difference etc.) whereas the objects doing the actual mathematics are BaseMixers, FFTBaseMixers, or similar, which are instantiated and kept in the background.

Drivers (mixing arrays with spin) and BaseMixers (mixing a single array) are purposely incompatible now - one uses the other, but cannot be replaced by the other. That was a very confusing property of the previous design. Mixers would inherit from (FFT)BaseMixer and also instantiate a number of (FFT)BaseMixers for the actual work. Now they always solve separate problems.

There probably exist better designs than what I have come up with, but this one came out after a lot of fighting to split things up, I think it is much better.

There is only one problem remaining: transport.

The transport test fails now. The transport calculator has no less than 81 lines that contain the word "mixer", and it uses attributes of the mixers in such a profanely perverted way that any principled, upstanding citizen should be appalled. But how do we solve this?

Also: charge mixing (rhot_g) is disabled for now. It was untested but would be very easy to implement again.

I think some of the more exotic mixers were untested. I don't actually know if those work.

Comments?

Update: This should not actually break anything anymore (except some untested parts of the transport code. Who knows about that).

Things should generally be nice-ish now.

Merge request reports