1from ase.build import bulk 2from gpaw import GPAW, Mixer, PW 3 4 5def test_reuse_wfs(): 6 atoms0 = bulk('Si') 7 atoms0.rattle(stdev=0.01, seed=17) # Break symmetry 8 9 results = [] 10 11 for mode in ['fd', 'pw']: 12 for method in [None, 'paw', 'lcao']: 13 atoms = atoms0.copy() 14 15 kwargs = {} 16 if mode == 'pw': 17 if method == 'lcao': 18 continue # Not implemented yet 19 kwargs.update(mode=PW(400.0)) 20 21 calc = GPAW(mixer=Mixer(0.4, 5, 20.0), 22 basis='dzp' if method == 'lcao' else {}, 23 experimental={'reuse_wfs_method': method}, 24 xc='oldLDA', 25 kpts=[2, 2, 2], 26 **kwargs) 27 atoms.calc = calc 28 E1 = atoms.get_potential_energy() 29 niter1 = calc.scf.niter 30 atoms.rattle(stdev=0.05) 31 E2 = atoms.get_potential_energy() 32 niter2 = calc.scf.niter 33 results.append([mode, method, E1, E2, niter1, niter2]) 34 35 if calc.wfs.world.rank == 0: 36 for result in results: 37 print(' '.join(str(x) for x in result)) 38