[gpaw-users] Manipulating the SCF Loop

Ask Hjorth Larsen asklarsen at gmail.com
Wed Jul 9 13:18:52 CEST 2014


Hi Tristan

Something like this.  I haven't quite tested.

calc = GPAW(convergence=dict(density=-1))

class Observer:
    def __init__(self):
        self.iterations = 0

    def __call__(self):
        print 'Do something'
        if self.iterations > 20 and calc.scf.density_error < 1e-4:
            calc.scf.converged = True
        self.iterations += 1

calc.attach(Observer(), 1)


It would be nice if one could just iterate the sodding thing like this:

for i in range(20):
    calc.iterate()

and then trigger the normal SCF procedure afterwards.  But that isn't
possible at the moment.

You could probably also call calc.set(convergence=...) from within the
observer, but the set() method is prone to severe bugginess.

Best regards
Ask

2014-07-08 22:32 GMT+02:00 Tristan Maxson <tgmaxson at gmail.com>:
> I have been doing some work which requires actively manipulating the SCF
> loop between iterations and encountered a problem where the loop may end
> before I desire it to.
>
> I am looking for some sort of "miniter" or a method of forcing another
> iteration of the SCF loop from an attached observer that does not require
> modifying the source if at all possible.  I need the calculation to continue
> as if the convergence was not reached in that iteration.
>
> _______________________________________________
> gpaw-users mailing list
> gpaw-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/gpaw-users


More information about the gpaw-users mailing list