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

Rochus Schmid rochus.schmid at rub.de
Tue Mar 23 15:23:45 CET 2021


dear ase experts,

after a bit of fiddling i found a solution for my problem which was 
discussed in a number of emails before. i dare calling it an issue of 
ase, but it might be that this is an intended behavior ... in any case 
the fix is simple and straight forward.

Note:
i use the current dftd4 version from conda-forge. it contains "just" a 
regular ase calculator interface. thus, the solution using the older 
interface with D4_model does not work for me.

Problem:
I want to restart a GPaw calculation that took a long time to converge 
and pack it into a SumCalculator with DFTD4 and optimize the system. My 
problem was, that the GPaw calculator was triggered to discard the 
wavefunctions and initialize from the LCAO guess again, when wrapping it 
into the SumCalculator like this:

   dft = GPAW('restart.gpw')
   system = dft.get_atoms()
   d4 = DFTD4(method='pbe')
   sumcalc = SumCalculator([dft, d4], atoms=system)
   e_total = system.get_potential_energy()

i expected that calling SumCalculator with atoms=system would set the 
atoms object of the new SumCalculator object. but it does not (not 
exactly sure why? is that a feature?)!
in other words, after setting

  sumcalc = SumCalculator([dft, d4], atoms=system)

sumcalc.atoms is still None, which then triggers the above unwanted 
behavior.

Solution:
one has to explicitly set the atoms afterwards. i do it this way now and 
all is fine:

  sumcalc = SumCalculator([d4, dft], atoms=system)
  system.calc = sumcalc
  sumcalc.atoms = system
  e_total = system.get_potential_energy()

hope this prevents others from searching.
best greetings,

   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



More information about the ase-users mailing list