[ase-users] how to avoid calculator reset when generating a SumCalculator

Rochus Schmid rochus.schmid at rub.de
Thu Mar 18 09:30:54 CET 2021


dear michael,

On 3/17/21 4:38 PM, Michael Walter wrote:
> Dear Rochus,
>
> Am Mi., 17. März 2021 um 15:48 Uhr schrieb Rochus Schmid 
> <rochus.schmid at rub.de <mailto:rochus.schmid at rub.de>>:
>
>     dear michael,
>
>     On 3/17/21 3:15 PM, Michael Walter wrote:
>>     Dear Rochus,
>>
>>     Am Mi., 17. März 2021 um 15:01 Uhr schrieb Rochus Schmid via
>>     ase-users <ase-users at listserv.fysik.dtu.dk
>>     <mailto:ase-users at listserv.fysik.dtu.dk>>:
>>
>>         dear ase experts,
>>
>>         i am trying to use the SumCalculator from
>>         ase.calculators.mixing to add
>>         dispersion corrections from Stefan Grimmes DFTD4 calculator
>>         to a GPaw
>>         calculator. The problem is that the DFT part converges very
>>         slowly. I
>>         have a restart file with wavefkts and can restart.
>>
>>         so if i do something like this
>>
>>         dft = GPAW('restart.gpw')
>>         system = dft.get_atoms()
>>         e_dft = system.get_potential_energy()
>>
>>         all is fine. but then i generate a new calculator like this
>>
>>         d4 = DFTD4(method='pbe')
>>         sumcalc = SumCalculator([dft, d4], atoms=system)
>>         e_total = system.get_potential_energy()
>>
>>         then the wavefktd from the dft calculator seems to be reset
>>         and starts
>>         from scratch. how can i prevent this?
>>
>>         i can not see that the reset() method of the mixing
>>         calculator is
>>         directly called, but i assume that in the process of setting the
>>         SumCalculator, the atoms object is "reattached" to both
>>         calculators dft
>>         and d4, and that attaching a "new" atoms object triggers a
>>         reset. this
>>         makes sense but in my case i know that the atoms are
>>         identical and i do
>>         not want the info from the SCF to be discarded. what can i do
>>         to prevent
>>         this to happen?
>>
>>         i also guess that it might be possible to "update" the
>>         wavefunctions
>>         from the info stored in restart.gpw, but this is probably a
>>         question for
>>         the gpaw-users mailing list.
>>
>>         any help/input highliy appreciated.
>>
>>
>>     There is no need for a SumCalculator.
>>     Please see
>>     https://wiki.fysik.dtu.dk/gpaw/documentation/xc/vdwcorrection.html
>>     where the D4_model is applied in the script given.
>>
>>     Regards,
>>     Michael
>
>     thanks a lot for your quick reply. i am using the dftd4-python
>     from conda-forge. but i also could not see a "D4_model" class on
>     the github repo. is it possible that the script refers to an older
>     API? to me it looks like in
>
>     cc = D4_model(xc='PBE', calc=c)
>     s.calc = cc
>
>     the D4_model takes a calculator c and attaches D4 by returning a
>     new calculator cc, right? however, it seems that this python API
>     is not in the current D4 version any more. there is a regular ASE
>     calculator interface as well as a raw python API and a QCSchema
>     interface.
>     https://github.com/dftd4/dftd4/tree/main/python
>
>     is it possible that the script refers to an older version of the
>     D4 code or am i missing something here?
>
>
> Yes, it seems the interface was changed. I do not really see how to 
> use DFTD4 as a correction anymore.
> Sorry about that.
>
> Maybe the following works:
>
> dft = GPAW()
> d4 = DFTD4(method='pbe')
>
> system.calc  = SumCalculator([dft, d4])
> e_total = system.get_potential_energy()
>
> Regards,
> Michael
>
>

This is roughly what I tried initially, as well. But when I do that the 
get_potential_energy() request triggers an SCF to start from scratch 
again for a system that was read in including wavefunctions and which 
took about 1000 SCF iterations to converge. So setting of the new 
SumCalculator (and presumably resetting the atoms object in the dft 
calculator) invalidates the read in wavefunctions from the restart. 
There should be a way to avoid this and to keep that info.
But I do not know how.

best regards,

   rochus


Prof. Dr. Rochus Schmid
Lehrstuhl für Anorganische Chemie II
Computational Materials Chemistry Group
Ruhr-Universität Bochum
Room NC02/30 (Postbox 9)
D-44780 Bochum
Tel.:   ++49(234) 32 24166
Fax:    ++49(234) 32 14174
Email: rochus.schmid at rub.de
http://www.rochusschmid.de

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20210318/ca152e99/attachment-0001.htm>


More information about the ase-users mailing list